aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/tbl/t1.c
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/cmd/tbl/t1.c
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/cmd/tbl/t1.c')
-rw-r--r--src/cmd/tbl/t1.c34
1 files changed, 19 insertions, 15 deletions
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--;