Checkpoint -- still merging with Taj's version of the world.

This commit is contained in:
wkj 2004-05-16 07:55:57 +00:00
parent b855148c9b
commit c5561c23cf
37 changed files with 415 additions and 378 deletions

View file

@ -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--;