You should have received a copy of the GNU General Public License along
with groff; see the file COPYING. If not, write to the Free Software
-Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
// A front end for groff.
}
#endif /* not STDLIB_H_DECLARES_PUTENV */
+#if !defined(__NetBSD__) && !defined(__OpenBSD__)
+/* defined in <string.h> in NetBSD */
+const char *strsignal(int);
+#endif
+
const int SOELIM_INDEX = 0;
const int REFER_INDEX = SOELIM_INDEX + 1;
const int PIC_INDEX = REFER_INDEX + 1;
void set_name(const char *, const char *);
const char *get_name();
void append_arg(const char *, const char * = 0);
- void insert_arg(const char *);
void clear_args();
char **get_argv();
void print(int is_last, FILE *fp);
void append_arg_to_string(const char *arg, string &str);
void handle_unknown_desc_command(const char *command, const char *arg,
const char *filename, int lineno);
-const char *xbasename(const char *);
+const char *basename(const char *);
void usage();
void help();
command_prefix = PROG_PREFIX;
commands[TROFF_INDEX].set_name(command_prefix, "troff");
while ((opt = getopt(argc, argv,
- "itpeRsSzavVhblCENXZF:m:T:f:w:W:M:d:r:n:o:P:L:"))
+ "itpeRszavVhblCENXZF:m:T:f:w:W:M:d:r:n:o:P:L:"))
!= EOF) {
char buf[3];
buf[0] = '-';
case 'b':
commands[TROFF_INDEX].append_arg(buf);
break;
- case 'S':
- commands[PIC_INDEX].append_arg(buf);
- commands[TROFF_INDEX].insert_arg("-msafer");
- break;
case 'T':
if (strcmp(optarg, "Xps") == 0) {
warning("-TXps option is obsolete: use -X -Tps instead");
}
if (driver)
commands[POST_INDEX].set_name(driver);
- int gxditview_flag = driver && strcmp(xbasename(driver), GXDITVIEW) == 0;
+ int gxditview_flag = driver && strcmp(basename(driver), GXDITVIEW) == 0;
if (gxditview_flag && argc - optind == 1) {
commands[POST_INDEX].append_arg("-title");
commands[POST_INDEX].append_arg(argv[optind]);
commands[TROFF_INDEX].append_arg("-T", device);
commands[EQN_INDEX].append_arg("-T", device);
- int first_index;
- for (first_index = 0; first_index < TROFF_INDEX; first_index++)
+ for (int first_index = 0; first_index < TROFF_INDEX; first_index++)
if (commands[first_index].get_name() != 0)
break;
if (optind < argc) {
print_commands();
exit(0);
}
- return run_commands();
+ exit(run_commands());
}
-const char *xbasename(const char *s)
+const char *basename(const char *s)
{
if (!s)
return 0;
void print_commands()
{
- int last;
- for (last = SPOOL_INDEX; last >= 0; last--)
+ for (int last = SPOOL_INDEX; last >= 0; last--)
if (commands[last].get_name() != 0)
break;
for (int i = 0; i <= last; i++)
args += '\0';
}
-void possible_command::insert_arg(const char *s)
-{
- string str(s);
- str += '\0';
- str += args;
- args = str;
-}
-
void possible_command::build_argv()
{
if (argv)
str += ' ';
int needs_quoting = 0;
int contains_single_quote = 0;
- const char*p;
- for (p = arg; *p != '\0'; p++)
+ for (const char *p = arg; *p != '\0'; p++)
switch (*p) {
case ';':
case '&':
void synopsis()
{
fprintf(stderr,
-"usage: %s [-abehilpstvzCENRSVXZ] [-Fdir] [-mname] [-Tdev] [-ffam] [-wname]\n"
+"usage: %s [-abehilpstvzCENRVXZ] [-Fdir] [-mname] [-Tdev] [-ffam] [-wname]\n"
" [-Wname] [ -Mdir] [-dcs] [-rcn] [-nnum] [-olist] [-Parg] [-Larg]\n"
" [files...]\n",
program_name);
"-Parg\tpass arg to the postprocessor\n"
"-Larg\tpass arg to the spooler\n"
"-N\tdon't allow newlines within eqn delimiters\n"
-"-S\tenable safer mode\n"
"\n",
stderr);
exit(0);