aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorwkj <devnull@localhost>2004-05-16 07:55:57 +0000
committerwkj <devnull@localhost>2004-05-16 07:55:57 +0000
commitc5561c23cf394806cbf6d70a96f2dc0253f93745 (patch)
treef4a5b99f88454917a5bada0f2a97d1505051968c /src
parentb855148c9b6d28fedfd083d037bcf246f1913d92 (diff)
downloadplan9port-c5561c23cf394806cbf6d70a96f2dc0253f93745.tar.gz
plan9port-c5561c23cf394806cbf6d70a96f2dc0253f93745.tar.bz2
plan9port-c5561c23cf394806cbf6d70a96f2dc0253f93745.zip
Checkpoint -- still merging with Taj's version of the world.
Diffstat (limited to 'src')
-rw-r--r--src/cmd/tbl/t.h10
-rw-r--r--src/cmd/tbl/t0.c4
-rw-r--r--src/cmd/tbl/t1.c34
-rw-r--r--src/cmd/tbl/t3.c47
-rw-r--r--src/cmd/tbl/t4.c26
-rw-r--r--src/cmd/tbl/t5.c2
-rw-r--r--src/cmd/tbl/t6.c110
-rw-r--r--src/cmd/tbl/t7.c74
-rw-r--r--src/cmd/tbl/t8.c141
-rw-r--r--src/cmd/tbl/t9.c4
-rw-r--r--src/cmd/tbl/tc.c6
-rw-r--r--src/cmd/tbl/te.c17
-rw-r--r--src/cmd/tbl/tf.c40
-rw-r--r--src/cmd/tbl/tg.c54
-rw-r--r--src/cmd/tbl/tm.c8
-rw-r--r--src/cmd/tbl/ts.c2
-rw-r--r--src/cmd/tbl/tt.c6
-rw-r--r--src/cmd/tbl/tu.c34
-rw-r--r--src/cmd/tbl/tv.c32
-rw-r--r--src/cmd/troff/dwbinit.c3
-rw-r--r--src/cmd/troff/ext.h2
-rw-r--r--src/cmd/troff/fns.h2
-rw-r--r--src/cmd/troff/mbwc.c2
-rw-r--r--src/cmd/troff/n1.c27
-rw-r--r--src/cmd/troff/n10.c9
-rw-r--r--src/cmd/troff/n2.c1
-rw-r--r--src/cmd/troff/n3.c4
-rw-r--r--src/cmd/troff/n4.c2
-rw-r--r--src/cmd/troff/n5.c13
-rw-r--r--src/cmd/troff/n6.c3
-rw-r--r--src/cmd/troff/n7.c12
-rw-r--r--src/cmd/troff/n8.c24
-rw-r--r--src/cmd/troff/n9.c3
-rw-r--r--src/cmd/troff/t10.c7
-rw-r--r--src/cmd/troff/t11.c11
-rw-r--r--src/cmd/troff/t6.c12
-rw-r--r--src/cmd/troff/tdef.h5
37 files changed, 415 insertions, 378 deletions
diff --git a/src/cmd/tbl/t.h b/src/cmd/tbl/t.h
index efcab373..ba9cd791 100644
--- a/src/cmd/tbl/t.h
+++ b/src/cmd/tbl/t.h
@@ -1,9 +1,9 @@
/* t..c : external declarations */
-#include <u.h>
-#include <libc.h>
-#include <bio.h>
-# include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
# define MAXLIN 250
# define MAXHEAD 44
@@ -62,7 +62,7 @@ extern char texstr[];
extern int linstart;
-extern Biobuf *tabin, tabout;
+extern FILE *tabin, *tabout;
# define CRIGHT 2
# define CLEFT 0
# define CMID 1
diff --git a/src/cmd/tbl/t0.c b/src/cmd/tbl/t0.c
index 0c0895bd..51218708 100644
--- a/src/cmd/tbl/t0.c
+++ b/src/cmd/tbl/t0.c
@@ -45,5 +45,5 @@ int texct = 0;
char texstr[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWYXZ0123456789";
int linstart;
char *exstore, *exlim, *exspace;
-Biobuf *tabin /*= stdin */;
-Biobuf tabout /* = stdout */;
+FILE *tabin;
+FILE *tabout;
diff --git a/src/cmd/tbl/t1.c b/src/cmd/tbl/t1.c
index 1e6cbf11..aff5f3d8 100644
--- a/src/cmd/tbl/t1.c
+++ b/src/cmd/tbl/t1.c
@@ -8,10 +8,17 @@
# define ever (;;)
-void
+int
main(int argc, char *argv[])
{
- exits(tbl(argc, argv)? "error" : 0);
+ tabin = stdin;
+ tabout = stdout;
+
+ if(tbl(argc, argv)){
+ fprintf(stderr, "error");
+ return 1;
+ }
+ return 0;
}
@@ -21,14 +28,14 @@ tbl(int argc, char *argv[])
char line[5120];
/*int x;*/
/*x=malloc((char *)0); uncomment when allocation breaks*/
- Binit(&tabout, 1, OWRITE);
+ /*Binit(&tabout, 1, OWRITE); /* tabout=stdout */
setinp(argc, argv);
while (gets1(line, sizeof(line))) {
- Bprint(&tabout, "%s\n", line);
+ fprintf(tabout, "%s\n", line);
if (prefix(".TS", line))
tableput();
}
- Bterm(tabin);
+ fclose(tabin);
return(0);
}
@@ -45,10 +52,8 @@ setinp(int argc, char **argv)
sargv++;
if (sargc > 0)
swapin();
- else {
- tabin = (Biobuf*)getcore(sizeof(Biobuf), 1);
- Binit(tabin, 0, OREAD);
- }
+ else
+ tabin = stdin;
}
@@ -76,17 +81,16 @@ swapin(void)
return(0);
/* file closing is done by GCOS troff preprocessor */
if(tabin)
- Bterm(tabin);
+ fclose(tabin);
ifile = *sargv;
name = ifile;
if (match(ifile, "-")) {
- tabin = (Biobuf*)getcore(sizeof(Biobuf), 1);
- Binit(tabin, 0, OREAD);
+ tabin = stdin;
} else
- tabin = Bopen(ifile, OREAD);
+ tabin = fopen(ifile, "r");
iline = 1;
- Bprint(&tabout, ".ds f. %s\n", ifile);
- Bprint(&tabout, ".lf %d %s\n", iline, name);
+ fprintf(tabout, ".ds f. %s\n", ifile);
+ fprintf(tabout, ".lf %d %s\n", iline, name);
if (tabin == 0)
error("Can't open file");
sargc--;
diff --git a/src/cmd/tbl/t3.c b/src/cmd/tbl/t3.c
index a4dc9f9f..5429e528 100644
--- a/src/cmd/tbl/t3.c
+++ b/src/cmd/tbl/t3.c
@@ -4,27 +4,28 @@ struct optstr {
char *optnam;
int *optadd;
} options [] = {
- "expand", &expflg,
- "EXPAND", &expflg,
- "center", &ctrflg,
- "CENTER", &ctrflg,
- "box", &boxflg,
- "BOX", &boxflg,
- "allbox", &allflg,
- "ALLBOX", &allflg,
- "doublebox", &dboxflg,
- "DOUBLEBOX", &dboxflg,
- "frame", &boxflg,
- "FRAME", &boxflg,
- "doubleframe", &dboxflg,
- "DOUBLEFRAME", &dboxflg,
- "tab", &tab,
- "TAB", &tab,
- "linesize", &linsize,
- "LINESIZE", &linsize,
- "delim", &delim1,
- "DELIM", &delim1,
- 0, 0};
+ { "expand", &expflg },
+ { "EXPAND", &expflg },
+ { "center", &ctrflg },
+ { "CENTER", &ctrflg },
+ { "box", &boxflg },
+ { "BOX", &boxflg },
+ { "allbox", &allflg },
+ { "ALLBOX", &allflg },
+ { "doublebox", &dboxflg },
+ { "DOUBLEBOX", &dboxflg },
+ { "frame", &boxflg },
+ { "FRAME", &boxflg },
+ { "doubleframe", &dboxflg },
+ { "DOUBLEFRAME", &dboxflg },
+ { "tab", &tab },
+ { "TAB", &tab },
+ { "linesize", &linsize },
+ { "LINESIZE", &linsize },
+ { "delim", &delim1 },
+ { "DELIM", &delim1 },
+ { 0, 0}
+};
void
@@ -38,7 +39,7 @@ getcomm(void)
*(lp->optadd) = 0;
texname = texstr[texct=0];
tab = '\t';
- Bprint(&tabout, ".nr %d \\n(.s\n", LSIZE);
+ fprintf(tabout, ".nr %d \\n(.s\n", LSIZE);
gets1(line, sizeof(line));
/* see if this is a command line */
if (strchr(line, ';') == 0) {
@@ -70,7 +71,7 @@ getcomm(void)
*(lp->optadd) = nb[0];
}
if (lp->optadd == &linsize)
- Bprint(&tabout, ".nr %d %s\n", LSIZE, nb);
+ fprintf(tabout, ".nr %d %s\n", LSIZE, nb);
if (lp->optadd == &delim1) {
delim1 = nb[0];
delim2 = nb[1];
diff --git a/src/cmd/tbl/t4.c b/src/cmd/tbl/t4.c
index 558d3ba3..0b60a942 100644
--- a/src/cmd/tbl/t4.c
+++ b/src/cmd/tbl/t4.c
@@ -28,10 +28,10 @@ getspec(void)
oncol = 0;
left1flg = rightl = 0;
readspec();
- Bprint(&tabout, ".rm");
+ fprintf(tabout, ".rm");
for (i = 0; i < ncol; i++)
- Bprint(&tabout, " %2s", reg(i, CRIGHT));
- Bprint(&tabout, "\n");
+ fprintf(tabout, " %2s", reg(i, CRIGHT));
+ fprintf(tabout, "\n");
}
@@ -42,12 +42,12 @@ readspec(void)
char sn[10], *snp, *temp;
sawchar = icol = 0;
- while (c = get1char()) {
+ while ((c = get1char())) {
switch (c) {
default:
if (c != tab) {
char buf[64];
- sprint(buf, "bad table specification character %c", c);
+ sprintf(buf, "bad table specification character %c", c);
error(buf);
}
case ' ': /* note this is also case tab */
@@ -108,11 +108,11 @@ readspec(void)
if (c == 's' && icol <= 0)
error("first column can not be S-type");
if (c == 's' && style[icol-1][nclin] == 'a') {
- Bprint(&tabout, ".tm warning: can't span a-type cols, changed to l\n");
+ fprintf(tabout, ".tm warning: can't span a-type cols, changed to l\n");
style[icol-1][nclin] = 'l';
}
if (c == 's' && style[icol-1][nclin] == 'n') {
- Bprint(&tabout, ".tm warning: can't span n-type cols, changed to c\n");
+ fprintf(tabout, ".tm warning: can't span n-type cols, changed to c\n");
style[icol-1][nclin] = 'c';
}
icol++;
@@ -181,7 +181,7 @@ readspec(void)
if (icol <= 0)
continue;
temp = snp = csize[icol-1][nclin];
- while (c = get1char()) {
+ while ((c = get1char())) {
if (c == ' ' || c == tab || c == '\n')
break;
if (c == '-' || c == '+')
@@ -206,7 +206,7 @@ readspec(void)
if (icol <= 0)
continue;
temp = snp = vsize[icol-1][nclin];
- while (c = get1char()) {
+ while ((c = get1char())) {
if (c == ' ' || c == tab || c == '\n')
break;
if (c == '-' || c == '+')
@@ -231,12 +231,12 @@ readspec(void)
of different widths now ....
if (*snp)
{
- Bprint(&tabout, "Ignored second width specification");
+ fprintf(tabout, "Ignored second width specification");
continue;
}
/* end commented out code ... */
stopc = 0;
- while (c = get1char()) {
+ while ((c = get1char())) {
if (snp == cll[icol-1] && c == '(') {
stopc = ')';
continue;
@@ -312,7 +312,7 @@ findcol(void)
;
if (c != '\n')
un1getc(c);
- for (s = line; *s = c = get1char(); s++) {
+ for (s = line; (*s = c = get1char()); s++) {
if (c == ')')
inpar = 0;
if (inpar)
@@ -371,7 +371,7 @@ garray(int qcol)
}
-char *
+char*
getcore(int a, int b)
{
char *x;
diff --git a/src/cmd/tbl/t5.c b/src/cmd/tbl/t5.c
index 8b7a65d8..9ad6b3c3 100644
--- a/src/cmd/tbl/t5.c
+++ b/src/cmd/tbl/t5.c
@@ -31,7 +31,7 @@ gettbl(void)
} else
instead[nlin] = 0;
if (nodata(nlin)) {
- if (ch = oneh(nlin))
+ if ((ch = oneh(nlin)))
fullbot[nlin] = ch;
table[nlin] = (struct colstr *) alocv((ncol + 2) * sizeof(table[0][0]));
for (icol = 0; icol < ncol; icol++) {
diff --git a/src/cmd/tbl/t6.c b/src/cmd/tbl/t6.c
index a78368fc..e6506910 100644
--- a/src/cmd/tbl/t6.c
+++ b/src/cmd/tbl/t6.c
@@ -14,10 +14,10 @@ maktab(void) /* define the tab stops of the table */
for (icol = 0; icol < ncol; icol++) {
doubled[icol] = acase[icol] = 0;
- Bprint(&tabout, ".nr %2s 0\n", reg(icol, CRIGHT));
+ fprintf(tabout, ".nr %2s 0\n", reg(icol, CRIGHT));
for (text = 0; text < 2; text++) {
if (text)
- Bprint(&tabout, ".%2s\n.rm %2s\n", reg(icol, CRIGHT),
+ fprintf(tabout, ".%2s\n.rm %2s\n", reg(icol, CRIGHT),
reg(icol, CRIGHT));
for (ilin = 0; ilin < nlin; ilin++) {
if (instead[ilin] || fullbot[ilin])
@@ -37,31 +37,31 @@ maktab(void) /* define the tab stops of the table */
s = table[ilin][icol].col;
if ((int)s > 0 && (int)s < 128 && text) {
if (doubled[icol] == 0)
- Bprint(&tabout, ".nr %d 0\n.nr %d 0\n",
+ fprintf(tabout, ".nr %d 0\n.nr %d 0\n",
S1, S2);
doubled[icol] = 1;
- Bprint(&tabout, ".if \\n(%c->\\n(%d .nr %d \\n(%c-\n",
+ fprintf(tabout, ".if \\n(%c->\\n(%d .nr %d \\n(%c-\n",
(int)s, S2, S2, (int)s);
}
case 'n':
if (table[ilin][icol].rcol != 0) {
if (doubled[icol] == 0 && text == 0)
- Bprint(&tabout, ".nr %d 0\n.nr %d 0\n",
+ fprintf(tabout, ".nr %d 0\n.nr %d 0\n",
S1, S2);
doubled[icol] = 1;
if (real(s = table[ilin][icol].col) && !vspen(s)) {
if (tx((int)s) != text)
continue;
- Bprint(&tabout, ".nr %d ", TMP);
+ fprintf(tabout, ".nr %d ", TMP);
wide(s, FN(vforml, icol), SZ(vforml, icol));
- Bprint(&tabout, "\n");
- Bprint(&tabout, ".if \\n(%d<\\n(%d .nr %d \\n(%d\n",
+ fprintf(tabout, "\n");
+ fprintf(tabout, ".if \\n(%d<\\n(%d .nr %d \\n(%d\n",
S1, TMP, S1, TMP);
}
if (text == 0 && real(s = table[ilin][icol].rcol) && !vspen(s) && !barent(s)) {
- Bprint(&tabout, ".nr %d \\w%c%s%c\n",
+ fprintf(tabout, ".nr %d \\w%c%s%c\n",
TMP, F1, s, F1);
- Bprint(&tabout, ".if \\n(%d<\\n(%d .nr %d \\n(%d\n", S2, TMP, S2,
+ fprintf(tabout, ".if \\n(%d<\\n(%d .nr %d \\n(%d\n", S2, TMP, S2,
TMP);
}
continue;
@@ -72,53 +72,53 @@ maktab(void) /* define the tab stops of the table */
if (real(s = table[ilin][icol].col) && !vspen(s)) {
if (tx((int)s) != text)
continue;
- Bprint(&tabout, ".nr %d ", TMP);
+ fprintf(tabout, ".nr %d ", TMP);
wide(s, FN(vforml, icol), SZ(vforml, icol));
- Bprint(&tabout, "\n");
- Bprint(&tabout, ".if \\n(%2s<\\n(%d .nr %2s \\n(%d\n",
+ fprintf(tabout, "\n");
+ fprintf(tabout, ".if \\n(%2s<\\n(%d .nr %2s \\n(%d\n",
reg(icol, CRIGHT), TMP, reg(icol, CRIGHT), TMP);
}
}
}
}
if (acase[icol]) {
- Bprint(&tabout, ".if \\n(%d>=\\n(%2s .nr %2s \\n(%du+2n\n",
+ fprintf(tabout, ".if \\n(%d>=\\n(%2s .nr %2s \\n(%du+2n\n",
S2, reg(icol, CRIGHT), reg(icol, CRIGHT), S2);
}
if (doubled[icol]) {
- Bprint(&tabout, ".nr %2s \\n(%d\n", reg(icol, CMID), S1);
- Bprint(&tabout, ".nr %d \\n(%2s+\\n(%d\n", TMP, reg(icol, CMID), S2);
- Bprint(&tabout, ".if \\n(%d>\\n(%2s .nr %2s \\n(%d\n", TMP,
+ fprintf(tabout, ".nr %2s \\n(%d\n", reg(icol, CMID), S1);
+ fprintf(tabout, ".nr %d \\n(%2s+\\n(%d\n", TMP, reg(icol, CMID), S2);
+ fprintf(tabout, ".if \\n(%d>\\n(%2s .nr %2s \\n(%d\n", TMP,
reg(icol, CRIGHT), reg(icol, CRIGHT), TMP);
- Bprint(&tabout, ".if \\n(%d<\\n(%2s .nr %2s +(\\n(%2s-\\n(%d)/2\n",
+ fprintf(tabout, ".if \\n(%d<\\n(%2s .nr %2s +(\\n(%2s-\\n(%d)/2\n",
TMP, reg(icol, CRIGHT), reg(icol, CMID), reg(icol, CRIGHT), TMP);
}
if (cll[icol][0]) {
- Bprint(&tabout, ".nr %d %sn\n", TMP, cll[icol]);
- Bprint(&tabout, ".if \\n(%2s<\\n(%d .nr %2s \\n(%d\n",
+ fprintf(tabout, ".nr %d %sn\n", TMP, cll[icol]);
+ fprintf(tabout, ".if \\n(%2s<\\n(%d .nr %2s \\n(%d\n",
reg(icol, CRIGHT), TMP, reg(icol, CRIGHT), TMP);
}
for (ilin = 0; ilin < nlin; ilin++)
- if (k = lspan(ilin, icol)) {
+ if ((k = lspan(ilin, icol))) {
s = table[ilin][icol-k].col;
if (!real(s) || barent(s) || vspen(s) )
continue;
- Bprint(&tabout, ".nr %d ", TMP);
+ fprintf(tabout, ".nr %d ", TMP);
wide(table[ilin][icol-k].col, FN(ilin, icol - k), SZ(ilin, icol - k));
for (ik = k; ik >= 0; ik--) {
- Bprint(&tabout, "-\\n(%2s", reg(icol - ik, CRIGHT));
+ fprintf(tabout, "-\\n(%2s", reg(icol - ik, CRIGHT));
if (!expflg && ik > 0)
- Bprint(&tabout, "-%dn", sep[icol-ik]);
+ fprintf(tabout, "-%dn", sep[icol-ik]);
}
- Bprint(&tabout, "\n");
- Bprint(&tabout, ".if \\n(%d>0 .nr %d \\n(%d/%d\n", TMP,
+ fprintf(tabout, "\n");
+ fprintf(tabout, ".if \\n(%d>0 .nr %d \\n(%d/%d\n", TMP,
TMP, TMP, k);
- Bprint(&tabout, ".if \\n(%d<0 .nr %d 0\n", TMP, TMP);
+ fprintf(tabout, ".if \\n(%d<0 .nr %d 0\n", TMP, TMP);
for (ik = 1; ik <= k; ik++) {
if (doubled[icol-k+ik])
- Bprint(&tabout, ".nr %2s +\\n(%d/2\n",
+ fprintf(tabout, ".nr %2s +\\n(%d/2\n",
reg(icol - k + ik, CMID), TMP);
- Bprint(&tabout, ".nr %2s +\\n(%d\n",
+ fprintf(tabout, ".nr %2s +\\n(%d\n",
reg(icol - k + ik, CRIGHT), TMP);
}
}
@@ -127,11 +127,11 @@ maktab(void) /* define the tab stops of the table */
untext();
/* if even requested, make all columns widest width */
if (evenflg) {
- Bprint(&tabout, ".nr %d 0\n", TMP);
+ fprintf(tabout, ".nr %d 0\n", TMP);
for (icol = 0; icol < ncol; icol++) {
if (evenup[icol] == 0)
continue;
- Bprint(&tabout, ".if \\n(%2s>\\n(%d .nr %d \\n(%2s\n",
+ fprintf(tabout, ".if \\n(%2s>\\n(%d .nr %d \\n(%2s\n",
reg(icol, CRIGHT), TMP, TMP, reg(icol, CRIGHT));
}
for (icol = 0; icol < ncol; icol++) {
@@ -139,56 +139,56 @@ maktab(void) /* define the tab stops of the table */
/* if column not evened just retain old interval */
continue;
if (doubled[icol])
- Bprint(&tabout, ".nr %2s (100*\\n(%2s/\\n(%2s)*\\n(%d/100\n",
+ fprintf(tabout, ".nr %2s (100*\\n(%2s/\\n(%2s)*\\n(%d/100\n",
reg(icol, CMID), reg(icol, CMID), reg(icol, CRIGHT), TMP);
/* that nonsense with the 100's and parens tries
to avoid overflow while proportionally shifting
the middle of the number */
- Bprint(&tabout, ".nr %2s \\n(%d\n", reg(icol, CRIGHT), TMP);
+ fprintf(tabout, ".nr %2s \\n(%d\n", reg(icol, CRIGHT), TMP);
}
}
/* now adjust for total table width */
for (tsep = icol = 0; icol < ncol; icol++)
tsep += sep[icol];
if (expflg) {
- Bprint(&tabout, ".nr %d 0", TMP);
+ fprintf(tabout, ".nr %d 0", TMP);
for (icol = 0; icol < ncol; icol++)
- Bprint(&tabout, "+\\n(%2s", reg(icol, CRIGHT));
- Bprint(&tabout, "\n");
- Bprint(&tabout, ".nr %d \\n(.l-\\n(%d\n", TMP, TMP);
+ fprintf(tabout, "+\\n(%2s", reg(icol, CRIGHT));
+ fprintf(tabout, "\n");
+ fprintf(tabout, ".nr %d \\n(.l-\\n(%d\n", TMP, TMP);
if (boxflg || dboxflg || allflg)
- /* tsep += 1; */ {}
+ /* tsep += 1; */ ;
else
tsep -= sep[ncol-1];
- Bprint(&tabout, ".nr %d \\n(%d/%d\n", TMP, TMP, tsep);
- Bprint(&tabout, ".if \\n(%d<0 .nr %d 0\n", TMP, TMP);
+ fprintf(tabout, ".nr %d \\n(%d/%d\n", TMP, TMP, tsep);
+ fprintf(tabout, ".if \\n(%d<0 .nr %d 0\n", TMP, TMP);
} else
- Bprint(&tabout, ".nr %d 1n\n", TMP);
- Bprint(&tabout, ".nr %2s 0\n", reg(-1, CRIGHT));
+ fprintf(tabout, ".nr %d 1n\n", TMP);
+ fprintf(tabout, ".nr %2s 0\n", reg(-1, CRIGHT));
tsep = (boxflg || allflg || dboxflg || left1flg) ? 2 : 0;
if (sep[-1] >= 0)
tsep = sep[-1];
for (icol = 0; icol < ncol; icol++) {
- Bprint(&tabout, ".nr %2s \\n(%2s+((%d*\\n(%d)/2)\n", reg(icol, CLEFT),
+ fprintf(tabout, ".nr %2s \\n(%2s+((%d*\\n(%d)/2)\n", reg(icol, CLEFT),
reg(icol - 1, CRIGHT), tsep, TMP);
- Bprint(&tabout, ".nr %2s +\\n(%2s\n", reg(icol, CRIGHT), reg(icol, CLEFT));
+ fprintf(tabout, ".nr %2s +\\n(%2s\n", reg(icol, CRIGHT), reg(icol, CLEFT));
if (doubled[icol]) {
/* the next line is last-ditch effort to avoid zero field width */
- /*Bprint(&tabout, ".if \\n(%2s=0 .nr %2s 1\n",reg(icol,CMID), reg(icol,CMID));*/
- Bprint(&tabout, ".nr %2s +\\n(%2s\n", reg(icol, CMID),
+ /*fprintf(tabout, ".if \\n(%2s=0 .nr %2s 1\n",reg(icol,CMID), reg(icol,CMID));*/
+ fprintf(tabout, ".nr %2s +\\n(%2s\n", reg(icol, CMID),
reg(icol, CLEFT));
- /* Bprint(&tabout, ".if n .if \\n(%s%%24>0 .nr %s +12u\n",reg(icol,CMID), reg(icol,CMID)); */
+ /* fprintf(tabout, ".if n .if \\n(%s%%24>0 .nr %s +12u\n",reg(icol,CMID), reg(icol,CMID)); */
}
tsep = sep[icol] * 2;
}
if (rightl)
- Bprint(&tabout, ".nr %s (\\n(%s+\\n(%s)/2\n", reg(ncol - 1, CRIGHT),
+ fprintf(tabout, ".nr %s (\\n(%s+\\n(%s)/2\n", reg(ncol - 1, CRIGHT),
reg(ncol - 1, CLEFT), reg(ncol - 2, CRIGHT));
- Bprint(&tabout, ".nr TW \\n(%2s\n", reg(ncol - 1, CRIGHT));
+ fprintf(tabout, ".nr TW \\n(%2s\n", reg(ncol - 1, CRIGHT));
tsep = sep[ncol-1];
if (boxflg || allflg || dboxflg)
- Bprint(&tabout, ".nr TW +((%d*\\n(%d)/2)\n", tsep, TMP);
- Bprint(&tabout,
+ fprintf(tabout, ".nr TW +((%d*\\n(%d)/2)\n", tsep, TMP);
+ fprintf(tabout,
".if t .if (\\n(TW+\\n(.o)>7.65i .tm Table at line %d file %s is too wide - \\n(TW units\n", iline - 1, ifile);
return;
}
@@ -198,19 +198,19 @@ void
wide(char *s, char *fn, char *size)
{
if (point(s)) {
- Bprint(&tabout, "\\w%c", F1);
+ fprintf(tabout, "\\w%c", F1);
if (*fn > 0)
putfont(fn);
if (*size)
putsize(size);
- Bprint(&tabout, "%s", s);
+ fprintf(tabout, "%s", s);
if (*fn > 0)
putfont("P");
if (*size)
putsize("0");
- Bprint(&tabout, "%c", F1);
+ fprintf(tabout, "%c", F1);
} else
- Bprint(&tabout, "\\n(%c-", (int)s);
+ fprintf(tabout, "\\n(%c-", (int)s);
}
diff --git a/src/cmd/tbl/t7.c b/src/cmd/tbl/t7.c
index 2fa9de53..0d11f0c5 100644
--- a/src/cmd/tbl/t7.c
+++ b/src/cmd/tbl/t7.c
@@ -10,21 +10,21 @@ runout(void)
if (boxflg || allflg || dboxflg)
need();
if (ctrflg) {
- Bprint(&tabout, ".nr #I \\n(.i\n");
- Bprint(&tabout, ".in +(\\n(.lu-\\n(TWu-\\n(.iu)/2u\n");
+ fprintf(tabout, ".nr #I \\n(.i\n");
+ fprintf(tabout, ".in +(\\n(.lu-\\n(TWu-\\n(.iu)/2u\n");
}
- Bprint(&tabout, ".fc %c %c\n", F1, F2);
- Bprint(&tabout, ".nr #T 0-1\n");
+ fprintf(tabout, ".fc %c %c\n", F1, F2);
+ fprintf(tabout, ".nr #T 0-1\n");
deftail();
for (i = 0; i < nlin; i++)
putline(i, i);
if (leftover)
yetmore();
- Bprint(&tabout, ".fc\n");
- Bprint(&tabout, ".nr T. 1\n");
- Bprint(&tabout, ".T# 1\n");
+ fprintf(tabout, ".fc\n");
+ fprintf(tabout, ".nr T. 1\n");
+ fprintf(tabout, ".T# 1\n");
if (ctrflg)
- Bprint(&tabout, ".in \\n(#Iu\n");
+ fprintf(tabout, ".in \\n(#Iu\n");
}
@@ -33,7 +33,7 @@ runtabs(int lform, int ldata)
{
int c, ct, vforml, lf;
- Bprint(&tabout, ".ta ");
+ fprintf(tabout, ".ta ");
for (c = 0; c < ncol; c++) {
vforml = lform;
for (lf = prev(lform); lf >= 0 && vspen(table[lf][c].col); lf = prev(lf))
@@ -45,20 +45,20 @@ runtabs(int lform, int ldata)
case 'a':
if (table[ldata][c].rcol)
if (lused[c]) /*Zero field width*/
- Bprint(&tabout, "\\n(%2su ", reg(c, CMID));
+ fprintf(tabout, "\\n(%2su ", reg(c, CMID));
case 'c':
case 'l':
case 'r':
if (realsplit ? rused[c] : (used[c] + lused[c]))
- Bprint(&tabout, "\\n(%2su ", reg(c, CRIGHT));
+ fprintf(tabout, "\\n(%2su ", reg(c, CRIGHT));
continue;
case 's':
if (lspan(lform, c))
- Bprint(&tabout, "\\n(%2su ", reg(c, CRIGHT));
+ fprintf(tabout, "\\n(%2su ", reg(c, CRIGHT));
continue;
}
}
- Bprint(&tabout, "\n");
+ fprintf(tabout, "\n");
}
@@ -92,7 +92,7 @@ need(void)
else
texlin++;
}
- Bprint(&tabout, ".ne %dv+%dp\n", texlin, 2 * horlin);
+ fprintf(tabout, ".ne %dv+%dp\n", texlin, 2 * horlin);
}
@@ -103,48 +103,48 @@ deftail(void)
for (i = 0; i < MAXHEAD; i++)
if (linestop[i])
- Bprint(&tabout, ".nr #%c 0-1\n", linestop[i] + 'a' - 1);
- Bprint(&tabout, ".nr #a 0-1\n");
- Bprint(&tabout, ".eo\n");
- Bprint(&tabout, ".de T#\n");
- Bprint(&tabout, ".nr 35 1m\n");
- Bprint(&tabout, ".ds #d .d\n");
- Bprint(&tabout, ".if \\(ts\\n(.z\\(ts\\(ts .ds #d nl\n");
- Bprint(&tabout, ".mk ##\n");
- Bprint(&tabout, ".nr ## -1v\n");
- Bprint(&tabout, ".ls 1\n");
+ fprintf(tabout, ".nr #%c 0-1\n", linestop[i] + 'a' - 1);
+ fprintf(tabout, ".nr #a 0-1\n");
+ fprintf(tabout, ".eo\n");
+ fprintf(tabout, ".de T#\n");
+ fprintf(tabout, ".nr 35 1m\n");
+ fprintf(tabout, ".ds #d .d\n");
+ fprintf(tabout, ".if \\(ts\\n(.z\\(ts\\(ts .ds #d nl\n");
+ fprintf(tabout, ".mk ##\n");
+ fprintf(tabout, ".nr ## -1v\n");
+ fprintf(tabout, ".ls 1\n");
for (i = 0; i < MAXHEAD; i++)
if (linestop[i])
- Bprint(&tabout, ".if \\n(#T>=0 .nr #%c \\n(#T\n",
+ fprintf(tabout, ".if \\n(#T>=0 .nr #%c \\n(#T\n",
linestop[i] + 'a' - 1);
if (boxflg || allflg || dboxflg) /* bottom of table line */
if (fullbot[nlin-1] == 0) {
if (!pr1403)
- Bprint(&tabout, ".if \\n(T. .vs \\n(.vu-\\n(.sp\n");
- Bprint(&tabout, ".if \\n(T. ");
+ fprintf(tabout, ".if \\n(T. .vs \\n(.vu-\\n(.sp\n");
+ fprintf(tabout, ".if \\n(T. ");
drawline(nlin, 0, ncol, dboxflg ? '=' : '-', 1, 0);
- Bprint(&tabout, "\n.if \\n(T. .vs\n");
+ fprintf(tabout, "\n.if \\n(T. .vs\n");
/* T. is really an argument to a macro but because of
eqn we don't dare pass it as an argument and reference by $1 */
}
for (c = 0; c < ncol; c++) {
if ((lf = left(nlin - 1, c, &lwid)) >= 0) {
- Bprint(&tabout, ".if \\n(#%c>=0 .sp -1\n", linestop[lf] + 'a' - 1);
- Bprint(&tabout, ".if \\n(#%c>=0 ", linestop[lf] + 'a' - 1);
+ fprintf(tabout, ".if \\n(#%c>=0 .sp -1\n", linestop[lf] + 'a' - 1);
+ fprintf(tabout, ".if \\n(#%c>=0 ", linestop[lf] + 'a' - 1);
tohcol(c);
drawvert(lf, nlin - 1, c, lwid);
- Bprint(&tabout, "\\h'|\\n(TWu'\n");
+ fprintf(tabout, "\\h'|\\n(TWu'\n");
}
}
if (boxflg || allflg || dboxflg) /* right hand line */ {
- Bprint(&tabout, ".if \\n(#a>=0 .sp -1\n");
- Bprint(&tabout, ".if \\n(#a>=0 \\h'|\\n(TWu'");
+ fprintf(tabout, ".if \\n(#a>=0 .sp -1\n");
+ fprintf(tabout, ".if \\n(#a>=0 \\h'|\\n(TWu'");
drawvert (0, nlin - 1, ncol, dboxflg ? 2 : 1);
- Bprint(&tabout, "\n");
+ fprintf(tabout, "\n");
}
- Bprint(&tabout, ".ls\n");
- Bprint(&tabout, "..\n");
- Bprint(&tabout, ".ec\n");
+ fprintf(tabout, ".ls\n");
+ fprintf(tabout, "..\n");
+ fprintf(tabout, ".ec\n");
}
diff --git a/src/cmd/tbl/t8.c b/src/cmd/tbl/t8.c
index 92277e2a..39bc9c14 100644
--- a/src/cmd/tbl/t8.c
+++ b/src/cmd/tbl/t8.c
@@ -28,19 +28,19 @@ putline(int i, int nl)
if (!vspen(s = table[ip][c].col))
break;
if ((int)s > 0 && (int)s < 128)
- Bprint(&tabout, ".ne \\n(%c|u+\\n(.Vu\n", (int)s);
+ fprintf(tabout, ".ne \\n(%c|u+\\n(.Vu\n", (int)s);
continue;
}
if (point(s))
continue;
- Bprint(&tabout, ".ne \\n(%c|u+\\n(.Vu\n", (int)s);
+ fprintf(tabout, ".ne \\n(%c|u+\\n(.Vu\n", (int)s);
watchout = 1;
}
if (linestop[nl])
- Bprint(&tabout, ".mk #%c\n", linestop[nl] + 'a' - 1);
+ fprintf(tabout, ".mk #%c\n", linestop[nl] + 'a' - 1);
lf = prev(nl);
if (instead[nl]) {
- Bprint(&tabout, "%s\n", instead[nl]);
+ fprintf(tabout, "%s\n", instead[nl]);
return;
}
if (fullbot[nl]) {
@@ -60,8 +60,8 @@ putline(int i, int nl)
vspf = 1;
}
if (vspf) {
- Bprint(&tabout, ".nr #^ \\n(\\*(#du\n");
- Bprint(&tabout, ".nr #- \\n(#^\n"); /* current line position relative to bottom */
+ fprintf(tabout, ".nr #^ \\n(\\*(#du\n");
+ fprintf(tabout, ".nr #- \\n(#^\n"); /* current line position relative to bottom */
}
vspf = 0;
chfont = 0;
@@ -74,11 +74,11 @@ putline(int i, int nl)
continue;
lf = prev(nl);
if (lf >= 0 && vspen(table[lf][c].col))
- Bprint(&tabout,
+ fprintf(tabout,
".if (\\n(%c|+\\n(^%c-1v)>\\n(#- .nr #- +(\\n(%c|+\\n(^%c-\\n(#--1v)\n",
(int)s, 'a' + c, (int)s, 'a' + c);
else
- Bprint(&tabout,
+ fprintf(tabout,
".if (\\n(%c|+\\n(#^-1v)>\\n(#- .nr #- +(\\n(%c|+\\n(#^-\\n(#--1v)\n",
(int)s, (int)s);
}
@@ -87,14 +87,14 @@ putline(int i, int nl)
once = 1;
runtabs(i, nl);
if (allh(i) && !pr1403) {
- Bprint(&tabout, ".nr %d \\n(.v\n", SVS);
- Bprint(&tabout, ".vs \\n(.vu-\\n(.sp\n");
- Bprint(&tabout, ".nr 35 \\n(.vu\n");
+ fprintf(tabout, ".nr %d \\n(.v\n", SVS);
+ fprintf(tabout, ".vs \\n(.vu-\\n(.sp\n");
+ fprintf(tabout, ".nr 35 \\n(.vu\n");
} else
- Bprint(&tabout, ".nr 35 1m\n");
+ fprintf(tabout, ".nr 35 1m\n");
if (chfont)
- Bprint(&tabout, ".nr %2d \\n(.f\n", S1);
- Bprint(&tabout, "\\&");
+ fprintf(tabout, ".nr %2d \\n(.f\n", S1);
+ fprintf(tabout, "\\&");
vct = 0;
for (c = 0; c < ncol; c++) {
uphalf = 0;
@@ -115,7 +115,7 @@ putline(int i, int nl)
rct = reg(c, CMID);
if (form == 'n' && table[nl][c].rcol && lused[c] == 0)
rct = reg(c, CMID);
- Bprint(&tabout, "\\h'|\\n(%2su'", rct);
+ fprintf(tabout, "\\h'|\\n(%2su'", rct);
}
s = table[nl][c].col;
fn = font[c][stynum[vforml]];
@@ -133,27 +133,27 @@ putline(int i, int nl)
if (ip >= 0)
if (vspen(table[ip][c].col)) {
if (exvspen == 0) {
- Bprint(&tabout, "\\v'-(\\n(\\*(#du-\\n(^%cu", c + 'a');
+ fprintf(tabout, "\\v'-(\\n(\\*(#du-\\n(^%cu", c + 'a');
if (cmidx)
/* code folded from here */
- Bprint(&tabout, "-((\\n(#-u-\\n(^%cu)/2u)", c + 'a');
+ fprintf(tabout, "-((\\n(#-u-\\n(^%cu)/2u)", c + 'a');
/* unfolding */
vct++;
if (pr1403) /* must round to whole lines */
/* code folded from here */
- Bprint(&tabout, "/1v*1v");
+ fprintf(tabout, "/1v*1v");
/* unfolding */
- Bprint(&tabout, "'");
+ fprintf(tabout, "'");
exvspen = 1;
}
}
- Bprint(&tabout, "%c%c", F1, F2);
+ fprintf(tabout, "%c%c", F1, F2);
if (uphalf)
- Bprint(&tabout, "\\u");
+ fprintf(tabout, "\\u");
puttext(s, fn, size);
if (uphalf)
- Bprint(&tabout, "\\d");
- Bprint(&tabout, "%c", F1);
+ fprintf(tabout, "\\d");
+ fprintf(tabout, "%c", F1);
}
s = table[nl][c].rcol;
form = 1;
@@ -171,7 +171,7 @@ putline(int i, int nl)
case '-':
case '=':
if (real(table[nl][c].col))
- fprint(2, "%s: line %d: Data ignored on table line %d\n", ifile, iline - 1, i + 1);
+ fprintf(stderr, "%s: line %d: Data ignored on table line %d\n", ifile, iline - 1, i + 1);
makeline(i, c, ct);
continue;
default:
@@ -184,7 +184,7 @@ putline(int i, int nl)
continue;
}
if (filler(s)) {
- Bprint(&tabout, "\\l'|\\n(%2su\\&%s'", reg(c, CRIGHT), s + 2);
+ fprintf(tabout, "\\l'|\\n(%2su\\&%s'", reg(c, CRIGHT), s + 2);
continue;
}
ip = prev(nl);
@@ -192,67 +192,68 @@ putline(int i, int nl)
if (ip >= 0)
if (vspen(table[ip][c].col)) {
if (exvspen == 0) {
- Bprint(&tabout, "\\v'-(\\n(\\*(#du-\\n(^%cu", c + 'a');
+ fprintf(tabout, "\\v'-(\\n(\\*(#du-\\n(^%cu", c + 'a');
if (cmidx)
- Bprint(&tabout, "-((\\n(#-u-\\n(^%cu)/2u)", c + 'a');
+ fprintf(tabout, "-((\\n(#-u-\\n(^%cu)/2u)", c + 'a');
vct++;
if (pr1403) /* round to whole lines */
- Bprint(&tabout, "/1v*1v");
- Bprint(&tabout, "'");
+ fprintf(tabout, "/1v*1v");
+ fprintf(tabout, "'");
}
}
- Bprint(&tabout, "%c", F1);
+ fprintf(tabout, "%c", F1);
if (form != 1)
- Bprint(&tabout, "%c", F2);
+ fprintf(tabout, "%c", F2);
if (vspen(s))
vspf = 1;
else
{
if (uphalf)
- Bprint(&tabout, "\\u");
+ fprintf(tabout, "\\u");
puttext(s, fn, size);
if (uphalf)
- Bprint(&tabout, "\\d");
+ fprintf(tabout, "\\d");
}
if (form != 2)
- Bprint(&tabout, "%c", F2);
- Bprint(&tabout, "%c", F1);
+ fprintf(tabout, "%c", F2);
+ fprintf(tabout, "%c", F1);
}
ip = prev(nl);
- if (ip >= 0)
+ if (ip >= 0) {
if (vspen(table[ip][c].col)) {
exvspen = (c + 1 < ncol) && vspen(table[ip][c+1].col) &&
(topat[c] == topat[c+1]) &&
- (cmidx == (flags[c+1] [stynum[nl]] & (CTOP | CDOWN) == 0))
+ (cmidx == ((flags[c+1] [stynum[nl]] & (CTOP | CDOWN)) == 0))
&& (left(i, c + 1, &lwid) < 0);
if (exvspen == 0) {
- Bprint(&tabout, "\\v'(\\n(\\*(#du-\\n(^%cu", c + 'a');
+ fprintf(tabout, "\\v'(\\n(\\*(#du-\\n(^%cu", c + 'a');
if (cmidx)
- Bprint(&tabout, "-((\\n(#-u-\\n(^%cu)/2u)", c + 'a');
+ fprintf(tabout, "-((\\n(#-u-\\n(^%cu)/2u)", c + 'a');
vct++;
if (pr1403) /* round to whole lines */
- Bprint(&tabout, "/1v*1v");
- Bprint(&tabout, "'");
+ fprintf(tabout, "/1v*1v");
+ fprintf(tabout, "'");
}
}
else
exvspen = 0;
+ }
/* if lines need to be split for gcos here is the place for a backslash */
if (vct > 7 && c < ncol) {
- Bprint(&tabout, "\n.sp-1\n\\&");
+ fprintf(tabout, "\n.sp-1\n\\&");
vct = 0;
}
}
- Bprint(&tabout, "\n");
+ fprintf(tabout, "\n");
if (allh(i) && !pr1403)
- Bprint(&tabout, ".vs \\n(%du\n", SVS);
+ fprintf(tabout, ".vs \\n(%du\n", SVS);
if (watchout)
funnies(i, nl);
if (vspf) {
for (c = 0; c < ncol; c++)
if (vspen(table[nl][c].col) && (nl == 0 || (lf = prev(nl)) < 0 ||
!vspen(table[lf][c].col))) {
- Bprint(&tabout, ".nr ^%c \\n(#^u\n", 'a' + c);
+ fprintf(tabout, ".nr ^%c \\n(#^u\n", 'a' + c);
topat[c] = nl;
}
}
@@ -265,9 +266,9 @@ puttext(char *s, char *fn, char *size)
if (point(s)) {
putfont(fn);
putsize(size);
- Bprint(&tabout, "%s", s);
+ fprintf(tabout, "%s", s);
if (*fn > 0)
- Bprint(&tabout, "\\f\\n(%2d", S1);
+ fprintf(tabout, "\\f\\n(%2d", S1);
if (size != 0)
putsize("0");
}
@@ -281,8 +282,8 @@ funnies(int stl, int lin)
int c, s, pl, lwid, dv, lf, ct;
char *fn, *ss;
- Bprint(&tabout, ".mk ##\n"); /* rmember current vertical position */
- Bprint(&tabout, ".nr %d \\n(##\n", S1); /* bottom position */
+ fprintf(tabout, ".mk ##\n"); /* rmember current vertical position */
+ fprintf(tabout, ".nr %d \\n(##\n", S1); /* bottom position */
for (c = 0; c < ncol; c++) {
ss = table[lin][c].col;
if (point(ss))
@@ -290,62 +291,62 @@ funnies(int stl, int lin)
if (ss == 0)
continue;
s = (int)ss;
- Bprint(&tabout, ".sp |\\n(##u-1v\n");
- Bprint(&tabout, ".nr %d ", SIND);
+ fprintf(tabout, ".sp |\\n(##u-1v\n");
+ fprintf(tabout, ".nr %d ", SIND);
ct = 0;
for (pl = stl; pl >= 0 && !isalpha(ct = ctype(pl, c)); pl = prev(pl))
;
switch (ct) {
case 'n':
case 'c':
- Bprint(&tabout, "(\\n(%2su+\\n(%2su-\\n(%c-u)/2u\n", reg(c, CLEFT),
+ fprintf(tabout, "(\\n(%2su+\\n(%2su-\\n(%c-u)/2u\n", reg(c, CLEFT),
reg(c - 1 + ctspan(lin, c), CRIGHT),
s);
break;
case 'l':
- Bprint(&tabout, "\\n(%2su\n", reg(c, CLEFT));
+ fprintf(tabout, "\\n(%2su\n", reg(c, CLEFT));
break;
case 'a':
- Bprint(&tabout, "\\n(%2su\n", reg(c, CMID));
+ fprintf(tabout, "\\n(%2su\n", reg(c, CMID));
break;
case 'r':
- Bprint(&tabout, "\\n(%2su-\\n(%c-u\n", reg(c, CRIGHT), s);
+ fprintf(tabout, "\\n(%2su-\\n(%c-u\n", reg(c, CRIGHT), s);
break;
}
- Bprint(&tabout, ".in +\\n(%du\n", SIND);
+ fprintf(tabout, ".in +\\n(%du\n", SIND);
fn = font[c][stynum[stl]];
putfont(fn);
pl = prev(stl);
if (stl > 0 && pl >= 0 && vspen(table[pl][c].col)) {
- Bprint(&tabout, ".sp |\\n(^%cu\n", 'a' + c);
+ fprintf(tabout, ".sp |\\n(^%cu\n", 'a' + c);
if ((flags[c][stynum[stl]] & (CTOP | CDOWN)) == 0) {
- Bprint(&tabout, ".nr %d \\n(#-u-\\n(^%c-\\n(%c|+1v\n",
+ fprintf(tabout, ".nr %d \\n(#-u-\\n(^%c-\\n(%c|+1v\n",
TMP, 'a' + c, s);
- Bprint(&tabout, ".if \\n(%d>0 .sp \\n(%du/2u", TMP, TMP);
+ fprintf(tabout, ".if \\n(%d>0 .sp \\n(%du/2u", TMP, TMP);
if (pr1403) /* round */
- Bprint(&tabout, "/1v*1v");
- Bprint(&tabout, "\n");
+ fprintf(tabout, "/1v*1v");
+ fprintf(tabout, "\n");
}
}
- Bprint(&tabout, ".%c+\n", s);
- Bprint(&tabout, ".in -\\n(%du\n", SIND);
+ fprintf(tabout, ".%c+\n", s);
+ fprintf(tabout, ".in -\\n(%du\n", SIND);
if (*fn > 0)
putfont("P");
- Bprint(&tabout, ".mk %d\n", S2);
- Bprint(&tabout, ".if \\n(%d>\\n(%d .nr %d \\n(%d\n", S2, S1, S1, S2);
+ fprintf(tabout, ".mk %d\n", S2);
+ fprintf(tabout, ".if \\n(%d>\\n(%d .nr %d \\n(%d\n", S2, S1, S1, S2);
}
- Bprint(&tabout, ".sp |\\n(%du\n", S1);
+ fprintf(tabout, ".sp |\\n(%du\n", S1);
for (c = dv = 0; c < ncol; c++) {
if (stl + 1 < nlin && (lf = left(stl, c, &lwid)) >= 0) {
if (dv++ == 0)
- Bprint(&tabout, ".sp -1\n");
+ fprintf(tabout, ".sp -1\n");
tohcol(c);
dv++;
drawvert(lf, stl, c, lwid);
}
}
if (dv)
- Bprint(&tabout, "\n");
+ fprintf(tabout, "\n");
}
@@ -353,7 +354,7 @@ void
putfont(char *fn)
{
if (fn && *fn)
- Bprint(&tabout, fn[1] ? "\\f(%.2s" : "\\f%.2s", fn);
+ fprintf(tabout, fn[1] ? "\\f(%.2s" : "\\f%.2s", fn);
}
@@ -361,7 +362,7 @@ void
putsize(char *s)
{
if (s && *s)
- Bprint(&tabout, "\\s%s", s);
+ fprintf(tabout, "\\s%s", s);
}
diff --git a/src/cmd/tbl/t9.c b/src/cmd/tbl/t9.c
index bf1978a9..da96e05f 100644
--- a/src/cmd/tbl/t9.c
+++ b/src/cmd/tbl/t9.c
@@ -1,6 +1,6 @@
/* t9.c: write lines for tables over 200 lines */
# include "t.h"
-static useln;
+static int useln;
void
yetmore(void)
@@ -30,7 +30,7 @@ domore(char *dataln)
if (prefix(".TE", dataln))
return(0);
if (dataln[0] == '.' && !isdigit(dataln[1])) {
- Bprint(&tabout, "%s\n", dataln);
+ fprintf(tabout, "%s\n", dataln);
return(1);
}
fullbot[0] = 0;
diff --git a/src/cmd/tbl/tc.c b/src/cmd/tbl/tc.c
index 635dbf8a..f089f4d5 100644
--- a/src/cmd/tbl/tc.c
+++ b/src/cmd/tbl/tc.c
@@ -4,9 +4,9 @@
void
choochar(void)
{
- /* choose funny characters to delimit fields */
- int had[128], ilin, icol, k;
- char *s;
+ /* choose funny characters to delimit fields */
+ int had[128], ilin, icol, k;
+ unsigned char *s;
for (icol = 0; icol < 128; icol++)
had[icol] = 0;
diff --git a/src/cmd/tbl/te.c b/src/cmd/tbl/te.c
index 3df8d445..e6282994 100644
--- a/src/cmd/tbl/te.c
+++ b/src/cmd/tbl/te.c
@@ -4,9 +4,9 @@
void
error(char *s)
{
- fprint(2, "\n%s:%d: %s\n", ifile, iline, s);
- fprint(2, "tbl quits\n");
- exits(s);
+ fprintf(stderr, "\n%s:%d: %s\n", ifile, iline, s);
+ fprintf(stderr, "tbl quits\n");
+ exit(1);
}
@@ -18,13 +18,14 @@ gets1(char *s, int size)
iline++;
ns = s;
- p = Brdline(tabin, '\n');
+ p = fgetln(tabin, &nbl);
while (p == 0) {
if (swapin() == 0)
return(0);
- p = Brdline(tabin, '\n');
+ p = fgetln(tabin, &nbl);
}
- nbl = Blinelen(tabin)-1;
+ if(p != 0 && p[nbl-1] == '\n')
+ nbl--;
if(nbl >= size)
error("input buffer too small");
p[nbl] = 0;
@@ -61,11 +62,11 @@ get1char(void)
if (backp > backup)
c = *--backp;
else
- c = Bgetc(tabin);
+ c = fgetc(tabin);
if (c == 0) /* EOF */ {
if (swapin() == 0)
error("unexpected EOF");
- c = Bgetc(tabin);
+ c = fgetc(tabin);
}
if (c == '\n')
iline++;
diff --git a/src/cmd/tbl/tf.c b/src/cmd/tbl/tf.c
index 3791c32f..320ba968 100644
--- a/src/cmd/tbl/tf.c
+++ b/src/cmd/tbl/tf.c
@@ -5,25 +5,25 @@ void
savefill(void)
{
/* remembers various things: fill mode, vs, ps in mac 35 (SF) */
- Bprint(&tabout, ".de %d\n", SF);
- Bprint(&tabout, ".ps \\n(.s\n");
- Bprint(&tabout, ".vs \\n(.vu\n");
- Bprint(&tabout, ".in \\n(.iu\n");
- Bprint(&tabout, ".if \\n(.u .fi\n");
- Bprint(&tabout, ".if \\n(.j .ad\n");
- Bprint(&tabout, ".if \\n(.j=0 .na\n");
- Bprint(&tabout, "..\n");
- Bprint(&tabout, ".nf\n");
+ fprintf(tabout, ".de %d\n", SF);
+ fprintf(tabout, ".ps \\n(.s\n");
+ fprintf(tabout, ".vs \\n(.vu\n");
+ fprintf(tabout, ".in \\n(.iu\n");
+ fprintf(tabout, ".if \\n(.u .fi\n");
+ fprintf(tabout, ".if \\n(.j .ad\n");
+ fprintf(tabout, ".if \\n(.j=0 .na\n");
+ fprintf(tabout, "..\n");
+ fprintf(tabout, ".nf\n");
/* set obx offset if useful */
- Bprint(&tabout, ".nr #~ 0\n");
- Bprint(&tabout, ".if \\n(.T .if n .nr #~ 0.6n\n");
+ fprintf(tabout, ".nr #~ 0\n");
+ fprintf(tabout, ".if \\n(.T .if n .nr #~ 0.6n\n");
}
void
rstofill(void)
{
- Bprint(&tabout, ".%d\n", SF);
+ fprintf(tabout, ".%d\n", SF);
}
@@ -34,25 +34,25 @@ endoff(void)
for (i = 0; i < MAXHEAD; i++)
if (linestop[i])
- Bprint(&tabout, ".nr #%c 0\n", linestop[i] + 'a' - 1);
+ fprintf(tabout, ".nr #%c 0\n", linestop[i] + 'a' - 1);
for (i = 0; i < texct; i++)
- Bprint(&tabout, ".rm %c+\n", texstr[i]);
- Bprint(&tabout, "%s\n", last);
+ fprintf(tabout, ".rm %c+\n", texstr[i]);
+ fprintf(tabout, "%s\n", last);
}
void
ifdivert(void)
{
- Bprint(&tabout, ".ds #d .d\n");
- Bprint(&tabout, ".if \\(ts\\n(.z\\(ts\\(ts .ds #d nl\n");
+ fprintf(tabout, ".ds #d .d\n");
+ fprintf(tabout, ".if \\(ts\\n(.z\\(ts\\(ts .ds #d nl\n");
}
void
saveline(void)
{
- Bprint(&tabout, ".if \\n+(b.=1 .nr d. \\n(.c-\\n(c.-1\n");
+ fprintf(tabout, ".if \\n+(b.=1 .nr d. \\n(.c-\\n(c.-1\n");
linstart = iline;
}
@@ -60,7 +60,7 @@ saveline(void)
void
restline(void)
{
- Bprint(&tabout, ".if \\n-(b.=0 .nr c. \\n(.c-\\n(d.-%d\n", iline - linstart);
+ fprintf(tabout, ".if \\n-(b.=0 .nr c. \\n(.c-\\n(d.-%d\n", iline - linstart);
linstart = 0;
}
@@ -68,7 +68,7 @@ restline(void)
void
cleanfc(void)
{
- Bprint(&tabout, ".fc\n");
+ fprintf(tabout, ".fc\n");
}
diff --git a/src/cmd/tbl/tg.c b/src/cmd/tbl/tg.c
index 6abb1490..e12bdc4e 100644
--- a/src/cmd/tbl/tg.c
+++ b/src/cmd/tbl/tg.c
@@ -12,53 +12,53 @@ gettext(char *sp, int ilin, int icol, char *fn, char *sz)
if (texname == 0)
error("Too many text block diversions");
if (textflg == 0) {
- Bprint(&tabout, ".nr %d \\n(.lu\n", SL); /* remember old line length */
+ fprintf(tabout, ".nr %d \\n(.lu\n", SL); /* remember old line length */
textflg = 1;
}
- Bprint(&tabout, ".eo\n");
- Bprint(&tabout, ".am %s\n", reg(icol, CRIGHT));
- Bprint(&tabout, ".br\n");
- Bprint(&tabout, ".di %c+\n", texname);
+ fprintf(tabout, ".eo\n");
+ fprintf(tabout, ".am %s\n", reg(icol, CRIGHT));
+ fprintf(tabout, ".br\n");
+ fprintf(tabout, ".di %c+\n", texname);
rstofill();
if (fn && *fn)
- Bprint(&tabout, ".nr %d \\n(.f\n.ft %s\n", S1, fn);
- Bprint(&tabout, ".ft \\n(.f\n"); /* protect font */
+ fprintf(tabout, ".nr %d \\n(.f\n.ft %s\n", S1, fn);
+ fprintf(tabout, ".ft \\n(.f\n"); /* protect font */
vs = vsize[icol][stynum[ilin]];
if ((sz && *sz) || (vs && *vs)) {
- Bprint(&tabout, ".nr %d \\n(.v\n", S9);
+ fprintf(tabout, ".nr %d \\n(.v\n", S9);
if (vs == 0 || *vs == 0)
vs = "\\n(.s+2";
if (sz && *sz)
- Bprint(&tabout, ".ps %s\n", sz);
- Bprint(&tabout, ".vs %s\n", vs);
- Bprint(&tabout, ".if \\n(%du>\\n(.vu .sp \\n(%du-\\n(.vu\n", S9, S9);
+ fprintf(tabout, ".ps %s\n", sz);
+ fprintf(tabout, ".vs %s\n", vs);
+ fprintf(tabout, ".if \\n(%du>\\n(.vu .sp \\n(%du-\\n(.vu\n", S9, S9);
}
if (cll[icol][0])
- Bprint(&tabout, ".ll %sn\n", cll[icol]);
+ fprintf(tabout, ".ll %sn\n", cll[icol]);
else
- Bprint(&tabout, ".ll \\n(%du*%du/%du\n", SL, ctspan(ilin, icol), ncol + 1);
- Bprint(&tabout, ".if \\n(.l<\\n(%2s .ll \\n(%2su\n", reg(icol, CRIGHT),
+ fprintf(tabout, ".ll \\n(%du*%du/%du\n", SL, ctspan(ilin, icol), ncol + 1);
+ fprintf(tabout, ".if \\n(.l<\\n(%2s .ll \\n(%2su\n", reg(icol, CRIGHT),
reg(icol, CRIGHT));
if (ctype(ilin, icol) == 'a')
- Bprint(&tabout, ".ll -2n\n");
- Bprint(&tabout, ".in 0\n");
+ fprintf(tabout, ".ll -2n\n");
+ fprintf(tabout, ".in 0\n");
while (gets1(line, sizeof(line))) {
if (line[0] == 'T' && line[1] == '}' && line[2] == tab)
break;
if (match("T}", line))
break;
- Bprint(&tabout, "%s\n", line);
+ fprintf(tabout, "%s\n", line);
}
if (fn && *fn)
- Bprint(&tabout, ".ft \\n(%d\n", S1);
+ fprintf(tabout, ".ft \\n(%d\n", S1);
if (sz && *sz)
- Bprint(&tabout, ".br\n.ps\n.vs\n");
- Bprint(&tabout, ".br\n");
- Bprint(&tabout, ".di\n");
- Bprint(&tabout, ".nr %c| \\n(dn\n", texname);
- Bprint(&tabout, ".nr %c- \\n(dl\n", texname);
- Bprint(&tabout, "..\n");
- Bprint(&tabout, ".ec \\\n");
+ fprintf(tabout, ".br\n.ps\n.vs\n");
+ fprintf(tabout, ".br\n");
+ fprintf(tabout, ".di\n");
+ fprintf(tabout, ".nr %c| \\n(dn\n", texname);
+ fprintf(tabout, ".nr %c- \\n(dl\n", texname);
+ fprintf(tabout, "..\n");
+ fprintf(tabout, ".ec \\\n");
/* copy remainder of line */
if (line[2])
tcopy (sp, line + 3);
@@ -74,8 +74,8 @@ void
untext(void)
{
rstofill();
- Bprint(&tabout, ".nf\n");
- Bprint(&tabout, ".ll \\n(%du\n", SL);
+ fprintf(tabout, ".nf\n");
+ fprintf(tabout, ".ll \\n(%du\n", SL);
}
diff --git a/src/cmd/tbl/tm.c b/src/cmd/tbl/tm.c
index 8fa4e497..7bf49e53 100644
--- a/src/cmd/tbl/tm.c
+++ b/src/cmd/tbl/tm.c
@@ -9,14 +9,14 @@ maknew(char *str)
char *p, *q, *ba;
p = str;
- for (ba = 0; c = *str; str++)
+ for (ba = 0; (c = *str); str++)
if (c == '\\' && *(str + 1) == '&')
ba = str;
str = p;
if (ba == 0) {
for (dpoint = 0; *str; str++) {
if (*str == '.' && !ineqn(str, p) &&
- (str > p && digit(*(str - 1)) ||
+ ((str > p && digit(*(str - 1))) ||
digit(*(str + 1))))
dpoint = (int)str;
}
@@ -37,7 +37,7 @@ maknew(char *str)
exlim = exstore + MAXCHS;
}
q = exstore;
- while (*exstore++ = *str++)
+ while ((*exstore++ = *str++))
;
*p = 0;
return(q);
@@ -50,7 +50,7 @@ ineqn (char *s, char *p)
/* true if s is in a eqn within p */
int ineq = 0, c;
- while (c = *p) {
+ while ((c = *p)) {
if (s == p)
return(ineq);
p++;
diff --git a/src/cmd/tbl/ts.c b/src/cmd/tbl/ts.c
index 43cc84ec..a3c5968e 100644
--- a/src/cmd/tbl/ts.c
+++ b/src/cmd/tbl/ts.c
@@ -64,7 +64,7 @@ max(int a, int b)
void
tcopy (char *s, char *t)
{
- while (*s++ = *t++)
+ while ((*s++ = *t++))
;
}
diff --git a/src/cmd/tbl/tt.c b/src/cmd/tbl/tt.c
index 96270b75..e70ab3da 100644
--- a/src/cmd/tbl/tt.c
+++ b/src/cmd/tbl/tt.c
@@ -59,9 +59,9 @@ void
tohcol(int ic)
{
if (ic == 0)
- Bprint(&tabout, "\\h'|0'");
+ fprintf(tabout, "\\h'|0'");
else
- Bprint(&tabout, "\\h'(|\\n(%2su+|\\n(%2su)/2u'", reg(ic, CLEFT),
+ fprintf(tabout, "\\h'(|\\n(%2su+|\\n(%2su)/2u'", reg(ic, CLEFT),
reg(ic - 1, CRIGHT));
}
@@ -119,7 +119,7 @@ thish(int i, int c)
return(1);
if (vspen(s))
return(1);
- if (t = barent( s))
+ if ((t = barent( s)))
return(t);
return(0);
}
diff --git a/src/cmd/tbl/tu.c b/src/cmd/tbl/tu.c
index 217869e1..87e1602e 100644
--- a/src/cmd/tbl/tu.c
+++ b/src/cmd/tbl/tu.c
@@ -28,7 +28,7 @@ fullwide(int i, int lintype)
int cr, cl;
if (!pr1403)
- Bprint(&tabout, ".nr %d \\n(.v\n.vs \\n(.vu-\\n(.sp\n", SVS);
+ fprintf(tabout, ".nr %d \\n(.v\n.vs \\n(.vu-\\n(.sp\n", SVS);
cr = 0;
while (cr < ncol) {
cl = cr;
@@ -40,9 +40,9 @@ fullwide(int i, int lintype)
if (cl < ncol)
drawline(i, cl, (cr < ncol ? cr - 1 : cr), lintype, 1, 0);
}
- Bprint(&tabout, "\n");
+ fprintf(tabout, "\n");
if (!pr1403)
- Bprint(&tabout, ".vs \\n(%du\n", SVS);
+ fprintf(tabout, ".vs \\n(%du\n", SVS);
}
@@ -69,11 +69,11 @@ drawline(int i, int cl, int cr, int lintype, int noheight, int shortl)
return;
nodata = cr - cl >= ncol || noheight || allh(i);
if (!nodata)
- Bprint(&tabout, "\\v'-.5m'");
+ fprintf(tabout, "\\v'-.5m'");
for (ln = oldpos = 0; ln < lcount; ln++) {
linpos = 2 * ln - lcount + 1;
if (linpos != oldpos)
- Bprint(&tabout, "\\v'%dp'", linpos - oldpos);
+ fprintf(tabout, "\\v'%dp'", linpos - oldpos);
oldpos = linpos;
if (shortl == 0) {
tohcol(cl);
@@ -90,7 +90,7 @@ drawline(int i, int cl, int cr, int lintype, int noheight, int shortl)
break;
}
if (exhl[0])
- Bprint(&tabout, "\\h'%s'", exhl);
+ fprintf(tabout, "\\h'%s'", exhl);
} else if (lcount == 1) {
switch (interv(i, cl)) {
case TOP:
@@ -102,7 +102,7 @@ drawline(int i, int cl, int cr, int lintype, int noheight, int shortl)
break;
}
if (exhl[0])
- Bprint(&tabout, "\\h'%s'", exhl);
+ fprintf(tabout, "\\h'%s'", exhl);
}
if (lcount > 1) {
switch (interv(i, cr + 1)) {
@@ -128,31 +128,31 @@ drawline(int i, int cl, int cr, int lintype, int noheight, int shortl)
}
}
} else
- Bprint(&tabout, "\\h'|\\n(%2su'", reg(cl, CLEFT));
- Bprint(&tabout, "\\s\\n(%d", LSIZE);
+ fprintf(tabout, "\\h'|\\n(%2su'", reg(cl, CLEFT));
+ fprintf(tabout, "\\s\\n(%d", LSIZE);
if (linsize)
- Bprint(&tabout, "\\v'-\\n(%dp/6u'", LSIZE);
+ fprintf(tabout, "\\v'-\\n(%dp/6u'", LSIZE);
if (shortl)
- Bprint(&tabout, "\\l'|\\n(%2su'", reg(cr, CRIGHT));
+ fprintf(tabout, "\\l'|\\n(%2su'", reg(cr, CRIGHT));
else
{
lnch = "\\(ul";
if (pr1403)
lnch = lintype == 2 ? "=" : "\\(ru";
if (cr + 1 >= ncol)
- Bprint(&tabout, "\\l'|\\n(TWu%s%s'", exhr, lnch);
+ fprintf(tabout, "\\l'|\\n(TWu%s%s'", exhr, lnch);
else
- Bprint(&tabout, "\\l'(|\\n(%2su+|\\n(%2su)/2u%s%s'", reg(cr, CRIGHT),
+ fprintf(tabout, "\\l'(|\\n(%2su+|\\n(%2su)/2u%s%s'", reg(cr, CRIGHT),
reg(cr + 1, CLEFT), exhr, lnch);
}
if (linsize)
- Bprint(&tabout, "\\v'\\n(%dp/6u'", LSIZE);
- Bprint(&tabout, "\\s0");
+ fprintf(tabout, "\\v'\\n(%dp/6u'", LSIZE);
+ fprintf(tabout, "\\s0");
}
if (oldpos != 0)
- Bprint(&tabout, "\\v'%dp'", -oldpos);
+ fprintf(tabout, "\\v'%dp'", -oldpos);
if (!nodata)
- Bprint(&tabout, "\\v'+.5m'");
+ fprintf(tabout, "\\v'+.5m'");
}
diff --git a/src/cmd/tbl/tv.c b/src/cmd/tbl/tv.c
index 19a4b03f..adcef76f 100644
--- a/src/cmd/tbl/tv.c
+++ b/src/cmd/tbl/tv.c
@@ -16,7 +16,7 @@ drawvert(int start, int end, int c, int lwid)
epb = ept = 0;
pos = 2 * ln - lwid + 1;
if (pos != tp)
- Bprint(&tabout, "\\h'%dp'", pos - tp);
+ fprintf(tabout, "\\h'%dp'", pos - tp);
tp = pos;
if (end < nlin) {
if (fullbot[end] || (!instead[end] && allh(end)))
@@ -102,33 +102,33 @@ drawvert(int start, int end, int c, int lwid)
break;
}
if (exb)
- Bprint(&tabout, "\\v'%s'", exb);
+ fprintf(tabout, "\\v'%s'", exb);
if (epb)
- Bprint(&tabout, "\\v'%dp'", epb);
- Bprint(&tabout, "\\s\\n(%d", LSIZE);
+ fprintf(tabout, "\\v'%dp'", epb);
+ fprintf(tabout, "\\s\\n(%d", LSIZE);
if (linsize)
- Bprint(&tabout, "\\v'-\\n(%dp/6u'", LSIZE);
- Bprint(&tabout, "\\h'-\\n(#~u'"); /* adjustment for T450 nroff boxes */
- Bprint(&tabout, "\\L'|\\n(#%cu-%s", linestop[start] + 'a' - 1,
+ fprintf(tabout, "\\v'-\\n(%dp/6u'", LSIZE);
+ fprintf(tabout, "\\h'-\\n(#~u'"); /* adjustment for T450 nroff boxes */
+ fprintf(tabout, "\\L'|\\n(#%cu-%s", linestop[start] + 'a' - 1,
vm == 'v' ? "1v" : "\\n(35u");
if (ext)
- Bprint(&tabout, "-(%s)", ext);
+ fprintf(tabout, "-(%s)", ext);
if (exb)
- Bprint(&tabout, "-(%s)", exb);
+ fprintf(tabout, "-(%s)", exb);
pos = ept - epb;
if (pos)
- Bprint(&tabout, "%s%dp", pos >= 0 ? "+" : "", pos);
+ fprintf(tabout, "%s%dp", pos >= 0 ? "+" : "", pos);
/* the string #d is either "nl" or ".d" depending
on diversions; on GCOS not the same */
- Bprint(&tabout, "'\\s0\\v'\\n(\\*(#du-\\n(#%cu+%s",
+ fprintf(tabout, "'\\s0\\v'\\n(\\*(#du-\\n(#%cu+%s",
linestop[start] + 'a' - 1, vm == 'v' ? "1v" : "\\n(35u");
if (ext)
- Bprint(&tabout, "+%s", ext);
+ fprintf(tabout, "+%s", ext);
if (ept)
- Bprint(&tabout, "%s%dp", (-ept) > 0 ? "+" : "", (-ept));
- Bprint(&tabout, "'");
+ fprintf(tabout, "%s%dp", (-ept) > 0 ? "+" : "", (-ept));
+ fprintf(tabout, "'");
if (linsize)
- Bprint(&tabout, "\\v'\\n(%dp/6u'", LSIZE);
+ fprintf(tabout, "\\v'\\n(%dp/6u'", LSIZE);
}
}
@@ -154,7 +154,7 @@ midbcol(int i, int c)
c--;
if (ct == '-' || ct == '=')
return(ct);
- if (ct = barent(table[i][c].col))
+ if ((ct = barent(table[i][c].col)))
return(ct);
return(0);
}
diff --git a/src/cmd/troff/dwbinit.c b/src/cmd/troff/dwbinit.c
index a63e5fde..59f74ec8 100644
--- a/src/cmd/troff/dwbinit.c
+++ b/src/cmd/troff/dwbinit.c
@@ -143,6 +143,8 @@ void DWBdebug(dwbinit *ptr, int level)
/*****************************************************************************/
+extern char *unsharp(char*);
+
char *DWBhome(void)
{
@@ -186,6 +188,7 @@ char *DWBhome(void)
if ( (home = DWBHOME) == NULL || *home == '\0' || *home == ' ' )
home = NULL;
} /* End if */
+ home = unsharp(home);
} /* End if */
while (home && *home == '/' && *(home +1) == '/') /* remove extra slashes */
diff --git a/src/cmd/troff/ext.h b/src/cmd/troff/ext.h
index 42147880..5e187563 100644
--- a/src/cmd/troff/ext.h
+++ b/src/cmd/troff/ext.h
@@ -1,3 +1,5 @@
+#define devname p9_devname
+
extern int TROFF;
extern int alphabet;
diff --git a/src/cmd/troff/fns.h b/src/cmd/troff/fns.h
index 6bd94ada..087d4c80 100644
--- a/src/cmd/troff/fns.h
+++ b/src/cmd/troff/fns.h
@@ -1,6 +1,7 @@
/*
* other
*/
+#ifdef NOTDEF
int pclose(FILE*);
long filesize(int fd);
int open(char *, int);
@@ -8,6 +9,7 @@ int read(int, char *, int);
int lseek(int, long, int);
int close(int);
int getpid(void);
+#endif
/*
* c1.c
diff --git a/src/cmd/troff/mbwc.c b/src/cmd/troff/mbwc.c
index 66a98219..8bc2e944 100644
--- a/src/cmd/troff/mbwc.c
+++ b/src/cmd/troff/mbwc.c
@@ -130,7 +130,7 @@ mbstowcs(wchar_t *pwcs, const char *s, size_t n)
size_t
wcstombs(char *s, const wchar_t *pwcs, size_t n)
{
- int i, d;
+ int /*i,*/ d;
long c;
char *p, *pe;
char buf[3];
diff --git a/src/cmd/troff/n1.c b/src/cmd/troff/n1.c
index d0949fe2..45e99f3f 100644
--- a/src/cmd/troff/n1.c
+++ b/src/cmd/troff/n1.c
@@ -10,9 +10,6 @@
#include "ext.h"
#include "dwbinit.h"
-#undef MB_CUR_MAX
-#define MB_CUR_MAX 3
-
#include <setjmp.h>
#include <time.h>
@@ -50,6 +47,7 @@ char *progname; /* program name (troff or nroff) */
int trace = 0; /* tracing mode: default off */
int trace1 = 0;
+int
main(int argc, char *argv[])
{
char *p;
@@ -57,7 +55,7 @@ main(int argc, char *argv[])
Tchar i;
char buf[100];
- ifile = stdin;
+ ifile = stdin; /* gcc */
ptid = stdout;
buf[0] = '\0'; /* make sure it's empty (silly 3b2) */
@@ -279,7 +277,7 @@ void init2(void)
void cvtime(void)
{
- long tt;
+ time_t tt;
struct tm *ltime;
time(&tt);
@@ -676,7 +674,6 @@ char ifilt[32] = { 0, 001, 002, 003, 0, 005, 006, 007, 010, 011, 012 };
Tchar getch0(void)
{
- int j;
Tchar i;
again:
@@ -719,7 +716,7 @@ g0:
if (ip)
goto again;
}
-g2:
+//g2:
if (i >= 040) /* zapped: && i < 0177 */
goto g4;
i = ifilt[i];
@@ -754,6 +751,7 @@ Tchar get1ch(FILE *fp) /* get one "character" from input, figure out what alphab
if ((n = mbtowc(&wc, buf, p-buf)) >= 0)
break;
}
+
if (n == 1) /* real ascii, presumably */
return wc;
if (n == 0)
@@ -830,7 +828,7 @@ n1:
if (p[0] == '-' && p[1] == 0) {
ifile = stdin;
strcpy(cfname[ifi], "stdin");
- } else if ((ifile = fopen(unsharp(p), "r")) == NULL) {
+ } else if ((ifile = fopen(p, "r")) == NULL) {
ERROR "cannot open file %s", p WARN;
nfo -= mflg;
done(02);
@@ -840,7 +838,7 @@ n1:
return(0);
}
-
+int
popf(void)
{
--ifi;
@@ -874,6 +872,7 @@ void flushi(void)
* (internal names), spaces and special cookies (below 040).
* Leave STX ETX ENQ ACK and BELL in to maintain compatibility with v7 troff.
*/
+int
getach(void)
{
Tchar i;
@@ -913,11 +912,10 @@ void casenx(void)
nxf = frame + 1;
}
-
+int
getname(void)
{
int j, k;
- Tchar i;
lgf++;
for (k = 0; k < NS - 1; k++) {
@@ -934,12 +932,11 @@ getname(void)
void caseso(void)
{
- FILE *fp;
- char *p, *q;
+ FILE *fp = 0;
lgf++;
nextf[0] = 0;
- if (skip() || !getname() || (fp = fopen(unsharp(nextf), "r")) == NULL || ifi >= NSO) {
+ if (skip() || !getname() || (fp = fopen(nextf, "r")) == NULL || ifi >= NSO) {
ERROR "can't open file %s", nextf WARN;
done(02);
}
@@ -1008,7 +1005,7 @@ void casecf(void)
nextf[0] = 0;
if (!skip() && getname()) {
if (strncmp("<<", nextf, 2) != 0) {
- if ((fd = fopen(unsharp(nextf), "r")) == NULL) {
+ if ((fd = fopen(nextf, "r")) == NULL) {
ERROR "can't open file %s", nextf WARN;
done(02);
}
diff --git a/src/cmd/troff/n10.c b/src/cmd/troff/n10.c
index 0183cadc..de2461d8 100644
--- a/src/cmd/troff/n10.c
+++ b/src/cmd/troff/n10.c
@@ -74,14 +74,13 @@ static char *parse(char *s, int typeit) /* convert \0, etc to nroff driving tabl
static int getnrfont(FILE *fp) /* read the nroff description file */
{
- FILE *fin;
Chwid chtemp[NCHARS];
static Chwid chinit;
int i, nw, n, wid, code, type;
- char buf[100], ch[100], s1[100], s2[100], cmd[300];
+ char buf[100], ch[100], s1[100], s2[100];
wchar_t wc;
-
+ code = 0;
chinit.wid = 1;
chinit.str = "";
for (i = 0; i < ALPHABET; i++) {
@@ -139,7 +138,7 @@ static int getnrfont(FILE *fp) /* read the nroff description file */
void n_ptinit(void)
{
int i;
- char *p, *cp;
+ char *p;
char opt[50], cmd[100];
FILE *fp;
@@ -186,7 +185,7 @@ void n_ptinit(void)
/* hyphalg = 0; /* for testing */
strcat(termtab, devname);
- if ((fp = fopen(unsharp(termtab), "r")) == NULL) {
+ if ((fp = fopen(termtab, "r")) == NULL) {
ERROR "cannot open %s", termtab WARN;
exit(-1);
}
diff --git a/src/cmd/troff/n2.c b/src/cmd/troff/n2.c
index 8164c038..22fd1019 100644
--- a/src/cmd/troff/n2.c
+++ b/src/cmd/troff/n2.c
@@ -137,7 +137,6 @@ void outweird(int k) /* like ptchname() but ascii */
void outascii(Tchar i) /* print i in best-guess ascii */
{
- char *p;
int j = cbits(i);
/* is this ever called with NROFF set? probably doesn't work at all. */
diff --git a/src/cmd/troff/n3.c b/src/cmd/troff/n3.c
index 6918d06d..8279d748 100644
--- a/src/cmd/troff/n3.c
+++ b/src/cmd/troff/n3.c
@@ -64,7 +64,7 @@ void blockinit(void)
char *grow(char *ptr, int num, int size) /* make array bigger */
{
- char *p, new;
+ char *p;
if (ptr == NULL)
p = (char *) calloc(num, size);
@@ -307,7 +307,6 @@ void growcontab(void)
Offset finds(int mn)
{
int i;
- Tchar j = IMP;
Offset savip;
oldmn = findmn(mn);
@@ -372,6 +371,7 @@ int copyb(void)
Offset savoff;
Uchar *p;
+ savoff = 0;
if (skip() || !(j = getrq()))
j = '.';
req = j;
diff --git a/src/cmd/troff/n4.c b/src/cmd/troff/n4.c
index 3b3698e4..71162cc3 100644
--- a/src/cmd/troff/n4.c
+++ b/src/cmd/troff/n4.c
@@ -141,7 +141,7 @@ void setn(void)
for( i = 0; tabtab[i] != 0 && i < NTAB; i++) {
if (i > 0)
buf[j++] = ' ';
- sprintf(&buf[j], "%d", tabtab[i] & TABMASK);
+ sprintf(&buf[j], "%ld", tabtab[i] & TABMASK);
j = strlen(buf);
if ( tabtab[i] & RTAB)
sprintf(&buf[j], "uR");
diff --git a/src/cmd/troff/n5.c b/src/cmd/troff/n5.c
index c2801e47..ab5ef2e5 100644
--- a/src/cmd/troff/n5.c
+++ b/src/cmd/troff/n5.c
@@ -78,11 +78,12 @@ void casens(void)
dip->nls++;
}
-
+int
chget(int c)
{
Tchar i;
+ i = 0;
if (skip() || ismot(i = getch()) || cbits(i) == ' ' || cbits(i) == '\n') {
ch = i;
return(c);
@@ -142,7 +143,7 @@ void casenh(void)
hyf = 0;
}
-
+int
max(int aa, int bb)
{
if (aa > bb)
@@ -333,7 +334,7 @@ void casech(void)
nlist[k] = i;
}
-
+int
findn(int i)
{
int k;
@@ -408,7 +409,7 @@ void casefm(void)
return;
}
if (fcache[i].fp == NULL) {
- if( (fcache[i].fp = fopen(unsharp(nextf), "w")) == NULL) {
+ if( (fcache[i].fp = fopen(nextf, "w")) == NULL) {
ERROR "fm: cannot open %s", nextf WARN;
return;
}
@@ -742,7 +743,7 @@ void eatblk(int inblk)
}
}
-
+int
cmpstr(Tchar c)
{
int j, delim;
@@ -830,7 +831,7 @@ void caserd(void)
pushi(RD_OFFSET, PAIR('r','d'));
}
-
+int
rdtty(void)
{
char onechar;
diff --git a/src/cmd/troff/n6.c b/src/cmd/troff/n6.c
index e4affa17..2328d6a9 100644
--- a/src/cmd/troff/n6.c
+++ b/src/cmd/troff/n6.c
@@ -7,6 +7,7 @@
* n6.c -- width functions, sizes and fonts
*/
+int
n_width(Tchar j)
{
int i, k;
@@ -294,7 +295,7 @@ void n_casebd(void)
{
int i, j, k;
- k = 0;
+ j = k = 0;
bd0:
if (skip() || !(i = getrq()) || (j = findft(i)) == -1) {
if (k)
diff --git a/src/cmd/troff/n7.c b/src/cmd/troff/n7.c
index c22a485c..bcea354a 100644
--- a/src/cmd/troff/n7.c
+++ b/src/cmd/troff/n7.c
@@ -354,6 +354,7 @@ void newline(int a)
int i, j, nlss;
int opn;
+ nlss = 0;
if (a)
goto nl1;
if (dip != d) {
@@ -445,7 +446,7 @@ nl2:
}
}
-
+int
findn1(int a)
{
int i, j;
@@ -477,7 +478,7 @@ void chkpn(void)
}
}
-
+int
findt(int a)
{
int i, j, k;
@@ -504,7 +505,7 @@ findt(int a)
return(k);
}
-
+int
findt1(void)
{
int i;
@@ -539,7 +540,7 @@ e1:
goto e1;
}
-
+int
movword(void)
{
int w;
@@ -648,7 +649,7 @@ void setnel(void)
}
}
-
+int
getword(int x)
{
int j, k;
@@ -656,6 +657,7 @@ getword(int x)
int noword;
int obits;
+ j = 0;
noword = 0;
if (x)
if (pendw) {
diff --git a/src/cmd/troff/n8.c b/src/cmd/troff/n8.c
index d1be5080..bace4aae 100644
--- a/src/cmd/troff/n8.c
+++ b/src/cmd/troff/n8.c
@@ -72,7 +72,7 @@ void hyphen(Tchar *wp)
}
}
-static alpha(Tchar i) /* non-zero if really alphabetic */
+static int alpha(Tchar i) /* non-zero if really alphabetic */
{
if (ismot(i))
return 0;
@@ -82,7 +82,7 @@ static alpha(Tchar i) /* non-zero if really alphabetic */
return isalpha(cbits(i));
}
-
+int
punct(Tchar i)
{
if (!i || alpha(i))
@@ -217,7 +217,7 @@ int exword(void)
}
}
-
+int
suffix(void)
{
Tchar *w;
@@ -269,7 +269,7 @@ mark:
goto again;
}
-
+int
maplow(int i)
{
if (isupper(i))
@@ -277,7 +277,7 @@ maplow(int i)
return(i);
}
-
+int
vowel(int i)
{
switch (i) {
@@ -310,7 +310,7 @@ void digram(void)
Tchar *nhyend, *maxw;
int maxval;
extern char bxh[26][13], bxxh[26][13], xxh[26][13], xhx[26][13], hxx[26][13];
-
+ maxw = 0;
again:
if (!(w = chkvow(hyend + 1)))
return;
@@ -341,7 +341,7 @@ again:
goto again;
}
-
+int
dilook(int a, int b, char t[26][13])
{
int i, j;
@@ -461,13 +461,19 @@ static int texit(Tchar *start, Tchar *end) /* hyphenate as in tex, return # foun
characters. sigh.
*/
+extern char *unsharp(char*);
+
+static char *texhyphens;
+
static int readpats(void)
{
FILE *fp;
char buf[200], buf1[200];
- if ((fp = fopen(unsharp(TEXHYPHENS), "r")) == NULL
- && (fp = fopen(unsharp(DWBalthyphens), "r")) == NULL) {
+ if(texhyphens == 0)
+ texhyphens = unsharp(TEXHYPHENS);
+ if ((fp = fopen(texhyphens, "r")) == NULL
+ && (fp = fopen(DWBalthyphens, "r")) == NULL) {
ERROR "warning: can't find hyphen.tex" WARN;
return 0;
}
diff --git a/src/cmd/troff/n9.c b/src/cmd/troff/n9.c
index 5cd70648..3e3ad97f 100644
--- a/src/cmd/troff/n9.c
+++ b/src/cmd/troff/n9.c
@@ -75,7 +75,7 @@ s1:
pushback(linebuf);
}
-
+int
eat(int c)
{
int i;
@@ -341,6 +341,7 @@ Tchar setfield(int x)
int savepos;
static Tchar wbuf[] = { WORDSP, 0};
+ rchar = 0;
if (x == tabch)
rchar = tabc | chbits;
else if (x == ldrch)
diff --git a/src/cmd/troff/t10.c b/src/cmd/troff/t10.c
index 3e8026d1..0022cc79 100644
--- a/src/cmd/troff/t10.c
+++ b/src/cmd/troff/t10.c
@@ -159,6 +159,7 @@ int ptout0(Tchar *pi)
Tchar i;
int outsize; /* size of object being printed */
+ w = 0;
outsize = 1; /* default */
i = *pi;
k = cbits(i);
@@ -176,11 +177,11 @@ int ptout0(Tchar *pi)
xpts = fbits(i); /* sneaky, font bits as size bits */
if (xpts != mpts)
ptps();
- OUT "x H %d\n", sbits(i) PUT;
+ OUT "x H %ld\n", sbits(i) PUT;
return(outsize);
}
if (k == SLANT) {
- OUT "x S %d\n", sfbits(i)-180 PUT;
+ OUT "x S %ld\n", sfbits(i)-180 PUT;
return(outsize);
}
if (k == WORDSP) {
@@ -300,7 +301,7 @@ int ptout0(Tchar *pi)
pi[1] = '~';
case DRAWSPLINE: /* spline */
default: /* something else; copy it like spline */
- OUT "D%c %d %d", cbits(pi[1]), dx, dy PUT;
+ OUT "D%ld %d %d", cbits(pi[1]), dx, dy PUT;
hpos += dx;
vpos += dy;
if (cbits(pi[3]) == DRAWFCN || cbits(pi[4]) == DRAWFCN) {
diff --git a/src/cmd/troff/t11.c b/src/cmd/troff/t11.c
index 5511748c..398d74da 100644
--- a/src/cmd/troff/t11.c
+++ b/src/cmd/troff/t11.c
@@ -17,13 +17,14 @@ Font fonts[MAXFONTS+1]; /* font info + ptr to width info */
#define eq(s1, s2) (strcmp(s1, s2) == 0)
+int
getdesc(char *name)
{
FILE *fin;
char cmd[100], s[100];
int i, v;
- if ((fin = fopen(unsharp(name), "r")) == NULL)
+ if ((fin = fopen(name, "r")) == NULL)
return -1;
while (fscanf(fin, "%s", cmd) != EOF) {
if (strcmp(cmd, "res") == 0) {
@@ -64,7 +65,7 @@ static int checkfont(char *name)
char buf[300], buf2[300];
int i, status = -1;
- if ((fp = fopen(unsharp(name), "r")) == NULL)
+ if ((fp = fopen(name, "r")) == NULL)
return -1;
for (i = 1; i <= 10; i++) {
if (fgets(buf, sizeof buf, fp) == NULL)
@@ -85,6 +86,7 @@ static int checkfont(char *name)
}
+int
getfont(char *name, int pos) /* create width tab for font */
{
FILE *fin;
@@ -94,10 +96,11 @@ getfont(char *name, int pos) /* create width tab for font */
int i, nw, n, wid, kern, code, type;
char buf[100], ch[100], s1[100], s2[100], s3[100], cmd[300];
+ nw = code = 0;
/* fprintf(stderr, "read font %s onto %d\n", name, pos); */
if (checkfont(name) == -1)
return -1;
- if ((fin = fopen(unsharp(name), "r")) == NULL)
+ if ((fin = fopen(name, "r")) == NULL)
return -1;
for (i = 0; i < ALPHABET; i++)
chtemp[i] = chinit; /* zero out to begin with */
@@ -189,6 +192,7 @@ getfont(char *name, int pos) /* create width tab for font */
return 1;
}
+int
chadd(char *s, int type, int install) /* add s to global character name table; */
{ /* or just look it up */
@@ -231,6 +235,7 @@ char *chname(int n) /* return string for char with index n */
return "";
}
+int
getlig(FILE *fin) /* pick up ligature list */
{
int lig;
diff --git a/src/cmd/troff/t6.c b/src/cmd/troff/t6.c
index b778916c..583d4aa8 100644
--- a/src/cmd/troff/t6.c
+++ b/src/cmd/troff/t6.c
@@ -14,6 +14,7 @@ int ccstab[MAXFONTS+1];
int bdtab[MAXFONTS+1];
int sbold = 0;
+int
t_width(Tchar j)
{
int i, k;
@@ -75,6 +76,7 @@ void zapwcache(int s)
widcache[i].fontpts = 0;
}
+int
onfont(int n, int f) /* is char n on font f? */
{
int i;
@@ -108,6 +110,7 @@ onfont(int n, int f) /* is char n on font f? */
return -1; /* vanilla not found */
}
+int
getcw(int i)
{
int k, n, x;
@@ -218,6 +221,7 @@ Tchar t_setch(int c)
char temp[50];
char *s;
+ j = 0;
s = temp;
if (c == '(') { /* \(xx */
if ((*s++ = getach()) == 0 || (*s++ = getach()) == 0)
@@ -283,7 +287,7 @@ Tchar t_setabs(void) /* set absolute char from \N'...' */
* returns -1 on error
*/
-
+int
t_findft(int i)
{
int k;
@@ -362,7 +366,7 @@ void casps1(int i)
mchbits();
}
-
+int
findps(int i)
{
int j, k;
@@ -396,6 +400,7 @@ void t_setps(void)
{
int i, j;
+ j = 0;
i = cbits(getch());
if (isdigit(i)) { /* \sd or \sdd */
i -= '0';
@@ -703,10 +708,12 @@ char *strdupl(const char *s) /* make a copy of s */
return t;
}
+int
setfp(int pos, int f, char *truename, int print) /* mount font f at position pos[0...nfonts] */
{
char pathname[NS], shortname[NS], *sl;
+ sl = (char*)0;
zapwcache(0);
if (truename)
strcpy(shortname, truename);
@@ -780,6 +787,7 @@ void casebd(void)
{
int i, j, k;
+ j=0;
if (!TROFF) {
n_casebd();
return;
diff --git a/src/cmd/troff/tdef.h b/src/cmd/troff/tdef.h
index e9e1f65c..0b3f2b17 100644
--- a/src/cmd/troff/tdef.h
+++ b/src/cmd/troff/tdef.h
@@ -3,9 +3,12 @@
#include <limits.h>
#include <ctype.h>
#include <string.h>
+#include <unistd.h>
-#define NROFF (!TROFF)
+#undef MB_CUR_MAX
+#define MB_CUR_MAX 3
+#define NROFF (!TROFF)
/* Site dependent definitions */