summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog23
-rw-r--r--ltdl/m4/gnulib-cache.m44
-rw-r--r--m4/debug.c6
-rw-r--r--m4/input.c34
-rw-r--r--m4/macro.c2
-rw-r--r--m4/module.c8
-rw-r--r--m4/output.c29
-rw-r--r--m4/path.c8
-rw-r--r--m4/symtab.c6
-rw-r--r--m4/syntax.c12
-rw-r--r--m4/system_.h17
-rw-r--r--modules/modtest.c2
-rw-r--r--po/Makevars2
-rw-r--r--po/POTFILES.in1
-rw-r--r--src/freeze.c24
-rw-r--r--src/main.c10
16 files changed, 108 insertions, 80 deletions
diff --git a/ChangeLog b/ChangeLog
index 195bde9a..0e927bde 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+2007-10-22 Eric Blake <ebb9@byu.net>
+
+ Never let printf failures go undetected.
+ * ltdl/m4/gnulib-cache.m4: Augment with 'gnulib-tool --import
+ xprintf'.
+ * m4/system_.h: Include xprintf.h.
+ * m4/debug.c (m4_debug_message_prefix, m4_debug_message): Wrap all
+ use of printf, xprintf.
+ * m4/input.c [DEBUG_INPUT]: Likewise.
+ * m4/module.c [DEBUG_MODULES]: Likewise.
+ * m4/output.c (m4_shipout_text, m4_shipout_int)
+ (m4_freeze_diversions): Likewise.
+ * m4/path.c [DEBUG_INCL]: Likewise.
+ * m4/symtab.c [DEBUG_SYM]: Likewise.
+ * m4/syntax.c [DEBUG_SYNTAX]: Likewise.
+ * modules/modtest.c (export_test): Likewise.
+ * src/freeze.c (produce_resyntax_dump, produce_syntax_dump)
+ (produce_module_dump, dump_symbol_CB, produce_frozen_state):
+ Likewise.
+ * src/main.c (usage): Likewise.
+ * po/POTFILES.in: Adjust to new file.
+ * po/Makevars (XGETTEXT_OPTIONS): Likewise.
+
2007-10-18 Eric Blake <ebb9@byu.net>
Fix 'm4 -F file -t undefined'.
diff --git a/ltdl/m4/gnulib-cache.m4 b/ltdl/m4/gnulib-cache.m4
index 5ca87d62..a0517eb3 100644
--- a/ltdl/m4/gnulib-cache.m4
+++ b/ltdl/m4/gnulib-cache.m4
@@ -15,11 +15,11 @@
# Specification in the form of a command-line invocation:
-# gnulib-tool --import --dir=. --local-dir=local --lib=libgnu --source-base=gnu --m4-base=ltdl/m4 --doc-base=doc --aux-dir=ltdl/config --with-tests --libtool --macro-prefix=M4 assert autobuild avltree-oset binary-io clean-temp cloexec close-stream closein config-h configmake dirname error exit fdl fflush filenamecat fopen-safer fprintf-posix free fseeko gendocs gettext gnupload gpl-3.0 mkstemp obstack progname regex regexprops-generic sprintf-posix stdbool stdlib-safer strnlen strtol tempname unlocked-io vasprintf-posix verror xalloc xalloc-die xstrndup xvasprintf
+# gnulib-tool --import --dir=. --local-dir=local --lib=libgnu --source-base=gnu --m4-base=ltdl/m4 --doc-base=doc --aux-dir=ltdl/config --with-tests --libtool --macro-prefix=M4 assert autobuild avltree-oset binary-io clean-temp cloexec close-stream closein config-h configmake dirname error exit fdl fflush filenamecat fopen-safer fprintf-posix free fseeko gendocs gettext gnupload gpl-3.0 mkstemp obstack progname regex regexprops-generic sprintf-posix stdbool stdlib-safer strnlen strtol tempname unlocked-io vasprintf-posix verror xalloc xalloc-die xprintf xstrndup xvasprintf
# Specification in the form of a few gnulib-tool.m4 macro invocations:
gl_LOCAL_DIR([local])
-gl_MODULES([assert autobuild avltree-oset binary-io clean-temp cloexec close-stream closein config-h configmake dirname error exit fdl fflush filenamecat fopen-safer fprintf-posix free fseeko gendocs gettext gnupload gpl-3.0 mkstemp obstack progname regex regexprops-generic sprintf-posix stdbool stdlib-safer strnlen strtol tempname unlocked-io vasprintf-posix verror xalloc xalloc-die xstrndup xvasprintf])
+gl_MODULES([assert autobuild avltree-oset binary-io clean-temp cloexec close-stream closein config-h configmake dirname error exit fdl fflush filenamecat fopen-safer fprintf-posix free fseeko gendocs gettext gnupload gpl-3.0 mkstemp obstack progname regex regexprops-generic sprintf-posix stdbool stdlib-safer strnlen strtol tempname unlocked-io vasprintf-posix verror xalloc xalloc-die xprintf xstrndup xvasprintf])
gl_AVOID([])
gl_SOURCE_BASE([gnu])
gl_M4_BASE([ltdl/m4])
diff --git a/m4/debug.c b/m4/debug.c
index 47ea114b..c90efde1 100644
--- a/m4/debug.c
+++ b/m4/debug.c
@@ -209,9 +209,9 @@ m4_debug_message_prefix (m4 *context)
if (m4_get_current_line (context))
{
if (m4_is_debug_bit (context, M4_DEBUG_TRACE_FILE))
- fprintf (debug_file, "%s:", m4_get_current_file (context));
+ xfprintf (debug_file, "%s:", m4_get_current_file (context));
if (m4_is_debug_bit (context, M4_DEBUG_TRACE_LINE))
- fprintf (debug_file, "%d:", m4_get_current_line (context));
+ xfprintf (debug_file, "%d:", m4_get_current_line (context));
}
putc (' ', debug_file);
}
@@ -233,7 +233,7 @@ m4_debug_message (m4 *context, int mode, const char *format, ...)
m4_debug_message_prefix (context);
va_start (args, format);
- vfprintf (m4_get_debug_file (context), format, args);
+ xvfprintf (m4_get_debug_file (context), format, args);
va_end (args);
putc ('\n', m4_get_debug_file (context));
}
diff --git a/m4/input.c b/m4/input.c
index 03b9ce0e..e5e7c924 100644
--- a/m4/input.c
+++ b/m4/input.c
@@ -1019,7 +1019,7 @@ m4__next_token (m4 *context, m4_symbol_value *token, int *line)
if (ch == CHAR_EOF) /* EOF */
{
#ifdef DEBUG_INPUT
- fprintf (stderr, "next_token -> EOF\n");
+ xfprintf (stderr, "next_token -> EOF\n");
#endif
next_char (context, true);
return M4_TOKEN_EOF;
@@ -1173,12 +1173,12 @@ m4__next_token (m4 *context, m4_symbol_value *token, int *line)
if (m4_has_syntax (M4SYNTAX, ch,
(M4_SYNTAX_OTHER | M4_SYNTAX_NUM | M4_SYNTAX_DOLLAR
- | M4_SYNTAX_LBRACE | M4_SYNTAX_RBRACE)))
+ | M4_SYNTAX_LBRACE | M4_SYNTAX_RBRACE)))
{
consume_syntax (context, &token_stack,
(M4_SYNTAX_OTHER | M4_SYNTAX_NUM
- | M4_SYNTAX_DOLLAR | M4_SYNTAX_LBRACE
- | M4_SYNTAX_RBRACE));
+ | M4_SYNTAX_DOLLAR | M4_SYNTAX_LBRACE
+ | M4_SYNTAX_RBRACE));
type = M4_TOKEN_STRING;
}
else if (m4_has_syntax (M4SYNTAX, ch, M4_SYNTAX_SPACE))
@@ -1199,7 +1199,7 @@ m4__next_token (m4 *context, m4_symbol_value *token, int *line)
if (m4_has_syntax (M4SYNTAX, ch,
(M4_SYNTAX_OTHER | M4_SYNTAX_NUM | M4_SYNTAX_DOLLAR
- | M4_SYNTAX_LBRACE | M4_SYNTAX_RBRACE)))
+ | M4_SYNTAX_LBRACE | M4_SYNTAX_RBRACE)))
type = M4_TOKEN_STRING;
else if (m4_has_syntax (M4SYNTAX, ch, M4_SYNTAX_SPACE))
type = M4_TOKEN_SPACE;
@@ -1249,43 +1249,43 @@ m4__next_token_is_open (m4 *context)
int
m4_print_token (const char *s, m4__token_type type, m4_symbol_value *token)
{
- fprintf (stderr, "%s: ", s ? s : "m4input");
+ xfprintf (stderr, "%s: ", s ? s : "m4input");
switch (type)
{ /* TOKSW */
case M4_TOKEN_EOF:
- fprintf (stderr, "eof\n");
+ xfprintf (stderr, "eof\n");
break;
case M4_TOKEN_NONE:
- fprintf (stderr, "none\n");
+ xfprintf (stderr, "none\n");
break;
case M4_TOKEN_STRING:
- fprintf (stderr, "string\t\"%s\"\n", m4_get_symbol_value_text (token));
+ xfprintf (stderr, "string\t\"%s\"\n", m4_get_symbol_value_text (token));
break;
case M4_TOKEN_SPACE:
- fprintf (stderr, "space\t\"%s\"\n", m4_get_symbol_value_text (token));
+ xfprintf (stderr, "space\t\"%s\"\n", m4_get_symbol_value_text (token));
break;
case M4_TOKEN_WORD:
- fprintf (stderr, "word\t\"%s\"\n", m4_get_symbol_value_text (token));
+ xfprintf (stderr, "word\t\"%s\"\n", m4_get_symbol_value_text (token));
break;
case M4_TOKEN_OPEN:
- fprintf (stderr, "open\t\"%s\"\n", m4_get_symbol_value_text (token));
+ xfprintf (stderr, "open\t\"%s\"\n", m4_get_symbol_value_text (token));
break;
case M4_TOKEN_COMMA:
- fprintf (stderr, "comma\t\"%s\"\n", m4_get_symbol_value_text (token));
+ xfprintf (stderr, "comma\t\"%s\"\n", m4_get_symbol_value_text (token));
break;
case M4_TOKEN_CLOSE:
- fprintf (stderr, "close\t\"%s\"\n", m4_get_symbol_value_text (token));
+ xfprintf (stderr, "close\t\"%s\"\n", m4_get_symbol_value_text (token));
break;
case M4_TOKEN_SIMPLE:
- fprintf (stderr, "simple\t\"%s\"\n", m4_get_symbol_value_text (token));
+ xfprintf (stderr, "simple\t\"%s\"\n", m4_get_symbol_value_text (token));
break;
case M4_TOKEN_MACDEF:
{
const m4_builtin *bp;
bp = m4_builtin_find_by_func (NULL, m4_get_symbol_value_func (token));
assert (bp);
- fprintf (stderr, "builtin\t<%s>{%s}\n", bp->name,
- m4_get_module_name (VALUE_MODULE (token)));
+ xfprintf (stderr, "builtin\t<%s>{%s}\n", bp->name,
+ m4_get_module_name (VALUE_MODULE (token)));
}
break;
}
diff --git a/m4/macro.c b/m4/macro.c
index ab68bb86..3628a49c 100644
--- a/m4/macro.c
+++ b/m4/macro.c
@@ -46,7 +46,7 @@ static void trace_post (m4 *, const char *, size_t, int,
m4_symbol_value **, m4_input_block *, bool);
static void trace_format (m4 *, const char *, ...)
- M4_GNUC_PRINTF(2, 3);
+ M4_GNUC_PRINTF (2, 3);
static void trace_header (m4 *, size_t);
static void trace_flush (m4 *);
diff --git a/m4/module.c b/m4/module.c
index 4c68c0ac..458808eb 100644
--- a/m4/module.c
+++ b/m4/module.c
@@ -405,8 +405,8 @@ m4__module_open (m4 *context, const char *name, m4_obstack *obs)
#ifdef DEBUG_MODULES
if (info->ref_count > 1)
{
- fprintf (stderr, "module %s: now has %d libtool references.",
- name, info->ref_count);
+ xfprintf (stderr, "module %s: now has %d libtool references.",
+ name, info->ref_count);
}
#endif /* DEBUG_MODULES */
@@ -545,8 +545,8 @@ module_remove (m4 *context, m4_module *module, m4_obstack *obs)
#ifdef DEBUG_MODULES
if (info->ref_count > 1)
{
- fprintf (stderr, "module %s: now has %d libtool references.",
- name, info->ref_count - 1);
+ xfprintf (stderr, "module %s: now has %d libtool references.",
+ name, info->ref_count - 1);
}
#endif /* DEBUG_MODULES */
diff --git a/m4/output.c b/m4/output.c
index 751aba72..1f8d1b0e 100644
--- a/m4/output.c
+++ b/m4/output.c
@@ -24,8 +24,9 @@
#include "binary-io.h"
#include "clean-temp.h"
-#include "gl_avltree_oset.h"
#include "exitfail.h"
+#include "gl_avltree_oset.h"
+#include "intprops.h"
#include "xvasprintf.h"
/* Define this to see runtime debug output. Implied by DEBUG. */
@@ -465,7 +466,7 @@ m4_shipout_text (m4 *context, m4_obstack *obs,
const char *text, size_t length, int line)
{
static bool start_of_output_line = true;
- char linebuf[20];
+ char linebuf[6 + INT_BUFSIZE_BOUND (unsigned long int)]; /* "#line nnnn" */
const char *cursor;
/* If output goes to an obstack, merely add TEXT to it. */
@@ -517,9 +518,9 @@ m4_shipout_text (m4 *context, m4_obstack *obs,
m4_set_output_line (context, m4_get_output_line (context) + 1);
#ifdef DEBUG_OUTPUT
- fprintf (stderr, "DEBUG: line %d, cur %lu, cur out %lu\n", line,
- (unsigned long int) m4_get_current_line (context),
- (unsigned long int) m4_get_output_line (context));
+ xfprintf (stderr, "DEBUG: line %d, cur %lu, cur out %lu\n", line,
+ (unsigned long int) m4_get_current_line (context),
+ (unsigned long int) m4_get_output_line (context));
#endif
/* Output a `#line NUM' synchronization directive if needed.
@@ -558,9 +559,9 @@ m4_shipout_text (m4 *context, m4_obstack *obs,
m4_set_output_line (context, m4_get_output_line (context) + 1);
#ifdef DEBUG_OUTPUT
- fprintf (stderr, "DEBUG: line %d, cur %lu, cur out %lu\n", line,
- (unsigned long int) m4_get_current_line (context),
- (unsigned long int) m4_get_output_line (context));
+ xfprintf (stderr, "DEBUG: line %d, cur %lu, cur out %lu\n", line,
+ (unsigned long int) m4_get_current_line (context),
+ (unsigned long int) m4_get_output_line (context));
#endif
}
OUTPUT_CHARACTER (*text);
@@ -576,7 +577,7 @@ m4_shipout_text (m4 *context, m4_obstack *obs,
void
m4_shipout_int (m4_obstack *obs, int val)
{
- char buf[128];
+ char buf[INT_BUFSIZE_BOUND (int)];
sprintf(buf, "%d", val);
obstack_grow (obs, buf, strlen (buf));
@@ -845,8 +846,8 @@ m4_freeze_diversions (m4 *context, FILE *file)
if (diversion->size)
{
assert (diversion->used == (int) diversion->used);
- fprintf (file, "D%d,%d\n", diversion->divnum,
- (int) diversion->used);
+ xfprintf (file, "D%d,%d\n", diversion->divnum,
+ (int) diversion->used);
}
else
{
@@ -863,8 +864,8 @@ m4_freeze_diversions (m4 *context, FILE *file)
|| file_stat.st_size != (unsigned long int) file_stat.st_size)
m4_error (context, EXIT_FAILURE, errno,
_("diversion too large"));
- fprintf (file, "D%d,%lu\n", diversion->divnum,
- (unsigned long int) file_stat.st_size);
+ xfprintf (file, "D%d,%lu\n", diversion->divnum,
+ (unsigned long int) file_stat.st_size);
}
insert_diversion_helper (context, diversion);
@@ -878,5 +879,5 @@ m4_freeze_diversions (m4 *context, FILE *file)
/* Save the active diversion number, if not already. */
if (saved_number != last_inserted)
- fprintf (file, "D%d,0\n\n", saved_number);
+ xfprintf (file, "D%d,0\n\n", saved_number);
}
diff --git a/m4/path.c b/m4/path.c
index 16aa3c70..b0b45d74 100644
--- a/m4/path.c
+++ b/m4/path.c
@@ -119,8 +119,8 @@ m4_add_include_directory (m4 *context, const char *dir, bool prepend)
search_path_add (m4__get_search_path (context), dir, prepend);
#ifdef DEBUG_INCL
- fprintf (stderr, "add_include_directory (%s) %s;\n", dir,
- prepend ? "prepend" : "append");
+ xfprintf (stderr, "add_include_directory (%s) %s;\n", dir,
+ prepend ? "prepend" : "append");
#endif
}
@@ -172,7 +172,7 @@ m4_path_search (m4 *context, const char *file, char **expanded_name)
name = file_name_concat (incl->dir, file, NULL);
#ifdef DEBUG_INCL
- fprintf (stderr, "path_search (%s) -- trying %s\n", file, name);
+ xfprintf (stderr, "path_search (%s) -- trying %s\n", file, name);
#endif
fp = fopen (name, "r");
@@ -221,7 +221,7 @@ include_dump (m4 *context)
fputs ("include_dump:\n", stderr);
for (incl = m4__get_search_path (context)->list;
incl != NULL; incl = incl->next)
- fprintf (stderr, "\t%s\n", incl->dir);
+ xfprintf (stderr, "\t%s\n", incl->dir);
}
#endif /* DEBUG_INCL */
diff --git a/m4/symtab.c b/m4/symtab.c
index 1228a29c..97f247ba 100644
--- a/m4/symtab.c
+++ b/m4/symtab.c
@@ -718,8 +718,8 @@ dump_symbol_CB (m4_symbol_table *symtab, const char *name,
m4_module * module = value ? SYMBOL_MODULE (symbol) : NULL;
const char * module_name = module ? m4_get_module_name (module) : "NONE";
- fprintf (stderr, "%10s: (%d%s) %s=", module_name, flags,
- m4_get_symbol_traced (symbol) ? "!" : "", name);
+ xfprintf (stderr, "%10s: (%d%s) %s=", module_name, flags,
+ m4_get_symbol_traced (symbol) ? "!" : "", name);
if (!value)
fputs ("<!UNDEFINED!>", stderr);
@@ -730,7 +730,7 @@ dump_symbol_CB (m4_symbol_table *symtab, const char *name,
m4_obstack obs;
obstack_init (&obs);
m4_symbol_value_print (value, &obs, false, NULL, NULL, 0, true);
- fprintf (stderr, "%s", (char *) obstack_finish (&obs));
+ xfprintf (stderr, "%s", (char *) obstack_finish (&obs));
obstack_free (&obs, NULL);
}
fputc ('\n', stderr);
diff --git a/m4/syntax.c b/m4/syntax.c
index 3ac655db..9f2e1220 100644
--- a/m4/syntax.c
+++ b/m4/syntax.c
@@ -220,9 +220,9 @@ add_syntax_attribute (m4_syntax_table *syntax, int ch, int code)
syntax->table[ch] = (syntax->table[ch] & M4_SYNTAX_MASKS) | code;
#ifdef DEBUG_SYNTAX
- fprintf(stderr, "Set syntax %o %c = %04X\n",
- ch, isprint(ch) ? ch : '-',
- syntax->table[ch]);
+ xfprintf(stderr, "Set syntax %o %c = %04X\n",
+ ch, isprint(ch) ? ch : '-',
+ syntax->table[ch]);
#endif
return syntax->table[ch];
@@ -235,9 +235,9 @@ remove_syntax_attribute (m4_syntax_table *syntax, int ch, int code)
syntax->table[ch] &= ~code;
#ifdef DEBUG_SYNTAX
- fprintf(stderr, "Unset syntax %o %c = %04X\n",
- ch, isprint(ch) ? ch : '-',
- syntax->table[ch]);
+ xfprintf(stderr, "Unset syntax %o %c = %04X\n",
+ ch, isprint(ch) ? ch : '-',
+ syntax->table[ch]);
#endif
return syntax->table[ch];
diff --git a/m4/system_.h b/m4/system_.h
index 88ba28a2..e014d75a 100644
--- a/m4/system_.h
+++ b/m4/system_.h
@@ -46,6 +46,7 @@
@INCLUDE_STDBOOL_H@
#include <gnu/xalloc.h>
+#include <gnu/xprintf.h>
#include <gnu/xstrndup.h>
/* glibc's obstack left out the ability to suspend and resume growth
@@ -137,18 +138,18 @@ BEGIN_C_DECLS
/* Take advantage of GNU C compiler source level optimization hints,
using portable macros. */
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 6)
-# define M4_GNUC_ATTRIBUTE(args) __attribute__(args)
+# define M4_GNUC_ATTRIBUTE(args) __attribute__ (args)
#else
# define M4_GNUC_ATTRIBUTE(args)
#endif /* __GNUC__ */
#define M4_GNUC_PRINTF(fmt, arg) \
- M4_GNUC_ATTRIBUTE((__format__ (__printf__, fmt, arg)))
+ M4_GNUC_ATTRIBUTE ((__format__ (__printf__, fmt, arg)))
#define M4_GNUC_SCANF(fmt, arg) \
- M4_GNUC_ATTRIBUTE((__format__ (__scanf__, fmt, arg)))
-#define M4_GNUC_NORETURN M4_GNUC_ATTRIBUTE((__noreturn__))
-#define M4_GNUC_CONST M4_GNUC_ATTRIBUTE((__const__))
-#define M4_GNUC_UNUSED M4_GNUC_ATTRIBUTE((__unused__))
+ M4_GNUC_ATTRIBUTE ((__format__ (__scanf__, fmt, arg)))
+#define M4_GNUC_NORETURN M4_GNUC_ATTRIBUTE ((__noreturn__))
+#define M4_GNUC_CONST M4_GNUC_ATTRIBUTE ((__const__))
+#define M4_GNUC_UNUSED M4_GNUC_ATTRIBUTE ((__unused__))
@@ -164,12 +165,12 @@ BEGIN_C_DECLS
be expanded before being quoted. */
#ifndef STR
# define _STR(arg) #arg
-# define STR(arg) _STR(arg)
+# define STR(arg) _STR (arg)
#endif
#ifndef CONC
# define _CONC(a, b) a##b
-# define CONC(a, b) _CONC(a, b)
+# define CONC(a, b) _CONC (a, b)
#endif
END_C_DECLS
diff --git a/modules/modtest.c b/modules/modtest.c
index e1143daa..022a2efa 100644
--- a/modules/modtest.c
+++ b/modules/modtest.c
@@ -113,6 +113,6 @@ bool
export_test (const char *foo)
{
if (foo)
- fprintf (stderr, "%s\n", foo);
+ xfprintf (stderr, "%s\n", foo);
return (bool) (foo != 0);
}
diff --git a/po/Makevars b/po/Makevars
index 793453ae..d952fe86 100644
--- a/po/Makevars
+++ b/po/Makevars
@@ -35,6 +35,8 @@ XGETTEXT_OPTIONS = \
--flag=verror:3:c-format --flag=verror_at_line:5:c-format \
--flag=asprintf:2:c-format --flag=vasprintf:2:c-format \
--flag=asnprintf:3:c-format --flag=vasnprintf:3:c-format \
+ --flag=xprintf:1:c-format --flag=xvprintf:1:c-format \
+ --flag=xfprintf:2:c-format --flag=xvfprintf:2:c-format \
--flag=m4_error:4:c-format --flag=m4_error_at_line:6:c-format \
--flag=m4_debug_message:3:c-format
diff --git a/po/POTFILES.in b/po/POTFILES.in
index c949e304..94415f90 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -7,6 +7,7 @@ gnu/quotearg.c
gnu/regcomp.c
gnu/verror.c
gnu/xalloc-die.c
+gnu/xprintf.c
m4/builtin.c
m4/debug.c
m4/input.c
diff --git a/src/freeze.c b/src/freeze.c
index 9eca0145..fa40ce70 100644
--- a/src/freeze.c
+++ b/src/freeze.c
@@ -96,7 +96,7 @@ produce_resyntax_dump (m4 *context, FILE *file)
/* No need to use produce_mem_dump, since we know all resyntax
names are already ASCII-encoded. */
- fprintf (file, "R%zu\n%s\n", strlen (resyntax), resyntax);
+ xfprintf (file, "R%zu\n%s\n", strlen (resyntax), resyntax);
}
}
@@ -121,7 +121,7 @@ produce_syntax_dump (FILE *file, m4_syntax_table *syntax, char ch)
if (count || (code & M4_SYNTAX_MASKS))
{
- fprintf (file, "S%c%d\n", ch, count);
+ xfprintf (file, "S%c%d\n", ch, count);
produce_mem_dump (file, buf, count);
fputc ('\n', file);
}
@@ -140,7 +140,7 @@ produce_module_dump (FILE *file, m4_module *module)
if (module)
produce_module_dump (file, module);
- fprintf (file, "M%zu\n", len);
+ xfprintf (file, "M%zu\n", len);
produce_mem_dump (file, name, len);
fputc ('\n', file);
}
@@ -169,9 +169,9 @@ dump_symbol_CB (m4_symbol_table *symtab, const char *symbol_name,
{
const char *text = m4_get_symbol_text (symbol);
size_t text_len = strlen (text);
- fprintf (file, "T%zu,%zu", symbol_len, text_len);
+ xfprintf (file, "T%zu,%zu", symbol_len, text_len);
if (module)
- fprintf (file, ",%zu", module_len);
+ xfprintf (file, ",%zu", module_len);
fputc ('\n', file);
produce_mem_dump (file, symbol_name, symbol_len);
@@ -188,9 +188,9 @@ dump_symbol_CB (m4_symbol_table *symtab, const char *symbol_name,
assert (!"INTERNAL ERROR: builtin not found in builtin table!");
bp_len = strlen (bp->name);
- fprintf (file, "F%zu,%zu", symbol_len, bp_len);
+ xfprintf (file, "F%zu,%zu", symbol_len, bp_len);
if (module)
- fprintf (file, ",%zu", module_len);
+ xfprintf (file, ",%zu", module_len);
fputc ('\n', file);
produce_mem_dump (file, symbol_name, symbol_len);
@@ -222,8 +222,8 @@ produce_frozen_state (m4 *context, const char *name)
/* Write a recognizable header. */
- fprintf (file, "# This is a frozen state file generated by GNU %s %s\n",
- PACKAGE, VERSION);
+ xfprintf (file, "# This is a frozen state file generated by GNU %s %s\n",
+ PACKAGE, VERSION);
fputs ("V2\n", file);
/* Dump quote delimiters. */
@@ -231,7 +231,7 @@ produce_frozen_state (m4 *context, const char *name)
if (strcmp (m4_get_syntax_lquote (M4SYNTAX), DEF_LQUOTE)
|| strcmp (m4_get_syntax_rquote (M4SYNTAX), DEF_RQUOTE))
{
- fprintf (file, "Q%zu,%zu\n", M4SYNTAX->lquote.length,
+ xfprintf (file, "Q%zu,%zu\n", M4SYNTAX->lquote.length,
M4SYNTAX->rquote.length);
produce_mem_dump (file, M4SYNTAX->lquote.string,
M4SYNTAX->lquote.length);
@@ -245,8 +245,8 @@ produce_frozen_state (m4 *context, const char *name)
if (strcmp (m4_get_syntax_bcomm (M4SYNTAX), DEF_BCOMM)
|| strcmp (m4_get_syntax_ecomm (M4SYNTAX), DEF_ECOMM))
{
- fprintf (file, "C%zu,%zu\n", M4SYNTAX->bcomm.length,
- M4SYNTAX->ecomm.length);
+ xfprintf (file, "C%zu,%zu\n", M4SYNTAX->bcomm.length,
+ M4SYNTAX->ecomm.length);
produce_mem_dump (file, M4SYNTAX->bcomm.string, M4SYNTAX->bcomm.length);
produce_mem_dump (file, M4SYNTAX->ecomm.string, M4SYNTAX->ecomm.length);
fputc ('\n', file);
diff --git a/src/main.c b/src/main.c
index 80be58d4..3fed2e5b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -66,11 +66,11 @@ static void
usage (int status)
{
if (status != EXIT_SUCCESS)
- fprintf (stderr, _("Try `%s --help' for more information.\n"),
- m4_get_program_name ());
+ xfprintf (stderr, _("Try `%s --help' for more information.\n"),
+ m4_get_program_name ());
else
{
- printf (_("Usage: %s [OPTION]... [FILE]...\n"), m4_get_program_name ());
+ xprintf (_("Usage: %s [OPTION]... [FILE]...\n"), m4_get_program_name ());
fputs (_("\
Process macros in FILEs.\n\
If no FILE or if FILE is `-', standard input is read. If no FILE, and both\n\
@@ -104,7 +104,7 @@ SPEC is any one of:\n\
GREP, POSIX_AWK, POSIX_EGREP, MINIMAL, MINIMAL_BASIC, SED.\n\
"), stdout);
puts ("");
- printf (_("\
+ xprintf (_("\
Dynamic loading features:\n\
-M, --module-directory=DIR add DIR to module search path before\n\
`%s'\n\
@@ -189,7 +189,7 @@ mismatch, or whatever value was passed to the m4exit macro.\n\
saying "Report translation bugs to <...>\n" with the address
for translation bugs (typically your translation team's web
or email address). */
- printf (_("Report bugs to <%s>.\n"), PACKAGE_BUGREPORT);
+ xprintf (_("Report bugs to <%s>.\n"), PACKAGE_BUGREPORT);
}
exit (status);
}