From 2e2c9047c3a8b5b6fdcdcd4585d5b114f31cd386 Mon Sep 17 00:00:00 2001 From: asmodai Date: Wed, 12 Jan 2000 09:51:43 +0000 Subject: Virgin import of FSF groff v1.15 --- contrib/groff/troff/input.cc | 22 ++++++++++++++++++---- contrib/groff/troff/node.cc | 8 +++++++- contrib/groff/troff/node.h | 1 + contrib/groff/troff/troff.man | 17 ++++++++++++++--- 4 files changed, 40 insertions(+), 8 deletions(-) (limited to 'contrib/groff/troff') diff --git a/contrib/groff/troff/input.cc b/contrib/groff/troff/input.cc index 2f942c9..9d98040 100644 --- a/contrib/groff/troff/input.cc +++ b/contrib/groff/troff/input.cc @@ -5331,6 +5331,13 @@ struct string_list { string_list(const char *ss) : s(ss), next(0) {} }; +static void prepend_string(const char *s, string_list **p) +{ + string_list *l = new string_list(s); + l->next = *p; + *p = l; +} + static void add_string(const char *s, string_list **p) { while (*p) @@ -5341,8 +5348,8 @@ static void add_string(const char *s, string_list **p) void usage(const char *prog) { errprint( -"usage: %1 -abivzCER -wname -Wname -dcstring -mname -nN -olist -rcN\n" -" -Tname -Fdir -Mdir [ files ]\n", +"usage: %1 -abivzCERU -wname -Wname -dcs -ffam -mname -nnum -olist\n" +" -rcn -Tname -Fdir -Mdir [files...]\n", prog); exit(USAGE_EXIT_CODE); } @@ -5360,11 +5367,12 @@ int main(int argc, char **argv) int tflag = 0; int fflag = 0; int nflag = 0; + int safer_flag = 1; // safer by default int no_rc = 0; // don't process troffrc int next_page_number; opterr = 0; hresolution = vresolution = 1; - while ((c = getopt(argc, argv, "abivw:W:zCEf:m:n:o:r:d:F:M:T:tqs:R")) + while ((c = getopt(argc, argv, "abivw:W:zCEf:m:n:o:r:d:F:M:T:tqs:RU")) != EOF) switch(c) { case 'v': @@ -5444,6 +5452,9 @@ int main(int argc, char **argv) case 't': // silently ignore these break; + case 'U': + safer_flag = 0; // unsafe behaviour + break; case '?': usage(argv[0]); default: @@ -5501,6 +5512,8 @@ int main(int argc, char **argv) } if (!no_rc) process_startup_file(); + if (safer_flag) + prepend_string("safer", ¯os); while (macros) { process_macro_file(macros->s); string_list *tem = macros; @@ -5727,7 +5740,8 @@ static node *read_draw_node() maxpoints *= 2; a_delete oldpoint; } - if (!get_hunits(&point[i].h, 'm')) { + if (!get_hunits(&point[i].h, + type == 'f' || type == 't' ? 'u' : 'm')) { err = 1; break; } diff --git a/contrib/groff/troff/node.cc b/contrib/groff/troff/node.cc index bfbf7de..5c1fa43 100644 --- a/contrib/groff/troff/node.cc +++ b/contrib/groff/troff/node.cc @@ -2428,7 +2428,13 @@ bracket_node::~bracket_node() node *bracket_node::copy() { bracket_node *on = new bracket_node; - for (node *tem = list; tem; tem = tem->next) + node *last, *tem; + for (tem = list; tem; tem = tem->next) { + if (tem->next) + tem->next->last = tem; + last = tem; + } + for (tem = last; tem; tem = tem->last) on->bracket(tem->copy()); return on; } diff --git a/contrib/groff/troff/node.h b/contrib/groff/troff/node.h index 540ee5e..fdfe36d 100644 --- a/contrib/groff/troff/node.h +++ b/contrib/groff/troff/node.h @@ -49,6 +49,7 @@ class token_node; struct node { node *next; + node *last; node(); node(node *n); node *add_char(charinfo *c, environment *, hunits *widthp); diff --git a/contrib/groff/troff/troff.man b/contrib/groff/troff/troff.man index 46bf011..4d54afd 100644 --- a/contrib/groff/troff/troff.man +++ b/contrib/groff/troff/troff.man @@ -1,5 +1,5 @@ .ig \"-*- nroff -*- -Copyright (C) 1989-1995 Free Software Foundation, Inc. +Copyright (C) 1989-1999 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice @@ -47,7 +47,7 @@ the original English. .ie \\n(.$-1 .RI "[\ \fB\\$1\fP" "\\$2" "\ ]" .el .RB "[\ " "\\$1" "\ ]" .. -.OP \-abivzCER +.OP \-abivzCERU .OP \-w name .OP \-W name .OP \-d cs @@ -80,7 +80,9 @@ approximation of the typeset output. .B \-b Print a backtrace with each warning or error message. This backtrace should help track down the cause of the error. The line numbers given -in the backtrace may not always correct: troff's idea of line numbers +in the backtrace may not always be correct: +.B troff 's +idea of line numbers gets confused by .B as or @@ -140,6 +142,14 @@ as the default font family. Read in the file .BI tmac. name\fR. Normally this will be searched for in @MACRODIR@. +By default is used the +.I safer +macro (reverted using -U ). +.TP +.B \-U +Unsafe option, avoids default use of +.I safer +macro. .TP .B \-R Don't load @@ -2046,6 +2056,7 @@ of device .BR grops (@MAN1EXT@), .BR grodvi (@MAN1EXT@), .BR grotty (@MAN1EXT@), +.BR grohtml (@MAN1EXT@), .BR groff_font (@MAN5EXT@), .BR groff_out (@MAN5EXT@), .BR groff_char (@MAN7EXT@) -- cgit v1.1