/* Error handler for noninteractive utilities
- Copyright (C) 1990-1998, 2000-2005, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1990-1998, 2000-2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- This program is free software; you can redistribute it and/or modify
+ 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.
+ the Free Software Foundation; either version 3 of the License, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */
-#ifdef HAVE_CONFIG_H
+#if !_LIBC
# include <config.h>
#endif
#if !_LIBC && ENABLE_NLS
# include "gettext.h"
+# define _(msgid) gettext (msgid)
#endif
#ifdef _LIBC
char *strerror_r ();
# endif
-# ifndef SIZE_MAX
-# define SIZE_MAX ((size_t) -1)
-# endif
-
/* The calling program should define program_name and set it to the
name of the executing program. */
extern char *program_name;
# if HAVE_STRERROR_R || defined strerror_r
# define __strerror_r strerror_r
-# endif
+# endif /* HAVE_STRERROR_R || defined strerror_r */
#endif /* not _LIBC */
static void
print_errno_message (int errnum)
{
- char const *s = NULL;
+ char const *s;
#if defined HAVE_STRERROR_R || _LIBC
char errbuf[1024];
# else
if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0)
s = errbuf;
+ else
+ s = 0;
# endif
+#else
+ s = strerror (errnum);
#endif
#if !_LIBC
- if (! s && ! (s = strerror (errnum)))
+ if (! s)
s = _("Unknown system error");
#endif
#if _LIBC
__fxprintf (NULL, file_name != NULL ? "%s:%d: " : " ",
- file_name, line_number);
+ file_name, line_number);
#else
fprintf (stderr, file_name != NULL ? "%s:%d: " : " ",
- file_name, line_number);
+ file_name, line_number);
#endif
va_start (args, message);