summaryrefslogtreecommitdiffstats
path: root/src/cmd/tbl/te.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/te.c
parentb855148c9b6d28fedfd083d037bcf246f1913d92 (diff)
downloadplan9port-c5561c23cf394806cbf6d70a96f2dc0253f93745.tar.gz
plan9port-c5561c23cf394806cbf6d70a96f2dc0253f93745.zip
Checkpoint -- still merging with Taj's version of the world.
Diffstat (limited to 'src/cmd/tbl/te.c')
-rw-r--r--src/cmd/tbl/te.c17
1 files changed, 9 insertions, 8 deletions
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++;