svn commit: r307812 - in projects/doctools/contrib/heirloom-doctools: . checknr eqn eqn/checkeq.d grap include mpm pic picpack ptx refer tbl troff troff/troff.d troff/troff.d/devaps troff/troff.d/d...
Baptiste Daroussin
bapt at FreeBSD.org
Sun Oct 23 00:46:59 UTC 2016
Author: bapt
Date: Sun Oct 23 00:46:53 2016
New Revision: 307812
URL: https://svnweb.freebsd.org/changeset/base/307812
Log:
Import heirloom doctools 20161016
Added:
projects/doctools/contrib/heirloom-doctools/compat.c
- copied unchanged from r307811, vendor/heirloom-doctools/dist/compat.c
Deleted:
projects/doctools/contrib/heirloom-doctools/picpack/getopt.c
projects/doctools/contrib/heirloom-doctools/troff/troff.d/devaps/getopt.c
projects/doctools/contrib/heirloom-doctools/troff/troff.d/dpost.d/getopt.c
Modified:
projects/doctools/contrib/heirloom-doctools/checknr/checknr.c
projects/doctools/contrib/heirloom-doctools/eqn/checkeq.d/checkeq.c
projects/doctools/contrib/heirloom-doctools/eqn/diacrit.c
projects/doctools/contrib/heirloom-doctools/eqn/e.h
projects/doctools/contrib/heirloom-doctools/eqn/io.c
projects/doctools/contrib/heirloom-doctools/eqn/lex.c
projects/doctools/contrib/heirloom-doctools/grap/coord.c
projects/doctools/contrib/heirloom-doctools/grap/grap.h
projects/doctools/contrib/heirloom-doctools/grap/input.c
projects/doctools/contrib/heirloom-doctools/grap/main.c
projects/doctools/contrib/heirloom-doctools/grap/misc.c
projects/doctools/contrib/heirloom-doctools/include/global.h
projects/doctools/contrib/heirloom-doctools/mpm/Makefile.mk
projects/doctools/contrib/heirloom-doctools/mpm/misc.h
projects/doctools/contrib/heirloom-doctools/pic/for.c
projects/doctools/contrib/heirloom-doctools/pic/input.c
projects/doctools/contrib/heirloom-doctools/pic/main.c
projects/doctools/contrib/heirloom-doctools/pic/misc.c
projects/doctools/contrib/heirloom-doctools/pic/pic.h
projects/doctools/contrib/heirloom-doctools/pic/pltroff.c
projects/doctools/contrib/heirloom-doctools/pic/symtab.c
projects/doctools/contrib/heirloom-doctools/picpack/Makefile.mk
projects/doctools/contrib/heirloom-doctools/picpack/picpack.c
projects/doctools/contrib/heirloom-doctools/ptx/Makefile.mk
projects/doctools/contrib/heirloom-doctools/ptx/ptx.c
projects/doctools/contrib/heirloom-doctools/refer/Makefile.mk
projects/doctools/contrib/heirloom-doctools/refer/deliv2.c
projects/doctools/contrib/heirloom-doctools/refer/refer..c
projects/doctools/contrib/heirloom-doctools/refer/refer1.c
projects/doctools/contrib/heirloom-doctools/refer/refer2.c
projects/doctools/contrib/heirloom-doctools/refer/refer5.c
projects/doctools/contrib/heirloom-doctools/tbl/Makefile.mk
projects/doctools/contrib/heirloom-doctools/tbl/t..c
projects/doctools/contrib/heirloom-doctools/tbl/t1.c
projects/doctools/contrib/heirloom-doctools/tbl/t3.c
projects/doctools/contrib/heirloom-doctools/tbl/t4.c
projects/doctools/contrib/heirloom-doctools/tbl/t5.c
projects/doctools/contrib/heirloom-doctools/tbl/tg.c
projects/doctools/contrib/heirloom-doctools/tbl/tm.c
projects/doctools/contrib/heirloom-doctools/tbl/ts.c
projects/doctools/contrib/heirloom-doctools/tbl/tt.c
projects/doctools/contrib/heirloom-doctools/troff/ext.h
projects/doctools/contrib/heirloom-doctools/troff/n1.c
projects/doctools/contrib/heirloom-doctools/troff/n2.c
projects/doctools/contrib/heirloom-doctools/troff/n3.c
projects/doctools/contrib/heirloom-doctools/troff/n5.c
projects/doctools/contrib/heirloom-doctools/troff/n8.c
projects/doctools/contrib/heirloom-doctools/troff/troff.d/Makefile.mk
projects/doctools/contrib/heirloom-doctools/troff/troff.d/afm.c
projects/doctools/contrib/heirloom-doctools/troff/troff.d/afm.h
projects/doctools/contrib/heirloom-doctools/troff/troff.d/devaps/Makefile.mk
projects/doctools/contrib/heirloom-doctools/troff/troff.d/dpost.d/Makefile.mk
projects/doctools/contrib/heirloom-doctools/troff/troff.d/dpost.d/dpost.c
projects/doctools/contrib/heirloom-doctools/troff/troff.d/dpost.d/gen.h
projects/doctools/contrib/heirloom-doctools/troff/troff.d/dpost.d/misc.c
projects/doctools/contrib/heirloom-doctools/troff/troff.d/dpost.d/ps_include.c
projects/doctools/contrib/heirloom-doctools/troff/troff.d/dpost.d/request.c
projects/doctools/contrib/heirloom-doctools/troff/troff.d/dpost.d/request.h
projects/doctools/contrib/heirloom-doctools/troff/troff.d/fontmap.c
projects/doctools/contrib/heirloom-doctools/troff/troff.d/fontmap.h
projects/doctools/contrib/heirloom-doctools/troff/troff.d/otf.c
projects/doctools/contrib/heirloom-doctools/troff/troff.d/otfdump.c
projects/doctools/contrib/heirloom-doctools/troff/troff.d/pt.h
projects/doctools/contrib/heirloom-doctools/troff/troff.d/t10.c
projects/doctools/contrib/heirloom-doctools/troff/troff.d/t6.c
projects/doctools/contrib/heirloom-doctools/vgrind/vfontedpr.c
Directory Properties:
projects/doctools/contrib/heirloom-doctools/ (props changed)
Modified: projects/doctools/contrib/heirloom-doctools/checknr/checknr.c
==============================================================================
--- projects/doctools/contrib/heirloom-doctools/checknr/checknr.c Sun Oct 23 00:35:11 2016 (r307811)
+++ projects/doctools/contrib/heirloom-doctools/checknr/checknr.c Sun Oct 23 00:46:53 2016 (r307812)
@@ -179,7 +179,6 @@ static void checkknown(char *mac);
static void addcmd(char *line);
static void addmac(char *mac);
static int binsrch(char *mac);
-static char *fgetline(char **line, size_t *linesize, size_t *llen, FILE *fp);
static void
growstk(void)
@@ -307,7 +306,7 @@ process(FILE *f)
int pl;
stktop = -1;
- for (lineno = 1; fgetline(&line, &linesize, NULL, f); lineno++) {
+ for (lineno = 1; getline(&line, &linesize, f) > 0; lineno++) {
if (line[0] == '.') {
/*
* find and isolate the macro/command name.
@@ -636,34 +635,3 @@ binsrch(char *mac)
slot = bot; /* place it would have gone */
return (-1);
}
-
-#define LSIZE 256
-
-static char *
-fgetline(char **line, size_t *linesize, size_t *llen, FILE *fp)
-{
- int c;
- size_t n = 0;
-
- if (*line == NULL || *linesize < LSIZE + n + 1)
- *line = realloc(*line, *linesize = LSIZE + n + 1);
- for (;;) {
- if (n >= *linesize - LSIZE / 2)
- *line = realloc(*line, *linesize += LSIZE);
- c = getc(fp);
- if (c != EOF) {
- (*line)[n++] = c;
- (*line)[n] = '\0';
- if (c == '\n')
- break;
- } else {
- if (n > 0)
- break;
- else
- return NULL;
- }
- }
- if (llen)
- *llen = n;
- return *line;
-}
Copied: projects/doctools/contrib/heirloom-doctools/compat.c (from r307811, vendor/heirloom-doctools/dist/compat.c)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/doctools/contrib/heirloom-doctools/compat.c Sun Oct 23 00:46:53 2016 (r307812, copy of r307811, vendor/heirloom-doctools/dist/compat.c)
@@ -0,0 +1,47 @@
+/* Carsten Kunze, 2016 */
+
+#include <string.h>
+
+#ifndef HAVE_STRLCPY
+size_t
+strlcpy(char *dst, const char *src, size_t dstsize) {
+ size_t srcsize;
+ /* Not conform to strlcpy, but avoids to access illegal memory in case
+ * of unterminated strings */
+ for (srcsize = 0; srcsize < dstsize; srcsize++)
+ if (!src[srcsize])
+ break;
+ if (dstsize > srcsize)
+ dstsize = srcsize;
+ else if (dstsize)
+ dstsize--;
+ if (dstsize)
+ /* assumes non-overlapping buffers */
+ memcpy(dst, src, dstsize);
+ dst[dstsize] = 0;
+ return srcsize;
+}
+#endif
+
+#ifndef HAVE_STRLCAT
+size_t
+strlcat(char *dst, const char *src, size_t dstsize) {
+ size_t ld, ls;
+ for (ld = 0; ld < dstsize - 1; ld++)
+ if (!dst[ld])
+ break;
+ dst += ld;
+ dstsize -= ld;
+ for (ls = 0; ls < dstsize; ls++)
+ if (!src[ls])
+ break;
+ if (dstsize > ls)
+ dstsize = ls;
+ else if (dstsize)
+ dstsize--;
+ if (dstsize)
+ memcpy(dst, src, dstsize);
+ dst[dstsize] = 0;
+ return ld + ls;
+}
+#endif
Modified: projects/doctools/contrib/heirloom-doctools/eqn/checkeq.d/checkeq.c
==============================================================================
--- projects/doctools/contrib/heirloom-doctools/eqn/checkeq.d/checkeq.c Sun Oct 23 00:35:11 2016 (r307811)
+++ projects/doctools/contrib/heirloom-doctools/eqn/checkeq.d/checkeq.c Sun Oct 23 00:46:53 2016 (r307812)
@@ -31,7 +31,6 @@ static const char sccsid[] USED = "@(#)/
#include <stdlib.h>
static void check(FILE *);
-static char *fgetline(char **, size_t *, FILE *);
static FILE *fin;
static int delim = '$';
@@ -62,7 +61,7 @@ check(FILE *f)
size_t insize = 0;
start = eq = line = ndel = totdel = 0;
- while (fgetline(&in, &insize, f) != NULL) {
+ while (getline(&in, &insize, f) > 0) {
line++;
ndel = 0;
for (p = in; *p; p++)
@@ -127,22 +126,3 @@ check(FILE *f)
if (eq)
printf(" Unfinished EQ\n");
}
-
-static char *
-fgetline(char **lp, size_t *zp, FILE *fp)
-{
- size_t n = 0;
- int c;
-
- while ((c = getc(fp)) != EOF) {
- if (n >= *zp)
- *lp = realloc(*lp, *zp += 600);
- (*lp)[n++] = c;
- if (c == '\n')
- break;
- }
- if (n >= *zp)
- *lp = realloc(*lp, *zp += 600);
- (*lp)[n] = 0;
- return c != EOF ? *lp : NULL;
-}
Modified: projects/doctools/contrib/heirloom-doctools/eqn/diacrit.c
==============================================================================
--- projects/doctools/contrib/heirloom-doctools/eqn/diacrit.c Sun Oct 23 00:35:11 2016 (r307811)
+++ projects/doctools/contrib/heirloom-doctools/eqn/diacrit.c Sun Oct 23 00:46:53 2016 (r307812)
@@ -35,7 +35,7 @@ diacrit(int p1, int type) {
t = oalloc();
#ifdef NEQN
nrwid(p1, ps, p1);
- printf(".nr 10 %gu\n", max(eht[p1]-ebase[p1]-VERT(2),0));
+ printf(".nr 10 %gu\n", (float)max(eht[p1]-ebase[p1]-VERT(2),0));
#else /* NEQN */
effps = EFFPS(ps);
nrwid(p1, effps, p1);
Modified: projects/doctools/contrib/heirloom-doctools/eqn/e.h
==============================================================================
--- projects/doctools/contrib/heirloom-doctools/eqn/e.h Sun Oct 23 00:35:11 2016 (r307811)
+++ projects/doctools/contrib/heirloom-doctools/eqn/e.h Sun Oct 23 00:46:53 2016 (r307812)
@@ -29,11 +29,6 @@
#include <inttypes.h>
#include "global.h"
-#if defined (__GLIBC__) && defined (_IO_getc_unlocked)
-#undef getc
-#define getc(f) _IO_getc_unlocked(f)
-#endif
-
#define FATAL 1
#define ROM '1'
#ifndef NEQN
@@ -129,7 +124,6 @@ int eqn(int, char **);
int getline(char **, size_t *);
void do_inline(void);
void putout(int);
-float max(float, float);
int oalloc(void);
void ofree(int);
void setps(float);
@@ -141,7 +135,7 @@ void error(int, const char *, ...);
/* lex.c */
int gtc(void);
int openinfile(void);
-void pbstr(register char *);
+void pbstr(register const char *);
int yylex(void);
int getstr(char *, register int);
int cstr(char *, int, int);
Modified: projects/doctools/contrib/heirloom-doctools/eqn/io.c
==============================================================================
--- projects/doctools/contrib/heirloom-doctools/eqn/io.c Sun Oct 23 00:35:11 2016 (r307811)
+++ projects/doctools/contrib/heirloom-doctools/eqn/io.c Sun Oct 23 00:46:53 2016 (r307812)
@@ -226,11 +226,6 @@ putout(int p1) {
}
-float
-max(float i,float j) {
- return (i>j ? i : j);
-}
-
int
oalloc(void) {
int i;
Modified: projects/doctools/contrib/heirloom-doctools/eqn/lex.c
==============================================================================
--- projects/doctools/contrib/heirloom-doctools/eqn/lex.c Sun Oct 23 00:35:11 2016 (r307811)
+++ projects/doctools/contrib/heirloom-doctools/eqn/lex.c Sun Oct 23 00:46:53 2016 (r307812)
@@ -77,9 +77,9 @@ openinfile(void)
}
void
-pbstr(register char *str)
+pbstr(register const char *str)
{
- register char *p;
+ register const char *p;
p = str;
while (*p++);
Modified: projects/doctools/contrib/heirloom-doctools/grap/coord.c
==============================================================================
--- projects/doctools/contrib/heirloom-doctools/grap/coord.c Sun Oct 23 00:35:11 2016 (r307811)
+++ projects/doctools/contrib/heirloom-doctools/grap/coord.c Sun Oct 23 00:46:53 2016 (r307812)
@@ -13,6 +13,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include "global.h"
#include "grap.h"
#include "y.tab.h"
Modified: projects/doctools/contrib/heirloom-doctools/grap/grap.h
==============================================================================
--- projects/doctools/contrib/heirloom-doctools/grap/grap.h Sun Oct 23 00:35:11 2016 (r307811)
+++ projects/doctools/contrib/heirloom-doctools/grap/grap.h Sun Oct 23 00:46:53 2016 (r307812)
@@ -143,9 +143,6 @@ extern int pointsize, ps_set;
#define Exp(x) errcheck(exp(x), "exp")
#define Sqrt(x) errcheck(sqrt(x), "sqrt")
-#define min(x,y) (((x) <= (y)) ? (x) : (y))
-#define max(x,y) (((x) >= (y)) ? (x) : (y))
-
extern void yyerror(char *);
extern void coord_x(Point);
extern void coord_y(Point);
Modified: projects/doctools/contrib/heirloom-doctools/grap/input.c
==============================================================================
--- projects/doctools/contrib/heirloom-doctools/grap/input.c Sun Oct 23 00:35:11 2016 (r307811)
+++ projects/doctools/contrib/heirloom-doctools/grap/input.c Sun Oct 23 00:46:53 2016 (r307812)
@@ -18,11 +18,6 @@
#include "grap.h"
#include "y.tab.h"
-#if defined (__GLIBC__) && defined (_IO_getc_unlocked)
-#undef getc
-#define getc(f) _IO_getc_unlocked(f)
-#endif
-
Infile infile[10];
Infile *curfile = infile;
@@ -596,33 +591,3 @@ void shell_exec(void) /* do it */
else
system(shellbuf);
}
-
-#define LSIZE 128
-
-char *fgetline(char **line, size_t *linesize, size_t *llen, FILE *fp)
-{
- int c;
- size_t n = 0;
-
- if (*line == NULL || *linesize < LSIZE + n + 1)
- *line = realloc(*line, *linesize = LSIZE + n + 1);
- for (;;) {
- if (n >= *linesize - LSIZE / 2)
- *line = realloc(*line, *linesize += LSIZE);
- c = getc(fp);
- if (c != EOF) {
- (*line)[n++] = c;
- (*line)[n] = '\0';
- if (c == '\n')
- break;
- } else {
- if (n > 0)
- break;
- else
- return NULL;
- }
- }
- if (llen)
- *llen = n;
- return *line;
-}
Modified: projects/doctools/contrib/heirloom-doctools/grap/main.c
==============================================================================
--- projects/doctools/contrib/heirloom-doctools/grap/main.c Sun Oct 23 00:35:11 2016 (r307811)
+++ projects/doctools/contrib/heirloom-doctools/grap/main.c Sun Oct 23 00:46:53 2016 (r307812)
@@ -156,12 +156,11 @@ void getdata(void) /* read input */
char *buf = NULL, *buf1 = NULL;
size_t size = 0;
int ln;
- char *fgetline(char **, size_t *, size_t *, FILE *);
fin = curfile->fin;
curfile->lineno = 0;
printf(".lf 1 %s\n", curfile->fname);
- while (fgetline(&buf, &size, NULL, fin) != NULL) {
+ while (getline(&buf, &size, fin) > 0) {
curfile->lineno++;
if (*buf == '.' && *(buf+1) == 'G' && *(buf+2) == '1') {
setup();
Modified: projects/doctools/contrib/heirloom-doctools/grap/misc.c
==============================================================================
--- projects/doctools/contrib/heirloom-doctools/grap/misc.c Sun Oct 23 00:35:11 2016 (r307811)
+++ projects/doctools/contrib/heirloom-doctools/grap/misc.c Sun Oct 23 00:46:53 2016 (r307812)
@@ -45,14 +45,11 @@ void setsize(int op, double expr)
char *tostring(char *s)
{
- register char *p;
- size_t l;
+ char *p;
- l = strlen(s)+1;
- p = malloc(l);
+ p = strdup(s);
if (p == NULL)
FATAL("out of space in tostring on %s", s);
- n_strcpy(p, s, l);
return(p);
}
Modified: projects/doctools/contrib/heirloom-doctools/include/global.h
==============================================================================
--- projects/doctools/contrib/heirloom-doctools/include/global.h Sun Oct 23 00:35:11 2016 (r307811)
+++ projects/doctools/contrib/heirloom-doctools/include/global.h Sun Oct 23 00:46:53 2016 (r307812)
@@ -15,3 +15,23 @@
#else
# define n_wcscpy(dst, src, size ) wcscpy(dst, src)
#endif
+
+#define min(x,y) ((x) < (y) ? (x) : (y))
+#define max(x,y) ((x) > (y) ? (x) : (y))
+#define prefix(str, pfx) (strncmp(pfx, str, strlen(pfx)) == 0)
+
+#undef __unused
+#define __unused __attribute__((unused))
+
+#ifdef __GLIBC__
+#ifdef _IO_getc_unlocked
+#undef getc
+#define getc(f) _IO_getc_unlocked(f)
+#endif
+#ifdef _IO_putc_unlocked
+#undef putc
+#undef putchar
+#define putc(c, f) _IO_putc_unlocked(c, f)
+#define putchar(c) _IO_putc_unlocked(c, stdout)
+#endif
+#endif
Modified: projects/doctools/contrib/heirloom-doctools/mpm/Makefile.mk
==============================================================================
--- projects/doctools/contrib/heirloom-doctools/mpm/Makefile.mk Sun Oct 23 00:35:11 2016 (r307811)
+++ projects/doctools/contrib/heirloom-doctools/mpm/Makefile.mk Sun Oct 23 00:46:53 2016 (r307812)
@@ -1,6 +1,6 @@
OBJ = misc.o page.o queue.o range.o slug.o version.o
-FLAGS = $(EUC) $(DEFINES)
+FLAGS = $(EUC) $(DEFINES) -I../include
.c.o:
$(CC) $(CFLAGS) $(WARN) $(FLAGS) $(CPPFLAGS) -c $<
Modified: projects/doctools/contrib/heirloom-doctools/mpm/misc.h
==============================================================================
--- projects/doctools/contrib/heirloom-doctools/mpm/misc.h Sun Oct 23 00:35:11 2016 (r307811)
+++ projects/doctools/contrib/heirloom-doctools/mpm/misc.h Sun Oct 23 00:46:53 2016 (r307812)
@@ -16,20 +16,8 @@
#include <math.h>
#include <ctype.h>
#include <string.h>
+#include "global.h"
-#ifdef __GLIBC__
-#ifdef _IO_getc_unlocked
-#undef getc
-#define getc(f) _IO_getc_unlocked(f)
-#endif
-#ifdef _IO_putc_unlocked
-#undef putc
-#undef putchar
-#define putc(c, f) _IO_putc_unlocked(c, f)
-#define putchar(c) _IO_putc_unlocked(c, stdout)
-#endif
-#endif /* __GLIBC__ */
-
extern char *progname;
extern int linenum;
extern int wantwarn;
@@ -39,11 +27,6 @@ extern void WARNING(const char *, ...);
#define eq(s,t) (strcmp(s,t) == 0)
-inline int max(int x, int y) { return x > y ? x : y; }
-inline int min(int x, int y) { return x > y ? y : x; }
-// already defined in stdlib.h:
-//inline int abs(int x) { return (x >= 0) ? x : -x; }
-
extern int dbg;
extern int pn, userpn; // actual and user-defined page numbers
Modified: projects/doctools/contrib/heirloom-doctools/pic/for.c
==============================================================================
--- projects/doctools/contrib/heirloom-doctools/pic/for.c Sun Oct 23 00:35:11 2016 (r307811)
+++ projects/doctools/contrib/heirloom-doctools/pic/for.c Sun Oct 23 00:46:53 2016 (r307812)
@@ -28,7 +28,7 @@ typedef struct {
static For forstk[10]; /* stack of for loops */
static For *forp = forstk; /* pointer to current top */
-void setfval(char *, double);
+void setfval(const char *, double);
void nextfor(void);
void forloop(char *var, double from, double to, int op,
Modified: projects/doctools/contrib/heirloom-doctools/pic/input.c
==============================================================================
--- projects/doctools/contrib/heirloom-doctools/pic/input.c Sun Oct 23 00:35:11 2016 (r307811)
+++ projects/doctools/contrib/heirloom-doctools/pic/input.c Sun Oct 23 00:46:53 2016 (r307812)
@@ -18,11 +18,6 @@
#include "pic.h"
#include "y.tab.h"
-#if defined (__GLIBC__) && defined (_IO_getc_unlocked)
-#undef getc
-#define getc(f) _IO_getc_unlocked(f)
-#endif
-
Infile infile[10];
Infile *curfile = infile;
@@ -609,33 +604,3 @@ void shell_exec(void) /* do it */
else
system(shellbuf);
}
-
-#define LSIZE 128
-
-char *fgetline(char **line, size_t *linesize, size_t *llen, FILE *fp)
-{
- int c;
- size_t n = 0;
-
- if (*line == NULL || *linesize < LSIZE + n + 1)
- *line = realloc(*line, *linesize = LSIZE + n + 1);
- for (;;) {
- if (n >= *linesize - LSIZE / 2)
- *line = realloc(*line, *linesize += LSIZE);
- c = getc(fp);
- if (c != EOF) {
- (*line)[n++] = c;
- (*line)[n] = '\0';
- if (c == '\n')
- break;
- } else {
- if (n > 0)
- break;
- else
- return NULL;
- }
- }
- if (llen)
- *llen = n;
- return *line;
-}
Modified: projects/doctools/contrib/heirloom-doctools/pic/main.c
==============================================================================
--- projects/doctools/contrib/heirloom-doctools/pic/main.c Sun Oct 23 00:35:11 2016 (r307811)
+++ projects/doctools/contrib/heirloom-doctools/pic/main.c Sun Oct 23 00:46:53 2016 (r307812)
@@ -210,11 +210,10 @@ void getdata(void)
int ln;
void reset(void), openpl(char *), closepl(char *);
int yyparse(void);
- char *fgetline(char **, size_t *, size_t *, FILE *);
curfile->lineno = 0;
printlf(1, curfile->fname);
- while (fgetline(&buf, &size, NULL, curfile->fin) != NULL) {
+ while (getline(&buf, &size, curfile->fin) > 0) {
curfile->lineno++;
if (buf[0] == '.' && buf[1] == 'l' && buf[2] == 'f') {
buf1 = realloc(buf1, size);
Modified: projects/doctools/contrib/heirloom-doctools/pic/misc.c
==============================================================================
--- projects/doctools/contrib/heirloom-doctools/pic/misc.c Sun Oct 23 00:35:11 2016 (r307811)
+++ projects/doctools/contrib/heirloom-doctools/pic/misc.c Sun Oct 23 00:46:53 2016 (r307812)
@@ -179,14 +179,11 @@ void printpos(obj *p) /* print position
char *tostring(const char *s)
{
- register char *p;
- size_t l;
+ char *p;
- l = strlen(s)+1;
- p = malloc(l);
+ p = strdup(s);
if (p == NULL)
FATAL("out of space in tostring on %s", s);
- n_strcpy(p, s, l);
return(p);
}
Modified: projects/doctools/contrib/heirloom-doctools/pic/pic.h
==============================================================================
--- projects/doctools/contrib/heirloom-doctools/pic/pic.h Sun Oct 23 00:35:11 2016 (r307811)
+++ projects/doctools/contrib/heirloom-doctools/pic/pic.h Sun Oct 23 00:46:53 2016 (r307812)
@@ -187,7 +187,7 @@ void copyfile(char *);
void copydef(struct symtab *);
void definition(const char *);
void freesymtab(struct symtab *);
-void setfval(char *s, double f);
+void setfval(const char *s, double f);
struct symtab *copythru(const char *);
#ifdef FLEX_SCANNER
int xxinput(void);
@@ -247,7 +247,6 @@ void ellipse(double, double, double, dou
void arc(double, double, double, double, double, double);
void dot(void);
void arrow(double, double, double, double, double, double, double, int);
-char *fgetline(char **, size_t *, size_t *, FILE *);
struct pushstack {
double p_x;
Modified: projects/doctools/contrib/heirloom-doctools/pic/pltroff.c
==============================================================================
--- projects/doctools/contrib/heirloom-doctools/pic/pltroff.c Sun Oct 23 00:35:11 2016 (r307811)
+++ projects/doctools/contrib/heirloom-doctools/pic/pltroff.c Sun Oct 23 00:46:53 2016 (r307812)
@@ -15,14 +15,8 @@
#include <string.h>
#include "pic.h"
-#ifndef __unused
-#define __unused __attribute__((unused))
-#endif
extern int dbg;
-#define abs(n) (n >= 0 ? n : -(n))
-#define max(x,y) ((x)>(y) ? (x) : (y))
-
static const char *textshift = "\\v'.2m'"; /* move text this far down */
/* scaling stuff defined by s command as X0,Y0 to X1,Y1 */
@@ -158,11 +152,6 @@ void vgoto(double n)
vpos = n;
}
-double fabs(double x)
-{
- return x < 0 ? -x : x;
-}
-
void hvflush(void) /* get to proper point for output */
{
if (fabs(hpos-htrue) >= 0.0005) {
@@ -355,7 +344,7 @@ void ellipse(double x, double y, double
hvflush();
ir1 = xsc(r1);
ir2 = ysc(r2);
- printf("\\D'e%.3fi %.3fi'\n", 2 * ir1, 2 * abs(ir2));
+ printf("\\D'e%.3fi %.3fi'\n", 2 * ir1, 2 * fabs(ir2));
flyback();
}
Modified: projects/doctools/contrib/heirloom-doctools/pic/symtab.c
==============================================================================
--- projects/doctools/contrib/heirloom-doctools/pic/symtab.c Sun Oct 23 00:35:11 2016 (r307811)
+++ projects/doctools/contrib/heirloom-doctools/pic/symtab.c Sun Oct 23 00:46:53 2016 (r307812)
@@ -41,7 +41,7 @@ double getfval(const char *s) /* return
return y.f;
}
-void setfval(char *s, double f) /* set variable s to f */
+void setfval(const char *s, double f) /* set variable s to f */
{
struct symtab *p;
Modified: projects/doctools/contrib/heirloom-doctools/picpack/Makefile.mk
==============================================================================
--- projects/doctools/contrib/heirloom-doctools/picpack/Makefile.mk Sun Oct 23 00:35:11 2016 (r307811)
+++ projects/doctools/contrib/heirloom-doctools/picpack/Makefile.mk Sun Oct 23 00:46:53 2016 (r307812)
@@ -1,4 +1,4 @@
-OBJ = picpack.o getopt.o
+OBJ = picpack.o
FLAGS = -I../troff/troff.d/dpost.d
Modified: projects/doctools/contrib/heirloom-doctools/picpack/picpack.c
==============================================================================
--- projects/doctools/contrib/heirloom-doctools/picpack/picpack.c Sun Oct 23 00:35:11 2016 (r307811)
+++ projects/doctools/contrib/heirloom-doctools/picpack/picpack.c Sun Oct 23 00:46:53 2016 (r307812)
@@ -126,8 +126,6 @@ static void do_inline(char *);
static int gotpicfile(char *);
static void addpicfile(char *);
-char *fgetline(char **line, size_t *linesize, size_t *llen, FILE *fp);
-
/*****************************************************************************/
@@ -418,7 +416,7 @@ picpack(void)
*/
- while ( fgetline(&line, &linesize, NULL, fp_in) != NULL ) {
+ while ( getline(&line, &linesize, fp_in) > 0 ) {
for ( i = 0; keys[i] != NULL; i++ )
if ( strncmp(line, keys[i], strlen(keys[i])) == 0 ) {
if ( sscanf(line, "%*s %s", name) == 1 ) {
@@ -563,54 +561,6 @@ addpicfile(char *name)
} /* End of addpicfile */
-
-/*****************************************************************************/
-
-static void *
-srealloc(void *p, size_t size)
-{
- if ((p = realloc(p, size)) == NULL) {
- write(2, "Can't malloc\n", 13);
- _exit(0177);
- }
- return p;
-}
-
-#define LSIZE 128 /* initial line size */
-
-#if defined (__GLIBC__) && defined (_IO_getc_unlocked)
-#undef getc
-#define getc(f) _IO_getc_unlocked(f)
-#endif
-
-char *
-fgetline(char **line, size_t *linesize, size_t *llen, FILE *fp)
-{
- int c;
- size_t n = 0;
-
- if (*line == NULL || *linesize < LSIZE + n + 1)
- *line = srealloc(*line, *linesize = LSIZE + n + 1);
- for (;;) {
- if (n >= *linesize - LSIZE / 2)
- *line = srealloc(*line, *linesize += LSIZE);
- c = getc(fp);
- if (c != EOF) {
- (*line)[n++] = c;
- (*line)[n] = '\0';
- if (c == '\n')
- break;
- } else {
- if (n > 0)
- break;
- else
- return NULL;
- }
- }
- if (llen)
- *llen = n;
- return *line;
-}
/* from OpenSolaris "misc.c 1.6 05/06/08 SMI" */
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
Modified: projects/doctools/contrib/heirloom-doctools/ptx/Makefile.mk
==============================================================================
--- projects/doctools/contrib/heirloom-doctools/ptx/Makefile.mk Sun Oct 23 00:35:11 2016 (r307811)
+++ projects/doctools/contrib/heirloom-doctools/ptx/Makefile.mk Sun Oct 23 00:46:53 2016 (r307812)
@@ -1,6 +1,6 @@
OBJ = ptx.o
-FLAGS = -DLIBDIR='"$(LIBDIR)"' $(EUC)
+FLAGS = -DLIBDIR='"$(LIBDIR)"' $(EUC) -I../include
.c.o:
$(CC) $(CFLAGS) $(WARN) $(CPPFLAGS) $(FLAGS) -c $<
Modified: projects/doctools/contrib/heirloom-doctools/ptx/ptx.c
==============================================================================
--- projects/doctools/contrib/heirloom-doctools/ptx/ptx.c Sun Oct 23 00:35:11 2016 (r307811)
+++ projects/doctools/contrib/heirloom-doctools/ptx/ptx.c Sun Oct 23 00:46:53 2016 (r307812)
@@ -76,6 +76,8 @@ static const char sccsid[] USED = "@(#)/
#include <unistd.h>
#include <locale.h>
#include <limits.h>
+#include "global.h"
+
#define DEFLTX LIBDIR "/eign"
#define TILDE 0177
#define SORT "sort"
@@ -87,17 +89,6 @@ static const char sccsid[] USED = "@(#)/
#define isabreak(c) (btable[c])
-#ifdef __GLIBC__
-#ifdef _IO_getc_unlocked
-#undef getc
-#define getc(f) _IO_getc_unlocked(f)
-#endif
-#ifdef _IO_putc_unlocked
-#undef putc
-#define putc(c, f) _IO_putc_unlocked(c, f)
-#endif
-#endif
-
#define getline xxgetline
static int status;
Modified: projects/doctools/contrib/heirloom-doctools/refer/Makefile.mk
==============================================================================
--- projects/doctools/contrib/heirloom-doctools/refer/Makefile.mk Sun Oct 23 00:35:11 2016 (r307811)
+++ projects/doctools/contrib/heirloom-doctools/refer/Makefile.mk Sun Oct 23 00:46:53 2016 (r307812)
@@ -18,6 +18,7 @@ FLAGS = -DMACDIR='"$(MACDIR)"' -DREFDIR=
$(CC) $(CFLAGS) $(WARN) $(FLAGS) $(CPPFLAGS) -c $<
all: refer addbib lookbib sortbib roffbib indxbib mkey inv hunt papers/runinv
+ cd papers && PATH=..:$$PATH sh runinv
refer: $(ROBJ)
$(CC) $(CFLAGS) $(LDFLAGS) $(ROBJ) $(LIBS) -o $@
@@ -74,7 +75,9 @@ install: all
papers/Rbstjissue $(ROOT)$(REFDIR)/papers/Rbstjissue
$(INSTALL) -c -m 644 papers/Rv7man $(ROOT)$(REFDIR)/papers/Rv7man
$(INSTALL) -c papers/runinv $(ROOT)$(REFDIR)/papers/runinv
- cd $(ROOT)$(REFDIR)/papers && PATH=$(ROOT)$(REFDIR):$$PATH ./runinv
+ for i in a b c; do \
+ $(INSTALL) -m 644 papers/Ind.i$$i $(ROOT)$(REFDIR)/papers/; \
+ done
for i in addbib.1 lookbib.1 refer.1 roffbib.1 sortbib.1; \
do \
$(INSTALL) -c -m 644 $$i $(ROOT)$(MANDIR)/man1/$$i || exit; \
@@ -85,7 +88,8 @@ install: all
clean:
rm -f $(ROBJ) refer $(AOBJ) addbib $(LOBJ) lookbib \
$(SOBJ) sortbib roffbib indxbib $(MOBJ) mkey \
- $(IOBJ) inv $(HOBJ) hunt papers/runinv core log *~
+ $(IOBJ) inv $(HOBJ) hunt papers/runinv core log *~ \
+ papers/Ind.i?
mrproper: clean
Modified: projects/doctools/contrib/heirloom-doctools/refer/deliv2.c
==============================================================================
--- projects/doctools/contrib/heirloom-doctools/refer/deliv2.c Sun Oct 23 00:35:11 2016 (r307811)
+++ projects/doctools/contrib/heirloom-doctools/refer/deliv2.c Sun Oct 23 00:46:53 2016 (r307812)
@@ -49,16 +49,6 @@ err (const char *s, ...)
exit(1);
}
-int
-prefix(const char *t, const char *s)
-{
- int c;
-
- while ((c= *t++) == *s++)
- if (c==0) return(1);
- return(c==0 ? 1: 0);
-}
-
const char *
mindex(const char *s, int c)
{
Modified: projects/doctools/contrib/heirloom-doctools/refer/refer..c
==============================================================================
--- projects/doctools/contrib/heirloom-doctools/refer/refer..c Sun Oct 23 00:35:11 2016 (r307811)
+++ projects/doctools/contrib/heirloom-doctools/refer/refer..c Sun Oct 23 00:46:53 2016 (r307812)
@@ -43,10 +43,6 @@
#define NSERCH 20
#define MXSIG 200 /* max bytes in aggregate signal */
-#ifndef __unused
-#define __unused __attribute__((unused))
-#endif
-
extern FILE *in;
extern int endpush, sort, labels, keywant, bare;
extern int biblio, science, postpunct;
@@ -86,7 +82,6 @@ extern char *sinput, *soutput, *tagout;
/* deliv2.c */
int hash(const char *);
void err(const char *, ...);
-int prefix(const char *, const char *);
const char *mindex(const char *, int);
void *zalloc(int, int);
/* glue1.c */
@@ -164,7 +159,7 @@ char *trimnl(char *);
/* refer5.c */
void putsig(int, char **, int, char *, char *, int);
char *fpar(int, char **, char *, size_t, int, int, int);
-void putkey(int, char **, int, char *);
+void putkey(int, char **, int, const char *);
void tokeytab(const char *, int);
int keylet(char *, int);
void mycpy(char *, const char *);
Modified: projects/doctools/contrib/heirloom-doctools/refer/refer1.c
==============================================================================
--- projects/doctools/contrib/heirloom-doctools/refer/refer1.c Sun Oct 23 00:35:11 2016 (r307811)
+++ projects/doctools/contrib/heirloom-doctools/refer/refer1.c Sun Oct 23 00:46:53 2016 (r307812)
@@ -25,6 +25,7 @@
#include <locale.h>
#include <stdlib.h>
#include <unistd.h>
+#include <string.h>
#include "refer..c"
static void signals(void);
@@ -146,7 +147,7 @@ main(int argc,char **argv) /* process c
doref(line);
else if (biblio && Iline == 1 && *line == '%')
doref(line);
- else if (!prefix(".[", line))
+ else if (!prefix(line, ".["))
output(line);
else
doref(line);
Modified: projects/doctools/contrib/heirloom-doctools/refer/refer2.c
==============================================================================
--- projects/doctools/contrib/heirloom-doctools/refer/refer2.c Sun Oct 23 00:35:11 2016 (r307811)
+++ projects/doctools/contrib/heirloom-doctools/refer/refer2.c Sun Oct 23 00:46:53 2016 (r307812)
@@ -48,7 +48,7 @@ doref(char *line1)
n_strcat(dbuff, line1, sizeof(dbuff));
while (input(line, sizeof(line))) { /* get query */
Iline++;
- if (prefix(".]", line))
+ if (prefix(line, ".]"))
break;
if (biblio && line[0] == '\n')
break;
Modified: projects/doctools/contrib/heirloom-doctools/refer/refer5.c
==============================================================================
--- projects/doctools/contrib/heirloom-doctools/refer/refer5.c Sun Oct 23 00:35:11 2016 (r307811)
+++ projects/doctools/contrib/heirloom-doctools/refer/refer5.c Sun Oct 23 00:46:53 2016 (r307812)
@@ -109,7 +109,7 @@ putsig (int nf, char **flds, int nref, c
else
snprintf(t, sizeof(t), "%d", nref);
}
- another = (sd = lookat()) ? prefix(".[", sd) : 0;
+ another = (sd = lookat()) ? prefix(sd, ".[") : 0;
if (another && (strcmp(".[\n", sd) != SAME))
fprintf(stderr, "File %s line %d: punctuation ignored from: %s",
Ifile, Iline, sd);
@@ -207,11 +207,11 @@ fpar (int nf, char **flds, char *out, si
/* for titles use first word otherwise last */
if (c == 'T' || c == 'J') {
p = flds[i]+3;
- if (prefix("A ", p))
+ if (prefix(p, "A "))
p += 2;
- if (prefix("An ", p))
+ if (prefix(p, "An "))
p += 3;
- if (prefix("The ", p))
+ if (prefix(p, "The "))
p += 4;
mycpy2(out, p, 20);
return(out);
@@ -240,7 +240,7 @@ fpar (int nf, char **flds, char *out, si
}
void
-putkey(int nf, char **flds, int nref, char *_keystr)
+putkey(int nf, char **flds, int nref, const char *_keystr)
{
char t1[50], *sf;
int ctype, i, count;
Modified: projects/doctools/contrib/heirloom-doctools/tbl/Makefile.mk
==============================================================================
--- projects/doctools/contrib/heirloom-doctools/tbl/Makefile.mk Sun Oct 23 00:35:11 2016 (r307811)
+++ projects/doctools/contrib/heirloom-doctools/tbl/Makefile.mk Sun Oct 23 00:46:53 2016 (r307812)
@@ -1,7 +1,7 @@
OBJ = t0.o t1.o t2.o t3.o t4.o t5.o t6.o t7.o t8.o t9.o tb.o tc.o te.o \
tf.o tg.o ti.o tm.o ts.o tt.o tu.o tv.o version.o
-FLAGS = -DMACDIR='"$(MACDIR)"'
+FLAGS = -DMACDIR='"$(MACDIR)"' -I../include
.c.o:
$(CC) $(CFLAGS) $(WARN) $(FLAGS) $(CPPFLAGS) -c $<
Modified: projects/doctools/contrib/heirloom-doctools/tbl/t..c
==============================================================================
--- projects/doctools/contrib/heirloom-doctools/tbl/t..c Sun Oct 23 00:35:11 2016 (r307811)
+++ projects/doctools/contrib/heirloom-doctools/tbl/t..c Sun Oct 23 00:46:53 2016 (r307812)
@@ -26,11 +26,7 @@
# include <stdio.h>
# include <ctype.h>
# include <inttypes.h>
-
-# if defined (__GLIBC__) && defined (_IO_getc_unlocked)
-# undef getc
-# define getc(f) _IO_getc_unlocked(f)
-# endif
+# include "global.h"
# define MAXCHS 2000
# define MAXSTR 1024
@@ -191,17 +187,11 @@ int up1(int);
char *maknew(char *);
int ineqn(char *, char *);
/* ts.c */
-int match(const char *, const char *);
-int prefix(const char *, const char *);
int cprefix(const char *, const char *);
int letter(int);
-int numb(char *);
-int digit(int);
-int max(int, int);
void tcopy(char *, char *);
/* tt.c */
int ctype(int, int);
-int min(int, int);
int fspan(int, int);
int lspan(int, int);
int ctspan(int, int);
Modified: projects/doctools/contrib/heirloom-doctools/tbl/t1.c
==============================================================================
--- projects/doctools/contrib/heirloom-doctools/tbl/t1.c Sun Oct 23 00:35:11 2016 (r307811)
+++ projects/doctools/contrib/heirloom-doctools/tbl/t1.c Sun Oct 23 00:46:53 2016 (r307812)
@@ -50,10 +50,6 @@ extern FILE *_f[];
# define ever (;;)
-#ifndef __unused
-#define __unused __attribute__((unused))
-#endif
-
# ifndef gcos
static void badsig(int);
# endif
@@ -109,17 +105,17 @@ swapin(void)
while (sargc>0 && **sargv=='-') /* Mem fault if no test on sargc */
{
if (sargc<=0) return(0);
- if (match("-me", *sargv))
+ if (strcmp("-me", *sargv) == 0)
{
*sargv = MEMACSS;
break;
}
- if (match("-ms", *sargv))
+ if (strcmp("-ms", *sargv) == 0)
{
*sargv = MACROSS;
break;
}
- if (match("-mm", *sargv))
+ if (strcmp("-mm", *sargv) == 0)
{
*sargv = PYMACSS;
break;
@@ -151,7 +147,7 @@ swapin(void)
}
}
}
- else if (match("-g", *sargv))
+ else if (strcmp("-g", *sargv) == 0)
{
Graphics=1;
utf8 = 0;
Modified: projects/doctools/contrib/heirloom-doctools/tbl/t3.c
==============================================================================
--- projects/doctools/contrib/heirloom-doctools/tbl/t3.c Sun Oct 23 00:35:11 2016 (r307811)
+++ projects/doctools/contrib/heirloom-doctools/tbl/t3.c Sun Oct 23 00:46:53 2016 (r307812)
@@ -25,6 +25,8 @@
# include "t..c"
# include <string.h>
# include <stdlib.h>
+# include "global.h"
+
static struct optstr {const char *optnam; int *optadd;} options [] = {
{ "expand", &expflg },
{ "EXPAND", &expflg },
@@ -82,7 +84,7 @@ getcomm(void) {
if (!letter(c)) continue;
found=0;
for(lp= options; lp->optnam; lp++) {
- if (prefix(lp->optnam, cp)) {
+ if (prefix(cp, lp->optnam)) {
cp += strlen(lp->optnam);
if (letter(*cp))
return
Modified: projects/doctools/contrib/heirloom-doctools/tbl/t4.c
==============================================================================
--- projects/doctools/contrib/heirloom-doctools/tbl/t4.c Sun Oct 23 00:35:11 2016 (r307811)
+++ projects/doctools/contrib/heirloom-doctools/tbl/t4.c Sun Oct 23 00:46:53 2016 (r307812)
@@ -26,6 +26,9 @@
# include "t..c"
# include <stdlib.h>
# include <string.h>
+# include <ctype.h>
+# include "global.h"
+
static int oncol;
static int morecols(int);
static int moreheads(int);
@@ -190,7 +193,7 @@ readspec(void)
else
*snp++=c;
else
- if (digit(c))
+ if (isdigit(c))
*snp++ = c;
else break;
if (snp-temp>20)
@@ -215,7 +218,7 @@ readspec(void)
else
*snp++=c;
else
- if (digit(c))
+ if (isdigit(c))
*snp++ = c;
else break;
if (snp-temp>20)
@@ -290,10 +293,10 @@ readspec(void)
case '5': case '6': case '7': case '8': case '9':
sn[0] = c;
snp=sn+1;
- while (digit(*snp++ = c = get1char()))
+ while (isdigit(*snp++ = c = get1char()))
;
un1getc(c);
- sep[icol-1] = max(sep[icol-1], numb(sn));
+ sep[icol-1] = max(sep[icol-1], strtol(sn, NULL, 10));
continue;
case '|':
lefline[nclin][icol]++;
Modified: projects/doctools/contrib/heirloom-doctools/tbl/t5.c
==============================================================================
--- projects/doctools/contrib/heirloom-doctools/tbl/t5.c Sun Oct 23 00:35:11 2016 (r307811)
+++ projects/doctools/contrib/heirloom-doctools/tbl/t5.c Sun Oct 23 00:46:53 2016 (r307812)
@@ -26,6 +26,7 @@
# include <string.h>
# include "t..c"
# include <inttypes.h>
+# include <global.h>
static int morelines(int);
@@ -93,7 +94,7 @@ gettbl(void)
table[nlin][icol].col = cstore;
table[nlin][icol].rcol=0;
ch=1;
- if (match(cstore, "T{")) { /* text follows */
+ if (strcmp(cstore, "T{") == 0) { /* text follows */
/* get_text was originally gettext and was renamed */
if ((table[nlin][icol].col =
get_text(cstore, nlin, icol,
@@ -214,13 +215,15 @@ vspand(int ir, int ij, int ifform)
if (fullbot[ir]) return(0);
return(vspen(table[ir][ij].col));
}
-int
+
+int
vspen(char *s)
{
if (s==0) return(0);
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-projects
mailing list