diff options
-rw-r--r-- | ChangeLog | 16 | ||||
-rw-r--r-- | Makefile.in | 2 | ||||
-rw-r--r-- | aclocal.m4 | 30 | ||||
-rwxr-xr-x | configure | 67 | ||||
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | src/include/nonposix.h | 90 | ||||
-rw-r--r-- | src/libs/libgroff/searchpath.cpp | 8 | ||||
-rw-r--r-- | src/roff/groff/groff.cpp | 6 |
8 files changed, 166 insertions, 54 deletions
@@ -1,3 +1,18 @@ +2003-12-05 Keith Marshall <keith.d.marshall@ntlworld.com> + + Use path separator character of target platform for compiled-in + default paths. + + * aclocal.m4 (GROFF_TARGET_PATH_SEPARATOR): New macro. + * configure.ac: Use GROFF_TARGET_PATH_SEPARATOR. + * configure: Regenerated. + * Makefile.in (SEP): Use GROFF_PATH_SEPARATOR. + +2003-12-05 Werner LEMBERG <wl@gnu.org> + + * src/include/nonposix.h (PATH_SEP_CHAR): New definition. + Replace `PATH_SEP[0]' with `PATH_SEP_CHAR' everywhere. + 2003-12-04 Bernd Warken <bwarken@mayn.de> * LICENSE: New file. @@ -203,7 +218,6 @@ (copyofstdoutfd): Removed. (char_buffer): Replace `write_file_html' and `write_file_troff' member functions with `emit_troff_output' and `run_output_filter'. - The latter (DEVICE_FORMAT, HTML_OUTPUT_FILTER, IMAGE_OUTPUT_FILTER): New macros. (replaceFd): Replaced with... diff --git a/Makefile.in b/Makefile.in index 57c891d2..3aaaeece 100644 --- a/Makefile.in +++ b/Makefile.in @@ -23,7 +23,7 @@ srcdir=@srcdir@ top_srcdir=@abs_top_srcdir@ VPATH=@srcdir@ top_builddir=@abs_top_builddir@ -SEP=@PATH_SEPARATOR@ +SEP=@GROFF_PATH_SEPARATOR@ version=`cat $(top_srcdir)/VERSION` # No additional number if revision is zero. @@ -832,3 +832,33 @@ AC_DEFUN([GROFF_UINTMAX_T], [Define uintmax_t to `unsigned long' or `unsigned long long' if <inttypes.h> does not exist.]) fi]) + +# Identify PATH_SEPARATOR character to use in GROFF_FONT_PATH and +# GROFF_TMAC_PATH which is appropriate for the target system (POSIX=':', +# MS-DOS/Win32=';'). +# +# The logic to resolve this test is already encapsulated in +# `${srcdir}/src/include/nonposix.h'. + +AC_DEFUN([GROFF_TARGET_PATH_SEPARATOR], + [AC_MSG_CHECKING([separator character to use in groff search paths]) + cp ${srcdir}/src/include/nonposix.h conftest.h + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + +#include <ctype.h> +#include "conftest.h" + + ]], + [[ + +#if PATH_SEP_CHAR == ';' +make an error "Path separator is ';'" +#endif + + ]]) + ], + [GROFF_PATH_SEPARATOR=":"], + [GROFF_PATH_SEPARATOR=";"]) + AC_MSG_RESULT([$GROFF_PATH_SEPARATOR]) + AC_SUBST(GROFF_PATH_SEPARATOR)]) @@ -309,7 +309,7 @@ ac_includes_default="\ # include <unistd.h> #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX TTYDEVDIRS OTHERDEVDIRS LPR LP LPQ PSPRINT DVIPRINT PERLPATH YACC RANLIB ac_ct_RANLIB INSTALL_INFO INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S SH_SCRIPT_SED_CMD CPP EGREP LIBC LIBM LIBOBJS BROKEN_SPOOLER_FLAGS PAGE g sys_tmac_prefix tmac_wrap pnmcut pnmcrop pnmtopng psselect pnmtops gs make_html make_install_html pnmtops_nosetpage LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX TTYDEVDIRS OTHERDEVDIRS LPR LP LPQ PSPRINT DVIPRINT PERLPATH YACC RANLIB ac_ct_RANLIB INSTALL_INFO INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S SH_SCRIPT_SED_CMD CPP EGREP LIBC LIBM LIBOBJS BROKEN_SPOOLER_FLAGS PAGE g sys_tmac_prefix tmac_wrap GROFF_PATH_SEPARATOR pnmcut pnmcrop pnmtopng psselect pnmtops gs make_html make_install_html pnmtops_nosetpage LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -7596,6 +7596,70 @@ echo $ECHO_N "checking which system macro packages should be made available... $ echo "$as_me:$LINENO: result: $tmac_wrap" >&5 echo "${ECHO_T}$tmac_wrap" >&6 +echo "$as_me:$LINENO: checking separator character to use in groff search paths" >&5 +echo $ECHO_N "checking separator character to use in groff search paths... $ECHO_C" >&6 + cp ${srcdir}/src/include/nonposix.h conftest.h + cat >conftest.$ac_ext <<_ACEOF + + /* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + +#include <ctype.h> +#include "conftest.h" + + +int +main () +{ + + +#if PATH_SEP_CHAR == ';' +make an error "Path separator is ';'" +#endif + + + ; + return 0; +} + +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + GROFF_PATH_SEPARATOR=":" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +GROFF_PATH_SEPARATOR=";" +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + echo "$as_me:$LINENO: result: $GROFF_PATH_SEPARATOR" >&5 +echo "${ECHO_T}$GROFF_PATH_SEPARATOR" >&6 + make_html=html make_install_html=install_html @@ -8545,6 +8609,7 @@ s,@PAGE@,$PAGE,;t t s,@g@,$g,;t t s,@sys_tmac_prefix@,$sys_tmac_prefix,;t t s,@tmac_wrap@,$tmac_wrap,;t t +s,@GROFF_PATH_SEPARATOR@,$GROFF_PATH_SEPARATOR,;t t s,@pnmcut@,$pnmcut,;t t s,@pnmcrop@,$pnmcrop,;t t s,@pnmtopng@,$pnmtopng,;t t diff --git a/configure.ac b/configure.ac index 0fda78cc..8fc78f4d 100644 --- a/configure.ac +++ b/configure.ac @@ -87,6 +87,7 @@ GROFF_BROKEN_SPOOLER_FLAGS GROFF_PAGE GROFF_G GROFF_TMAC +GROFF_TARGET_PATH_SEPARATOR GROFF_HTML_PROGRAMS GROFF_PNMTOPS_NOSETPAGE diff --git a/src/include/nonposix.h b/src/include/nonposix.h index 08eb3b0c..1c1e92c5 100644 --- a/src/include/nonposix.h +++ b/src/include/nonposix.h @@ -37,24 +37,24 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ # include <unistd.h> # endif # if defined(_MSC_VER) || defined(__MINGW32__) -# define POPEN_RT "rt" -# define POPEN_WT "wt" -# define popen(c,m) _popen(c,m) -# define pclose(p) _pclose(p) -# define pipe(pfd) _pipe((pfd),0,_O_BINARY|_O_NOINHERIT) -# define getpid() (1) -# define mkdir(p,m) _mkdir(p) -# define setmode(f,m) _setmode(f,m) -# define WAIT(s,p,m) _cwait(s,p,m) -# define creat(p,m) _creat(p,m) +# define POPEN_RT "rt" +# define POPEN_WT "wt" +# define popen(c,m) _popen(c,m) +# define pclose(p) _pclose(p) +# define pipe(pfd) _pipe((pfd),0,_O_BINARY|_O_NOINHERIT) +# define getpid() (1) +# define mkdir(p,m) _mkdir(p) +# define setmode(f,m) _setmode(f,m) +# define WAIT(s,p,m) _cwait(s,p,m) +# define creat(p,m) _creat(p,m) # endif -# define SET_BINARY(f) do {if (!isatty(f)) setmode(f,O_BINARY);} while(0) -# define FOPEN_RB "rb" -# define FOPEN_WB "wb" -# define FOPEN_RWB "wb+" +# define SET_BINARY(f) do {if (!isatty(f)) setmode(f,O_BINARY);} while(0) +# define FOPEN_RB "rb" +# define FOPEN_WB "wb" +# define FOPEN_RWB "wb+" # ifndef O_BINARY # ifdef _O_BINARY -# define O_BINARY (_O_BINARY) +# define O_BINARY (_O_BINARY) # endif # endif @@ -62,36 +62,37 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ systems don't have standard places where it lives, and might not have it installed to begin with. We want to give them some leeway. */ # ifdef __EMX__ -# define getcwd(b,s) _getcwd2(b,s) +# define getcwd(b,s) _getcwd2(b,s) # else -# define BSHELL (system_shell_name()) -# define BSHELL_DASH_C (system_shell_dash_c()) -# define IS_BSHELL(s) (is_system_shell(s)) +# define BSHELL (system_shell_name()) +# define BSHELL_DASH_C (system_shell_dash_c()) +# define IS_BSHELL(s) (is_system_shell(s)) # endif /* The separator for directories in PATH and other environment variables. */ -# define PATH_SEP ";" +# define PATH_SEP ";" +# define PATH_SEP_CHAR ';' /* Characters that separate directories in a path name. */ -# define DIR_SEPS "/\\:" +# define DIR_SEPS "/\\:" /* How to tell if the argument is an absolute file name. */ # define IS_ABSOLUTE(f) \ ((f)[0] == '/' || (f)[0] == '\\' || (f)[0] && (f)[1] == ':') /* The executable extension. */ -# define EXE_EXT ".exe" +# define EXE_EXT ".exe" /* The system null device. */ -# define NULL_DEV "NUL" +# define NULL_DEV "NUL" /* The default place to create temporary files. */ # ifndef P_tmpdir # ifdef _P_tmpdir -# define P_tmpdir _P_tmpdir +# define P_tmpdir _P_tmpdir # else -# define P_tmpdir "c:/temp" +# define P_tmpdir "c:/temp" # endif # endif @@ -101,7 +102,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ # endif const char * system_shell_name(void); const char * system_shell_dash_c(void); - int is_system_shell(const char *); + int is_system_shell(const char *); # ifdef __cplusplus } # endif @@ -111,56 +112,57 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Defaults, for Posix systems. */ #ifndef SET_BINARY -# define SET_BINARY(f) do {} while(0) +# define SET_BINARY(f) do {} while(0) #endif #ifndef FOPEN_RB -# define FOPEN_RB "r" +# define FOPEN_RB "r" #endif #ifndef FOPEN_WB -# define FOPEN_WB "w" +# define FOPEN_WB "w" #endif #ifndef FOPEN_RWB -# define FOPEN_RWB "w+" +# define FOPEN_RWB "w+" #endif #ifndef POPEN_RT -# define POPEN_RT "r" +# define POPEN_RT "r" #endif #ifndef POPEN_WT -# define POPEN_WT "w" +# define POPEN_WT "w" #endif #ifndef O_BINARY -# define O_BINARY 0 +# define O_BINARY 0 #endif #ifndef BSHELL -# define BSHELL "/bin/sh" +# define BSHELL "/bin/sh" #endif #ifndef BSHELL_DASH_C -# define BSHELL_DASH_C "-c" +# define BSHELL_DASH_C "-c" #endif #ifndef IS_BSHELL -# define IS_BSHELL(s) ((s) && strcmp(s,BSHELL) == 0) +# define IS_BSHELL(s) ((s) && strcmp(s,BSHELL) == 0) #endif #ifndef PATH_SEP -# define PATH_SEP ":" +# define PATH_SEP ":" +# define PATH_SEP_CHAR ':' #endif #ifndef DIR_SEPS -# define DIR_SEPS "/" +# define DIR_SEPS "/" #endif #ifndef IS_ABSOLUTE -# define IS_ABSOLUTE(f) ((f)[0] == '/') +# define IS_ABSOLUTE(f) ((f)[0] == '/') #endif #ifndef EXE_EXT -# define EXE_EXT "" +# define EXE_EXT "" #endif #ifndef NULL_DEV -# define NULL_DEV "/dev/null" +# define NULL_DEV "/dev/null" #endif #ifndef GS_NAME -# define GS_NAME "gs" +# define GS_NAME "gs" #endif #ifndef WAIT -# define WAIT(s,p,m) wait(s) +# define WAIT(s,p,m) wait(s) #endif #ifndef _WAIT_CHILD -# define _WAIT_CHILD 0 +# define _WAIT_CHILD 0 #endif diff --git a/src/libs/libgroff/searchpath.cpp b/src/libs/libgroff/searchpath.cpp index ce08cdf2..122f8e56 100644 --- a/src/libs/libgroff/searchpath.cpp +++ b/src/libs/libgroff/searchpath.cpp @@ -76,11 +76,11 @@ void search_path::command_line_dir(const char *s) char *p = dirs; p += old_len - init_len; if (init_len == 0) - *p++ = PATH_SEP[0]; + *p++ = PATH_SEP_CHAR; memcpy(p, s, slen); p += slen; if (init_len > 0) { - *p++ = PATH_SEP[0]; + *p++ = PATH_SEP_CHAR; memcpy(p, old + old_len - init_len, init_len); p += init_len; } @@ -104,7 +104,7 @@ FILE *search_path::open_file(const char *name, char **pathp) unsigned namelen = strlen(name); char *p = dirs; for (;;) { - char *end = strchr(p, PATH_SEP[0]); + char *end = strchr(p, PATH_SEP_CHAR); if (!end) end = strchr(p, '\0'); int need_slash = end > p && strchr(DIR_SEPS, end[-1]) == 0; @@ -156,7 +156,7 @@ FILE *search_path::open_file_cautious(const char *name, char **pathp, unsigned namelen = strlen(name); char *p = dirs; for (;;) { - char *end = strchr(p, PATH_SEP[0]); + char *end = strchr(p, PATH_SEP_CHAR); if (!end) end = strchr(p, '\0'); int need_slash = end > p && strchr(DIR_SEPS, end[-1]) == 0; diff --git a/src/roff/groff/groff.cpp b/src/roff/groff/groff.cpp index d20998b5..f92c8af6 100644 --- a/src/roff/groff/groff.cpp +++ b/src/roff/groff/groff.cpp @@ -240,7 +240,7 @@ int main(int argc, char **argv) case 'F': font::command_line_font_dir(optarg); if (Fargs.length() > 0) { - Fargs += PATH_SEP[0]; + Fargs += PATH_SEP_CHAR; Fargs += optarg; } else @@ -378,7 +378,7 @@ int main(int argc, char **argv) e += Fargs; char *fontpath = getenv("GROFF_FONT_PATH"); if (fontpath && *fontpath) { - e += PATH_SEP[0]; + e += PATH_SEP_CHAR; e += fontpath; } e += '\0'; @@ -404,7 +404,7 @@ int main(int argc, char **argv) else f += BINPATH; if (path && *path) { - f += PATH_SEP[0]; + f += PATH_SEP_CHAR; f += path; } f += '\0'; |