From: Panu Matilainen Date: Wed, 23 Dec 2009 12:36:36 +0000 (+0200) Subject: Remove unneeded replacement error/warn functions X-Git-Tag: rpm-4.9.0-beta1~1065 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5741334a857a783b033c647223f206a7ca43cef3;p=platform%2Fupstream%2Frpm.git Remove unneeded replacement error/warn functions --- diff --git a/misc/Makefile.am b/misc/Makefile.am index b014bf1..a87921a 100644 --- a/misc/Makefile.am +++ b/misc/Makefile.am @@ -4,8 +4,7 @@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) -I$(top_builddir)/include/rpm AM_CPPFLAGS += -I$(top_srcdir)/misc EXTRA_DIST = \ - basename.c err.c err.h \ - error.c error.h \ + basename.c \ fakefork.c fnmatch.c fnmatch.h \ getcwd.c getmntent.c \ getwd.c glob.c glob.h \ diff --git a/misc/err.c b/misc/err.c deleted file mode 100644 index fa23594..0000000 --- a/misc/err.c +++ /dev/null @@ -1,112 +0,0 @@ -/* err.c --- 4.4BSD utility functions for error messages. - Copyright (C) 1995, 1996, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include "system.h" - -#ifdef HAVE_LIBIO_H -#define flockfile(s) _IO_flockfile (s) -#define funlockfile(s) _IO_funlockfile (s) -#else -#define flockfile(s) -#define funlockfile(s) -#define putc_unlocked(c,fp) putc(c,fp); -#define fputs_unlocked(s,fp) fputs(s,fp); -#define __set_errno(error) errno = error -#define __ptr_t void * -#endif - -#include -#include - -#define VA(call) \ -{ \ - va_list ap; \ - va_start (ap, format); \ - call; \ - va_end (ap); \ -} - -void -vwarnx (const char *format, __gnuc_va_list ap) -{ - flockfile (stderr); - if (__progname) - fprintf (stderr, "%s: ", __progname); - if (format) - vfprintf (stderr, format, ap); - putc_unlocked ('\n', stderr); - funlockfile (stderr); -} - -void -vwarn (const char *format, __gnuc_va_list ap) -{ - int error = errno; - - flockfile (stderr); - if (__progname) - fprintf (stderr, "%s: ", __progname); - if (format) - { - vfprintf (stderr, format, ap); - fputs_unlocked (": ", stderr); - } - __set_errno (error); - fprintf (stderr, "%m\n"); - funlockfile (stderr); -} - - -void -warn (const char *format, ...) -{ - VA (vwarn (format, ap)) -} - -void -warnx (const char *format, ...) -{ - VA (vwarnx (format, ap)) -} - -void -verr (int status, const char *format, __gnuc_va_list ap) -{ - vwarn (format, ap); - exit (status); -} - -void -verrx (int status, const char *format, __gnuc_va_list ap) -{ - vwarnx (format, ap); - exit (status); -} - -void -err (int status, const char *format, ...) -{ - VA (verr (status, format, ap)) -} - -void -errx (int status, const char *format, ...) -{ - VA (verrx (status, format, ap)) -} diff --git a/misc/err.h b/misc/err.h deleted file mode 100644 index 6143433..0000000 --- a/misc/err.h +++ /dev/null @@ -1,59 +0,0 @@ -/* 4.4BSD utility functions for error messages. - Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef _ERR_H -#define _ERR_H 1 - -#define __need___va_list -#include -#ifndef __ptr_t -#define __ptr_t void * -#endif -#ifndef __GNUC_VA_LIST -# define __gnuc_va_list __ptr_t -#endif - -__BEGIN_DECLS - -/* Print "program: ", FORMAT, ": ", the standard error string for errno, - and a newline, on stderr. */ -extern void warn __P ((__const char *__format, ...)) - __attribute__ ((__format__ (__printf__, 1, 2))); -extern void vwarn __P ((__const char *__format, __gnuc_va_list)) - __attribute__ ((__format__ (__printf__, 1, 0))); - -/* Likewise, but without ": " and the standard error string. */ -extern void warnx __P ((__const char *__format, ...)) - __attribute__ ((__format__ (__printf__, 1, 2))); -extern void vwarnx __P ((__const char *__format, __gnuc_va_list)) - __attribute__ ((__format__ (__printf__, 1, 0))); - -/* Likewise, and then exit with STATUS. */ -extern void err __P ((int __status, __const char *__format, ...)) - __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3))); -extern void verr __P ((int __status, __const char *__format, __gnuc_va_list)) - __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0))); -extern void errx __P ((int __status, __const char *__format, ...)) - __attribute__ ((__noreturn__, __format__ (__printf__, 2, 3))); -extern void verrx __P ((int __status, __const char *, __gnuc_va_list)) - __attribute__ ((__noreturn__, __format__ (__printf__, 2, 0))); - -__END_DECLS - -#endif /* err.h */ diff --git a/misc/error.c b/misc/error.c deleted file mode 100644 index ac9b84e..0000000 --- a/misc/error.c +++ /dev/null @@ -1,252 +0,0 @@ -/* Error handler for noninteractive utilities - Copyright (C) 1990,91,92,93,94,95,96,97,98 Free Software Foundation, Inc. - - This file is part of the GNU C Library. Its master source is NOT part of - the C library, however. The master source lives in /gd/gnu/lib. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* Written by David MacKenzie . */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include - -#if HAVE_VPRINTF || HAVE_DOPRNT || _LIBC -# if __STDC__ -# include -# define VA_START(args, lastarg) va_start(args, lastarg) -# else -# include -# define VA_START(args, lastarg) va_start(args) -# endif -#else -# define va_alist a1, a2, a3, a4, a5, a6, a7, a8 -# define va_dcl char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8; -#endif - -#if STDC_HEADERS || _LIBC -# include -# include -#else -void exit (); -#endif - -#include "error.h" - -#ifndef _ -# define _(String) String -#endif - -/* If NULL, error will flush stdout, then print on stderr the program - name, a colon and a space. Otherwise, error will call this - function without parameters instead. */ -void (*error_print_progname) ( -#if __STDC__ - 0 - void -#endif - ); - -/* This variable is incremented each time `error' is called. */ -unsigned int error_message_count; - -#ifdef _LIBC -/* In the GNU C library, there is a predefined variable for this. */ - -# define program_name program_invocation_name -# include - -/* In GNU libc we want do not want to use the common name `error' directly. - Instead make it a weak alias. */ -# define error __error -# define error_at_line __error_at_line - -# ifdef USE_IN_LIBIO -# include -# define fflush(s) _IO_fflush (s) -# endif - -#else /* not _LIBC */ - -/* The calling program should define program_name and set it to the - name of the executing program. */ -extern char *program_name; - -# ifdef HAVE_STRERROR_R -# define __strerror_r strerror_r -# else -# if HAVE_STRERROR -# ifndef strerror /* On some systems, strerror is a macro */ -char *strerror (); -# endif -# else -static char * -private_strerror (errnum) - int errnum; -{ - extern char *sys_errlist[]; - extern int sys_nerr; - - if (errnum > 0 && errnum <= sys_nerr) - return _(sys_errlist[errnum]); - return _("Unknown system error"); -} -# define strerror private_strerror -# endif /* HAVE_STRERROR */ -# endif /* HAVE_STRERROR_R */ -#endif /* not _LIBC */ - -/* Print the program name and error message MESSAGE, which is a printf-style - format string with optional args. - If ERRNUM is nonzero, print its corresponding system error message. - Exit with status STATUS if it is nonzero. */ -/* VARARGS */ - -void -#if defined VA_START && __STDC__ -error (int status, int errnum, const char *message, ...) -#else -error (status, errnum, message, va_alist) - int status; - int errnum; - char *message; - va_dcl -#endif -{ -#ifdef VA_START - va_list args; -#endif - - if (error_print_progname) - (*error_print_progname) (); - else - { - fflush (stdout); - fprintf (stderr, "%s: ", program_name); - } - -#ifdef VA_START - VA_START (args, message); -# if HAVE_VPRINTF || _LIBC - vfprintf (stderr, message, args); -# else - _doprnt (message, args, stderr); -# endif - va_end (args); -#else - fprintf (stderr, message, a1, a2, a3, a4, a5, a6, a7, a8); -#endif - - ++error_message_count; - if (errnum) - { -#if defined HAVE_STRERROR_R || defined _LIBC - char errbuf[1024]; - fprintf (stderr, ": %s", __strerror_r (errnum, errbuf, sizeof errbuf)); -#else - fprintf (stderr, ": %s", strerror (errnum)); -#endif - } - putc ('\n', stderr); - fflush (stderr); - if (status) - exit (status); -} - -/* Sometimes we want to have at most one error per line. This - variable controls whether this mode is selected or not. */ -int error_one_per_line; - -void -#if defined VA_START && __STDC__ -error_at_line (int status, int errnum, const char *file_name, - unsigned int line_number, const char *message, ...) -#else -error_at_line (status, errnum, file_name, line_number, message, va_alist) - int status; - int errnum; - const char *file_name; - unsigned int line_number; - char *message; - va_dcl -#endif -{ -#ifdef VA_START - va_list args; -#endif - - if (error_one_per_line) - { - static const char *old_file_name; - static unsigned int old_line_number; - - if (old_line_number == line_number && - (file_name == old_file_name || !strcmp (old_file_name, file_name))) - /* Simply return and print nothing. */ - return; - - old_file_name = file_name; - old_line_number = line_number; - } - - if (error_print_progname) - (*error_print_progname) (); - else - { - fflush (stdout); - fprintf (stderr, "%s:", program_name); - } - - if (file_name != NULL) - fprintf (stderr, "%s:%d: ", file_name, line_number); - -#ifdef VA_START - VA_START (args, message); -# if HAVE_VPRINTF || _LIBC - vfprintf (stderr, message, args); -# else - _doprnt (message, args, stderr); -# endif - va_end (args); -#else - fprintf (stderr, message, a1, a2, a3, a4, a5, a6, a7, a8); -#endif - - ++error_message_count; - if (errnum) - { -#if defined HAVE_STRERROR_R || defined _LIBC - char errbuf[1024]; - fprintf (stderr, ": %s", __strerror_r (errnum, errbuf, sizeof errbuf)); -#else - fprintf (stderr, ": %s", strerror (errnum)); -#endif - } - putc ('\n', stderr); - fflush (stderr); - if (status) - exit (status); -} - -#ifdef _LIBC -/* Make the weak alias. */ -# undef error -# undef error_at_line -weak_alias (__error, error) -weak_alias (__error_at_line, error_at_line) -#endif diff --git a/misc/error.h b/misc/error.h deleted file mode 100644 index 0d3bcb7..0000000 --- a/misc/error.h +++ /dev/null @@ -1,77 +0,0 @@ -/* Declaration for error-reporting function - Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. - - This file is part of the GNU C Library. Its master source is NOT part of - the C library, however. The master source lives in /gd/gnu/lib. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef _ERROR_H -#define _ERROR_H 1 - -#ifndef __attribute__ -/* This feature is available in gcc versions 2.5 and later. */ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__ -# define __attribute__(Spec) /* empty */ -# endif -/* The __-protected variants of `format' and `printf' attributes - are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */ -# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) -# define __format__ format -# define __printf__ printf -# endif -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#if defined (__STDC__) && __STDC__ - -/* Print a message with `fprintf (stderr, FORMAT, ...)'; - if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM). - If STATUS is nonzero, terminate the program with `exit (STATUS)'. */ - -extern void error (int status, int errnum, const char *format, ...) - __attribute__ ((__format__ (__printf__, 3, 4))); - -extern void error_at_line (int status, int errnum, const char *fname, - unsigned int lineno, const char *format, ...) - __attribute__ ((__format__ (__printf__, 5, 6))); - -/* If NULL, error will flush stdout, then print on stderr the program - name, a colon and a space. Otherwise, error will call this - function without parameters instead. */ -extern void (*error_print_progname) (void); - -#else -void error (); -void error_at_line (); -extern void (*error_print_progname) (); -#endif - -/* This variable is incremented each time `error' is called. */ -extern unsigned int error_message_count; - -/* Sometimes we want to have at most one error per line. This - variable controls whether this mode is selected or not. */ -extern int error_one_per_line; - -#ifdef __cplusplus -} -#endif - -#endif /* error.h */