ed@mtxinu.UUCP (Ed Gould) (01/11/85)
Here are various fixes we've made to the tbl that comes with DItroff; it's probably the same one that comes with Documenter's Workbench. Unfortunately, I didn't generate the fixes myself, so I'm not sure just what is fixed by these changes. Anyway, I'll describe what I do know about them. Many of the changes (aside from adding our own SCCS keywords) are changing explicit 512 constants to BUFSIZ, so that things are more efficient on 4.2bsd systems (and perhaps others, too). This should never cause any loss of performance. The change in t4.c (adding a --) fixes a bug that mangles text in some cases. The rest, I'm not sure about. ---------- diff -c outputs ------------ *** t1.c Fri Jan 11 11:11:36 1985 --- t1.c_old Fri Jan 11 11:12:37 1985 *************** *** 1,9 /* t1.c: main control and input switching */ - - #ifndef lint - static char sccsid[] = "@(#)t1.c 2.1 84/10/08 mt Xinu"; - #endif - # # include "t..c" #include <signal.h> --- 1,4 ----- /* t1.c: main control and input switching */ # # include "t..c" #include <signal.h> *************** *** 42,48 tbl(argc,argv) char *argv[]; { ! char line[BUFSIZ]; /* required by GCOS because "stdout" is set by troff preprocessor */ tabin=stdin; tabout=stdout; setinp(argc,argv); --- 37,43 ----- tbl(argc,argv) char *argv[]; { ! char line[512]; /* required by GCOS because "stdout" is set by troff preprocessor */ tabin=stdin; tabout=stdout; setinp(argc,argv); *************** *** 109,115 # ifdef unix badsig() { ! signal(SIGPIPE, SIG_IGN); exit(0); } # endif --- 104,110 ----- # ifdef unix badsig() { ! signal(SIGPIPE, 1); exit(0); } # endif *** t4.c Fri Jan 11 11:11:45 1985 --- t4.c_old Fri Jan 11 11:12:39 1985 *************** *** 1,9 /* t4.c: read table specification */ - - #ifndef lint - static char sccsid[] = "@(#)t4.c 2.1 84/10/08 mt Xinu"; - #endif - # include "t..c" int oncol; getspec() --- 1,4 ----- /* t4.c: read table specification */ # include "t..c" int oncol; getspec() *************** *** 320,326 cfree(csize); cfree(vsize); cfree(cll); ! cfree(--sep); cfree(used); cfree(lused); cfree(rused); --- 315,321 ----- cfree(csize); cfree(vsize); cfree(cll); ! cfree(sep); cfree(used); cfree(lused); cfree(rused); *** tb.c Fri Jan 11 11:11:48 1985 --- tb.c_old Fri Jan 11 11:12:41 1985 *************** *** 1,9 /* tb.c: check which entries exist, also storage allocation */ - - #ifndef lint - static char sccsid[] = "@(#)tb.c 2.1 84/10/08 mt Xinu"; - #endif - # include "t..c" checkuse() { --- 1,4 ----- /* tb.c: check which entries exist, also storage allocation */ # include "t..c" checkuse() { *************** *** 69,75 tpvecs[tpcount] = calloc(MAXCHS,1); } thisvec = tpvecs[tpcount]; ! if ((thisvec == (char *) 0) || (thisvec == (char *) -1)) error("no space for vectors"); } tp=(int *)thisvec; --- 64,70 ----- tpvecs[tpcount] = calloc(MAXCHS,1); } thisvec = tpvecs[tpcount]; ! if (thisvec == (char *)0) error("no space for vectors"); } tp=(int *)thisvec; *** te.c Fri Jan 11 11:11:51 1985 --- te.c_old Fri Jan 11 11:12:44 1985 *************** *** 1,9 /* te.c: error message control, input line count */ - - #ifndef lint - static char sccsid[] = "@(#)te.c 2.1 84/10/08 mt Xinu"; - #endif - # include "t..c" error(s) char *s; --- 1,4 ----- /* te.c: error message control, input line count */ # include "t..c" error(s) char *s; *************** *** 24,30 char *p; int nbl = 0; iline++; ! p=fgets(s,BUFSIZ,tabin); while (p==0) { if (swapin()==0) --- 19,25 ----- char *p; int nbl = 0; iline++; ! p=fgets(s,512,tabin); while (p==0) { if (swapin()==0) *************** *** 29,35 { if (swapin()==0) return(0); ! p = fgets(s,BUFSIZ,tabin); } while (*s) s++; --- 24,30 ----- { if (swapin()==0) return(0); ! p = fgets(s,512,tabin); } while (*s) s++; ---------- end diffs ------------------ -- Ed Gould mt Xinu, 739 Allston Way, Berkeley, CA 94710 USA {ucbvax,decvax}!mtxinu!ed +1 415 644 0146