diff options
author | wlemb <wlemb> | 2004-02-22 09:00:34 +0000 |
---|---|---|
committer | wlemb <wlemb> | 2004-02-22 09:00:34 +0000 |
commit | 0ca21c8d6c4931abca01f669e3215b7952827f2a (patch) | |
tree | ce49870ee7c7be932086e71e0d9a693d36621090 | |
parent | d63903bb009a281dc1379733417c5cc0ce658446 (diff) | |
download | groff-0ca21c8d6c4931abca01f669e3215b7952827f2a.tar.gz |
* src/libs/libgroff/quotearg.c: New file, providing proper argument
quoting for MSVC's spawn* and exec* functions.
* src/libs/libgroff/spawnvp.c: New file, providing a wrapper around
spawnvp with proper quoting for MSVC.
* src/libs/libgroff/assert.cpp (program_name),
src/libs/libgroff/new.cpp (program_name): Declare as `extern "C"'.
* src/libs/libgroff/Makefile.sub (OBJS, CSRCS): Updated.
* src/roff/troff/input.cpp (program_name): Declare as `extern "C"'.
* src/include/error.h (program_name): Declare as `extern "C"'.
* src/include/nonposix.h [__MSDOS__ ...]: Handle spawnvp.
* src/preproc/html/pre-html.cpp [__CYGWIN__ ...]: Declare
spawnvp_wrapper.
[MAY_SPAWN_ASYNCHRONOUS_CHILD]: Declare i and j.
-rw-r--r-- | ChangeLog | 22 | ||||
-rw-r--r-- | src/include/error.h | 5 | ||||
-rw-r--r-- | src/include/nonposix.h | 11 | ||||
-rw-r--r-- | src/libs/libgroff/Makefile.sub | 4 | ||||
-rw-r--r-- | src/libs/libgroff/assert.cpp | 4 | ||||
-rw-r--r-- | src/libs/libgroff/new.cpp | 4 | ||||
-rw-r--r-- | src/preproc/html/pre-html.cpp | 39 | ||||
-rw-r--r-- | src/roff/troff/input.cpp | 2 |
8 files changed, 73 insertions, 18 deletions
@@ -1,5 +1,27 @@ +2004-02-21 Keith Marshall <keith.d.marshall@ntlworld.com> + + * src/libs/libgroff/quotearg.c: New file, providing proper argument + quoting for MSVC's spawn* and exec* functions. + * src/libs/libgroff/spawnvp.c: New file, providing a wrapper around + spawnvp with proper quoting for MSVC. + + * src/libs/libgroff/assert.cpp (program_name), + src/libs/libgroff/new.cpp (program_name): Declare as `extern "C"'. + * src/libs/libgroff/Makefile.sub (OBJS, CSRCS): Updated. + + * src/roff/troff/input.cpp (program_name): Declare as `extern "C"'. + + * src/include/error.h (program_name): Declare as `extern "C"'. + * src/include/nonposix.h [__MSDOS__ ...]: Handle spawnvp. + 2004-02-21 Jeff Conrad <jeff_conrad@msn.com> + * src/preproc/html/pre-html.cpp [__CYGWIN__ ...]: Declare + spawnvp_wrapper. + [MAY_SPAWN_ASYNCHRONOUS_CHILD]: Declare i and j. + +2004-02-20 Jeff Conrad <jeff_conrad@msn.com> + * src/roff/groff/pipeline.c (cmd) [__MSDOS__ || ...]: New global variable. (sbasename) [__MSDOS__ || ...]: New function. diff --git a/src/include/error.h b/src/include/error.h index e227682b..6910e550 100644 --- a/src/include/error.h +++ b/src/include/error.h @@ -1,5 +1,6 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1989, 1990, 1991, 1992, 2003, 2004 + Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) This file is part of groff. @@ -52,7 +53,7 @@ extern void warning(const char *, const errarg &arg3 = empty_errarg); -extern const char *program_name; +extern "C" const char *program_name; extern int current_lineno; extern const char *current_filename; extern const char *current_source_filename; diff --git a/src/include/nonposix.h b/src/include/nonposix.h index 25a7b54e..dfbe6d0a 100644 --- a/src/include/nonposix.h +++ b/src/include/nonposix.h @@ -60,6 +60,16 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ # define creat(p,m) _creat(p,m) # define read(f,b,s) _read(f,b,s) # define isatty(f) _isatty(f) + +/* Workaround for broken argument parsing + in child process invoked through MSVC `spawnvp()' function. */ +# ifndef SPAWNVP_C +# undef spawnvp +# define spawnvp spawnvp_wrapper +# undef _spawnvp +# define _spawnvp spawnvp +# endif + # endif # define SET_BINARY(f) do {if (!isatty(f)) setmode(f,O_BINARY);} while(0) # define FOPEN_RB "rb" @@ -116,6 +126,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ const char * system_shell_name(void); const char * system_shell_dash_c(void); int is_system_shell(const char *); + int spawnvp_wrapper(int, char *, char **); # ifdef __cplusplus } # endif diff --git a/src/libs/libgroff/Makefile.sub b/src/libs/libgroff/Makefile.sub index 0883791c..d6ea0c2e 100644 --- a/src/libs/libgroff/Makefile.sub +++ b/src/libs/libgroff/Makefile.sub @@ -32,7 +32,9 @@ OBJS=\ prime.$(OBJEXT) \ progname.$(OBJEXT) \ ptable.$(OBJEXT) \ + quotearg.$(OBJEXT) \ searchpath.$(OBJEXT) \ + spawnvp.$(OBJEXT) \ string.$(OBJEXT) \ strsave.$(OBJEXT) \ symbol.$(OBJEXT) \ @@ -91,6 +93,8 @@ CSRCS=\ $(srcdir)/matherr.c \ $(srcdir)/progname.c \ $(srcdir)/putenv.c \ + $(srcdir)/quotearg.c \ + $(srcdir)/spawnvp.c \ $(srcdir)/strcasecmp.c \ $(srcdir)/strerror.c \ $(srcdir)/strncasecmp.c \ diff --git a/src/libs/libgroff/assert.cpp b/src/libs/libgroff/assert.cpp index 89742e32..01127196 100644 --- a/src/libs/libgroff/assert.cpp +++ b/src/libs/libgroff/assert.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc. +/* Copyright (C) 1989, 1990, 1991, 1992, 2004 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) This file is part of groff. @@ -21,7 +21,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <stdlib.h> #include "assert.h" -extern const char *program_name; +extern "C" const char *program_name; void assertion_failed(int lineno, const char *filename) { diff --git a/src/libs/libgroff/new.cpp b/src/libs/libgroff/new.cpp index 739cffa3..93347b4f 100644 --- a/src/libs/libgroff/new.cpp +++ b/src/libs/libgroff/new.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 1989, 1990, 1991, 1992, 2001, 2003 +/* Copyright (C) 1989, 1990, 1991, 1992, 2001, 2003, 2004 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) @@ -26,7 +26,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "posix.h" #include "nonposix.h" -extern const char *program_name; +extern "C" const char *program_name; static void ewrite(const char *s) { diff --git a/src/preproc/html/pre-html.cpp b/src/preproc/html/pre-html.cpp index 595ded13..604547d1 100644 --- a/src/preproc/html/pre-html.cpp +++ b/src/preproc/html/pre-html.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Written by Gaius Mulley (gaius@glam.ac.uk). This file is part of groff. @@ -60,22 +60,35 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #undef MAY_SPAWN_ASYNCHRONOUS_CHILD #if defined(__MSDOS__) || defined(_WIN32) -/* Most MS-DOS and Win32 environments will be missing the `fork' capability - (some like Cygwin have it, but it is best avoided). */ + +// Most MS-DOS and Win32 environments will be missing the `fork' capability +// (some like Cygwin have it, but it is best avoided). + # define MAY_FORK_CHILD_PROCESS 0 -/* On these systems, we use `spawn...', instead of `fork' ... `exec...'. */ +// On these systems, we use `spawn...', instead of `fork' ... `exec...'. # include <process.h> // for `spawn...' # include <fcntl.h> // for attributes of pipes -# if defined(__CYGWIN__) || defined(_UWIN) || defined(__MINGW32__) -/* These Win32 implementations allow parent and `spawn...'ed child to - multitask asynchronously. */ +# if defined(__CYGWIN__) || defined(_UWIN) \ + || defined(__MINGW32__) || defined(_WIN32) + +// These Win32 implementations allow parent and `spawn...'ed child to +// multitask asynchronously. + +# ifdef __cplusplus +extern "C" spawnvp_wrapper(int, char *, char **); +# endif + # define MAY_SPAWN_ASYNCHRONOUS_CHILD 1 + # else -/* Others may adopt MS-DOS behaviour where parent must sleep, - from `spawn...' until child terminates. */ + +// Others may adopt MS-DOS behaviour where parent must sleep, +// from `spawn...' until child terminates. */ + # define MAY_SPAWN_ASYNCHRONOUS_CHILD 0 + # endif /* not defined __CYGWIN__, _UWIN, or __MINGW32__ */ # if defined(DEBUGGING) && !defined(DEBUG_FILE) @@ -97,8 +110,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #else /* not __MSDOS__ or _WIN32 */ -/* For non-Microsoft environments assume UNIX conventions, - so `fork' is required and child processes are asynchronous */ +// For non-Microsoft environments assume UNIX conventions, +// so `fork' is required and child processes are asynchronous. # define MAY_FORK_CHILD_PROCESS 1 # define MAY_SPAWN_ASYNCHRONOUS_CHILD 1 @@ -113,6 +126,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ in the CPPFLAGS, again noting that the trailing `/' is REQUIRED.) */ # define DEBUG_FILE "/tmp/" # endif + #endif /* not __MSDOS__ or _WIN32 */ extern "C" const char *Version_string; @@ -1262,6 +1276,7 @@ int char_buffer::run_output_filter(int filter, int argc, char **argv) sys_fatal("pipe"); #if MAY_FORK_CHILD_PROCESS + // This is the UNIX process model. To invoke our post-processor, // we must `fork' the current process. @@ -1331,6 +1346,8 @@ int char_buffer::run_output_filter(int filter, int argc, char **argv) #elif MAY_SPAWN_ASYNCHRONOUS_CHILD + int i, j; + // This should be ok for most Win32 systems and is preferred to `fork' // for starting child processes under Cygwin. diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp index abe54f31..b055b758 100644 --- a/src/roff/troff/input.cpp +++ b/src/roff/troff/input.cpp @@ -62,6 +62,7 @@ extern "C" { // initial size of buffer for reading names; expanded as necessary #define ABUF_SIZE 16 +extern "C" const char *program_name; extern "C" const char *Version_string; #ifdef COLUMN @@ -79,7 +80,6 @@ void vjustify(); void transparent_file(); void process_input_stack(); -const char *program_name = 0; token tok; int break_flag = 0; int color_flag = 1; // colors are on by default |