From 8ec25476b88dc3138d74c285cf249a90200ae6ac Mon Sep 17 00:00:00 2001 From: wlemb Date: Fri, 20 Jul 2001 07:43:28 +0000 Subject: * src/preproc/html/pre-html.cc (scanArguments): Use getopt_long() instead of current code. * src/devices/grohtml/post-html.cc (main): Handle `-d' option. * src/roff/groff/groff.cc (possible_command::insert_args): New function. (main): Use it for predriver handling instead of insert_arg(). * src/include/posix.h: Define S_IWUSR if not yet defined. --- ChangeLog | 11 ++++++ doc/.cvsignore | 6 ++++ src/devices/grohtml/post-html.cc | 3 ++ src/include/posix.h | 4 +++ src/preproc/html/pre-html.cc | 74 +++++++++++++++++++++++++--------------- src/roff/groff/groff.cc | 31 +++++++++++++---- 6 files changed, 94 insertions(+), 35 deletions(-) create mode 100644 doc/.cvsignore diff --git a/ChangeLog b/ChangeLog index ba92ccee..5a664398 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,19 @@ +2001-07-20 Gaius Mulley + + * src/preproc/html/pre-html.cc (scanArguments): Use getopt_long() + instead of current code. + * src/devices/grohtml/post-html.cc (main): Handle `-d' option. + * src/roff/groff/groff.cc (possible_command::insert_args): New + function. + (main): Use it for predriver handling instead of insert_arg(). + 2001-07-19 Werner LEMBERG * doc/Makefile: Added GROFF_BIN_PATH to make it work with uninstalled groff also. + * src/include/posix.h: Define S_IWUSR if not yet defined. + 2001-07-18 Werner LEMBERG * NEWS: Updated. diff --git a/doc/.cvsignore b/doc/.cvsignore new file mode 100644 index 00000000..21321904 --- /dev/null +++ b/doc/.cvsignore @@ -0,0 +1,6 @@ +grohtml-*-*.png +homepage.html +meintro.ps +meref.ps +pic.html +pic.ps diff --git a/src/devices/grohtml/post-html.cc b/src/devices/grohtml/post-html.cc index 7e1a9bf0..1323b282 100644 --- a/src/devices/grohtml/post-html.cc +++ b/src/devices/grohtml/post-html.cc @@ -2900,6 +2900,9 @@ int main(int argc, char **argv) case 'r': auto_rule = FALSE; break; + case 'd': + /* handled by pre-html */ + break; case 'o': /* handled by pre-html */ break; diff --git a/src/include/posix.h b/src/include/posix.h index 1b7d5cdc..80f59cad 100644 --- a/src/include/posix.h +++ b/src/include/posix.h @@ -42,6 +42,10 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define S_IROTH 0004 #endif +#ifndef S_IWUSR +#define S_IWUSR 0200 +#endif + #ifndef S_ISREG #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) #endif diff --git a/src/preproc/html/pre-html.cc b/src/preproc/html/pre-html.cc index dd9ee0af..6f2b9789 100644 --- a/src/preproc/html/pre-html.cc +++ b/src/preproc/html/pre-html.cc @@ -1151,7 +1151,7 @@ static void alterDeviceTo (int argc, char *argv[], int toImage) char **addZ (int argc, char *argv[]) { char **new_argv = (char **)malloc((argc+2)*sizeof(char *)); - int i=0; + int i=0; if (new_argv == NULL) sys_fatal("malloc"); @@ -1241,7 +1241,7 @@ int char_buffer::do_html(int argc, char *argv[]) char **addps4html (int argc, char *argv[]) { char **new_argv = (char **)malloc((argc+2)*sizeof(char *)); - int i=0; + int i=0; if (new_argv == NULL) sys_fatal("malloc"); @@ -1329,43 +1329,61 @@ void usage(FILE *stream) } /* - * scanArguments - scans for -P-i, -P-o, -P-D and -P-I arguments. + * scanArguments - scans for all arguments including -P-i, -P-o, -P-D and -P-I. It returns + * the argument index of the first non option. */ int scanArguments (int argc, char **argv) { - int i=1; - - while (i= end) + return; + // find the total number of arguments in our string + do { + l++; + p = strchr(p, '\0') + 1; + } while (p < end); + // now insert each argument preserving the order + for (int i = l - 1; i >= 0; i--) { + p = s.contents(); + for (int j = 0; j < i; j++) + p = strchr(p, '\0') + 1; + insert_arg(p); + } +} + void possible_command::build_argv() { if (argv) -- cgit v1.2.1