2 * Copyright 1998 Sun Microsystems, Inc. All rights reserved.
3 * Use is subject to license terms.
6 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
7 /* All Rights Reserved */
10 * Copyright (c) 1980 Regents of the University of California.
11 * All rights reserved. The Berkeley software License Agreement
12 * specifies the terms and conditions for redistribution.
15 #pragma ident "%Z%%M% %I% %E% SMI"
17 /* t1.c: main control and input switching */
25 /* required by GCOS because file is passed to "tbl" by troff preprocessor */
31 # define MACROS "/usr/doctools/tmac/tmac.s"
32 # define MACROSS "/usr/share/lib/tmac/s"
33 # define PYMACS "/usr/doctools/tmac/tmac.m"
34 # define PYMACSS "/usr/share/lib/tmac/m"
35 # define MEMACSS "/usr/share/lib/tmac/e"
39 # define MACROS "cc/troff/smac"
40 # define PYMACS "cc/troff/mmac"
45 void setinp(int, char **);
48 main(int argc
, char **argv
)
53 (void) setlocale(LC_ALL
, "");
54 #if !defined(TEXT_DOMAIN)
55 #define TEXT_DOMAIN "SYS_TEST"
57 (void) textdomain(TEXT_DOMAIN
);
59 signal(SIGPIPE
, badsig
);
62 if(!intss()) tabout
= fopen("qq", "w"); /* default media code is type 5 */
68 tbl(int argc
, char **argv
)
71 /* required by GCOS because "stdout" is set by troff preprocessor */
72 tabin
=stdin
; tabout
=stdout
;
74 while (gets1(line
, sizeof line
))
76 fprintf(tabout
, "%s\n",line
);
77 if (prefix(".TS", line
))
88 setinp(int argc
, char **argv
)
100 while (sargc
>0 && **sargv
=='-') /* Mem fault if no test on sargc */
102 if (sargc
<=0) return(0);
103 if (match("-me", *sargv
))
108 if (match("-ms", *sargv
))
113 if (match("-mm", *sargv
))
118 if (match("-TX", *sargv
))
121 (void) fprintf(stderr
, gettext("tbl: Invalid option "
123 (void) fprintf(stderr
, gettext("Usage: tbl [ -me ] "
124 "[ -mm ] [ -ms ] [ filename ] ...\n"));
129 if (sargc
<=0) return(0);
131 /* file closing is done by GCOS troff preprocessor */
132 if (tabin
!=stdin
) fclose(tabin
);
134 tabin
= fopen(ifile
= *sargv
, "r");
137 /* file names are all put into f. by the GCOS troff preprocessor */
138 fprintf(tabout
, ".ds f. %s\n",ifile
);
141 error(gettext("Can't open file"));
151 signal(SIGPIPE
, SIG_IGN
);