From: Bruno Haible Date: Mon, 31 Mar 2003 20:34:28 +0000 (+0000) Subject: More Woe32/MSVC support. X-Git-Tag: v0.12~119 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2784ad9f09ef6d0db9cc917ed984a5e13df7703f;p=thirdparty%2Fgettext.git More Woe32/MSVC support. --- diff --git a/gettext-tools/src/ChangeLog b/gettext-tools/src/ChangeLog index 4d3bb739a..9ea6eb30c 100644 --- a/gettext-tools/src/ChangeLog +++ b/gettext-tools/src/ChangeLog @@ -1,8 +1,28 @@ +2003-03-30 Bruno Haible + + * Makefile.am (noinst_HEADERS): Add po-gram-gen2.h. + (BUILT_SOURCES): Add po-gram-gen2.h. + (DISTCLEANFILES): Remove po-gram-gen2.h. + (po-gram-gen2.h): Simplify rule. + 2003-03-17 Bruno Haible Native Woe32/MSVC support. * Makefile.msvc: New file. * Makefile.am (EXTRA_DIST): Add it. + * msgfilter.c: Include only if it exists. + (process_string): Mark as NYI on Woe32. + * msgfmt.c (sigjmp_buf, sigsetjmp, siglongjmp): Provide fallback + definitions for Woe32. + * msginit.c: Include , for F_OK. Include only if it + exists. + (get_user_pwd, get_user_fullname): Adapt for when is missing. + (project_id, project_id_version, get_user_email, + language_team_address): Use DEV_NULL instead of "/dev/null". + * msggrep.c (is_string_selected): Likewise. + * read-java.c (execute_and_read_po_output): Likewise. + * read-tcl.c (msgdomain_read_tcl): Likewise. + * write-mo.c: Include only if it exists. 2003-03-28 Bruno Haible diff --git a/gettext-tools/src/Makefile.am b/gettext-tools/src/Makefile.am index d0bf63aaf..5efedf88b 100644 --- a/gettext-tools/src/Makefile.am +++ b/gettext-tools/src/Makefile.am @@ -36,10 +36,10 @@ include_HEADERS = gettext-po.h noinst_HEADERS = pos.h message.h po-gram.h po-hash.h po-charset.h po-lex.h \ po.h open-po.h read-po.h str-list.h write-po.h dir-list.h file-list.h \ -po-gram-gen.h po-hash-gen.h msgl-charset.h msgl-equal.h msgl-iconv.h \ -msgl-ascii.h msgl-cat.h msgl-english.h msgfmt.h msgunfmt.h read-mo.h \ -write-mo.h read-java.h write-java.h read-tcl.h write-tcl.h po-time.h \ -plural-table.h format.h xgettext.h x-c.h x-po.h x-python.h x-lisp.h \ +po-gram-gen.h po-gram-gen2.h po-hash-gen.h msgl-charset.h msgl-equal.h \ +msgl-iconv.h msgl-ascii.h msgl-cat.h msgl-english.h msgfmt.h msgunfmt.h \ +read-mo.h write-mo.h read-java.h write-java.h read-tcl.h write-tcl.h \ +po-time.h plural-table.h format.h xgettext.h x-c.h x-po.h x-python.h x-lisp.h \ x-elisp.h x-librep.h x-smalltalk.h x-java.h x-awk.h x-ycp.h x-tcl.h x-php.h \ x-rst.h x-glade.h @@ -214,19 +214,19 @@ endif # Special rules for bison and flex generated files. -BUILT_SOURCES = po-gram-gen.c po-hash-gen.c po-gram-gen.h po-hash-gen.h +BUILT_SOURCES = \ + po-gram-gen.c po-gram-gen.h po-gram-gen2.h \ + po-hash-gen.c po-hash-gen.h po-lex.o po-lex.lo: po-gram-gen2.h po-gram-gen2.h: po-gram-gen.h - $(SED) 's/[yY][yY]/po_gram_/g' $(srcdir)/po-gram-gen.h > $@-tmp + $(SED) 's/yy/po_gram_/g' $(srcdir)/po-gram-gen.h > $@-tmp mv $@-tmp $@ x-java.c: x-java.l $(LEX) -o$@-tmp -Px_java_yy $(srcdir)/x-java.l test "$(LEX)" = ":" || mv $@-tmp $@ -DISTCLEANFILES += po-gram-gen2.h - # Special rules for installation of auxiliary programs. diff --git a/gettext-tools/src/Makefile.msvc b/gettext-tools/src/Makefile.msvc index f76e845fe..c9c492d5b 100644 --- a/gettext-tools/src/Makefile.msvc +++ b/gettext-tools/src/Makefile.msvc @@ -33,7 +33,20 @@ includedir = $(prefix)\include datadir = $(prefix)\share localedir = $(datadir)\locale aliaspath = +jardir = $(datadir)\gettext pkgdatadir = $(datadir)\gettext +projectsdir = $(pkgdatadir)\projects +IIprefix = c:\\usr +IIexec_prefix = $(IIprefix) +IIbindir = $(IIexec_prefix)\\bin +IIlibdir = $(IIexec_prefix)\\lib +IIincludedir = $(IIprefix)\\include +IIdatadir = $(IIprefix)\\share +IIlocaledir = $(IIdatadir)\\locale +IIaliaspath = +IIjardir = $(IIdatadir)\\gettext +IIpkgdatadir = $(IIdatadir)\\gettext +IIprojectsdir = $(IIpkgdatadir)\\projects # Programs used by "make": @@ -58,9 +71,9 @@ OPTIMFLAGS = -Od -Z7 OPTIMFLAGS = -D_NDEBUG -O1 !endif -CFLAGS = $(MFLAGS) $(WARN_CFLAGS) $(OPTIMFLAGS) -DHAVE_CONFIG_H +CFLAGS = $(MFLAGS) $(WARN_CFLAGS) $(OPTIMFLAGS) -DHAVE_CONFIG_H -DLOCALEDIR=\"$(IIlocaledir)\" -DLOCALE_ALIAS_PATH=\"$(IIaliaspath)\" -DGETTEXTJAR=\"$(IIjardir)\\gettext.jar\" -DLIBDIR=\"$(IIlibdir)\" -DGETTEXTDATADIR=\"$(IIpkgdatadir)\" -DPROJECTSDIR=\"$(IIprojectsdir)\" -INCLUDES = +INCLUDES = -I. -I.. -I..\libuniname -I..\lib -I..\intl -I..\..\gettext-runtime\intl -I..\windows -I$(includedir) AR = lib AR_FLAGS = /out: @@ -131,6 +144,7 @@ msgfilter_OBJECTS = msgfilter.obj msggrep_OBJECTS = msggrep.obj msginit_OBJECTS = msginit.obj localealias.obj msguniq_OBJECTS = msguniq.obj +LDADD = RESOURCES = gettextsrc.res @@ -246,8 +260,8 @@ gettextsrc.lib : $(OBJECTS) !else # gettextsrc.dll and gettextsrc.lib are created together. -gettextsrc.lib : $(OBJECTS) $(RESOURCES) - $(CC) $(MFLAGS) -LD $(OBJECTS) $(RESOURCES) +gettextsrc.lib : ..\windows\gettextsrc.def $(OBJECTS) $(RESOURCES) + $(CC) $(MFLAGS) -LD ..\windows\gettextsrc.def $(OBJECTS) ..\lib\gettextlib.lib ..\intl\intl.lib $(libdir)\iconv.lib $(RESOURCES) -Fegettextsrc.dll gettextsrc.res : ../windows/gettextsrc.rc rc -Fo gettextsrc.res ../windows/gettextsrc.rc @@ -257,10 +271,10 @@ gettextsrc.res : ../windows/gettextsrc.rc # Compilation rules for $(program_OBJECTS), without $(PICFLAGS). msgcmp.obj : msgcmp.c - $(CC) $(INCLUDES) $(CFLAGS) -DINSTALLPREFIX=\"$(prefix)\" -DINSTALLDIR=\"$(bindir)\" -c msgcmp.c + $(CC) $(INCLUDES) $(CFLAGS) -DINSTALLPREFIX=\"$(IIprefix)\" -DINSTALLDIR=\"$(IIbindir)\" -c msgcmp.c msgfmt.obj : msgfmt.c - $(CC) $(INCLUDES) $(CFLAGS) -DINSTALLPREFIX=\"$(prefix)\" -DINSTALLDIR=\"$(bindir)\" -c msgfmt.c + $(CC) $(INCLUDES) $(CFLAGS) -DINSTALLPREFIX=\"$(IIprefix)\" -DINSTALLDIR=\"$(IIbindir)\" -c msgfmt.c write-mo.obj : write-mo.c $(CC) $(INCLUDES) $(CFLAGS) -c write-mo.c @@ -275,10 +289,10 @@ plural-eval.obj : plural-eval.c $(CC) $(INCLUDES) $(CFLAGS) -c plural-eval.c msgmerge.obj : msgmerge.c - $(CC) $(INCLUDES) $(CFLAGS) -DINSTALLPREFIX=\"$(prefix)\" -DINSTALLDIR=\"$(bindir)\" -c msgmerge.c + $(CC) $(INCLUDES) $(CFLAGS) -DINSTALLPREFIX=\"$(IIprefix)\" -DINSTALLDIR=\"$(IIbindir)\" -c msgmerge.c msgunfmt.obj : msgunfmt.c - $(CC) $(INCLUDES) $(CFLAGS) -DINSTALLPREFIX=\"$(prefix)\" -DINSTALLDIR=\"$(bindir)\" -c msgunfmt.c + $(CC) $(INCLUDES) $(CFLAGS) -DINSTALLPREFIX=\"$(IIprefix)\" -DINSTALLDIR=\"$(IIbindir)\" -c msgunfmt.c read-mo.obj : read-mo.c $(CC) $(INCLUDES) $(CFLAGS) -c read-mo.c @@ -290,7 +304,7 @@ read-tcl.obj : read-tcl.c $(CC) $(INCLUDES) $(CFLAGS) -c read-tcl.c xgettext.obj : xgettext.c - $(CC) $(INCLUDES) $(CFLAGS) -DINSTALLPREFIX=\"$(prefix)\" -DINSTALLDIR=\"$(bindir)\" -c xgettext.c + $(CC) $(INCLUDES) $(CFLAGS) -DINSTALLPREFIX=\"$(IIprefix)\" -DINSTALLDIR=\"$(IIbindir)\" -c xgettext.c x-c.obj : x-c.c $(CC) $(INCLUDES) $(CFLAGS) -c x-c.c @@ -335,82 +349,82 @@ x-glade.obj : x-glade.c $(CC) $(INCLUDES) $(CFLAGS) -c x-glade.c msgattrib.obj : msgattrib.c - $(CC) $(INCLUDES) $(CFLAGS) -DINSTALLPREFIX=\"$(prefix)\" -DINSTALLDIR=\"$(bindir)\" -c msgattrib.c + $(CC) $(INCLUDES) $(CFLAGS) -DINSTALLPREFIX=\"$(IIprefix)\" -DINSTALLDIR=\"$(IIbindir)\" -c msgattrib.c msgcat.obj : msgcat.c - $(CC) $(INCLUDES) $(CFLAGS) -DINSTALLPREFIX=\"$(prefix)\" -DINSTALLDIR=\"$(bindir)\" -c msgcat.c + $(CC) $(INCLUDES) $(CFLAGS) -DINSTALLPREFIX=\"$(IIprefix)\" -DINSTALLDIR=\"$(IIbindir)\" -c msgcat.c msgcomm.obj : msgcomm.c - $(CC) $(INCLUDES) $(CFLAGS) -DINSTALLPREFIX=\"$(prefix)\" -DINSTALLDIR=\"$(bindir)\" -c msgcomm.c + $(CC) $(INCLUDES) $(CFLAGS) -DINSTALLPREFIX=\"$(IIprefix)\" -DINSTALLDIR=\"$(IIbindir)\" -c msgcomm.c msgconv.obj : msgconv.c - $(CC) $(INCLUDES) $(CFLAGS) -DINSTALLPREFIX=\"$(prefix)\" -DINSTALLDIR=\"$(bindir)\" -c msgconv.c + $(CC) $(INCLUDES) $(CFLAGS) -DINSTALLPREFIX=\"$(IIprefix)\" -DINSTALLDIR=\"$(IIbindir)\" -c msgconv.c msgen.obj : msgen.c - $(CC) $(INCLUDES) $(CFLAGS) -DINSTALLPREFIX=\"$(prefix)\" -DINSTALLDIR=\"$(bindir)\" -c msgen.c + $(CC) $(INCLUDES) $(CFLAGS) -DINSTALLPREFIX=\"$(IIprefix)\" -DINSTALLDIR=\"$(IIbindir)\" -c msgen.c msgexec.obj : msgexec.c - $(CC) $(INCLUDES) $(CFLAGS) -DINSTALLPREFIX=\"$(prefix)\" -DINSTALLDIR=\"$(bindir)\" -c msgexec.c + $(CC) $(INCLUDES) $(CFLAGS) -DINSTALLPREFIX=\"$(IIprefix)\" -DINSTALLDIR=\"$(IIbindir)\" -c msgexec.c msgfilter.obj : msgfilter.c - $(CC) $(INCLUDES) $(CFLAGS) -DINSTALLPREFIX=\"$(prefix)\" -DINSTALLDIR=\"$(bindir)\" -c msgfilter.c + $(CC) $(INCLUDES) $(CFLAGS) -DINSTALLPREFIX=\"$(IIprefix)\" -DINSTALLDIR=\"$(IIbindir)\" -c msgfilter.c msggrep.obj : msggrep.c - $(CC) $(INCLUDES) $(CFLAGS) -DINSTALLPREFIX=\"$(prefix)\" -DINSTALLDIR=\"$(bindir)\" -c msggrep.c + $(CC) $(INCLUDES) $(CFLAGS) -DINSTALLPREFIX=\"$(IIprefix)\" -DINSTALLDIR=\"$(IIbindir)\" -c msggrep.c msginit.obj : msginit.c - $(CC) $(INCLUDES) $(CFLAGS) -DINSTALLPREFIX=\"$(prefix)\" -DINSTALLDIR=\"$(bindir)\" -c msginit.c + $(CC) $(INCLUDES) $(CFLAGS) -DINSTALLPREFIX=\"$(IIprefix)\" -DINSTALLDIR=\"$(IIbindir)\" -c msginit.c localealias.obj : ..\..\gettext-runtime\intl\localealias.c - $(CC) $(INCLUDES) $(CFLAGS) -DLOCALE_ALIAS_PATH=\"$(aliaspath)\" -c ..\..\gettext-runtime\intl\localealias.c + $(CC) $(INCLUDES) $(CFLAGS) -DLOCALE_ALIAS_PATH=\"$(IIaliaspath)\" -c ..\..\gettext-runtime\intl\localealias.c msguniq.obj : msguniq.c - $(CC) $(INCLUDES) $(CFLAGS) -DINSTALLPREFIX=\"$(prefix)\" -DINSTALLDIR=\"$(bindir)\" -c msguniq.c + $(CC) $(INCLUDES) $(CFLAGS) -DINSTALLPREFIX=\"$(IIprefix)\" -DINSTALLDIR=\"$(IIbindir)\" -c msguniq.c msgcmp.exe : $(msgcmp_OBJECTS) - $(CC) $(msgcmp_OBJECTS) -lgettextsrc -Femsgcmp.exe + $(CC) $(msgcmp_OBJECTS) gettextsrc.lib ..\lib\gettextlib.lib ..\intl\intl.lib $(LDADD) -Femsgcmp.exe msgfmt.exe : $(msgfmt_OBJECTS) - $(CC) $(msgfmt_OBJECTS) -lgettextsrc -Femsgfmt.exe + $(CC) $(msgfmt_OBJECTS) gettextsrc.lib ..\lib\gettextlib.lib ..\intl\intl.lib $(LDADD) -Femsgfmt.exe msgmerge.exe : $(msgmerge_OBJECTS) - $(CC) $(msgmerge_OBJECTS) -lgettextsrc -Femsgmerge.exe + $(CC) $(msgmerge_OBJECTS) gettextsrc.lib ..\lib\gettextlib.lib ..\intl\intl.lib $(LDADD) -Femsgmerge.exe msgunfmt.exe : $(msgunfmt_OBJECTS) - $(CC) $(msgunfmt_OBJECTS) -lgettextsrc -Femsgunfmt.exe + $(CC) $(msgunfmt_OBJECTS) gettextsrc.lib ..\lib\gettextlib.lib ..\intl\intl.lib $(LDADD) -Femsgunfmt.exe xgettext.exe : $(xgettext_OBJECTS) - $(CC) $(xgettext_OBJECTS) ..\libuniname\uniname.lib -lgettextsrc -Fexgettext.exe + $(CC) $(xgettext_OBJECTS) ..\libuniname\uniname.lib gettextsrc.lib ..\lib\gettextlib.lib ..\intl\intl.lib $(libdir)\iconv.lib $(LDADD) -Fexgettext.exe msgattrib.exe : $(msgattrib_OBJECTS) - $(CC) $(msgattrib_OBJECTS) -lgettextsrc -Femsgattrib.exe + $(CC) $(msgattrib_OBJECTS) gettextsrc.lib ..\lib\gettextlib.lib ..\intl\intl.lib $(LDADD) -Femsgattrib.exe msgcat.exe : $(msgcat_OBJECTS) - $(CC) $(msgcat_OBJECTS) -lgettextsrc -Femsgcat.exe + $(CC) $(msgcat_OBJECTS) gettextsrc.lib ..\lib\gettextlib.lib ..\intl\intl.lib $(LDADD) -Femsgcat.exe msgcomm.exe : $(msgcomm_OBJECTS) - $(CC) $(msgcomm_OBJECTS) -lgettextsrc -Femsgcomm.exe + $(CC) $(msgcomm_OBJECTS) gettextsrc.lib ..\lib\gettextlib.lib ..\intl\intl.lib $(LDADD) -Femsgcomm.exe msgconv.exe : $(msgconv_OBJECTS) - $(CC) $(msgconv_OBJECTS) -lgettextsrc -Femsgconv.exe + $(CC) $(msgconv_OBJECTS) gettextsrc.lib ..\lib\gettextlib.lib ..\intl\intl.lib $(LDADD) -Femsgconv.exe msgen.exe : $(msgen_OBJECTS) - $(CC) $(msgen_OBJECTS) -lgettextsrc -Femsgen.exe + $(CC) $(msgen_OBJECTS) gettextsrc.lib ..\lib\gettextlib.lib ..\intl\intl.lib $(LDADD) -Femsgen.exe msgexec.exe : $(msgexec_OBJECTS) - $(CC) $(msgexec_OBJECTS) -lgettextsrc -Femsgexec.exe + $(CC) $(msgexec_OBJECTS) gettextsrc.lib ..\lib\gettextlib.lib ..\intl\intl.lib $(LDADD) -Femsgexec.exe msgfilter.exe : $(msgfilter_OBJECTS) - $(CC) $(msgfilter_OBJECTS) -lgettextsrc -Femsgfilter.exe + $(CC) $(msgfilter_OBJECTS) gettextsrc.lib ..\lib\gettextlib.lib ..\intl\intl.lib $(LDADD) -Femsgfilter.exe msggrep.exe : $(msggrep_OBJECTS) - $(CC) $(msggrep_OBJECTS) -lgettextsrc -Femsggrep.exe + $(CC) $(msggrep_OBJECTS) gettextsrc.lib ..\lib\gettextlib.lib ..\intl\intl.lib $(LDADD) -Femsggrep.exe msginit.exe : $(msginit_OBJECTS) - $(CC) $(msginit_OBJECTS) ..\intl\localename.obj -lgettextsrc -Femsginit.exe + $(CC) $(msginit_OBJECTS) ..\intl\localename.obj gettextsrc.lib ..\lib\gettextlib.lib ..\intl\intl.lib $(LDADD) -Femsginit.exe msguniq.exe : $(msguniq_OBJECTS) - $(CC) $(msguniq_OBJECTS) -lgettextsrc -Femsguniq.exe + $(CC) $(msguniq_OBJECTS) gettextsrc.lib ..\lib\gettextlib.lib ..\intl\intl.lib $(LDADD) -Femsguniq.exe install : all force -mkdir $(prefix) diff --git a/gettext-tools/src/msgfilter.c b/gettext-tools/src/msgfilter.c index 11e5f5724..93339ee83 100644 --- a/gettext-tools/src/msgfilter.c +++ b/gettext-tools/src/msgfilter.c @@ -30,7 +30,10 @@ #include #include #include -#include + +#if HAVE_SYS_TIME_H +# include +#endif #ifdef HAVE_UNISTD_H # include @@ -503,6 +506,11 @@ nonintr_select (int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, static void process_string (const char *str, size_t len, char **resultp, size_t *lengthp) { +#if defined _MSC_VER || defined __MINGW32__ + /* Native Woe32 API. */ + /* Not yet implemented. */ + error (EXIT_FAILURE, 0, _("Not yet implemented.")); +#else pid_t child; int fd[2]; char *result; @@ -648,6 +656,7 @@ process_string (const char *str, size_t len, char **resultp, size_t *lengthp) *resultp = result; *lengthp = length; +#endif } diff --git a/gettext-tools/src/msgfmt.c b/gettext-tools/src/msgfmt.c index 29c0a98e5..322f07896 100644 --- a/gettext-tools/src/msgfmt.c +++ b/gettext-tools/src/msgfmt.c @@ -56,6 +56,14 @@ #define SIZEOF(a) (sizeof(a) / sizeof(a[0])) +/* Some platforms don't have the sigjmp_buf type in . */ +#if defined _MSC_VER || defined __MINGW32__ +/* Native Woe32 API. */ +# define sigjmp_buf jmp_buf +# define sigsetjmp(env,savesigs) setjmp (env) +# define siglongjmp longjmp +#endif + /* We use siginfo to get precise information about the signal. But siginfo doesn't work on Irix 6.5. */ #if HAVE_SIGINFO && !defined (__sgi) diff --git a/gettext-tools/src/msggrep.c b/gettext-tools/src/msggrep.c index 0ce5a3375..d143401d6 100644 --- a/gettext-tools/src/msggrep.c +++ b/gettext-tools/src/msggrep.c @@ -550,7 +550,7 @@ is_string_selected (int grep_pass, const char *str, size_t len) /* Open a pipe to a grep subprocess. */ child = create_pipe_out ("grep", grep_path, grep_argv[grep_pass], - "/dev/null", false, true, fd); + DEV_NULL, false, true, fd); if (full_write (fd[0], str, len) < len) error (EXIT_FAILURE, errno, diff --git a/gettext-tools/src/msginit.c b/gettext-tools/src/msginit.c index bd146e730..f04dc281d 100644 --- a/gettext-tools/src/msginit.c +++ b/gettext-tools/src/msginit.c @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -31,7 +32,10 @@ #include #include #include -#include + +#if HAVE_PWD_H +# include +#endif #if HAVE_UNISTD_H # include @@ -872,7 +876,7 @@ project_id () argv[0] = "/bin/sh"; argv[1] = prog; argv[2] = NULL; - child = create_pipe_in (prog, "/bin/sh", argv, "/dev/null", false, true, fd); + child = create_pipe_in (prog, "/bin/sh", argv, DEV_NULL, false, true, fd); /* Retrieve its result. */ fp = fdopen (fd[0], "r"); @@ -924,7 +928,7 @@ project_id_version () argv[1] = prog; argv[2] = "yes"; argv[3] = NULL; - child = create_pipe_in (prog, "/bin/sh", argv, "/dev/null", false, true, fd); + child = create_pipe_in (prog, "/bin/sh", argv, DEV_NULL, false, true, fd); /* Retrieve its result. */ fp = fdopen (fd[0], "r"); @@ -973,6 +977,7 @@ po_revision_date (const char *header) static struct passwd * get_user_pwd () { +#if HAVE_PWD_H /* Only Unix, not native Woe32. */ const char *username; struct passwd *userpasswd; @@ -1007,6 +1012,7 @@ get_user_pwd () return userpasswd; if (errno != 0) error (EXIT_FAILURE, errno, "getpwuid(\"%d\")", getuid ()); +#endif return NULL; } @@ -1022,20 +1028,24 @@ get_user_fullname () char *result; pwd = get_user_pwd (); - if (pwd == NULL) - return NULL; +#if HAVE_PWD_H + if (pwd != NULL) + { + /* Return the pw_gecos field, upto the first comma (if any). */ + fullname = pwd->pw_gecos; + fullname_end = strchr (fullname, ','); + if (fullname_end == NULL) + fullname_end = fullname + strlen (fullname); - /* Return the pw_gecos field, upto the first comma (if any). */ - fullname = pwd->pw_gecos; - fullname_end = strchr (fullname, ','); - if (fullname_end == NULL) - fullname_end = fullname + strlen (fullname); + result = (char *) xmalloc (fullname_end - fullname + 1); + memcpy (result, fullname, fullname_end - fullname); + result[fullname_end - fullname] = '\0'; - result = (char *) xmalloc (fullname_end - fullname + 1); - memcpy (result, fullname, fullname_end - fullname); - result[fullname_end - fullname] = '\0'; + return result; + } +#endif - return result; + return NULL; } @@ -1061,7 +1071,7 @@ The new message catalog should contain your email address, so that users can\n\ give you feedback about the translations, and so that maintainers can contact\n\ you in case of unexpected technical problems.\n"); argv[3] = NULL; - child = create_pipe_in (prog, "/bin/sh", argv, "/dev/null", false, true, fd); + child = create_pipe_in (prog, "/bin/sh", argv, DEV_NULL, false, true, fd); /* Retrieve his answer. */ fp = fdopen (fd[0], "r"); @@ -1128,7 +1138,7 @@ language_team_address () argv[4] = (char *) catalogname; argv[5] = (char *) language; argv[6] = NULL; - child = create_pipe_in (prog, "/bin/sh", argv, "/dev/null", false, true, fd); + child = create_pipe_in (prog, "/bin/sh", argv, DEV_NULL, false, true, fd); /* Retrieve its result. */ fp = fdopen (fd[0], "r"); diff --git a/gettext-tools/src/read-java.c b/gettext-tools/src/read-java.c index ed6459138..5d9fbf132 100644 --- a/gettext-tools/src/read-java.c +++ b/gettext-tools/src/read-java.c @@ -63,7 +63,7 @@ execute_and_read_po_output (const char *progname, int exitstatus; /* Open a pipe to the JVM. */ - child = create_pipe_in (progname, prog_path, prog_argv, "/dev/null", false, + child = create_pipe_in (progname, prog_path, prog_argv, DEV_NULL, false, true, fd); fp = fdopen (fd[0], "r"); diff --git a/gettext-tools/src/read-tcl.c b/gettext-tools/src/read-tcl.c index 71567ce4f..38fdc07f0 100644 --- a/gettext-tools/src/read-tcl.c +++ b/gettext-tools/src/read-tcl.c @@ -100,8 +100,7 @@ msgdomain_read_tcl (const char *locale_name, const char *directory) } /* Open a pipe to the Tcl interpreter. */ - child = create_pipe_in ("tclsh", "tclsh", argv, "/dev/null", false, true, - fd); + child = create_pipe_in ("tclsh", "tclsh", argv, DEV_NULL, false, true, fd); fp = fdopen (fd[0], "r"); if (fp == NULL) diff --git a/gettext-tools/src/write-mo.c b/gettext-tools/src/write-mo.c index 1fcd36405..53e69013f 100644 --- a/gettext-tools/src/write-mo.c +++ b/gettext-tools/src/write-mo.c @@ -27,10 +27,13 @@ #include #include #include -#include #include #include +#if HAVE_SYS_PARAM_H +# include +#endif + /* These two include files describe the binary .mo format. */ #include "gmo.h" #include "hash-string.h"