Date: Sun, 23 Oct 2016 00:24:25 +0000 (UTC) From: Baptiste Daroussin <bapt@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r307809 - in vendor/heirloom-doctools/dist: . checknr eqn eqn/checkeq.d eqn/eqnchar.d grap include mpm pic picpack ptx refer tbl troff troff/libhnj troff/nroff.d troff/troff.d troff/tro... Message-ID: <201610230024.u9N0OPPh094137@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bapt Date: Sun Oct 23 00:24:25 2016 New Revision: 307809 URL: https://svnweb.freebsd.org/changeset/base/307809 Log: Import heirloom doctools snapshot 20161016 Added: vendor/heirloom-doctools/dist/compat.c (contents, props changed) Deleted: vendor/heirloom-doctools/dist/picpack/getopt.c vendor/heirloom-doctools/dist/troff/troff.d/devaps/getopt.c vendor/heirloom-doctools/dist/troff/troff.d/dpost.d/getopt.c Modified: vendor/heirloom-doctools/dist/checknr/checknr.c vendor/heirloom-doctools/dist/eqn/checkeq.d/checkeq.c vendor/heirloom-doctools/dist/eqn/diacrit.c vendor/heirloom-doctools/dist/eqn/e.h vendor/heirloom-doctools/dist/eqn/eqnbox.c vendor/heirloom-doctools/dist/eqn/eqnchar.d/genutf8.c vendor/heirloom-doctools/dist/eqn/funny.c vendor/heirloom-doctools/dist/eqn/integral.c vendor/heirloom-doctools/dist/eqn/io.c vendor/heirloom-doctools/dist/eqn/lex.c vendor/heirloom-doctools/dist/eqn/lookup.c vendor/heirloom-doctools/dist/eqn/matrix.c vendor/heirloom-doctools/dist/eqn/paren.c vendor/heirloom-doctools/dist/eqn/shift.c vendor/heirloom-doctools/dist/eqn/text.c vendor/heirloom-doctools/dist/grap/coord.c vendor/heirloom-doctools/dist/grap/grap.h vendor/heirloom-doctools/dist/grap/input.c vendor/heirloom-doctools/dist/grap/main.c vendor/heirloom-doctools/dist/grap/misc.c vendor/heirloom-doctools/dist/include/global.h vendor/heirloom-doctools/dist/mpm/Makefile.mk vendor/heirloom-doctools/dist/mpm/misc.h vendor/heirloom-doctools/dist/pic/arcgen.c vendor/heirloom-doctools/dist/pic/blockgen.c vendor/heirloom-doctools/dist/pic/for.c vendor/heirloom-doctools/dist/pic/input.c vendor/heirloom-doctools/dist/pic/main.c vendor/heirloom-doctools/dist/pic/misc.c vendor/heirloom-doctools/dist/pic/pic.h vendor/heirloom-doctools/dist/pic/picl.l vendor/heirloom-doctools/dist/pic/pltroff.c vendor/heirloom-doctools/dist/pic/symtab.c vendor/heirloom-doctools/dist/picpack/Makefile.mk vendor/heirloom-doctools/dist/picpack/picpack.c vendor/heirloom-doctools/dist/ptx/Makefile.mk vendor/heirloom-doctools/dist/ptx/ptx.c vendor/heirloom-doctools/dist/refer/Makefile.mk vendor/heirloom-doctools/dist/refer/deliv2.c vendor/heirloom-doctools/dist/refer/glue1.c vendor/heirloom-doctools/dist/refer/glue3.c vendor/heirloom-doctools/dist/refer/glue4.c vendor/heirloom-doctools/dist/refer/glue5.c vendor/heirloom-doctools/dist/refer/hunt1.c vendor/heirloom-doctools/dist/refer/hunt2.c vendor/heirloom-doctools/dist/refer/hunt5.c vendor/heirloom-doctools/dist/refer/hunt6.c vendor/heirloom-doctools/dist/refer/hunt7.c vendor/heirloom-doctools/dist/refer/hunt8.c vendor/heirloom-doctools/dist/refer/hunt9.c vendor/heirloom-doctools/dist/refer/inv1.c vendor/heirloom-doctools/dist/refer/inv2.c vendor/heirloom-doctools/dist/refer/inv3.c vendor/heirloom-doctools/dist/refer/inv5.c vendor/heirloom-doctools/dist/refer/inv6.c vendor/heirloom-doctools/dist/refer/mkey1.c vendor/heirloom-doctools/dist/refer/mkey2.c vendor/heirloom-doctools/dist/refer/refer..c vendor/heirloom-doctools/dist/refer/refer0.c vendor/heirloom-doctools/dist/refer/refer1.c vendor/heirloom-doctools/dist/refer/refer2.c vendor/heirloom-doctools/dist/refer/refer3.c vendor/heirloom-doctools/dist/refer/refer5.c vendor/heirloom-doctools/dist/refer/refer6.c vendor/heirloom-doctools/dist/refer/refer7.c vendor/heirloom-doctools/dist/refer/refer8.c vendor/heirloom-doctools/dist/refer/shell.c vendor/heirloom-doctools/dist/refer/sortbib.c vendor/heirloom-doctools/dist/refer/tick.c vendor/heirloom-doctools/dist/tbl/Makefile.mk vendor/heirloom-doctools/dist/tbl/t..c vendor/heirloom-doctools/dist/tbl/t0.c vendor/heirloom-doctools/dist/tbl/t1.c vendor/heirloom-doctools/dist/tbl/t3.c vendor/heirloom-doctools/dist/tbl/t4.c vendor/heirloom-doctools/dist/tbl/t5.c vendor/heirloom-doctools/dist/tbl/t8.c vendor/heirloom-doctools/dist/tbl/tb.c vendor/heirloom-doctools/dist/tbl/tc.c vendor/heirloom-doctools/dist/tbl/te.c vendor/heirloom-doctools/dist/tbl/tg.c vendor/heirloom-doctools/dist/tbl/tm.c vendor/heirloom-doctools/dist/tbl/ts.c vendor/heirloom-doctools/dist/tbl/tt.c vendor/heirloom-doctools/dist/tbl/tu.c vendor/heirloom-doctools/dist/tbl/tv.c vendor/heirloom-doctools/dist/troff/ext.h vendor/heirloom-doctools/dist/troff/libhnj/hnjalloc.c vendor/heirloom-doctools/dist/troff/n1.c vendor/heirloom-doctools/dist/troff/n2.c vendor/heirloom-doctools/dist/troff/n3.c vendor/heirloom-doctools/dist/troff/n4.c vendor/heirloom-doctools/dist/troff/n5.c vendor/heirloom-doctools/dist/troff/n7.c vendor/heirloom-doctools/dist/troff/n8.c vendor/heirloom-doctools/dist/troff/n9.c vendor/heirloom-doctools/dist/troff/nroff.d/draw.c vendor/heirloom-doctools/dist/troff/nroff.d/n10.c vendor/heirloom-doctools/dist/troff/nroff.d/n6.c vendor/heirloom-doctools/dist/troff/nroff.d/pt.h vendor/heirloom-doctools/dist/troff/tdef.h vendor/heirloom-doctools/dist/troff/troff.d/Makefile.mk vendor/heirloom-doctools/dist/troff/troff.d/afm.c vendor/heirloom-doctools/dist/troff/troff.d/afm.h vendor/heirloom-doctools/dist/troff/troff.d/devaps/Makefile.mk vendor/heirloom-doctools/dist/troff/troff.d/dpost.d/Makefile.mk vendor/heirloom-doctools/dist/troff/troff.d/dpost.d/color.c vendor/heirloom-doctools/dist/troff/troff.d/dpost.d/dpost.c vendor/heirloom-doctools/dist/troff/troff.d/dpost.d/dpost.h vendor/heirloom-doctools/dist/troff/troff.d/dpost.d/draw.c vendor/heirloom-doctools/dist/troff/troff.d/dpost.d/gen.h vendor/heirloom-doctools/dist/troff/troff.d/dpost.d/misc.c vendor/heirloom-doctools/dist/troff/troff.d/dpost.d/ps_include.c vendor/heirloom-doctools/dist/troff/troff.d/dpost.d/request.c vendor/heirloom-doctools/dist/troff/troff.d/dpost.d/request.h vendor/heirloom-doctools/dist/troff/troff.d/draw.c vendor/heirloom-doctools/dist/troff/troff.d/fontmap.c vendor/heirloom-doctools/dist/troff/troff.d/fontmap.h vendor/heirloom-doctools/dist/troff/troff.d/otf.c vendor/heirloom-doctools/dist/troff/troff.d/otfdump.c vendor/heirloom-doctools/dist/troff/troff.d/pt.h vendor/heirloom-doctools/dist/troff/troff.d/t10.c vendor/heirloom-doctools/dist/troff/troff.d/t6.c vendor/heirloom-doctools/dist/vgrind/vfontedpr.c Modified: vendor/heirloom-doctools/dist/checknr/checknr.c ============================================================================== --- vendor/heirloom-doctools/dist/checknr/checknr.c Sat Oct 22 23:49:06 2016 (r307808) +++ vendor/heirloom-doctools/dist/checknr/checknr.c Sun Oct 23 00:24:25 2016 (r307809) @@ -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; -} Added: vendor/heirloom-doctools/dist/compat.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/heirloom-doctools/dist/compat.c Sun Oct 23 00:24:25 2016 (r307809) @@ -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: vendor/heirloom-doctools/dist/eqn/checkeq.d/checkeq.c ============================================================================== --- vendor/heirloom-doctools/dist/eqn/checkeq.d/checkeq.c Sat Oct 22 23:49:06 2016 (r307808) +++ vendor/heirloom-doctools/dist/eqn/checkeq.d/checkeq.c Sun Oct 23 00:24:25 2016 (r307809) @@ -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: vendor/heirloom-doctools/dist/eqn/diacrit.c ============================================================================== --- vendor/heirloom-doctools/dist/eqn/diacrit.c Sat Oct 22 23:49:06 2016 (r307808) +++ vendor/heirloom-doctools/dist/eqn/diacrit.c Sun Oct 23 00:24:25 2016 (r307809) @@ -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: vendor/heirloom-doctools/dist/eqn/e.h ============================================================================== --- vendor/heirloom-doctools/dist/eqn/e.h Sat Oct 22 23:49:06 2016 (r307808) +++ vendor/heirloom-doctools/dist/eqn/e.h Sun Oct 23 00:24:25 2016 (r307809) @@ -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 @@ -92,8 +87,8 @@ extern int markline; /* 1 if this EQ/EN extern char *progname; typedef struct s_tbl { - char *name; - char *defn; + const char *name; + const char *defn; struct s_tbl *next; } tbl; extern char *spaceval; /* use in place of normal \x (for pic) */ @@ -125,7 +120,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); @@ -137,7 +131,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); @@ -147,7 +141,7 @@ char *strsave(char *); void include(void); void delim(void); /* lookup.c */ -tbl *lookup(tbl **, char *, char *); +tbl *lookup(tbl **, const char *, const char *); void init_tbl(void); /* mark.c */ void mark(int); @@ -161,7 +155,7 @@ void move(int, int, int); void boverb(int, int); /* paren.c */ void paren(int, int, int); -void brack(int, char *, char *, char *); +void brack(int, const char *, const char *, const char *); /* pile.c */ void lpile(int, int, int); /* shift.c */ Modified: vendor/heirloom-doctools/dist/eqn/eqnbox.c ============================================================================== --- vendor/heirloom-doctools/dist/eqn/eqnbox.c Sat Oct 22 23:49:06 2016 (r307808) +++ vendor/heirloom-doctools/dist/eqn/eqnbox.c Sun Oct 23 00:24:25 2016 (r307809) @@ -37,7 +37,7 @@ eqnbox(int p1, int p2, int lu) { #else /* NEQN */ int b, h; #endif /* NEQN */ - char *sh; + const char *sh; yyval.token = p1; b = max(ebase[p1], ebase[p2]); Modified: vendor/heirloom-doctools/dist/eqn/eqnchar.d/genutf8.c ============================================================================== --- vendor/heirloom-doctools/dist/eqn/eqnchar.d/genutf8.c Sat Oct 22 23:49:06 2016 (r307808) +++ vendor/heirloom-doctools/dist/eqn/eqnchar.d/genutf8.c Sun Oct 23 00:24:25 2016 (r307809) @@ -14,7 +14,7 @@ #include <wctype.h> #include <stdio.h> -const char *const ctl[] = { +static const char *const ctl[] = { "nul", "soh", "stx", Modified: vendor/heirloom-doctools/dist/eqn/funny.c ============================================================================== --- vendor/heirloom-doctools/dist/eqn/funny.c Sat Oct 22 23:49:06 2016 (r307808) +++ vendor/heirloom-doctools/dist/eqn/funny.c Sun Oct 23 00:24:25 2016 (r307809) @@ -32,7 +32,7 @@ extern YYSTYPE yyval; void funny(int n) { - char *f = NULL; + const char *f = NULL; yyval.token = oalloc(); switch(n) { Modified: vendor/heirloom-doctools/dist/eqn/integral.c ============================================================================== --- vendor/heirloom-doctools/dist/eqn/integral.c Sat Oct 22 23:49:06 2016 (r307808) +++ vendor/heirloom-doctools/dist/eqn/integral.c Sun Oct 23 00:24:25 2016 (r307809) @@ -56,7 +56,7 @@ integral(int p, int p1, int p2) { void setintegral(void) { - char *f; + const char *f; yyval.token = oalloc(); f = "\\(is"; Modified: vendor/heirloom-doctools/dist/eqn/io.c ============================================================================== --- vendor/heirloom-doctools/dist/eqn/io.c Sat Oct 22 23:49:06 2016 (r307808) +++ vendor/heirloom-doctools/dist/eqn/io.c Sun Oct 23 00:24:25 2016 (r307809) @@ -26,9 +26,9 @@ #include <stdlib.h> #include <libgen.h> -char *in; /* input buffer */ -size_t insize; /* input buffer size */ -int noeqn; +static char *in; /* input buffer */ +static size_t insize; /* input buffer size */ +static int noeqn; int main(int argc,char **argv) { @@ -95,7 +95,8 @@ eqn(int argc,char **argv) { int getline(char **sp, size_t *np) { - register int c, n = 0, esc = 0, par = 0, brack = 0; + register int c, esc = 0, par = 0, brack = 0; + size_t n = 0; char *xp; for (;;) { c = gtc(); @@ -225,11 +226,6 @@ putout(int p1) { } -float -max(float i,float j) { - return (i>j ? i : j); -} - int oalloc(void) { int i; Modified: vendor/heirloom-doctools/dist/eqn/lex.c ============================================================================== --- vendor/heirloom-doctools/dist/eqn/lex.c Sat Oct 22 23:49:06 2016 (r307808) +++ vendor/heirloom-doctools/dist/eqn/lex.c Sun Oct 23 00:24:25 2016 (r307809) @@ -34,12 +34,12 @@ extern YYSTYPE yyval; #define SSIZE 400 -char token[SSIZE]; -int sp; +static char token[SSIZE]; +static int sp; #define putbak(c) *ip++ = c; #define PUSHBACK 300 /* maximum pushback characters */ -char ibuf[PUSHBACK+SSIZE]; /* pushback buffer for definitions, etc. */ -char *ip = ibuf; +static char ibuf[PUSHBACK+SSIZE]; /* pushback buffer for definitions, etc. */ +static char *ip = ibuf; int gtc(void) { @@ -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: vendor/heirloom-doctools/dist/eqn/lookup.c ============================================================================== --- vendor/heirloom-doctools/dist/eqn/lookup.c Sat Oct 22 23:49:06 2016 (r307808) +++ vendor/heirloom-doctools/dist/eqn/lookup.c Sun Oct 23 00:24:25 2016 (r307809) @@ -33,8 +33,8 @@ tbl *keytbl[TBLSIZE]; /* key words */ tbl *restbl[TBLSIZE]; /* reserved words */ tbl *deftbl[TBLSIZE]; /* user-defined names */ -struct { - char *key; +static struct { + const char *key; int keyval; } keyword[] ={ { "sub", SUB }, @@ -104,9 +104,9 @@ struct { { NULL, 0 } }; -struct { - char *res; - char *resval; +static struct { + const char *res; + const char *resval; } resword[] ={ { ">=", "\\(>=" }, { "<=", "\\(<=" }, @@ -220,11 +220,11 @@ struct { }; tbl * -lookup(tbl **tblp, char *name, char *defn) /* find name in tbl. if defn non-null, install */ +lookup(tbl **tblp, const char *name, const char *defn) /* find name in tbl. if defn non-null, install */ { register tbl *p; register int h; - register unsigned char *s = (unsigned char *)name; + register unsigned const char *s = (unsigned const char *)name; for (h = 0; *s != '\0'; ) h += *s++; Modified: vendor/heirloom-doctools/dist/eqn/matrix.c ============================================================================== --- vendor/heirloom-doctools/dist/eqn/matrix.c Sat Oct 22 23:49:06 2016 (r307808) +++ vendor/heirloom-doctools/dist/eqn/matrix.c Sun Oct 23 00:24:25 2016 (r307809) @@ -52,7 +52,7 @@ matrix(int p1) { int hb, b; #endif /* NEQN */ int nrow, ncol, i, j, k, val[100]; - char *space; + const char *space; space = "\\ \\ "; nrow = lp[p1]; /* disaster if rows inconsistent */ Modified: vendor/heirloom-doctools/dist/eqn/paren.c ============================================================================== --- vendor/heirloom-doctools/dist/eqn/paren.c Sat Oct 22 23:49:06 2016 (r307808) +++ vendor/heirloom-doctools/dist/eqn/paren.c Sun Oct 23 00:24:25 2016 (r307809) @@ -163,7 +163,7 @@ paren(int leftc, int p1, int rightc) { } void -brack(int m, char *t, char *c, char *b) { +brack(int m, const char *t, const char *c, const char *b) { int j; printf("\\b'%s", t); for( j=0; j<m; j++) Modified: vendor/heirloom-doctools/dist/eqn/shift.c ============================================================================== --- vendor/heirloom-doctools/dist/eqn/shift.c Sat Oct 22 23:49:06 2016 (r307808) +++ vendor/heirloom-doctools/dist/eqn/shift.c Sun Oct 23 00:24:25 2016 (r307809) @@ -35,7 +35,7 @@ bshiftb(int p1, int dir, int p2) { #ifndef NEQN float shval, d1, h1, b1, h2, b2; float diffps, effps, effps2; - char *sh1, *sh2; + const char *sh1, *sh2; #else /* NEQN */ int shval, d1, h1, b1, h2, b2; #endif /* NEQN */ Modified: vendor/heirloom-doctools/dist/eqn/text.c ============================================================================== --- vendor/heirloom-doctools/dist/eqn/text.c Sat Oct 22 23:49:06 2016 (r307808) +++ vendor/heirloom-doctools/dist/eqn/text.c Sun Oct 23 00:24:25 2016 (r307809) @@ -30,17 +30,17 @@ extern YYSTYPE yyval; -int csp; -int psp; +static int csp; +static int psp; #define CSSIZE 400 -char cs[420]; +static char cs[420]; -int lf, rf; /* temporary spots for left and right fonts */ +static int lf, rf; /* temporary spots for left and right fonts */ void text(int t,char *p1) { int c; - char *p; + const char *p; tbl *tp; extern tbl *restbl; Modified: vendor/heirloom-doctools/dist/grap/coord.c ============================================================================== --- vendor/heirloom-doctools/dist/grap/coord.c Sat Oct 22 23:49:06 2016 (r307808) +++ vendor/heirloom-doctools/dist/grap/coord.c Sun Oct 23 00:24:25 2016 (r307809) @@ -13,6 +13,7 @@ #include <stdio.h> #include <string.h> #include <stdlib.h> +#include "global.h" #include "grap.h" #include "y.tab.h" Modified: vendor/heirloom-doctools/dist/grap/grap.h ============================================================================== --- vendor/heirloom-doctools/dist/grap/grap.h Sat Oct 22 23:49:06 2016 (r307808) +++ vendor/heirloom-doctools/dist/grap/grap.h Sun Oct 23 00:24:25 2016 (r307809) @@ -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: vendor/heirloom-doctools/dist/grap/input.c ============================================================================== --- vendor/heirloom-doctools/dist/grap/input.c Sat Oct 22 23:49:06 2016 (r307808) +++ vendor/heirloom-doctools/dist/grap/input.c Sun Oct 23 00:24:25 2016 (r307809) @@ -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: vendor/heirloom-doctools/dist/grap/main.c ============================================================================== --- vendor/heirloom-doctools/dist/grap/main.c Sat Oct 22 23:49:06 2016 (r307808) +++ vendor/heirloom-doctools/dist/grap/main.c Sun Oct 23 00:24:25 2016 (r307809) @@ -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: vendor/heirloom-doctools/dist/grap/misc.c ============================================================================== --- vendor/heirloom-doctools/dist/grap/misc.c Sat Oct 22 23:49:06 2016 (r307808) +++ vendor/heirloom-doctools/dist/grap/misc.c Sun Oct 23 00:24:25 2016 (r307809) @@ -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: vendor/heirloom-doctools/dist/include/global.h ============================================================================== --- vendor/heirloom-doctools/dist/include/global.h Sat Oct 22 23:49:06 2016 (r307808) +++ vendor/heirloom-doctools/dist/include/global.h Sun Oct 23 00:24:25 2016 (r307809) @@ -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: vendor/heirloom-doctools/dist/mpm/Makefile.mk ============================================================================== --- vendor/heirloom-doctools/dist/mpm/Makefile.mk Sat Oct 22 23:49:06 2016 (r307808) +++ vendor/heirloom-doctools/dist/mpm/Makefile.mk Sun Oct 23 00:24:25 2016 (r307809) @@ -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: vendor/heirloom-doctools/dist/mpm/misc.h ============================================================================== --- vendor/heirloom-doctools/dist/mpm/misc.h Sat Oct 22 23:49:06 2016 (r307808) +++ vendor/heirloom-doctools/dist/mpm/misc.h Sun Oct 23 00:24:25 2016 (r307809) @@ -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: vendor/heirloom-doctools/dist/pic/arcgen.c ============================================================================== --- vendor/heirloom-doctools/dist/pic/arcgen.c Sat Oct 22 23:49:06 2016 (r307808) +++ vendor/heirloom-doctools/dist/pic/arcgen.c Sun Oct 23 00:24:25 2016 (r307809) @@ -30,7 +30,7 @@ obj *arcgen(int type) /* handles circula static int nexthv[2][4] ={ {U_DIR, L_DIR, D_DIR, R_DIR}, {D_DIR, R_DIR, U_DIR, L_DIR} }; double dx2, dy2, ht, phi, r, d; - int i, head, to, at, cw, invis, ddtype, battr; + int i, head, to, at, _cw, invis, ddtype, battr; obj *p, *ppos; double fromx, fromy, tox = 0, toy = 0, fillval = 0; Attr *ap; @@ -40,7 +40,7 @@ obj *arcgen(int type) /* handles circula prevw = getfval("arrowwid"); fromx = curx; fromy = cury; - head = to = at = cw = invis = ddtype = battr = 0; + head = to = at = _cw = invis = ddtype = battr = 0; for (i = 0; i < nattr; i++) { ap = &attr[i]; switch (ap->a_type) { @@ -66,7 +66,7 @@ obj *arcgen(int type) /* handles circula prevrad = ap->a_val.f / 2; break; case CW: - cw = 1; + _cw = 1; break; case FROM: /* start point of arc */ ppos = ap->a_val.o; @@ -107,16 +107,16 @@ obj *arcgen(int type) /* handles circula } } if (!at && !to) { /* the defaults are mostly OK */ - curx = fromx + prevrad * dctrx[cw][hvmode]; - cury = fromy + prevrad * dctry[cw][hvmode]; - tox = fromx + prevrad * dtox[cw][hvmode]; - toy = fromy + prevrad * dtoy[cw][hvmode]; - hvmode = nexthv[cw][hvmode]; + curx = fromx + prevrad * dctrx[_cw][hvmode]; + cury = fromy + prevrad * dctry[_cw][hvmode]; + tox = fromx + prevrad * dtox[_cw][hvmode]; + toy = fromy + prevrad * dtoy[_cw][hvmode]; + hvmode = nexthv[_cw][hvmode]; } else if (!at) { dx2 = (tox - fromx) / 2; dy2 = (toy - fromy) / 2; - phi = atan2(dy2, dx2) + (cw ? -PI/2 : PI/2); + phi = atan2(dy2, dx2) + (_cw ? -PI/2 : PI/2); if (prevrad <= 0.0) prevrad = dx2*dx2+dy2*dy2; for (r=prevrad; (d = r*r - (dx2*dx2+dy2*dy2)) <= 0.0; r *= 2) @@ -129,11 +129,11 @@ obj *arcgen(int type) /* handles circula dx2, dy2, phi, r, ht); } else if (at && !to) { /* do we have all the cases??? */ - tox = fromx + prevrad * dtox[cw][hvmode]; - toy = fromy + prevrad * dtoy[cw][hvmode]; - hvmode = nexthv[cw][hvmode]; + tox = fromx + prevrad * dtox[_cw][hvmode]; + toy = fromy + prevrad * dtoy[_cw][hvmode]; + hvmode = nexthv[_cw][hvmode]; } - if (cw) { /* interchange roles of from-to and heads */ + if (_cw) { /* interchange roles of from-to and heads */ double temp; temp = fromx; fromx = tox; tox = temp; temp = fromy; fromy = toy; toy = temp; @@ -148,7 +148,7 @@ obj *arcgen(int type) /* handles circula p->o_val[1] = fromy; p->o_val[2] = tox; p->o_val[3] = toy; - if (cw) { + if (_cw) { curx = fromx; cury = fromy; } else { @@ -158,7 +158,7 @@ obj *arcgen(int type) /* handles circula p->o_val[4] = prevw; p->o_val[5] = prevh; p->o_val[6] = prevrad; - p->o_attr = head | (cw ? CW_ARC : 0) | invis | ddtype | battr; + p->o_attr = head | (_cw ? CW_ARC : 0) | invis | ddtype | battr; p->o_fillval = fillval; if (head) p->o_nhead = getfval("arrowhead"); @@ -191,36 +191,36 @@ void arc_extreme(double x0, double y0, d /* start, end, center */ { /* assumes center isn't too far out */ - double r, xmin, ymin, xmax, ymax; + double r, _xmin, _ymin, _xmax, _ymax; int j, k; x0 -= xc; y0 -= yc; /* move to center */ x1 -= xc; y1 -= yc; - xmin = (x0<x1)?x0:x1; ymin = (y0<y1)?y0:y1; - xmax = (x0>x1)?x0:x1; ymax = (y0>y1)?y0:y1; + _xmin = (x0<x1)?x0:x1; _ymin = (y0<y1)?y0:y1; + _xmax = (x0>x1)?x0:x1; _ymax = (y0>y1)?y0:y1; r = sqrt(x0*x0 + y0*y0); if (r > 0.0) { j = quadrant(x0,y0); k = quadrant(x1,y1); if (j == k && y1*x0 < x1*y0) { /* viewed as complex numbers, if Im(z1/z0)<0, arc is big */ - if( xmin > -r) xmin = -r; if( ymin > -r) ymin = -r; - if( xmax < r) xmax = r; if( ymax < r) ymax = r; + if( _xmin > -r) _xmin = -r; if( _ymin > -r) _ymin = -r; + if( _xmax < r) _xmax = r; if( _ymax < r) _ymax = r; } else { while (j != k) { switch (j) { - case 1: if( ymax < r) ymax = r; break; /* north */ - case 2: if( xmin > -r) xmin = -r; break; /* west */ - case 3: if( ymin > -r) ymin = -r; break; /* south */ - case 4: if( xmax < r) xmax = r; break; /* east */ + case 1: if( _ymax < r) _ymax = r; break; /* north */ + case 2: if( _xmin > -r) _xmin = -r; break; /* west */ + case 3: if( _ymin > -r) _ymin = -r; break; /* south */ + case 4: if( _xmax < r) _xmax = r; break; /* east */ } j = j%4 + 1; } } } - xmin += xc; ymin += yc; - xmax += xc; ymax += yc; - extreme(xmin, ymin); - extreme(xmax, ymax); + _xmin += xc; _ymin += yc; + _xmax += xc; _ymax += yc; + extreme(_xmin, _ymin); + extreme(_xmax, _ymax); } int Modified: vendor/heirloom-doctools/dist/pic/blockgen.c ============================================================================== --- vendor/heirloom-doctools/dist/pic/blockgen.c Sat Oct 22 23:49:06 2016 (r307808) +++ vendor/heirloom-doctools/dist/pic/blockgen.c Sun Oct 23 00:24:25 2016 (r307809) @@ -20,8 +20,8 @@ struct pushstack stack[NBRACK]; int nstack = 0; -struct pushstack bracestack[NBRACE]; -int nbstack = 0; +static struct pushstack bracestack[NBRACE]; +static int nbstack = 0; void blockadj(obj *); Modified: vendor/heirloom-doctools/dist/pic/for.c ============================================================================== --- vendor/heirloom-doctools/dist/pic/for.c Sat Oct 22 23:49:06 2016 (r307808) +++ vendor/heirloom-doctools/dist/pic/for.c Sun Oct 23 00:24:25 2016 (r307809) @@ -25,10 +25,10 @@ typedef struct { char *str; /* string to push back */ } For; -For forstk[10]; /* stack of for loops */ -For *forp = forstk; /* pointer to current top */ +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: vendor/heirloom-doctools/dist/pic/input.c ============================================================================== --- vendor/heirloom-doctools/dist/pic/input.c Sat Oct 22 23:49:06 2016 (r307808) +++ vendor/heirloom-doctools/dist/pic/input.c Sun Oct 23 00:24:25 2016 (r307809) @@ -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; @@ -33,10 +28,12 @@ Src *srcp = src; void do_thru(void); int nextchar(void); int getarg(char *); -void freedef(char *); -int baldelim(int, char *); +int baldelim(int, const char *); +static void popsrc(void); + +static char *addnewline(char *); -void pushsrc(int type, char *ptr) /* new input source */ +void pushsrc(int type, const char *ptr) /* new input source */ { if (++srcp >= src + MAXSRC) FATAL("inputs nested too deep"); @@ -70,7 +67,7 @@ void pushsrc(int type, char *ptr) /* new } } -void popsrc(void) /* restore an old one */ +static void popsrc(void) /* restore an old one */ { if (srcp <= src) FATAL("too many inputs popped"); @@ -102,7 +99,7 @@ void popsrc(void) /* restore an old one srcp--; } -void definition(char *s) /* collect definition for s and install */ +void definition(const char *s) /* collect definition for s and install */ /* definitions picked up lexically */ { char *p; @@ -125,7 +122,7 @@ void definition(char *s) /* collect defi dprintf("installing %s as `%s'\n", s, p); } -char *delimstr(char *s) /* get body of X ... X */ +char *delimstr(const char *s) /* get body of X ... X */ /* message if too big */ { int c, delim, rdelim, n, deep; @@ -160,7 +157,7 @@ char *delimstr(char *s) /* get body of X return tostring(buf); } -int baldelim(int c, char *s) /* replace c by balancing entry in s */ +int baldelim(int c, const char *s) /* replace c by balancing entry in s */ { for ( ; *s; s += 2) if (*s == c) @@ -178,9 +175,9 @@ void undefine(char *s) /* undefine macro } -Arg args[10]; /* argument frames */ -Arg *argfp = args; /* frame pointer */ -int argcnt; /* number of arguments seen so far */ +static Arg args[10]; /* argument frames */ +static Arg *argfp = args; /* frame pointer */ +static int argcnt; /* number of arguments seen so far */ void dodef(struct symtab *stp) /* collect args and switch input to defn */ { @@ -239,13 +236,13 @@ int getarg(char *p) /* pick up single ar } #define PBSIZE 2000 -char pbuf[PBSIZE]; /* pushback buffer */ -char *pb = pbuf-1; /* next pushed back character */ +static char pbuf[PBSIZE]; /* pushback buffer */ +static char *pb = pbuf-1; /* next pushed back character */ -char ebuf[200]; /* collect input here for error reporting */ -char *ep = ebuf; +static char ebuf[200]; /* collect input here for error reporting */ +static char *ep = ebuf; -int begin = 0; +static int begin = 0; extern int thru; extern struct symtab *thrudef; extern char *untilstr; @@ -429,7 +426,7 @@ int unput(int c) return c; } -void pbstr(char *s) +void pbstr(const char *s) { pushsrc(String, s); } @@ -450,7 +447,6 @@ void eprint(void); void yyerror(char *s) { - extern char *cmdname; int ern = errno; /* cause some libraries clobber it */ if (synerr) @@ -498,7 +494,7 @@ void eprint(void) /* try to print contex void yywrap(void) {} -char *newfile = 0; /* filename for file copy */ +static char *newfile = 0; /* filename for file copy */ char *untilstr = 0; /* string that terminates a thru */ int thru = 0; /* 1 if copying thru macro */ struct symtab *thrudef = 0; /* macro being used */ @@ -513,7 +509,7 @@ void copydef(struct symtab *p) /* rememb thrudef = p; } -struct symtab *copythru(char *s) /* collect the macro name or body for thru */ +struct symtab *copythru(const char *s) /* collect the macro name or body for thru */ { struct symtab *p; char *q, *addnewline(char *); @@ -545,7 +541,7 @@ struct symtab *copythru(char *s) /* coll return p; } -char *addnewline(char *p) /* add newline to end of p */ +static char *addnewline(char *p) /* add newline to end of p */ { int n; @@ -584,7 +580,7 @@ void copy(void) /* begin input from file } } -char shellbuf[1000], *shellp; +static char shellbuf[1000], *shellp; void shell_init(void) /* set up to interpret a shell command */ { @@ -608,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: vendor/heirloom-doctools/dist/pic/main.c ============================================================================== --- vendor/heirloom-doctools/dist/pic/main.c Sat Oct 22 23:49:06 2016 (r307808) +++ vendor/heirloom-doctools/dist/pic/main.c Sun Oct 23 00:24:25 2016 (r307809) @@ -44,9 +44,8 @@ double deltx = 6; /* max x value in outp double delty = 6; /* max y value in output, for scaling */ int dbg = 0; int lineno = 0; -char *filename = "-"; int synerr = 0; -int anyerr = 0; /* becomes 1 if synerr ever 1 */ +static int anyerr = 0; /* becomes 1 if synerr ever 1 */ char *cmdname; int Sflag; @@ -57,7 +56,6 @@ double ymax = -30000; void fpecatch(int); void getdata(void), setdefaults(void); -void setfval(char *, double); int getpid(void); int @@ -122,7 +120,7 @@ void fpecatch(int n) FATAL("floating point exception %d", n); } -char *grow(char *ptr, char *name, int num, int size) /* make array bigger */ +char *grow(char *ptr, const char *name, int num, int size) /* make array bigger */ { char *p; @@ -136,7 +134,7 @@ char *grow(char *ptr, char *name, int nu } static struct { - char *name; + const char *name; double val; short scalable; /* 1 => adjust when "scale" changes */ } defaults[] ={ @@ -210,13 +208,12 @@ void getdata(void) char *p, *buf = NULL, *buf1 = NULL; size_t size = 0; int ln; - void reset(void), openpl(char *), closepl(char *), print(void); + void reset(void), openpl(char *), closepl(char *); int yyparse(void); *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201610230024.u9N0OPPh094137>