[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Changes to m4/m4/utility.c,v
From: |
Eric Blake |
Subject: |
Changes to m4/m4/utility.c,v |
Date: |
Thu, 31 Aug 2006 03:21:38 +0000 |
CVSROOT: /sources/m4
Module name: m4
Changes by: Eric Blake <ericb> 06/08/31 03:21:36
Index: m4/utility.c
===================================================================
RCS file: /sources/m4/m4/m4/utility.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -b -r1.46 -r1.47
--- m4/utility.c 28 Aug 2006 12:48:54 -0000 1.46
+++ m4/utility.c 31 Aug 2006 03:21:35 -0000 1.47
@@ -24,6 +24,7 @@
#include "m4private.h"
#include "verror.h"
+#include "xvasprintf.h"
static const char * skip_space (m4 *, const char *);
@@ -44,14 +45,14 @@
{
if (argc - 1 < min)
{
- m4_warn (context, 0, _("Warning: %s: too few arguments: %d < %d"),
+ m4_warn (context, 0, _("%s: too few arguments: %d < %d"),
M4ARG (0), argc - 1, min);
return ! side_effect;
}
if (argc - 1 > max)
{
- m4_warn (context, 0, _("Warning: %s: extra arguments ignored: %d > %d"),
+ m4_warn (context, 0, _("%s: extra arguments ignored: %d > %d"),
M4ARG (0), argc - 1, max);
}
@@ -81,7 +82,7 @@
|| (*valuep = strtol (skip_space (context, M4ARG (arg)), &endp, 10),
*skip_space (context, endp) != 0))
{
- m4_warn (context, 0, _("Warning: %s: argument %d non-numeric: %s"),
+ m4_warn (context, 0, _("%s: argument %d non-numeric: %s"),
M4ARG (0), arg - 1, M4ARG (arg));
return false;
}
@@ -129,10 +130,10 @@
/* Issue a warning, if they are not being suppressed. The message is
printf-style, based on FORMAT and any other arguments, and the
- program name and location (if we are currently parsing an input
- file) are automatically prepended. If ERRNUM is non-zero, include
- strerror output in the message. If warnings are fatal, call exit
- immediately, otherwise exit status is unchanged. */
+ program name, location (if we are currently parsing an input file),
+ and "Warning:" are automatically prepended. If ERRNUM is non-zero,
+ include strerror output in the message. If warnings are fatal,
+ call exit immediately, otherwise exit status is unchanged. */
void
m4_warn (m4 *context, int errnum, const char *format, ...)
{
@@ -141,11 +142,15 @@
va_list args;
int status = EXIT_SUCCESS;
int line = m4_get_current_line (context);
+ char *full_format = xasprintf(_("Warning: %s"), format);
va_start (args, format);
if (m4_get_fatal_warnings_opt (context))
status = EXIT_FAILURE;
+ /* If the full_format failed (unlikely though that may be), at
+ least fall back on the original format. */
verror_at_line (status, errnum,
line ? m4_get_current_file (context) : NULL, line,
- format, args);
+ full_format ? full_format : format, args);
+ free (full_format);
}
}
- Changes to m4/m4/utility.c,v, Eric Blake, 2006/08/09
- Changes to m4/m4/utility.c,v, Eric Blake, 2006/08/22
- Changes to m4/m4/utility.c,v, Eric Blake, 2006/08/25
- Changes to m4/m4/utility.c,v, Eric Blake, 2006/08/28
- Changes to m4/m4/utility.c,v,
Eric Blake <=