mirror of
https://https.git.savannah.gnu.org/git/gettext.git
synced 2026-01-26 15:39:11 +00:00
New include files xmalloc.h and strstr.h.
This commit is contained in:
parent
3acbafedd7
commit
7890459c6b
@ -1,3 +1,28 @@
|
||||
2001-09-09 Bruno Haible <haible@clisp.cons.org>
|
||||
|
||||
* xmalloc.h: New file.
|
||||
* strstr.h: New file.
|
||||
* system.h (xmalloc, xrealloc, xstrdup): Remove declarations, now in
|
||||
xmalloc.h.
|
||||
(parse_printf_format, asprintf): Remove declarations.
|
||||
(strstr): Remove declaration, now in strstr.h.
|
||||
* xmalloc.c: Include xmalloc.h. Modernize. Assume <stdlib.h> exists.
|
||||
* xstrdup.c: Include xmalloc.h. Modernize. Assume <string.h> exists.
|
||||
* concatpath.c: Include xmalloc.h.
|
||||
* findprog.c: Likewise.
|
||||
* fstrcmp.c: Include xmalloc.h instead of system.h.
|
||||
* javacomp.c: Likewise.
|
||||
* javaexec.c: Likewise.
|
||||
* sh-quote.c: Likewise.
|
||||
* hash.c: Include xmalloc.h. Don't declare xmalloc, xcalloc.
|
||||
* xgetcwd.c: Include stdlib.h and xmalloc.h. Don't declare xmalloc,
|
||||
xstrdup, free.
|
||||
* Makefile.am (libnlsut_a_HEADER): Add xmalloc.h.
|
||||
(LIBADD_HEADER): Add strstr.h.
|
||||
|
||||
* Makefile.am (INCLUDES): Add -I$(top_srcdir)/intl. Needed because
|
||||
some files include "libgettext.h", in the case $builddir != $srcdir.
|
||||
|
||||
2001-09-25 Bruno Haible <haible@clisp.cons.org>
|
||||
|
||||
* javacomp.c (compile_java_class): Recognize javac exit code 2.
|
||||
|
||||
@ -32,7 +32,7 @@ xmalloc.c xstrdup.c
|
||||
libnlsut_a_HEADER = c-ctype.h execute.h findprog.h fstrcmp.h full-write.h \
|
||||
gcd.h getopt.h hash.h javacomp.h javaexec.h lbrkprop.h linebreak.h mbswidth.h \
|
||||
obstack.h pathmax.h pipe.h progname.h sh-quote.h system.h tmpdir.h \
|
||||
utf8-ucs4.h utf16-ucs4.h wait-process.h xerror.h
|
||||
utf8-ucs4.h utf16-ucs4.h wait-process.h xerror.h xmalloc.h
|
||||
|
||||
# Sources that are compiled only on platforms that lack the functions.
|
||||
|
||||
@ -40,7 +40,7 @@ LIBADD_SOURCE = alloca.c error.c getline.c memset.c mkdtemp.c setenv.c \
|
||||
stpcpy.c stpncpy.c strcasecmp.c strcspn.c strncasecmp.c strpbrk.c strstr.c \
|
||||
strtol.c strtoul.c vasprintf.c
|
||||
|
||||
LIBADD_HEADER = error.h getline.h mkdtemp.h setenv.h strpbrk.h
|
||||
LIBADD_HEADER = error.h getline.h mkdtemp.h setenv.h strpbrk.h strstr.h
|
||||
|
||||
# Unused sources.
|
||||
|
||||
@ -60,7 +60,7 @@ stdbool.h.in \
|
||||
gen-lbrkprop.c 3level.h
|
||||
|
||||
DEFS = -DLIBDIR=\"$(libdir)\" @DEFS@
|
||||
INCLUDES = -I. -I$(srcdir) -I.. -I../intl
|
||||
INCLUDES = -I. -I$(srcdir) -I.. -I../intl -I$(top_srcdir)/intl
|
||||
|
||||
|
||||
all-local: @STDBOOL_H@
|
||||
|
||||
@ -25,6 +25,8 @@
|
||||
/* Specification. */
|
||||
#include "system.h"
|
||||
|
||||
#include "xmalloc.h"
|
||||
|
||||
/* Concatenate a directory pathname, a relative pathname and an optional
|
||||
suffix. The directory may end with the directory separator. The second
|
||||
argument may not start with the directory separator (it is relative).
|
||||
|
||||
@ -31,6 +31,7 @@
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "xmalloc.h"
|
||||
#include "system.h"
|
||||
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "xmalloc.h"
|
||||
|
||||
|
||||
/*
|
||||
@ -622,7 +622,7 @@ fstrcmp (string1, string2)
|
||||
((number of chars in common) / (average length of the strings)).
|
||||
This is admittedly biased towards finding that the strings are
|
||||
similar, however it does produce meaningful results. */
|
||||
return ((double) (string[0].data_length + string[1].data_length -
|
||||
string[1].edit_count - string[0].edit_count) / (string[0].data_length
|
||||
+ string[1].data_length));
|
||||
return ((double) (string[0].data_length + string[1].data_length
|
||||
- string[1].edit_count - string[0].edit_count)
|
||||
/ (string[0].data_length + string[1].data_length));
|
||||
}
|
||||
|
||||
@ -50,6 +50,8 @@
|
||||
# include <values.h>
|
||||
#endif
|
||||
|
||||
#include "xmalloc.h"
|
||||
|
||||
#define obstack_chunk_alloc xmalloc
|
||||
#define obstack_chunk_free free
|
||||
|
||||
@ -65,9 +67,6 @@
|
||||
# define bcopy(S, D, N) memcpy ((D), (S), (N))
|
||||
#endif
|
||||
|
||||
extern void *xmalloc PARAMS ((size_t __n));
|
||||
extern void *xcalloc PARAMS ((size_t __n, size_t __m));
|
||||
|
||||
typedef struct hash_entry
|
||||
{
|
||||
unsigned long used;
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
#include "execute.h"
|
||||
#include "setenv.h"
|
||||
#include "sh-quote.h"
|
||||
#include "system.h"
|
||||
#include "xmalloc.h"
|
||||
#include "error.h"
|
||||
#include "libgettext.h"
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
#include "execute.h"
|
||||
#include "setenv.h"
|
||||
#include "sh-quote.h"
|
||||
#include "system.h"
|
||||
#include "xmalloc.h"
|
||||
#include "error.h"
|
||||
#include "libgettext.h"
|
||||
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "strpbrk.h"
|
||||
#include "system.h"
|
||||
#include "xmalloc.h"
|
||||
|
||||
|
||||
#define SHELL_SPECIAL_CHARS "\t\n !\"#$&'()*;<=>?[\\]`{|}~"
|
||||
|
||||
36
lib/strstr.h
Normal file
36
lib/strstr.h
Normal file
@ -0,0 +1,36 @@
|
||||
/* Searching in a string.
|
||||
Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef PARAMS
|
||||
# if defined (__GNUC__) || __STDC__
|
||||
# define PARAMS(Args) Args
|
||||
# else
|
||||
# define PARAMS(Args) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if HAVE_STRSTR
|
||||
|
||||
/* Get strstr() declaration. */
|
||||
#include <string.h>
|
||||
|
||||
#else
|
||||
|
||||
/* Find the first occurrence of NEEDLE in HAYSTACK. */
|
||||
extern char *strstr PARAMS ((const char *haystack, const char *needle));
|
||||
|
||||
#endif
|
||||
@ -40,18 +40,11 @@ unsigned long strtoul ();
|
||||
|
||||
/* Wrapper functions with error checking for standard functions. */
|
||||
extern char *xgetcwd PARAMS ((void));
|
||||
extern void *xmalloc PARAMS ((size_t __n));
|
||||
extern void *xrealloc PARAMS ((void *__p, size_t __n));
|
||||
extern char *xstrdup PARAMS ((const char *__string));
|
||||
extern char *stpcpy PARAMS ((char *__dst, const char *__src));
|
||||
extern char *stpncpy PARAMS ((char *__dst, const char *__src, size_t __n));
|
||||
extern size_t parse_printf_format PARAMS ((const char *__fmt, size_t __n,
|
||||
int *__argtypes));
|
||||
extern int asprintf PARAMS ((char **, const char *, ...));
|
||||
extern int strcasecmp PARAMS ((const char *__s1, const char *__s2));
|
||||
extern int strncasecmp PARAMS ((const char *__s1, const char *__s2,
|
||||
size_t __n));
|
||||
extern char *strstr PARAMS ((const char *__str, const char *__sub));
|
||||
|
||||
#include <string.h>
|
||||
#if !STDC_HEADERS && HAVE_MEMORY_H
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#ifndef errno
|
||||
@ -37,9 +38,7 @@ char *getwd ();
|
||||
# define getcwd(Buf, Max) getwd (Buf)
|
||||
#endif
|
||||
|
||||
extern void *xmalloc ();
|
||||
extern char *xstrdup ();
|
||||
extern void free ();
|
||||
#include "xmalloc.h"
|
||||
|
||||
/* Return the current directory, newly allocated, arbitrarily long.
|
||||
Return NULL and set errno on error. */
|
||||
|
||||
@ -19,65 +19,35 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if __STDC__
|
||||
# define VOID void
|
||||
#else
|
||||
# define VOID char
|
||||
#endif
|
||||
/* Specification. */
|
||||
#include "xmalloc.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#if HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
VOID *calloc ();
|
||||
VOID *malloc ();
|
||||
VOID *realloc ();
|
||||
void free ();
|
||||
#endif
|
||||
|
||||
#if ENABLE_NLS
|
||||
# include <libintl.h>
|
||||
# define _(Text) gettext (Text)
|
||||
#else
|
||||
# define textdomain(Domain)
|
||||
# define _(Text) Text
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "error.h"
|
||||
#include "libgettext.h"
|
||||
|
||||
#ifndef EXIT_FAILURE
|
||||
# define EXIT_FAILURE 1
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
# define NULL ((VOID *) 0)
|
||||
#endif
|
||||
#define _(str) gettext (str)
|
||||
|
||||
/* Prototypes for functions defined here. */
|
||||
#if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
|
||||
static VOID *fixup_null_alloc (size_t n);
|
||||
VOID *xmalloc (size_t n);
|
||||
VOID *xcalloc (size_t n, size_t s);
|
||||
VOID *xrealloc (VOID *p, size_t n);
|
||||
#endif
|
||||
|
||||
/* Prototypes for local functions. Needed to ensure compiler checking of
|
||||
function argument counts despite of K&R C function definition syntax. */
|
||||
static void *fixup_null_alloc PARAMS ((size_t n));
|
||||
|
||||
|
||||
/* Exit value when the requested amount of memory is not available.
|
||||
The caller may set it to some other value. */
|
||||
int xmalloc_exit_failure = EXIT_FAILURE;
|
||||
|
||||
#if __STDC__ && (HAVE_VPRINTF || HAVE_DOPRNT)
|
||||
extern void error (int, int, const char *, ...);
|
||||
#else
|
||||
extern void error ();
|
||||
#endif
|
||||
|
||||
static VOID *
|
||||
static void *
|
||||
fixup_null_alloc (n)
|
||||
size_t n;
|
||||
{
|
||||
VOID *p;
|
||||
void *p;
|
||||
|
||||
p = 0;
|
||||
if (n == 0)
|
||||
@ -89,11 +59,11 @@ fixup_null_alloc (n)
|
||||
|
||||
/* Allocate N bytes of memory dynamically, with error checking. */
|
||||
|
||||
VOID *
|
||||
void *
|
||||
xmalloc (n)
|
||||
size_t n;
|
||||
{
|
||||
VOID *p;
|
||||
void *p;
|
||||
|
||||
p = malloc (n);
|
||||
if (p == NULL)
|
||||
@ -103,11 +73,11 @@ xmalloc (n)
|
||||
|
||||
/* Allocate memory for N elements of S bytes, with error checking. */
|
||||
|
||||
VOID *
|
||||
void *
|
||||
xcalloc (n, s)
|
||||
size_t n, s;
|
||||
{
|
||||
VOID *p;
|
||||
void *p;
|
||||
|
||||
p = calloc (n, s);
|
||||
if (p == NULL)
|
||||
@ -119,9 +89,9 @@ xcalloc (n, s)
|
||||
with error checking.
|
||||
If P is NULL, run xmalloc. */
|
||||
|
||||
VOID *
|
||||
void *
|
||||
xrealloc (p, n)
|
||||
VOID *p;
|
||||
void *p;
|
||||
size_t n;
|
||||
{
|
||||
if (p == NULL)
|
||||
|
||||
44
lib/xmalloc.h
Normal file
44
lib/xmalloc.h
Normal file
@ -0,0 +1,44 @@
|
||||
/* malloc with out of memory checking.
|
||||
Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
Written by Bruno Haible <haible@clisp.cons.org>, 2001.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _XMALLOC_H
|
||||
#define _XMALLOC_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
/* Defined in xmalloc.c. */
|
||||
|
||||
/* Allocate SIZE bytes of memory dynamically, with error checking. */
|
||||
extern void *xmalloc PARAMS ((size_t size));
|
||||
|
||||
/* Allocate memory for NMEMB elements of SIZE bytes, with error checking. */
|
||||
extern void *xcalloc PARAMS ((size_t nmemb, size_t size));
|
||||
|
||||
/* Change the size of an allocated block of memory PTR to SIZE bytes,
|
||||
with error checking. If PTR is NULL, run xmalloc. */
|
||||
extern void *xrealloc PARAMS ((void *ptr, size_t size));
|
||||
|
||||
|
||||
/* Defined in xstrdup.c. */
|
||||
|
||||
/* Return a newly allocated copy of STRING. */
|
||||
extern char *xstrdup PARAMS ((const char *string));
|
||||
|
||||
|
||||
#endif /* _XMALLOC_H */
|
||||
@ -1,5 +1,5 @@
|
||||
/* xstrdup.c -- copy a string with out of memory checking
|
||||
Copyright (C) 1990, 1996, 2000 Free Software Foundation, Inc.
|
||||
Copyright (C) 1990, 1996, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -19,17 +19,10 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#else
|
||||
# include <strings.h>
|
||||
#endif
|
||||
/* Specification. */
|
||||
#include "xmalloc.h"
|
||||
|
||||
#if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
|
||||
extern char *xmalloc (size_t);
|
||||
#else
|
||||
extern char *xmalloc ();
|
||||
#endif
|
||||
#include <string.h>
|
||||
|
||||
/* Return a newly allocated copy of STRING. */
|
||||
|
||||
|
||||
@ -1,3 +1,37 @@
|
||||
2001-09-09 Bruno Haible <haible@clisp.cons.org>
|
||||
|
||||
* file-list.c: Include system.h.
|
||||
* format-c.c: Include xmalloc.h instead of system.h.
|
||||
* format-ycp.c: Likewise.
|
||||
* read-po.c: Likewise.
|
||||
* x-po.c: Likewise.
|
||||
* format-java.c: Include xmalloc.h.
|
||||
* format-lisp.c: Likewise.
|
||||
* format-python.c: Likewise.
|
||||
* gettext.c: Likewise.
|
||||
* msgen.c: Likewise.
|
||||
* msgexec.c: Likewise.
|
||||
* msggrep.c: Likewise.
|
||||
* ngettext.c: Likewise.
|
||||
* po-lex.c: Likewise.
|
||||
* read-mo.c: Likewise.
|
||||
* x-c.c: Likewise.
|
||||
* message.c: Include xmalloc.h and strstr.h.
|
||||
* msgfmt.c: Likewise.
|
||||
* write-po.c: Likewise.
|
||||
* msgl-cat.c: Include string.h, xmalloc.h and strstr.h.
|
||||
* msgl-iconv.c: Likewise.
|
||||
* msgl-charset.c: Include strstr.h.
|
||||
* po-charset.c: Likewise.
|
||||
* po-gram-gen.y: Include stdlib.h, xmalloc.h instead of system.h.
|
||||
* po-hash-gen.y: Likewise.
|
||||
* str-list.c: Likewise.
|
||||
* po.c: Include string.h, xmalloc.h instead of system.h.
|
||||
* write-java.c: Include string.h, xmalloc.h.
|
||||
* x-java.l: Include stdlib.h, xmalloc.h, strstr.h instead of system.h.
|
||||
* xgettext.c: Include xmalloc.h, strstr.h, xerror.h.
|
||||
(main, construct_header): Use xasprintf instead of asprintf.
|
||||
|
||||
2001-09-24 Bruno Haible <haible@clisp.cons.org>
|
||||
|
||||
* po-lex.c (mb_iseq): Compare the byte sequence, not the Unicode
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
|
||||
#include "str-list.h"
|
||||
#include "error.h"
|
||||
#include "system.h"
|
||||
#include "getline.h"
|
||||
#include "libgettext.h"
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "format.h"
|
||||
#include "system.h"
|
||||
#include "xmalloc.h"
|
||||
#include "error.h"
|
||||
#include "progname.h"
|
||||
#include "libgettext.h"
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
|
||||
#include "format.h"
|
||||
#include "c-ctype.h"
|
||||
#include "xmalloc.h"
|
||||
#include "system.h"
|
||||
#include "error.h"
|
||||
#include "progname.h"
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
#include "format.h"
|
||||
#include "c-ctype.h"
|
||||
#include "gcd.h"
|
||||
#include "xmalloc.h"
|
||||
#include "system.h"
|
||||
#include "error.h"
|
||||
#include "progname.h"
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "format.h"
|
||||
#include "xmalloc.h"
|
||||
#include "system.h"
|
||||
#include "error.h"
|
||||
#include "progname.h"
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "format.h"
|
||||
#include "system.h"
|
||||
#include "xmalloc.h"
|
||||
#include "error.h"
|
||||
#include "progname.h"
|
||||
#include "libgettext.h"
|
||||
|
||||
@ -27,6 +27,7 @@
|
||||
#include <locale.h>
|
||||
|
||||
#include "error.h"
|
||||
#include "xmalloc.h"
|
||||
#include "system.h"
|
||||
|
||||
#ifdef TESTS
|
||||
|
||||
@ -28,6 +28,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#include <string.h>
|
||||
|
||||
#include "fstrcmp.h"
|
||||
#include "xmalloc.h"
|
||||
#include "strstr.h"
|
||||
#include "system.h"
|
||||
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
#include "error.h"
|
||||
#include "progname.h"
|
||||
#include "message.h"
|
||||
#include <system.h>
|
||||
#include "system.h"
|
||||
#include "libgettext.h"
|
||||
#include "po.h"
|
||||
#include "str-list.h"
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
#include "message.h"
|
||||
#include "read-po.h"
|
||||
#include "write-po.h"
|
||||
#include "xmalloc.h"
|
||||
#include "system.h"
|
||||
#include "libgettext.h"
|
||||
|
||||
|
||||
@ -44,6 +44,7 @@
|
||||
#include "write-po.h"
|
||||
#include "str-list.h"
|
||||
#include "msgl-charset.h"
|
||||
#include "xmalloc.h"
|
||||
#include "system.h"
|
||||
#include "findprog.h"
|
||||
#include "pipe.h"
|
||||
|
||||
@ -34,6 +34,8 @@
|
||||
#include "xerror.h"
|
||||
#include "getline.h"
|
||||
#include "format.h"
|
||||
#include "xmalloc.h"
|
||||
#include "strstr.h"
|
||||
#include "system.h"
|
||||
#include "msgfmt.h"
|
||||
#include "write-mo.h"
|
||||
|
||||
@ -42,6 +42,7 @@
|
||||
#include "write-po.h"
|
||||
#include "str-list.h"
|
||||
#include "msgl-charset.h"
|
||||
#include "xmalloc.h"
|
||||
#include "system.h"
|
||||
#include "full-write.h"
|
||||
#include "findprog.h"
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
#include "msgl-cat.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "error.h"
|
||||
#include "xerror.h"
|
||||
@ -33,6 +34,8 @@
|
||||
#include "po-charset.h"
|
||||
#include "msgl-ascii.h"
|
||||
#include "msgl-iconv.h"
|
||||
#include "xmalloc.h"
|
||||
#include "strstr.h"
|
||||
#include "system.h"
|
||||
#include "libgettext.h"
|
||||
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
#include "progname.h"
|
||||
#include "xerror.h"
|
||||
#include "message.h"
|
||||
#include "strstr.h"
|
||||
#include "system.h"
|
||||
#include "libgettext.h"
|
||||
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if HAVE_ICONV
|
||||
# include <iconv.h>
|
||||
@ -36,6 +37,8 @@
|
||||
#include "message.h"
|
||||
#include "po-charset.h"
|
||||
#include "msgl-ascii.h"
|
||||
#include "xmalloc.h"
|
||||
#include "strstr.h"
|
||||
#include "system.h"
|
||||
#include "libgettext.h"
|
||||
|
||||
|
||||
@ -27,6 +27,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include "error.h"
|
||||
#include "xmalloc.h"
|
||||
#include "system.h"
|
||||
|
||||
#include "libgettext.h"
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
|
||||
#include "error.h"
|
||||
#include "xerror.h"
|
||||
#include "strstr.h"
|
||||
#include "system.h"
|
||||
#include "libgettext.h"
|
||||
|
||||
|
||||
@ -26,11 +26,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#include "po-gram.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "str-list.h"
|
||||
#include "po-lex.h"
|
||||
#include "error.h"
|
||||
#include "system.h"
|
||||
#include "xmalloc.h"
|
||||
#include "libgettext.h"
|
||||
#include "po.h"
|
||||
|
||||
|
||||
@ -27,8 +27,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#include "po-hash.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "xmalloc.h"
|
||||
#include "po.h"
|
||||
|
||||
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
|
||||
|
||||
@ -57,6 +57,7 @@
|
||||
|
||||
#include "str-list.h"
|
||||
#include "po-charset.h"
|
||||
#include "xmalloc.h"
|
||||
#include "system.h"
|
||||
#include "error.h"
|
||||
#include "open-po.h"
|
||||
|
||||
3
src/po.c
3
src/po.c
@ -26,10 +26,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#include "po.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "po-charset.h"
|
||||
#include "po-hash.h"
|
||||
#include "system.h"
|
||||
#include "xmalloc.h"
|
||||
|
||||
/* Prototypes for local functions. Needed to ensure compiler checking of
|
||||
function argument counts despite of K&R C function definition syntax. */
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
#include "gettext.h"
|
||||
|
||||
#include "error.h"
|
||||
#include "xmalloc.h"
|
||||
#include "system.h"
|
||||
#include "message.h"
|
||||
#include "libgettext.h"
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "po.h"
|
||||
#include "system.h"
|
||||
#include "xmalloc.h"
|
||||
#include "libgettext.h"
|
||||
|
||||
#define _(str) gettext (str)
|
||||
|
||||
@ -25,8 +25,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#include "str-list.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "system.h"
|
||||
#include "xmalloc.h"
|
||||
|
||||
|
||||
/* Initialize an empty list of strings. */
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
@ -70,6 +71,7 @@
|
||||
#include "pathmax.h"
|
||||
#include "plural-exp.h"
|
||||
#include "po-charset.h"
|
||||
#include "xmalloc.h"
|
||||
#include "system.h"
|
||||
#include "tmpdir.h"
|
||||
#include "utf8-ucs4.h"
|
||||
|
||||
@ -37,6 +37,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#include "c-ctype.h"
|
||||
#include "linebreak.h"
|
||||
#include "msgl-ascii.h"
|
||||
#include "xmalloc.h"
|
||||
#include "strstr.h"
|
||||
#include "system.h"
|
||||
#include "error.h"
|
||||
#include "xerror.h"
|
||||
|
||||
@ -33,6 +33,7 @@
|
||||
#include "xgettext.h"
|
||||
#include "error.h"
|
||||
#include "progname.h"
|
||||
#include "xmalloc.h"
|
||||
#include "system.h"
|
||||
#include "hash.h"
|
||||
#include "libgettext.h"
|
||||
|
||||
@ -22,12 +22,14 @@
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "message.h"
|
||||
#include "x-java.h"
|
||||
#include "xgettext.h"
|
||||
#include "system.h"
|
||||
#include "xmalloc.h"
|
||||
#include "strstr.h"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
#include "message.h"
|
||||
#include "x-po.h"
|
||||
#include "xgettext.h"
|
||||
#include "system.h"
|
||||
#include "xmalloc.h"
|
||||
#include "po.h"
|
||||
#include "po-lex.h"
|
||||
#include "libgettext.h"
|
||||
|
||||
@ -43,6 +43,9 @@
|
||||
#include "progname.h"
|
||||
#include "xerror.h"
|
||||
#include "getline.h"
|
||||
#include "xmalloc.h"
|
||||
#include "strstr.h"
|
||||
#include "xerror.h"
|
||||
#include "system.h"
|
||||
#include "po.h"
|
||||
#include "message.h"
|
||||
@ -311,13 +314,7 @@ main (argc, argv)
|
||||
if (optarg[len - 1] == '/')
|
||||
output_dir = xstrdup (optarg);
|
||||
else
|
||||
{
|
||||
asprintf (&output_dir, "%s/", optarg);
|
||||
if (output_dir == NULL)
|
||||
/* We are about to construct the absolute path to the
|
||||
directory for the output files but asprintf failed. */
|
||||
error (EXIT_FAILURE, errno, _("while preparing output"));
|
||||
}
|
||||
output_dir = xasprintf ("%s/", optarg);
|
||||
}
|
||||
break;
|
||||
case 's':
|
||||
@ -1103,7 +1100,7 @@ construct_header ()
|
||||
tz_sign = '-';
|
||||
}
|
||||
|
||||
asprintf (&msgstr, "\
|
||||
msgstr = xasprintf ("\
|
||||
Project-Id-Version: PACKAGE VERSION\n\
|
||||
POT-Creation-Date: %d-%02d-%02d %02d:%02d%c%02ld%02ld\n\
|
||||
PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n\
|
||||
@ -1119,9 +1116,6 @@ Content-Transfer-Encoding: 8bit\n",
|
||||
local_time.tm_min,
|
||||
tz_sign, tz_min / 60, tz_min % 60);
|
||||
|
||||
if (msgstr == NULL)
|
||||
error (EXIT_FAILURE, errno, _("while preparing output"));
|
||||
|
||||
mp = message_alloc ("", NULL, msgstr, strlen (msgstr) + 1, &pos);
|
||||
|
||||
if (foreign_user)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user