From: "Juan Manuel Guerrero" Organization: Darmstadt University of Technology To: Bruno Haible Date: Wed, 28 Feb 2001 12:53:32 +0200 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: gettext pretest available CC: Eli Zaretskii , djgpp-workers AT delorie DOT com X-mailer: Pegasus Mail for Windows (v2.54DE) Message-ID: <343878750F9@HRZ1.hrz.tu-darmstadt.de> Reply-To: djgpp-workers AT delorie DOT com This is a new patch that accounts for all the issues discussed lats week. This is a minimal set of changes needed for DJGPP support. Some remarks: 1) The macros PATH_SEPARATOR and IS_ABSOLUTE_PATH are defined in lib/system.h so MSDOS specific path issues can be handled by the binaries. 2) The macros READ, WRITE and OPENED_IN_BINARY_MODE and the associated code has been removed. 3) The patch will **not** modify the intl/charset.alias and intl/localcharset.c at all. These files have already been modified in libiconv-1.6. Those changes should be applied here too. Bruno has the latest versions of this files, so *he* should copy them into gettext. I will *not* interfere here. 4) The patch contains a setmode macro. The goal of this code is to remember that this is a DJGPP specific *must have*. I know that this has been implemented in a different way in libiconv-1.6. That is ok. I will not care about the implementation as long as it is *not* forgotten. 5) The patch does *not* contain files from the djgpp/ subdir. I will submit those files as soon as possible. Regards, Guerrero, Juan Manuel diff -acprNC3 gettext-2001-02-05.orig/intl/dcigettext.c gettext-2001-02-05/intl/dcigettext.c *** gettext-2001-02-05.orig/intl/dcigettext.c Wed Jan 24 13:51:14 2001 --- gettext-2001-02-05/intl/dcigettext.c Tue Feb 27 22:40:34 2001 *************** DCIGETTEXT (domainname, msgid1, msgid2, *** 449,455 **** if (binding == NULL) dirname = (char *) _nl_default_dirname; ! else if (binding->dirname[0] == '/') dirname = binding->dirname; else { --- 449,455 ---- if (binding == NULL) dirname = (char *) _nl_default_dirname; ! else if (IS_ABSOLUTE_PATH(binding->dirname)) dirname = binding->dirname; else { diff -acprNC3 gettext-2001-02-05.orig/intl/gettextP.h gettext-2001-02-05/intl/gettextP.h *** gettext-2001-02-05.orig/intl/gettextP.h Wed Jan 24 19:04:10 2001 --- gettext-2001-02-05/intl/gettextP.h Wed Feb 28 00:28:08 2001 *************** extern void gettext_free_exp__ PARAMS (( *** 232,237 **** --- 232,270 ---- extern int gettextparse__ PARAMS ((void *arg)); #endif + /* MS-DOS and similar non-Posix systems have some peculiarities: + - they distinguish between binary and text files; + - they use both `/' and `\\' as directory separator in file names; + - they can have a drive letter X: prepended to a file name; + - they have a separate root directory on each drive; + - directories in environment variables (like PATH) are separated + by `;' rather than `:'; + These are all parameterized here. */ + + #include + /* For systems that distinguish between text and binary I/O. + O_BINARY is usually declared in . */ + #if !defined O_BINARY && defined _O_BINARY + /* For MSC-compatible compilers. */ + # define O_BINARY _O_BINARY + # define O_TEXT _O_TEXT + #endif + #ifdef __BEOS__ + /* BeOS 5 has O_BINARY and O_TEXT, but they have no effect. */ + # undef O_BINARY + # undef O_TEXT + #endif + #if O_BINARY + # define IS_DIR_SEPARATOR(path) (((path)[0]) == '/' || ((path)[0]) == '\\') + # define IS_DEVICE(path) (((path)[0]) && ((path)[1]) == ':') + # define IS_ABSOLUTE_PATH(path) (IS_DIR_SEPARATOR(path) || IS_DEVICE(path)) + # define PATH_SEPARATOR ';' + #else /* not O_BINARY */ + # define IS_ABSOLUTE_PATH(path) (((path)[0]) == '/') + # define PATH_SEPARATOR ':' + #endif /* not O_BINARY */ + /* End of OS specific parametrization. */ + /* @@ begin of epilog @@ */ #endif /* gettextP.h */ diff -acprNC3 gettext-2001-02-05.orig/intl/libgnuintl.h gettext-2001-02-05/intl/libgnuintl.h *** gettext-2001-02-05.orig/intl/libgnuintl.h Tue Feb 6 12:58:40 2001 --- gettext-2001-02-05/intl/libgnuintl.h Tue Feb 27 22:40:34 2001 *************** *** 39,44 **** --- 39,53 ---- # endif #endif + #ifdef __DJGPP__ + /* This will remove the conflict between the gettext function + from libintl.h and DJGPP's gettext function from conio.h. + GNU gettext takes *always* precedence over DJGPP's _conio_gettext. */ + # undef gettext + # define gettext gettext + # define __LIBINTL_H_INCLUDED__ + #endif /* not __DJGPP__ */ + #ifdef __cplusplus extern "C" { #endif diff -acprNC3 gettext-2001-02-05.orig/intl/localealias.c gettext-2001-02-05/intl/localealias.c *** gettext-2001-02-05.orig/intl/localealias.c Mon Jan 22 12:48:00 2001 --- gettext-2001-02-05/intl/localealias.c Wed Feb 28 00:38:34 2001 *************** _nl_expand_alias (name) *** 164,174 **** { const char *start; ! while (locale_alias_path[0] == ':') ++locale_alias_path; start = locale_alias_path; ! while (locale_alias_path[0] != '\0' && locale_alias_path[0] != ':') ++locale_alias_path; if (start < locale_alias_path) --- 164,174 ---- { const char *start; ! while (locale_alias_path[0] == PATH_SEPARATOR) ++locale_alias_path; start = locale_alias_path; ! while (locale_alias_path[0] != '\0' && locale_alias_path[0] != PATH_SEPARATOR) ++locale_alias_path; if (start < locale_alias_path) diff -acprNC3 gettext-2001-02-05.orig/lib/system.h gettext-2001-02-05/lib/system.h *** gettext-2001-02-05.orig/lib/system.h Mon Feb 5 18:38:02 2001 --- gettext-2001-02-05/lib/system.h Wed Feb 28 12:17:54 2001 *************** extern char *gnu_basename PARAMS ((const *** 129,141 **** #endif #include /* For systems that distinguish between text and binary I/O. O_BINARY is usually declared in . */ #if !defined O_BINARY && defined _O_BINARY /* For MSC-compatible compilers. */ ! # define O_BINARY _O_BINARY ! # define O_TEXT _O_TEXT #endif #ifdef __BEOS__ /* BeOS 5 has O_BINARY and O_TEXT, but they have no effect. */ --- 129,150 ---- #endif + /* MS-DOS and similar non-Posix systems have some peculiarities: + - they distinguish between binary and text files; + - they use both `/' and `\\' as directory separator in file names; + - they can have a drive letter X: prepended to a file name; + - they have a separate root directory on each drive; + - directories in environment variables (like PATH) are separated + by `;' rather than `:'; + These are all parameterized here. */ + #include /* For systems that distinguish between text and binary I/O. O_BINARY is usually declared in . */ #if !defined O_BINARY && defined _O_BINARY /* For MSC-compatible compilers. */ ! # define O_BINARY _O_BINARY ! # define O_TEXT _O_TEXT #endif #ifdef __BEOS__ /* BeOS 5 has O_BINARY and O_TEXT, but they have no effect. */ *************** extern char *gnu_basename PARAMS ((const *** 143,154 **** # undef O_TEXT #endif #if O_BINARY # if !(defined(__EMX__) || defined(__DJGPP__)) # define setmode _setmode ! # define fileno _fileno # endif ! #else ! # define setmode(fd, mode) /* nothing */ ! #endif #endif --- 152,181 ---- # undef O_TEXT #endif #if O_BINARY + # include /* setmode() is usually declared in . */ # if !(defined(__EMX__) || defined(__DJGPP__)) # define setmode _setmode ! # define fileno _fileno # endif ! # ifdef __DJGPP__ ! /* DJGPP's implementation of basename() ! knows about all the DOS path peculiarities. */ ! # undef basename ! # define basename basename ! # include /* declares isatty(). */ ! # define setmode(fd, mode) do { \ ! if (!isatty ((fd))) \ ! setmode ((fd), mode); \ ! } while (0) ! # endif /* not __DJGPP__ */ ! # define IS_DIR_SEPARATOR(path) (((path)[0]) == '/' || ((path)[0]) == '\\') ! # define IS_DEVICE(path) (((path)[0]) && ((path)[1]) == ':') ! # define IS_ABSOLUTE_PATH(path) (IS_DIR_SEPARATOR(path) || IS_DEVICE(path)) ! # define PATH_SEPARATOR ';' ! #else /* not O_BINARY */ ! # define setmode(fd, mode) /* nothing */ ! # define IS_ABSOLUTE_PATH(path) (((path)[0]) == '/') ! # define PATH_SEPARATOR ':' ! #endif /* not O_BINARY */ #endif diff -acprNC3 gettext-2001-02-05.orig/src/Makefile.am gettext-2001-02-05/src/Makefile.am *** gettext-2001-02-05.orig/src/Makefile.am Fri Jan 26 13:51:40 2001 --- gettext-2001-02-05/src/Makefile.am Tue Feb 27 22:40:34 2001 *************** localedir = $(datadir)/locale *** 32,38 **** INCLUDES = -I. -I$(srcdir) -I.. -I$(top_srcdir)/lib -I../intl \ -I$(top_srcdir)/intl DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ ! LDADD = ../lib/libnlsut.a @INTLLIBS@ SED = sed YACC = @YACC@ -d --- 32,38 ---- INCLUDES = -I. -I$(srcdir) -I.. -I$(top_srcdir)/lib -I../intl \ -I$(top_srcdir)/intl DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ ! LDADD = ../lib/libnlsut.a @INTLLIBS@ @LIBICONV@ SED = sed YACC = @YACC@ -d diff -acprNC3 gettext-2001-02-05.orig/src/msgcomm.c gettext-2001-02-05/src/msgcomm.c *** gettext-2001-02-05.orig/src/msgcomm.c Thu Jan 25 14:20:58 2001 --- gettext-2001-02-05/src/msgcomm.c Wed Feb 28 00:47:42 2001 *************** warranty; not even for MERCHANTABILITY o *** 300,306 **** the special name "-" we write to stdout. */ if (output_file) { ! if (output_file[0] == '/' || strcmp(output_dir, ".") == 0 || strcmp(output_file, "-") == 0 ) --- 300,306 ---- the special name "-" we write to stdout. */ if (output_file) { ! if (IS_ABSOLUTE_PATH(output_file) || strcmp(output_dir, ".") == 0 || strcmp(output_file, "-") == 0 ) diff -acprNC3 gettext-2001-02-05.orig/src/open-po.c gettext-2001-02-05/src/open-po.c *** gettext-2001-02-05.orig/src/open-po.c Mon Jan 22 12:48:00 2001 --- gettext-2001-02-05/src/open-po.c Wed Feb 28 00:49:44 2001 *************** open_po_file (input_name, file_name) *** 68,74 **** /* We have a real name for the input file. If the name is absolute, try the various extensions, but ignore the directory search list. */ ! if (*input_name == '/') { for (k = 0; k < SIZEOF (extension); ++k) { --- 68,74 ---- /* We have a real name for the input file. If the name is absolute, try the various extensions, but ignore the directory search list. */ ! if (IS_ABSOLUTE_PATH(input_name)) { for (k = 0; k < SIZEOF (extension); ++k) { diff -acprNC3 gettext-2001-02-05.orig/src/xget-lex.c gettext-2001-02-05/src/xget-lex.c *** gettext-2001-02-05.orig/src/xget-lex.c Sun Jan 21 16:08:46 2001 --- gettext-2001-02-05/src/xget-lex.c Wed Feb 28 00:55:22 2001 *************** xgettext_lex_open (fn) *** 149,155 **** logical_file_name = xstrdup (new_name); fp = stdin; } ! else if (*fn == '/') { new_name = xstrdup (fn); fp = fopen (fn, "r"); --- 149,155 ---- logical_file_name = xstrdup (new_name); fp = stdin; } ! else if (IS_ABSOLUTE_PATH(fn)) { new_name = xstrdup (fn); fp = fopen (fn, "r"); diff -acprNC3 gettext-2001-02-05.orig/src/xgettext.c gettext-2001-02-05/src/xgettext.c *** gettext-2001-02-05.orig/src/xgettext.c Mon Jan 22 12:48:00 2001 --- gettext-2001-02-05/src/xgettext.c Wed Feb 28 00:56:20 2001 *************** warranty; not even for MERCHANTABILITY o *** 428,434 **** the special name "-" we write to stdout. */ if (output_file) { ! if (output_file[0] == '/' || strcmp(output_dir, ".") == 0 || strcmp(output_file, "-") == 0) file_name = xstrdup (output_file); else --- 428,434 ---- the special name "-" we write to stdout. */ if (output_file) { ! if (IS_ABSOLUTE_PATH(output_file) || strcmp(output_dir, ".") == 0 || strcmp(output_file, "-") == 0) file_name = xstrdup (output_file); else diff -acprNC3 gettext-2001-02-05.orig/tests/Makefile.am gettext-2001-02-05/tests/Makefile.am *** gettext-2001-02-05.orig/tests/Makefile.am Fri Jan 26 13:51:40 2001 --- gettext-2001-02-05/tests/Makefile.am Tue Feb 27 22:40:34 2001 *************** xg-test1.ok.po: $(top_srcdir)/src/xgette *** 46,52 **** # Two auxiliary programs used by the tests. INCLUDES = -I.. -I$(top_srcdir)/lib -I$(top_srcdir)/intl DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ ! LDADD = ../intl/libintl.la EXTRA_PROGRAMS = tstgettext cake tstgettext_SOURCES = tstgettext.c setlocale.c tstgettext_LDADD = ../lib/libnlsut.a $(LDADD) --- 46,52 ---- # Two auxiliary programs used by the tests. INCLUDES = -I.. -I$(top_srcdir)/lib -I$(top_srcdir)/intl DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ ! LDADD = ../intl/libintl.la @LIBICONV@ EXTRA_PROGRAMS = tstgettext cake tstgettext_SOURCES = tstgettext.c setlocale.c tstgettext_LDADD = ../lib/libnlsut.a $(LDADD)