diff options
24 files changed, 310 insertions, 489 deletions
diff --git a/Build/source/texk/README b/Build/source/texk/README index bf2c6596120..cbe6b993c8f 100644 --- a/Build/source/texk/README +++ b/Build/source/texk/README @@ -56,8 +56,6 @@ dvipos - ? dvipsk - maintained here by Tom Rokicki, Karl Berry, Akira Kakuto, ... -etc - random additional files - gsftopk - from Paul Vojta's xdvi? kpathsea - maintained here by Karl Berry, Akira Kakuto, ... @@ -68,10 +66,6 @@ lcdf-typetools - checked 15jun09 http://www.lcdf.org/type/ http://www.lcdf.org/type/lcdf-typetools-2.79.tar.gz -m4 - maintained here, part of our build - -make - maintained here, part of our build - makeindexk - maintained here (but should it be?) musixflx - ? diff --git a/Build/source/texk/seetexk/ChangeLog b/Build/source/texk/seetexk/ChangeLog index 1d8007ff6d6..fc78cbb47e7 100644 --- a/Build/source/texk/seetexk/ChangeLog +++ b/Build/source/texk/seetexk/ChangeLog @@ -1,3 +1,20 @@ +2009-06-17 Peter Breitenlohner <peb@mppmu.mpg.de> + + * Makefile.am (AM_CFLAGS): enable compiler warnings. + + * use ANSI C prototypes for all functions. + * tempfile.h (new): prototype for MakeRWTempFile. + * Makefile.am: distribute tempfile.h. + + * avoid unused variables, remove rcsid's. + * remove unnecessary prototypes for static functions + (some with long/i32 discrepancies). + * dvibook.c, dviconcat.c, dviselect.c, dvitodvi.c: + (HandleFontDef) add explicit braces to avoid ambiguous `else'. + * dviselect.c (main): add parentheses around && within ||. + * font.h: guard against multiple inclusion. + * gripes.h: #include "font.h", for struct font. + 2009-06-02 Peter Breitenlohner <peb@mppmu.mpg.de> * tempfile.c: define __cdecl only when used, to avoid warnings diff --git a/Build/source/texk/seetexk/Makefile.am b/Build/source/texk/seetexk/Makefile.am index f9838dfad7c..4d8c9dc4c15 100644 --- a/Build/source/texk/seetexk/Makefile.am +++ b/Build/source/texk/seetexk/Makefile.am @@ -7,6 +7,7 @@ ACLOCAL_AMFLAGS = -I ../../m4 INCLUDES = $(KPATHSEA_INCLUDES) AM_CPPFLAGS = -DUNIX -DKPATHSEA -DNeedFunctionPrototypes +AM_CFLAGS = $(WARNING_CFLAGS) noinst_LIBRARIES = libtex.a @@ -26,6 +27,7 @@ libtex_a_SOURCES = \ seek.h \ seek.c \ tempfile.c \ + tempfile.h \ types.h bin_PROGRAMS = dvibook dviconcat dviselect dvitodvi diff --git a/Build/source/texk/seetexk/Makefile.in b/Build/source/texk/seetexk/Makefile.in index 0d348c67c40..2705101357f 100644 --- a/Build/source/texk/seetexk/Makefile.in +++ b/Build/source/texk/seetexk/Makefile.in @@ -267,6 +267,7 @@ top_srcdir = @top_srcdir@ ACLOCAL_AMFLAGS = -I ../../m4 INCLUDES = $(KPATHSEA_INCLUDES) AM_CPPFLAGS = -DUNIX -DKPATHSEA -DNeedFunctionPrototypes +AM_CFLAGS = $(WARNING_CFLAGS) noinst_LIBRARIES = libtex.a libtex_a_SOURCES = \ dviclass.c \ @@ -284,6 +285,7 @@ libtex_a_SOURCES = \ seek.h \ seek.c \ tempfile.c \ + tempfile.h \ types.h dvibook_DEPENDENCIES = libtex.a $(KPATHSEA_DEPEND) diff --git a/Build/source/texk/seetexk/dvibook.c b/Build/source/texk/seetexk/dvibook.c index 388aace141a..0b32e97ef0d 100644 --- a/Build/source/texk/seetexk/dvibook.c +++ b/Build/source/texk/seetexk/dvibook.c @@ -5,10 +5,6 @@ * so long as this copyright notice remains intact. */ -#ifndef lint -static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/dvi/RCS/dviselect.c,v 3.1 89/08/22 17:16:13 chris Exp $"; -#endif - /* * DVI page rearrangement program * @@ -26,7 +22,7 @@ static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/dvi/RCS/dviselect #else #define FOPEN_RBIN_MODE "r" #define FOPEN_RBIN_MODE "w" -#define SET_BINARY(x) +#define SET_BINARY(x) 0 extern char *optarg; extern int optind; #endif @@ -127,48 +123,20 @@ char *malloc(), *realloc(); #endif #ifdef HAVE_PROTOTYPES -void message(int space,char *str,int len); -void BeginPage(void); -void DviEndPage(void); -void PostAmbleFontEnumerator(char *addr,long key); -void HandlePostAmble(void); -void WriteFont(struct fontinfo *fi); -void HandlePreAmble(void); -void HandleFontDef(long strchr); -void HandleSpecial(int c,int l,long p); -void ReallyUseFont(void); -void PutFontSelector(long strchr); -void ScanDVIFile(void); -void HandleDVIFile(void); -int HandlePage(void); -void PutEmptyPage(void); -#else -void message(); -void BeginPage(); -void DviEndPage(); -void PostAmbleFontEnumerator(); -void HandlePostAmble(); -void WriteFont(); -void HandlePreAmble(); -void HandleFontDef(); -void HandleSpecial(); -void ReallyUseFont(); -void PutFontSelector(); -void ScanDVIFile(); -void HandleDVIFile(); -int HandlePage(); -void PutEmptyPage(); +static void WriteFont(struct fontinfo *fi); +static void PutFontSelector(i32 index); +static void ScanDVIFile(void); +static void HandleDVIFile(void); +static int HandlePage(void); +static void PutEmptyPage(void); #endif /* * Print a message to stderr, with an optional leading space, and handling * long line wraps. */ -void -message(space, str, len) - int space; - register char *str; - register int len; +static void +message(int space, char *str, int len) { static int beenhere; static int col; @@ -192,8 +160,8 @@ message(space, str, len) /* * Start a page (process a DVI_BOP). */ -void -BeginPage() +static void +BeginPage(void) { register i32 *i; @@ -240,8 +208,8 @@ BeginPage() /* * End a page (process a DVI_EOP). */ -void -EndPage() +static void +EndPage(void) { if (!UseThisPage) @@ -259,18 +227,16 @@ EndPage() * For each of the fonts used in the new DVI file, write out a definition. */ /* ARGSUSED */ -void -PostAmbleFontEnumerator(addr, key) - char *addr; - i32 key; +static void +PostAmbleFontEnumerator(char *addr, i32 key) { if (((struct fontinfo *)addr)->fi_reallyused) WriteFont((struct fontinfo *)addr); } -void -HandlePostAmble() +static void +HandlePostAmble(void) { register i32 c; @@ -330,9 +296,8 @@ HandlePostAmble() /* * Write a font definition to the output file */ -void -WriteFont(fi) - register struct fontinfo *fi; +static void +WriteFont(struct fontinfo *fi) { register int l; register char *s; @@ -369,8 +334,8 @@ WriteFont(fi) /* * Handle the preamble. Someday we should update the comment field. */ -void -HandlePreAmble() +static void +HandlePreAmble(void) { register int n, c; @@ -401,9 +366,7 @@ HandlePreAmble() } int -main(argc, argv) - int argc; - register char **argv; +main(int argc, char **argv) { register int c; register char *s; @@ -468,13 +431,13 @@ Usage: %s [-s signature] [-q] [-i infile] [-o outfile] [infile [outfile]]\n", DVIFileName = "`stdin'"; inf = stdin; if (!isatty(fileno(inf))) - SET_BINARY(fileno(inf)); + (void)SET_BINARY(fileno(inf)); } else if ((inf = fopen(DVIFileName, FOPEN_RBIN_MODE)) == 0) error(1, -1, "cannot read %s", DVIFileName); if (outname == NULL) { outf = stdout; if (!isatty(fileno(outf))) - SET_BINARY(fileno(outf)); + (void)SET_BINARY(fileno(outf)); } else if ((outf = fopen(outname, FOPEN_WBIN_MODE)) == 0) error(1, -1, "cannot write %s", outname); @@ -502,9 +465,8 @@ Usage: %s [-s signature] [-q] [-i infile] [-o outfile] [infile [outfile]]\n", /* * Handle a font definition. */ -void -HandleFontDef(index) - i32 index; +static void +HandleFontDef(i32 index) { register struct fontinfo *fi; register int i; @@ -512,12 +474,13 @@ HandleFontDef(index) int def = S_CREATE | S_EXCL; if (!UseThisPage) { - if ((fi = (struct fontinfo *)SSearch(FontFinder, index, &def)) == 0) + if ((fi = (struct fontinfo *)SSearch(FontFinder, index, &def)) == 0) { if (def & S_COLL) error(1, 0, "font %ld already defined", (long)index); else error(1, 0, "cannot stash font %ld (out of memory?)", (long)index); + } fi->fi_reallyused = 0; fi->fi_checksum = GetLong(inf); fi->fi_mag = GetLong(inf); @@ -544,11 +507,8 @@ HandleFontDef(index) /* * Handle a \special. */ -void -HandleSpecial(c, l, p) - int c; - register int l; - register i32 p; +static void +HandleSpecial(int c, int l, i32 p) { register int i; @@ -594,8 +554,8 @@ HandleSpecial(c, l, p) (void) getc(inf); } -void -ReallyUseFont() +static void +ReallyUseFont(void) { register struct fontinfo *fi; int look = S_LOOKUP; @@ -618,9 +578,8 @@ ReallyUseFont() /* * Write a font selection command to the output file */ -void -PutFontSelector(index) - i32 index; +static void +PutFontSelector(i32 index) { if (index < 64) { @@ -690,8 +649,8 @@ char oplen[128] = { /* * Here we scan the input DVI file and record pointers to the pages. */ -void -ScanDVIFile() +static void +ScanDVIFile(void) { UseThisPage = 0; @@ -706,8 +665,8 @@ ScanDVIFile() * output DVI file. We also keep track of font changes, handle font * definitions, and perform some other housekeeping. */ -void -HandleDVIFile() +static void +HandleDVIFile(void) { int CurrentPage, ActualPage, MaxPage; @@ -741,11 +700,11 @@ HandleDVIFile() error(1, -1, "can't seek last page"); } -int -HandlePage() +static int +HandlePage(void) { register int c, l; - register i32 p; + register i32 p = 0; /* avoid uninitialized warning */ register int CurrentFontOK = 0; int doingpage = 0; @@ -914,8 +873,8 @@ HandlePage() } /* write an empty page to fill out space */ -void -PutEmptyPage() +static void +PutEmptyPage(void) { int i; diff --git a/Build/source/texk/seetexk/dviclass.c b/Build/source/texk/seetexk/dviclass.c index 2897a00b7cf..08e97820211 100644 --- a/Build/source/texk/seetexk/dviclass.c +++ b/Build/source/texk/seetexk/dviclass.c @@ -5,10 +5,6 @@ * so long as this copyright notice remains intact. */ -#ifndef lint -static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/dviclass.c,v 3.1 89/08/22 21:48:35 chris Exp $"; -#endif - /* * dviclass - DVI code classification tables. */ diff --git a/Build/source/texk/seetexk/dviconcat.c b/Build/source/texk/seetexk/dviconcat.c index c8410ac9dc5..1d280ea12fd 100644 --- a/Build/source/texk/seetexk/dviconcat.c +++ b/Build/source/texk/seetexk/dviconcat.c @@ -5,10 +5,6 @@ * so long as this copyright notice remains intact. */ -#ifndef lint -static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/dvi/RCS/dviconcat.c,v 3.1 89/08/22 17:23:15 chris Exp $"; -#endif - /* * DVI page concatenation program. */ @@ -24,7 +20,7 @@ static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/dvi/RCS/dviconcat #else #define FOPEN_RBIN_MODE "rb" #define FOPEN_RBIN_MODE "wb" -#define SET_BINARY(x) +#define SET_BINARY(x) 0 extern char *optarg; extern int optind; #endif @@ -91,10 +87,7 @@ i16 DVIStackSize; /* max of all stack sizes */ char writeerr[] = "error writing DVI file"; #ifdef NeedFunctionPrototypes -void HandleDVIFile(); -void HandleFontDef(i32); -void HandleSpecial(int, int, i32); -void UseFont(); +static void HandleDVIFile(void); #ifdef _AMIGA #define bcmp(s1, s2, len) memcmp(s1, s2, len) #define bzero(s, len) memset(s, '\0', len) @@ -123,8 +116,8 @@ char *malloc(), *realloc(); /* * Start a page (process a DVI_BOP). */ -void -BeginPage() +static void +BeginPage(void) { register i32 t; register int i; @@ -148,8 +141,8 @@ BeginPage() /* * End a page (process a DVI_EOP). */ -void -EndPage() +static void +EndPage(void) { putbyte(outf, DVI_EOP); @@ -162,9 +155,8 @@ EndPage() /* * Write a font definition to the output file. */ -void -WriteFont(fi) - register struct fontinfo *fi; +static void +WriteFont(register struct fontinfo *fi) { register int l; register char *s; @@ -201,8 +193,8 @@ WriteFont(fi) /* * Write the postamble for the concatenation of all the input files. */ -void -WritePostAmble() +static void +WritePostAmble(void) { register struct fontinfo *fi; register i32 postpos = CurrentPosition; /* remember for later */ @@ -241,8 +233,8 @@ WritePostAmble() /* * Read the information we need from the postamble for the current DVI file. */ -void -HandlePostAmble() +static void +HandlePostAmble(void) { register i32 t; register i16 w; @@ -292,9 +284,8 @@ HandlePostAmble() * `firstone' is true if this is the first input file. * Return true iff something is wrong with the file. */ -int -HandlePreAmble(firstone) - int firstone; +static int +HandlePreAmble(int firstone) { register int n, c; static char warn1[] = "%s: Warning: preamble %s of %ld"; @@ -367,10 +358,8 @@ HandlePreAmble(firstone) * Read one DVI file, concatenating it with the previous one (if any) * or starting up the output file (otherwise). */ -void -doit(name, fp) - char *name; - FILE *fp; +static void +doit(char *name, FILE *fp) { static int started; @@ -385,9 +374,7 @@ doit(name, fp) } int -main(argc, argv) - int argc; - register char **argv; +main(int argc, char **argv) { register int c; register char *s; @@ -428,7 +415,7 @@ usage: if (outf == NULL) { outf = stdout; if (!isatty(fileno(outf))) - SET_BINARY(fileno(outf)); + (void)SET_BINARY(fileno(outf)); } if ((FontFinder = SCreate(sizeof(struct fontinfo *))) == 0) error(1, 0, "cannot create font finder (out of memory?)"); @@ -440,7 +427,7 @@ usage: */ if (optind >= argc) { if (!isatty(fileno(stdin))) - SET_BINARY(fileno(stdin)); + (void)SET_BINARY(fileno(stdin)); doit("`stdin'", stdin); } else { @@ -448,7 +435,7 @@ usage: s = argv[c]; if (*s == '-' && s[1] == 0) { if (!isatty(fileno(stdin))) - SET_BINARY(fileno(stdin)); + (void)SET_BINARY(fileno(stdin)); doit("`stdin'", stdin); } else if ((f = fopen(s, FOPEN_RBIN_MODE)) == NULL) { @@ -472,8 +459,8 @@ usage: /* * Handle a font definition. */ -void HandleFontDef(index) - i32 index; +static void +HandleFontDef(i32 index) { register struct fontinfo *fi; register int i; @@ -484,13 +471,14 @@ void HandleFontDef(index) char *name; int d = S_CREATE | S_EXCL; - if ((p = (struct fontinfo **)SSearch(FontFinder, index, &d)) == NULL) + if ((p = (struct fontinfo **)SSearch(FontFinder, index, &d)) == NULL) { if (d & S_COLL) error(1, 0, "font %ld already defined", (long)index); else error(1, 0, "cannot stash font %ld (out of memory?)", (long)index); + } /* collect the font information */ checksum = GetLong(inf); mag = GetLong(inf); @@ -546,10 +534,8 @@ void HandleFontDef(index) /* * Handle a \special. */ -void HandleSpecial(c, l, p) - int c; - register int l; - register i32 p; +static void +HandleSpecial(int c, int l, i32 p) { register int i; @@ -591,8 +577,8 @@ void HandleSpecial(c, l, p) error(1, -1, writeerr); } -void UseFont(index) - register i32 index; +static void +UseFont(i32 index) { struct fontinfo *fi, **p; int look = S_LOOKUP; @@ -673,10 +659,11 @@ char oplen[128] = { * DVI file, renumbering fonts. We also keep track of font changes, * handle font definitions, and perform some other housekeeping. */ -void HandleDVIFile() +static void +HandleDVIFile(void) { register int c, l; - register i32 p; + register i32 p = 0; /* avoid uninitialized warning */ int doingpage = 0; /* Only way out is via "return" statement */ diff --git a/Build/source/texk/seetexk/dviselect.c b/Build/source/texk/seetexk/dviselect.c index 1d9296cca6c..7485bf6ecf4 100644 --- a/Build/source/texk/seetexk/dviselect.c +++ b/Build/source/texk/seetexk/dviselect.c @@ -5,10 +5,6 @@ * so long as this copyright notice remains intact. */ -#ifndef lint -static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/dvi/RCS/dviselect.c,v 3.1 89/08/22 17:16:13 chris Exp $"; -#endif - /* * DVI page selection program * @@ -29,7 +25,7 @@ static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/dvi/RCS/dviselect #else #define FOPEN_RBIN_MODE "rb" #define FOPEN_RBIN_MODE "wb" -#define SET_BINARY(x) +#define SET_BINARY(x) 0 extern char *optarg; extern int optind; #endif @@ -147,11 +143,11 @@ char writeerr[] = "error writing DVI file"; #ifdef NeedFunctionPrototypes #include <string.h> -void WriteFont(struct fontinfo *); -int evenodd(char *); -int ParsePages(char *); -void HandleDVIFile(); -void PutFontSelector(i32); +static void WriteFont(struct fontinfo *); +static int evenodd(char *); +static int ParsePages(char *); +static void HandleDVIFile(void); +static void PutFontSelector(i32); #ifdef _AMIGA #define bcmp(s1, s2, len) memcmp(s1, s2, len) @@ -184,7 +180,8 @@ char *malloc(), *realloc(); /* * Return true iff the 10 \counts are one of the desired output pages. */ -DesiredPageP() +static int +DesiredPageP(void) { register struct pagelist *pl; @@ -237,10 +234,8 @@ DesiredPageP() * Print a message to stderr, with an optional leading space, and handling * long line wraps. */ -void message(space, str, len) - int space; - register char *str; - register int len; +static void +message(int space, char *str, int len) { static int beenhere; static int col; @@ -264,7 +259,8 @@ void message(space, str, len) /* * Start a page (process a DVI_BOP). */ -void BeginPage() +static void +BeginPage(void) { register i32 *i; @@ -312,7 +308,8 @@ void BeginPage() /* * End a page (process a DVI_EOP). */ -void EndPage() +static void +EndPage(void) { if (!UseThisPage) @@ -330,17 +327,16 @@ void EndPage() * For each of the fonts used in the new DVI file, write out a definition. */ /* ARGSUSED */ -void -PostAmbleFontEnumerator(addr, key) - char *addr; - i32 key; +static void +PostAmbleFontEnumerator(char *addr, i32 key) { if (((struct fontinfo *)addr)->fi_reallyused) WriteFont((struct fontinfo *)addr); } -void HandlePostAmble() +static void +HandlePostAmble(void) { register i32 c; @@ -400,8 +396,8 @@ void HandlePostAmble() /* * Write a font definition to the output file */ -void WriteFont(fi) - register struct fontinfo *fi; +static void +WriteFont(struct fontinfo *fi) { register int l; register char *s; @@ -438,7 +434,8 @@ void WriteFont(fi) /* * Handle the preamble. Someday we should update the comment field. */ -void HandlePreAmble() +static void +HandlePreAmble(void) { register int n, c; @@ -469,9 +466,7 @@ void HandlePreAmble() } int -main(argc, argv) - int argc; - register char **argv; +main(int argc, char **argv) { register int c; register char *s; @@ -512,8 +507,8 @@ Usage: %s [-s] [-i infile] [-o outfile] pages [...] [infile [outfile]]\n", while (optind < argc) { s = argv[optind++]; c = *s; - if (!isalpha(c) && c != '/' || - (c == 'e' || c == 'o') && evenodd(s)) { + if ((!isalpha(c) && c != '/') || + ((c == 'e' || c == 'o') && evenodd(s))) { if (ParsePages(s)) goto usage; } else if (DVIFileName == NULL) @@ -529,13 +524,13 @@ Usage: %s [-s] [-i infile] [-o outfile] pages [...] [infile [outfile]]\n", DVIFileName = "`stdin'"; inf = stdin; if (!isatty(fileno(inf))) - SET_BINARY(fileno(inf)); + (void)SET_BINARY(fileno(inf)); } else if ((inf = fopen(DVIFileName, FOPEN_RBIN_MODE)) == 0) error(1, -1, "cannot read %s", DVIFileName); if (outname == NULL) { outf = stdout; if (!isatty(fileno(outf))) - SET_BINARY(fileno(outf)); + (void)SET_BINARY(fileno(outf)); } else if ((outf = fopen(outname, FOPEN_WBIN_MODE)) == 0) error(1, -1, "cannot write %s", outname); @@ -553,11 +548,8 @@ Usage: %s [-s] [-i infile] [-o outfile] pages [...] [infile [outfile]]\n", return 0; } -struct pagelist * -InstallPL(ps, n, absolute) - register struct pagesel *ps; - register int n; - int absolute; +static struct pagelist * +InstallPL(struct pagesel *ps, int n, int absolute) { register struct pagelist *pl; @@ -577,9 +569,8 @@ InstallPL(ps, n, absolute) * Return true iff the string `s' is the word `even' or `odd', * followed by `.' or `white' characters. */ -int -evenodd(s) - char *s; +static int +evenodd(char *s) { register int c; @@ -598,8 +589,8 @@ evenodd(s) * Parse a string representing a list of pages. Return 0 iff ok. As a * side effect, the page selection(s) is (are) prepended to PageList. */ -int ParsePages(s) - register char *s; +static int +ParsePages(char *s) { register struct pagesel *ps; register int c; /* current character */ @@ -613,7 +604,9 @@ int ParsePages(s) struct pagesel pagesel[10]; range = 0; + n = 0; innumber = 0; + negative = 0; absolute = 0; i = 0; ps = pagesel; @@ -739,20 +732,21 @@ finishnum: /* * Handle a font definition. */ -void HandleFontDef(index) - i32 index; +static void +HandleFontDef(i32 index) { register struct fontinfo *fi; register int i; register char *s; int def = S_CREATE | S_EXCL; - if ((fi = (struct fontinfo *)SSearch(FontFinder, index, &def)) == 0) + if ((fi = (struct fontinfo *)SSearch(FontFinder, index, &def)) == 0) { if (def & S_COLL) error(1, 0, "font %ld already defined", (long)index); else error(1, 0, "cannot stash font %ld (out of memory?)", (long)index); + } fi->fi_reallyused = 0; fi->fi_checksum = GetLong(inf); fi->fi_mag = GetLong(inf); @@ -770,10 +764,8 @@ void HandleFontDef(index) /* * Handle a \special. */ -void HandleSpecial(c, l, p) - int c; - register int l; - register i32 p; +static void +HandleSpecial(int c, int l, i32 p) { register int i; @@ -819,7 +811,8 @@ void HandleSpecial(c, l, p) (void) getc(inf); } -void ReallyUseFont() +static void +ReallyUseFont(void) { register struct fontinfo *fi; int look = S_LOOKUP; @@ -842,8 +835,8 @@ void ReallyUseFont() /* * Write a font selection command to the output file */ -void PutFontSelector(index) - i32 index; +static void +PutFontSelector(i32 index) { if (index < 64) { @@ -915,10 +908,11 @@ char oplen[128] = { * output DVI file. We also keep track of font changes, handle font * definitions, and perform some other housekeeping. */ -void HandleDVIFile() +static void +HandleDVIFile(void) { register int c, l; - register i32 p; + register i32 p = 0; /* avoid uninitialized warning */ register int CurrentFontOK = 0; int doingpage = 0; diff --git a/Build/source/texk/seetexk/dvitodvi.c b/Build/source/texk/seetexk/dvitodvi.c index 333db89697e..f04a43ad751 100644 --- a/Build/source/texk/seetexk/dvitodvi.c +++ b/Build/source/texk/seetexk/dvitodvi.c @@ -5,10 +5,6 @@ * so long as this copyright notice remains intact. */ -#ifndef lint -static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/dvi/RCS/dviselect.c,v 3.1 89/08/22 17:16:13 chris Exp $"; -#endif - /* * DVI page rearrangement program * @@ -26,7 +22,7 @@ static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/dvi/RCS/dviselect #else #define FOPEN_RBIN_MODE "r" #define FOPEN_RBIN_MODE "w" -#define SET_BINARY(x) +#define SET_BINARY(x) 0 extern char *optarg; extern int optind; #endif @@ -114,51 +110,10 @@ char *malloc(), *realloc(); #endif #ifdef HAVE_PROTOTYPES -void specusage(void); -long scale(long whole,int num,int den,long sf); -struct pagespec * newspec(void); -int parseint(char **sp ); -long parsedimen(char **sp ); -struct pagespec * ParseSpecs(char *str,int make); -long singledimen(char *str); -void message(int space,char *str,int len); -void BeginPage(int really); -void DviEndPage(int really); -void PostAmbleFontEnumerator(char *addr,long key); -void HandlePostAmble(void); -void WriteFont(struct fontinfo *fi); -void HandlePreAmble(void); -void HandleFontDef(long strchr); -void HandleSpecial(int c,int l,long p); -void ReallyUseFont(void); -void PutFontSelector(long strchr); -int HandlePage(int first,int last,long hoffset,long voffset); -void PutEmptyPage(void); -void ScanDVIFile(void); -void HandleDVIFile(void); -#else -void specusage(); -long scale(); -struct pagespec *newspec(); -int parseint(); -long parsedimen(); -struct pagespec *ParseSpecs(); -long singledimen(); -void message(); -void BeginPage(); -void DviEndPage(); -void PostAmbleFontEnumerator(); -void HandlePostAmble(); -void WriteFont(); -void HandlePreAmble(); -void HandleFontDef(); -void HandleSpecial(); -void ReallyUseFont(); -void PutFontSelector(); -int HandlePage(); -void PutEmptyPage(); -void ScanDVIFile(); -void HandleDVIFile(); +static void WriteFont(struct fontinfo *fi); +static void PutFontSelector(i32 index); +static void ScanDVIFile(void); +static void HandleDVIFile(void); #endif /* @@ -179,7 +134,8 @@ void HandleDVIFile(); #endif #endif -void specusage() +static void +specusage(void) { error(1, -1, "page specification error:\n\ <pagespecs> = [modulo:][mag@]<spec>\n\ @@ -198,9 +154,9 @@ void specusage() * 0 <= whole */ i32 defaultscale = 4736286 ; -i32 scale(whole, num, den, sf) - i32 whole, sf; - int num, den; + +static i32 +scale(i32 whole, int num, int den, i32 sf) { i32 v ; @@ -220,7 +176,8 @@ struct pagespec { struct pagespec *next; }; -struct pagespec *newspec() +static struct pagespec * +newspec(void) { struct pagespec *temp = (struct pagespec *)malloc(sizeof(struct pagespec)); temp->reversed = temp->pageno = temp->add = 0; @@ -229,8 +186,8 @@ struct pagespec *newspec() return (temp); } -int parseint(sp) - char **sp; +static int +parseint(char **sp) { char *s = *sp; int n = 0, neg = 0; @@ -246,8 +203,8 @@ int parseint(sp) return (neg ? -n : n); } -i32 parsedimen(sp) - char **sp; +static i32 +parsedimen(char **sp) { i32 whole = 0; int num = 0, den = 1, neg = 0; @@ -325,9 +282,8 @@ i32 parsedimen(sp) return (neg ? -whole : whole); } -struct pagespec *ParseSpecs(str, make) - char *str; - int make; +static struct pagespec * +ParseSpecs(char *str, int make) { struct pagespec *head, *tail; int other = 0; @@ -388,8 +344,8 @@ struct pagespec *ParseSpecs(str, make) return (head); } -i32 singledimen(str) - char *str; +static i32 +singledimen(char *str) { i32 num = parsedimen(&str); if (*str) return (0); @@ -400,11 +356,8 @@ i32 singledimen(str) * Print a message to stderr, with an optional leading space, and handling * long line wraps. */ -void -message(space, str, len) - int space; - register char *str; - register int len; +static void +message(int space, char *str, int len) { static int beenhere; static int col; @@ -428,9 +381,8 @@ message(space, str, len) /* * Start a page (process a DVI_BOP). */ -void -BeginPage(really) - int really; +static void +BeginPage(int really) { register i32 *i; @@ -477,9 +429,8 @@ BeginPage(really) /* * End a page (process a DVI_EOP). */ -void -EndPage(really) - int really; +static void +EndPage(int really) { if (!UseThisPage || !really) @@ -497,18 +448,16 @@ EndPage(really) * For each of the fonts used in the new DVI file, write out a definition. */ /* ARGSUSED */ -void -PostAmbleFontEnumerator(addr, key) - char *addr; - i32 key; +static void +PostAmbleFontEnumerator(char *addr, i32 key) { if (((struct fontinfo *)addr)->fi_reallyused) WriteFont((struct fontinfo *)addr); } -void -HandlePostAmble() +static void +HandlePostAmble(void) { register i32 c; @@ -568,9 +517,8 @@ HandlePostAmble() /* * Write a font definition to the output file */ -void -WriteFont(fi) - register struct fontinfo *fi; +static void +WriteFont(struct fontinfo *fi) { register int l; register char *s; @@ -607,8 +555,8 @@ WriteFont(fi) /* * Handle the preamble. Someday we should update the comment field. */ -void -HandlePreAmble() +static void +HandlePreAmble(void) { register int n, c; @@ -639,9 +587,7 @@ HandlePreAmble() } int -main(argc, argv) - int argc; - register char **argv; +main(int argc, char **argv) { register int c; register char *s; @@ -721,13 +667,13 @@ Usage: %s [-q] [-i infile] [-o outfile] [-w width] [-h height] <pagespecs> [infi DVIFileName = "`stdin'"; inf = stdin; if (!isatty(fileno(inf))) - SET_BINARY(fileno(inf)); + (void)SET_BINARY(fileno(inf)); } else if ((inf = fopen(DVIFileName, FOPEN_RBIN_MODE)) == 0) error(1, -1, "cannot read %s", DVIFileName); if (outname == NULL) { outf = stdout; if (!isatty(fileno(outf))) - SET_BINARY(fileno(outf)); + (void)SET_BINARY(fileno(outf)); } else if ((outf = fopen(outname, FOPEN_WBIN_MODE)) == 0) error(1, -1, "cannot write %s", outname); @@ -766,9 +712,8 @@ Usage: %s [-q] [-i infile] [-o outfile] [-w width] [-h height] <pagespecs> [infi /* * Handle a font definition. */ -void -HandleFontDef(index) - i32 index; +static void +HandleFontDef(i32 index) { register struct fontinfo *fi; register int i; @@ -776,12 +721,13 @@ HandleFontDef(index) int def = S_CREATE | S_EXCL; if (!UseThisPage) { - if ((fi = (struct fontinfo *)SSearch(FontFinder, index, &def)) == 0) + if ((fi = (struct fontinfo *)SSearch(FontFinder, index, &def)) == 0) { if (def & S_COLL) error(1, 0, "font %ld already defined", (long)index); else error(1, 0, "cannot stash font %ld (out of memory?)", (long)index); + } fi->fi_reallyused = 0; fi->fi_checksum = GetLong(inf); fi->fi_mag = GetLong(inf); @@ -808,11 +754,8 @@ HandleFontDef(index) /* * Handle a \special. */ -void -HandleSpecial(c, l, p) - int c; - register int l; - register i32 p; +static void +HandleSpecial(int c, int l, i32 p) { register int i; @@ -858,8 +801,8 @@ HandleSpecial(c, l, p) (void) getc(inf); } -void -ReallyUseFont() +static void +ReallyUseFont(void) { register struct fontinfo *fi; int look = S_LOOKUP; @@ -882,9 +825,8 @@ ReallyUseFont() /* * Write a font selection command to the output file */ -void -PutFontSelector(index) - i32 index; +static void +PutFontSelector(i32 index) { if (index < 64) { @@ -951,13 +893,11 @@ char oplen[128] = { 0, 0, 0, 0, 0, 0, /* 250 .. 255 */ }; -int -HandlePage(first, last, hoffset, voffset) - int first, last; - i32 hoffset, voffset; +static int +HandlePage(int first, int last, i32 hoffset, i32 voffset) { register int c, l; - register i32 p; + register i32 p = 0; /* avoid uninitialized warning */ register int CurrentFontOK = 0; int doingpage = 0; @@ -1146,8 +1086,8 @@ HandlePage(first, last, hoffset, voffset) } /* write an empty page to fill out space */ -void -PutEmptyPage() +static void +PutEmptyPage(void) { int i; @@ -1172,8 +1112,8 @@ PutEmptyPage() /* * Here we scan the input DVI file and record pointers to the pages. */ -void -ScanDVIFile() +static void +ScanDVIFile(void) { UseThisPage = 0; @@ -1188,8 +1128,8 @@ ScanDVIFile() * output DVI file. We also keep track of font changes, handle font * definitions, and perform some other housekeeping. */ -void -HandleDVIFile() +static void +HandleDVIFile(void) { int CurrentPage, ActualPage, MaxPage; diff --git a/Build/source/texk/seetexk/error.c b/Build/source/texk/seetexk/error.c index b33ee84ea27..f4621745c1c 100644 --- a/Build/source/texk/seetexk/error.c +++ b/Build/source/texk/seetexk/error.c @@ -5,10 +5,6 @@ * so long as this copyright notice remains intact. */ -#ifndef lint -static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/error.c,v 2.8 89/08/22 21:49:12 chris Exp $"; -#endif - /* * Print an error message with an optional system error number, and * optionally quit. @@ -22,19 +18,7 @@ static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/error.c,v #include "types.h" /* for HAVE_VPRINTF */ #include "error.h" - -#if defined(lint) && !defined(LINT_ANYWAY) - -/* ARGSUSED */ -void SetErrorTrap(fn) void (*fn)(); {;} - -/* VARARGS3 ARGSUSED */ -void error(quit, e, fmt) int quit, e; char *fmt; {;} - -/* VARARGS1 ARGSUSED */ -void panic(fmt) char *fmt; { exit(1); /* NOTREACHED */ } - -#else /* lint */ +#include "tempfile.h" extern char *ProgName; /* program name from argv[0] */ @@ -44,7 +28,7 @@ extern int errno; #endif static FILE *trap_file; /* error diversion file, if any */ -static void (*trap_fn)(); /* trap function */ +static void (*trap_fn)(int, char *); /* trap function */ static char *trap_buf; /* buffer for trapped error strings */ static int trap_size; /* size of trap_buf */ @@ -52,13 +36,9 @@ static int trap_size; /* size of trap_buf */ extern char *malloc(), *realloc(); #endif -extern int MakeRWTempFile(); - - #if !defined (HAVE_STRERROR) && !defined (strerror) static char * -strerror (errnum) - int errnum; +strerror (int errnum) { extern char *sys_errlist[]; extern int sys_nerr; @@ -74,7 +54,7 @@ strerror (errnum) * If something goes wrong, return something else printable. */ static char * -readback() +readback(void) { int nbytes = ftell(trap_file) + 1; @@ -108,10 +88,7 @@ readback() * the program name is omitted. */ static void -verror(quit, a0, fmt, l, e) - char *a0, *fmt; - va_list l; - int e; +verror(int quit, const char *a0, const char *fmt, va_list l, int e) { register FILE *fp = trap_file; @@ -140,30 +117,35 @@ verror(quit, a0, fmt, l, e) /* * Print an error message and optionally quit. */ -void error PVAR3C(int, quit, int, e, const char *, fmt, l) +void +error(int quit, int e, const char *fmt, ...) { + va_list l; + va_start(l, fmt); if (e < 0) e = errno; - verror(quit, (char *)NULL, fmt, l, e); + verror(quit, NULL, fmt, l, e); va_end(l); -}} +} /* * Panic (print to stderr and abort). */ -void panic PVAR1C(const char *, fmt, l) +void +panic(const char *fmt, ...) { + va_list l; + va_start(l, fmt); verror(0, "panic: ", fmt, l, 0); va_end(l); abort(); -}} +} /* * Enable error trapping: register the function fn as the trapper. * If fn is NULL, stop trapping. */ void -SetErrorTrap(fn) - void (*fn)(int, char *); +SetErrorTrap(void (*fn)(int, char *)) { int tempfd; char fname[BUFSIZ]; @@ -187,5 +169,3 @@ SetErrorTrap(fn) if ((trap_file = fdopen(tempfd, "r+")) == NULL) error(1, -1, "cannot get stdio file for error trap"); } - -#endif /* lint */ diff --git a/Build/source/texk/seetexk/error.h b/Build/source/texk/seetexk/error.h index 58491f8ae43..4074126680e 100644 --- a/Build/source/texk/seetexk/error.h +++ b/Build/source/texk/seetexk/error.h @@ -9,10 +9,9 @@ * Errors. */ -#include <kpathsea/config.h> -#include <kpathsea/c-vararg.h> +#include <stdarg.h> -void error PVAR3H(int quit, int e, const char *fmt); -void panic PVAR1H(const char *fmt); +void error(int quit, int e, const char *fmt, ...); +void panic(const char *fmt, ...); void SetErrorTrap(void (*fn)(int quit, char *text)); diff --git a/Build/source/texk/seetexk/fio.c b/Build/source/texk/seetexk/fio.c index b4ccf8974c1..0d5ff7c618e 100644 --- a/Build/source/texk/seetexk/fio.c +++ b/Build/source/texk/seetexk/fio.c @@ -5,10 +5,6 @@ * so long as this copyright notice remains intact. */ -#ifndef lint -static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/fio.c,v 2.4 89/08/22 21:50:31 chris Exp $"; -#endif - /* * File I/O subroutines for getting bytes, words, 3bytes, and longwords. * N.B.: these believe they are working on a DVI file. @@ -27,8 +23,7 @@ static char eofmsg[] = "unexpected EOF, help"; #define make(name, func, signextend) \ i32 \ -name(fp) \ - register FILE *fp; \ +name(FILE *fp) \ { \ register i32 n; \ \ diff --git a/Build/source/texk/seetexk/fio.h b/Build/source/texk/seetexk/fio.h index 53f2ef8ca81..aa2c8188a65 100644 --- a/Build/source/texk/seetexk/fio.h +++ b/Build/source/texk/seetexk/fio.h @@ -50,4 +50,4 @@ /* * Function types */ -i32 GetByte(), GetWord(), Get3Byte(), GetLong(); +i32 GetByte(FILE *), GetWord(FILE *), Get3Byte(FILE *), GetLong(FILE *); diff --git a/Build/source/texk/seetexk/font.c b/Build/source/texk/seetexk/font.c index dbaee944e4a..f00094a963e 100644 --- a/Build/source/texk/seetexk/font.c +++ b/Build/source/texk/seetexk/font.c @@ -65,8 +65,12 @@ static struct fontconf *fonts; /* font list */ static struct fontconf **nextfc;/* used during initialisation */ static char spec_any[] = "*"; /* the `anything' specifier */ -static void readconf(), badcf(), setfenv(), setfont(); -static struct font *getafont(); +static void readconf(char *name); +static void badcf(char *why); +static void setfenv(struct fontconf *pfc, char *env, char *suf); +static void setfont(struct fontconf *pfc, char *path); +static struct font *getafont(char *nm, i32 dvimag, i32 dvidsz, + char *dev, char **fname, int wantrast); /* * Imports. @@ -93,8 +97,7 @@ char *getenv(), *malloc(), *strncpy(), *strsave(); } void -fontinit(file) - char *file; +fontinit(char *file) { if (didinit) { @@ -124,8 +127,7 @@ fontinit(file) * Find a font's operations, given its name. */ static struct fontops * -findops(name) - register char *name; +findops(char *name) { register struct fontops *fo; @@ -142,8 +144,7 @@ findops(name) * words and make a fontconf entry. */ static void -readconf(name) - char *name; +readconf(char *name) { register FILE *f; /* config file */ register int c; /* char and word counter */ @@ -251,9 +252,7 @@ readconf(name) * as there are components in the given environment variable. */ static void -setfenv(pfc, env, suf) - struct fontconf *pfc; - char *env, *suf; +setfenv(struct fontconf *pfc, char *env, char *suf) { register char *s, *t; register int len, suflen = strlen(suf); @@ -297,9 +296,7 @@ setfenv(pfc, env, suf) * Turn a prototype fontconf into a real one. */ static void -setfont(pfc, path) - struct fontconf *pfc; - char *path; +setfont(struct fontconf *pfc, char *path) { register struct fontconf *fc; @@ -320,8 +317,7 @@ setfont(pfc, path) * Complain about a problem in the configuration file. */ static void -badcf(why) - char *why; +badcf(char *why) { error(1, 0, "\"%s\", line %d: %s", cfname, cfline, why); @@ -333,9 +329,7 @@ badcf(why) * E.g., cmr7 and cmr10 become cmr. (This is the `%b' operator.) */ static void -basify(s, buf, size) - char *s, *buf; - int size; +basify(char *s, char *buf, int size) { register char *p, *endp; register int n; @@ -354,9 +348,7 @@ basify(s, buf, size) * path (expand %f, %m, %b). */ static void -pave(result, proto, name, mag) - char *result, *proto, *name; - int mag; +pave(char *result, char *proto, char *name, int mag) { register int c; register char *s, *d, *p; @@ -426,10 +418,7 @@ put: * are no fonts for the device, in which case we set *fname to NULL. */ struct font * -GetFont(nm, dvimag, dvidsz, dev, fname) - char *nm; - i32 dvimag, dvidsz; - char *dev, **fname; +GetFont(char *nm, i32 dvimag, i32 dvidsz, char *dev, char **fname) { return (getafont(nm, dvimag, dvidsz, dev, fname, 1)); @@ -439,10 +428,7 @@ GetFont(nm, dvimag, dvidsz, dev, fname) * Same as GetFont, but caller promises never to ask for rasters. */ struct font * -GetRasterlessFont(nm, dvimag, dvidsz, dev, fname) - char *nm; - i32 dvimag, dvidsz; - char *dev, **fname; +GetRasterlessFont(char *nm, i32 dvimag, i32 dvidsz, char *dev, char **fname) { return (getafont(nm, dvimag, dvidsz, dev, fname, 0)); @@ -453,11 +439,7 @@ GetRasterlessFont(nm, dvimag, dvidsz, dev, fname) * WHAT ABOUT OTHERS? */ static struct font * -getafont(nm, dvimag, dvidsz, dev, fname, wantrast) - char *nm; - i32 dvimag, dvidsz; - char *dev, **fname; - int wantrast; +getafont(char *nm, i32 dvimag, i32 dvidsz, char *dev, char **fname, int wantrast) { register int slop, fmag; register struct font *f; diff --git a/Build/source/texk/seetexk/font.h b/Build/source/texk/seetexk/font.h index 2998bcf50b6..71516478783 100644 --- a/Build/source/texk/seetexk/font.h +++ b/Build/source/texk/seetexk/font.h @@ -5,6 +5,9 @@ * so long as this copyright notice remains intact. */ +#ifndef _MCTEX_FONT_ +#define _MCTEX_FONT_ + /* * Font file information, readers, etc. */ @@ -276,15 +279,15 @@ struct fontops { /* * Function types. */ -struct font *GetFont(), *GetRasterlessFont(); +struct font *GetFont(char *nm, i32 dvimag, i32 dvidsz, char *dev, char **fname); +struct font *GetRasterlessFont(char *nm, i32 dvimag, i32 dvidsz, char *dev, char **fname); struct glyph *GetGlyph(); char *GetRaster(); void FreeFont(); void FreeGlyph(); void FreeRaster(); char *Font_TeXName(); -double DMagFactor(); /* from magfactor.c */ -void fontinit(); +void fontinit(char *file); /* * Normally from stdio.h @@ -299,3 +302,5 @@ void fontinit(); * called, or is passed a null pointer. */ #define CONFENV "TEXFONTDESC" + +#endif /* _MCTEX_FONT_ */ diff --git a/Build/source/texk/seetexk/gripes.h b/Build/source/texk/seetexk/gripes.h index 87ebbb18b9e..f49a2fb4cac 100644 --- a/Build/source/texk/seetexk/gripes.h +++ b/Build/source/texk/seetexk/gripes.h @@ -5,12 +5,22 @@ * so long as this copyright notice remains intact. */ +#include "font.h" /* for struct font */ + /* * Declarations for the various gripes. */ -void GripeOutOfMemory(), GripeCannotGetFont(), GripeDifferentChecksums(); -void GripeMissingFontsPreventOutput(), GripeNoSuchFont(); -void GripeFontAlreadyDefined(), GripeUnexpectedDVIEOF(), GripeUnexpectedOp(); -void GripeMissingOp(), GripeCannotFindPostamble(), GripeMismatchedValue(); -void GripeUndefinedOp(), GripeBadGlyph(); +void GripeOutOfMemory(int n, char *why); +void GripeCannotGetFont(char *name, i32 mag, i32 dsz, char *dev, char *fullname); +void GripeDifferentChecksums(char *font, i32 tfmsum, i32 fontsum); +void GripeMissingFontsPreventOutput(int n); +void GripeNoSuchFont(i32 n); +void GripeFontAlreadyDefined(i32 n); +void GripeUnexpectedDVIEOF(void); +void GripeUnexpectedOp(char *s); +void GripeMissingOp(char *s); +void GripeCannotFindPostamble(void); +void GripeMismatchedValue(char *s); +void GripeUndefinedOp(int n); +void GripeBadGlyph(i32 c, struct font *f); diff --git a/Build/source/texk/seetexk/gripes0.c b/Build/source/texk/seetexk/gripes0.c index b80239896d5..6e9c0a572ad 100644 --- a/Build/source/texk/seetexk/gripes0.c +++ b/Build/source/texk/seetexk/gripes0.c @@ -5,10 +5,6 @@ * so long as this copyright notice remains intact. */ -#ifndef lint -static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/gripes0.c,v 2.5 89/09/01 13:52:38 chris Exp $"; -#endif - /* * Common errors (`gripes'). */ @@ -19,16 +15,14 @@ static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/gripes0.c #include "gripes.h" #ifndef WIN32 -extern errno; +extern int errno; #endif /* * Cannot allocate memory. */ void -GripeOutOfMemory(n, why) - int n; - char *why; +GripeOutOfMemory(int n, char *why) { error(1, -1, "ran out of memory allocating %d bytes for %s", n, why); @@ -40,10 +34,7 @@ GripeOutOfMemory(n, why) * RETURNS TO CALLER */ void -GripeCannotGetFont(name, mag, dsz, dev, fullname) - char *name; - i32 mag, dsz; - char *dev, *fullname; +GripeCannotGetFont(char *name, i32 mag, i32 dsz, char *dev, char *fullname) { int e = errno; char scale[40]; @@ -72,9 +63,7 @@ GripeCannotGetFont(name, mag, dsz, dev, fullname) * RETURNS TO CALLER */ void -GripeDifferentChecksums(font, tfmsum, fontsum) - char *font; - i32 tfmsum, fontsum; +GripeDifferentChecksums(char *font, i32 tfmsum, i32 fontsum) { error(0, 0, "\ @@ -89,8 +78,7 @@ WARNING: TeX and I have different checksums for font\n\ * A font, or several fonts, are missing, so no output. */ void -GripeMissingFontsPreventOutput(n) - int n; +GripeMissingFontsPreventOutput(int n) { static char s[2] = {'s', 0}; diff --git a/Build/source/texk/seetexk/gripes1.c b/Build/source/texk/seetexk/gripes1.c index cd31a2f2b5d..acf3359940d 100644 --- a/Build/source/texk/seetexk/gripes1.c +++ b/Build/source/texk/seetexk/gripes1.c @@ -5,10 +5,6 @@ * so long as this copyright notice remains intact. */ -#ifndef lint -static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/gripes1.c,v 1.1 89/08/22 21:54:19 chris Exp $"; -#endif - /* * Gripes having to do with DVI files. */ @@ -22,7 +18,7 @@ static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/gripes1.c extern char *DVIFileName; static char * -dfn() +dfn(void) { return (DVIFileName ? DVIFileName : "the input"); @@ -43,8 +39,7 @@ static char areyousure[] = "(are you sure %s is a %s?)"; * DVI file requests a font it never defined. */ void -GripeNoSuchFont(n) - i32 n; +GripeNoSuchFont(i32 n) { error(0, 0, "%s wants font %ld, which it never defined", dfl, (long)n); @@ -56,8 +51,7 @@ GripeNoSuchFont(n) * DVI file redefines a font. */ void -GripeFontAlreadyDefined(n) - i32 n; +GripeFontAlreadyDefined(i32 n) { error(0, 0, "%s redefines font %ld", dfl, n); @@ -69,7 +63,7 @@ GripeFontAlreadyDefined(n) * Unexpected end of DVI file. */ void -GripeUnexpectedDVIEOF() +GripeUnexpectedDVIEOF(void) { GripeUnexpectedOp("end of file"); @@ -80,8 +74,7 @@ GripeUnexpectedDVIEOF() * Unexpected DVI opcode. */ void -GripeUnexpectedOp(s) - char *s; +GripeUnexpectedOp(char *s) { error(0, 0, "unexpected %s in %s", s, dfl); @@ -93,8 +86,7 @@ GripeUnexpectedOp(s) * Missing DVI opcode. */ void -GripeMissingOp(s) - char *s; +GripeMissingOp(char *s) { error(0, 0, "missing %s in %s", s, dfl); @@ -106,7 +98,7 @@ GripeMissingOp(s) * Cannot find DVI postamble. */ void -GripeCannotFindPostamble() +GripeCannotFindPostamble(void) { error(0, 0, "cannot find postamble"); @@ -118,8 +110,7 @@ GripeCannotFindPostamble() * Inconsistent DVI value. */ void -GripeMismatchedValue(s) - char *s; +GripeMismatchedValue(char *s) { error(0, 0, "mismatched %s in %s", s, dfl); @@ -131,8 +122,7 @@ GripeMismatchedValue(s) * Undefined DVI opcode. */ void -GripeUndefinedOp(n) - int n; +GripeUndefinedOp(int n) { error(0, 0, "undefined DVI opcode %d", n); @@ -147,9 +137,7 @@ GripeUndefinedOp(n) * RETURNS TO CALLER */ void -GripeBadGlyph(c, f) - i32 c; - struct font *f; +GripeBadGlyph(i32 c, struct font *f) { if (f->f_path == NULL) { diff --git a/Build/source/texk/seetexk/search.c b/Build/source/texk/seetexk/search.c index 0768450787d..70ba4282ba8 100644 --- a/Build/source/texk/seetexk/search.c +++ b/Build/source/texk/seetexk/search.c @@ -5,10 +5,6 @@ * so long as this copyright notice remains intact. */ -#ifndef lint -static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/search.c,v 3.1 89/08/22 21:58:14 chris Exp $"; -#endif - /* * Key search routines (for a 32 bit key) * @@ -39,8 +35,7 @@ char *malloc(), *realloc(); #endif struct search * -SCreate(dsize) - register unsigned int dsize; +SCreate(unsigned int dsize) { register struct search *s; @@ -85,10 +80,7 @@ SCreate(dsize) * We actually use a binary search right now - this may change. */ char * -SSearch(s, key, disp) - register struct search *s; - register i32 key; - int *disp; +SSearch(struct search *s, i32 key, int *disp) { register char *keyaddr; int itemstomove; @@ -166,9 +158,7 @@ SSearch(s, key, disp) * Call function `f' for each element in the search table `s'. */ void -SEnumerate(s, f) - register struct search *s; - register void (*f)(); +SEnumerate(struct search *s, void(*f)(char*,i32)) { register int n; register char *p; diff --git a/Build/source/texk/seetexk/search.h b/Build/source/texk/seetexk/search.h index 864649c8dfb..a3e7558e5ce 100644 --- a/Build/source/texk/seetexk/search.h +++ b/Build/source/texk/seetexk/search.h @@ -15,10 +15,10 @@ struct search { }; /* returns a pointer to the search table (for future search/installs) */ -struct search *SCreate(); /* create a search table */ +struct search *SCreate(unsigned int dsize); /* create a search table */ /* returns a pointer to the data object found or created */ -char *SSearch(); /* search for a data object */ +char *SSearch(struct search *s, i32 key, int *disp); /* search for a data object */ /* clears a search table (wipes out all entries) */ #define SClear(s) ((s)->s_space += (s)->s_n, (s)->s_n = 0) @@ -34,4 +34,4 @@ char *SSearch(); /* search for a data object */ #define S_NEW 0x10 /* created (occurs iff S_CREATE && !S_EXCL) */ #define S_ERROR 0x20 /* problem creating (out of memory) */ -void SEnumerate(); +void SEnumerate(struct search *s, void(*f)(char*,i32)); diff --git a/Build/source/texk/seetexk/seek.c b/Build/source/texk/seetexk/seek.c index 64c8baa7037..9a309a3b431 100644 --- a/Build/source/texk/seetexk/seek.c +++ b/Build/source/texk/seetexk/seek.c @@ -5,10 +5,6 @@ * so long as this copyright notice remains intact. */ -#ifndef lint -static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/seek.c,v 3.1 89/08/22 21:59:04 chris Exp $"; -#endif - /* * SeekFile copies an input stdio file, if necessary, so that * it produces a stdio file on which fseek() works properly. @@ -34,19 +30,7 @@ static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/seek.c,v #include <stdio.h> #include "types.h" /* for BSD_FILE_SYSTEM */ #include "seek.h" - -#ifdef HAVE_PROTOTYPES -extern int MakeRWTempFile(char *); -#else -extern int MakeRWTempFile(); -#endif - -#ifdef EASY_BUT_NOT_GOOD - -FILE *CopyFile(f) FILE *f; { return (f); } -FILE *SeekFile(f) FILE *f; { return (f); } - -#else +#include "tempfile.h" #include <errno.h> #ifdef BSD_FILE_SYSTEM @@ -68,13 +52,14 @@ extern int errno; * This code is somewhat Unix-specific. */ FILE * -CopyFile(f) - FILE *f; +CopyFile(FILE *f) { register int tf, n, ifd, w; register char *p, *buf; register int blksize; +#ifdef BSD_FILE_SYSTEM struct stat st; +#endif int e; #ifdef MAXBSIZE #define BSIZE MAXBSIZE @@ -168,12 +153,9 @@ CopyFile(f) /* * Copy an input file, but only if necessary. */ -FILE *SeekFile(f) - FILE *f; +FILE *SeekFile(FILE *f) { int fd = fileno(f); return (lseek(fd, 0L, 1) >= 0 && !isatty(fd) ? f : CopyFile(f)); } - -#endif /* EASY_BUT_NOT_GOOD */ diff --git a/Build/source/texk/seetexk/seek.h b/Build/source/texk/seetexk/seek.h index a8c898db851..84f88c819ee 100644 --- a/Build/source/texk/seetexk/seek.h +++ b/Build/source/texk/seetexk/seek.h @@ -6,13 +6,11 @@ */ /* - * Declarations for seek.c: SeekFile(FILE *fp) returns a - * version of `fp' on which `fseek' functions properly; - * CopyFile(FILE *fp) returns a temporary copy of fp. + * Declarations for seek.c: SeekFile(FILE *f) returns a + * version of `f' on which `fseek' functions properly; + * CopyFile(FILE *f) returns a temporary copy of f. */ #ifdef WIN32 #undef CopyFile -FILE *SeekFile(FILE *fp), *CopyFile(FILE *fp); -#else -FILE *SeekFile(/* FILE *fp */), *CopyFile(/* FILE *fp */); #endif +FILE *SeekFile(FILE *f), *CopyFile(FILE *f); diff --git a/Build/source/texk/seetexk/tempfile.c b/Build/source/texk/seetexk/tempfile.c index 8d55c8bab52..954a6e56d58 100644 --- a/Build/source/texk/seetexk/tempfile.c +++ b/Build/source/texk/seetexk/tempfile.c @@ -5,10 +5,6 @@ * so long as this copyright notice remains intact. */ -#ifndef lint -static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/tempfile.c,v 3.1 89/08/22 21:45:20 chris Exp $"; -#endif - #ifdef HAVE_CONFIG_H #include <config.h> #endif @@ -16,6 +12,10 @@ static char rcsid[] = "$Header: /usr/src/local/tex/local/mctex/lib/RCS/tempfile. #include <stdio.h> #include <sys/types.h> +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + #ifdef _AMIGA #define getpid() 42 #endif /* _AMIGA */ @@ -29,6 +29,8 @@ char *getenv(); #endif +#include "tempfile.h" + #ifdef KPATHSEA #include <kpathsea/c-fopen.h> #else @@ -73,8 +75,7 @@ RemoveTempFile(void) * then exit with the same status, or send itself the same signal. */ int -MakeRWTempFile(name) - register char *name; +MakeRWTempFile(char *name) { register int tf, n; int mypid, tries; diff --git a/Build/source/texk/seetexk/tempfile.h b/Build/source/texk/seetexk/tempfile.h new file mode 100644 index 00000000000..da7dc7d827a --- /dev/null +++ b/Build/source/texk/seetexk/tempfile.h @@ -0,0 +1,12 @@ +/* + * Copyright (c) 1989 University of Maryland + * Department of Computer Science. All rights reserved. + * Permission to copy for any purpose is hereby granted + * so long as this copyright notice remains intact. + */ + +/* + * Temp Files. + */ + +int MakeRWTempFile(char *name); |