diff options
Diffstat (limited to 'main/recode/0001-avoid-gnu-error-3.patch')
-rw-r--r-- | main/recode/0001-avoid-gnu-error-3.patch | 378 |
1 files changed, 0 insertions, 378 deletions
diff --git a/main/recode/0001-avoid-gnu-error-3.patch b/main/recode/0001-avoid-gnu-error-3.patch deleted file mode 100644 index 423ae190c5..0000000000 --- a/main/recode/0001-avoid-gnu-error-3.patch +++ /dev/null @@ -1,378 +0,0 @@ -From 2b46384a2f115e54fef5e5295b4ad71206649b7f Mon Sep 17 00:00:00 2001 -From: Natanael Copa <ncopa@alpinelinux.org> -Date: Fri, 8 Jan 2016 15:41:08 +0000 -Subject: [PATCH] avoid gnu error(3) - ---- - lib/Makefile.am | 4 +-- - lib/error.h | 78 --------------------------------------------------------- - src/argmatch.c | 6 +++-- - src/common.h | 1 - - src/main.c | 51 +++++++++++++++++++------------------ - src/xmalloc.c | 8 ++---- - 6 files changed, 34 insertions(+), 114 deletions(-) - delete mode 100644 lib/error.h - -diff --git a/lib/Makefile.am b/lib/Makefile.am -index 237fe72..36d7430 100644 ---- a/lib/Makefile.am -+++ b/lib/Makefile.am -@@ -20,8 +20,8 @@ - AUTOMAKE_OPTIONS = gnits - - noinst_LIBRARIES = libreco.a --noinst_HEADERS = error.h getopt.h gettext.h pathmax.h xstring.h --libreco_a_SOURCES = error.c getopt.c getopt1.c xstrdup.c -+noinst_HEADERS = xstring.h -+libreco_a_SOURCES = xstrdup.c - - EXTRA_DIST = alloca.c gettext.c malloc.c realloc.c strtol.c strtoul.c - -diff --git a/lib/error.h b/lib/error.h -deleted file mode 100644 -index 20f7582..0000000 ---- a/lib/error.h -+++ /dev/null -@@ -1,78 +0,0 @@ --/* Declaration for error-reporting function -- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. -- -- -- NOTE: The canonical source of this file is maintained with the GNU C Library. -- Bugs can be reported to bug-glibc@prep.ai.mit.edu. -- -- 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 _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 */ -diff --git a/src/argmatch.c b/src/argmatch.c -index 9642706..daa39bd 100644 ---- a/src/argmatch.c -+++ b/src/argmatch.c -@@ -36,7 +36,9 @@ - # define _(Text) Text - #endif - --#include "error.h" -+#include <err.h> -+#include <stdlib.h> -+ - #include "quotearg.h" - - /* When reporting an invalid argument, show nonprinting characters -@@ -159,7 +161,7 @@ argmatch_invalid (const char *context, const char *value, int problem) - ? _("invalid argument %s for `%s'") - : _("ambiguous argument %s for `%s'")); - -- error (0, 0, format, quotearg_style (ARGMATCH_QUOTING_STYLE, value), context); -+ warnx (format, quotearg_style (ARGMATCH_QUOTING_STYLE, value), context); - } - - /* List the valid arguments for argmatch. -diff --git a/src/common.h b/src/common.h -index a4f56dc..089ea61 100644 ---- a/src/common.h -+++ b/src/common.h -@@ -112,7 +112,6 @@ typedef enum {false = 0, true = 1} bool; - #ifndef errno - extern int errno; - #endif --#include "error.h" - - /* Generate a mask of LENGTH one-bits, right justified in a word. */ - #define MASK(Length) ((unsigned) ~(~0 << (Length))) -diff --git a/src/main.c b/src/main.c -index 3a5de1d..9575b32 100644 ---- a/src/main.c -+++ b/src/main.c -@@ -23,7 +23,8 @@ - #include <sys/types.h> - #include <sys/stat.h> - --#include "getopt.h" -+#include <getopt.h> -+#include <err.h> - - #if HAVE_UNISTD_H - # include <unistd.h> -@@ -427,11 +428,11 @@ main (int argc, char *const *argv) - switch (argmatch (optarg, sequence_strings, NULL, 0)) - { - case -2: -- error (0, 0, _("Sequence `%s' is ambiguous"), optarg); -+ warnx ( _("Sequence `%s' is ambiguous"), optarg); - usage (EXIT_FAILURE, 0); - - case -1: -- error (0, 0, _("Sequence `%s' is unknown"), optarg); -+ warnx ( _("Sequence `%s' is unknown"), optarg); - usage (EXIT_FAILURE, 0); - - case 0: -@@ -461,11 +462,11 @@ main (int argc, char *const *argv) - switch (argmatch (optarg, language_strings, NULL, 0)) - { - case -2: -- error (0, 0, _("Language `%s' is ambiguous"), optarg); -+ warnx ( _("Language `%s' is ambiguous"), optarg); - usage (EXIT_FAILURE, 0); - - default: /* -1 */ -- error (0, 0, _("Language `%s' is unknown"), optarg); -+ warnx ( _("Language `%s' is unknown"), optarg); - usage (EXIT_FAILURE, 0); - - case 0: -@@ -519,11 +520,11 @@ main (int argc, char *const *argv) - switch (argmatch (buffer, language_strings, NULL, 0)) - { - case -2: -- error (0, 0, _("Language `%s' is ambiguous"), buffer); -+ warnx ( _("Language `%s' is ambiguous"), buffer); - usage (EXIT_FAILURE, 0); - - default: /* -1 */ -- error (0, 0, _("Language `%s' is unknown"), buffer); -+ warnx ( _("Language `%s' is unknown"), buffer); - usage (EXIT_FAILURE, 0); - - case 0: -@@ -557,11 +558,11 @@ main (int argc, char *const *argv) - switch (argmatch (optarg, format_strings, NULL, 0)) - { - case -2: -- error (0, 0, _("Format `%s' is ambiguous"), optarg); -+ warnx ( _("Format `%s' is ambiguous"), optarg); - usage (EXIT_FAILURE, 0); - - case -1: -- error (0, 0, _("Format `%s' is unknown"), optarg); -+ warnx ( _("Format `%s' is unknown"), optarg); - usage (EXIT_FAILURE, 0); - - case 0: -@@ -666,7 +667,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"), - - if (!alias) - { -- error (0, 0, _("Symbol `%s' is unknown"), ignored_name); -+ warnx ( _("Symbol `%s' is unknown"), ignored_name); - usage (EXIT_FAILURE, 1); - } - -@@ -688,12 +689,12 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"), - if (charset_restrictions) - if (!decode_known_pairs (outer, charset_restrictions)) - { -- error (0, 0, "Could not understand `%s'", charset_restrictions); -+ warnx ( "Could not understand `%s'", charset_restrictions); - usage (EXIT_FAILURE, 0); - } - if (optind + 1 < argc) - { -- error (0, 0, "Argument `%s' is extraneous", argv[optind]); -+ warnx ( "Argument `%s' is extraneous", argv[optind]); - usage (EXIT_FAILURE, 0); - } - -@@ -706,7 +707,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"), - - if (!alias) - { -- error (0, 0, _("Charset `%s' is unknown or ambiguous"), -+ warnx ( _("Charset `%s' is unknown or ambiguous"), - argv[optind]); - usage (EXIT_FAILURE, 1); - } -@@ -720,7 +721,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"), - - if (!alias) - { -- error (0, 0, _("Charset `%s' is unknown or ambiguous"), -+ warnx ( _("Charset `%s' is unknown or ambiguous"), - argv[optind]); - usage (EXIT_FAILURE, 1); - } -@@ -751,7 +752,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"), - - if (optind + 1 > argc) - { -- error (0, 0, _("Required argument is missing")); -+ warnx ( _("Required argument is missing")); - usage (EXIT_FAILURE, 0); - } - -@@ -794,13 +795,13 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"), - - user_request = rewritten_request; - if (!quiet_flag) -- error (0, 0, _("Syntax is deprecated, please prefer `%s'"), -+ warnx ( _("Syntax is deprecated, please prefer `%s'"), - user_request); - } - } - - if (!recode_scan_request (request, user_request)) -- error (EXIT_FAILURE, 0, _("Request `%s' is erroneous"), user_request); -+ errx (EXIT_FAILURE, _("Request `%s' is erroneous"), user_request); - if (rewritten_request) - free (rewritten_request); - } -@@ -857,7 +858,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"), - /* Check if the file can be read and rewritten. */ - - if (file = fopen (input_name, "r+"), file == NULL) -- error (EXIT_FAILURE, errno, "fopen (%s)", input_name); -+ err (EXIT_FAILURE, "fopen (%s)", input_name); - - /* Save the input file attrobites. */ - -@@ -917,22 +918,22 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"), - /* Move the new file over the original. */ - - if (unlink (input_name) < 0) -- error (EXIT_FAILURE, errno, "unlink (%s)", input_name); -+ err (EXIT_FAILURE, "unlink (%s)", input_name); - - /* Preserve the file permissions. */ - - if (chmod (output_name, file_stat.st_mode & 07777) < 0) -- error (EXIT_FAILURE, errno, "chmod (%s)", output_name); -+ err (EXIT_FAILURE, "chmod (%s)", output_name); - #if HAVE_RENAME - if (rename (output_name, input_name) < 0) -- error (EXIT_FAILURE, errno, "rename (%s, %s)", -+ err (EXIT_FAILURE, "rename (%s, %s)", - output_name, input_name); - #else - if (link (output_name, input_name) < 0) -- error (EXIT_FAILURE, errno, "link (%s, %s)", -+ err (EXIT_FAILURE, "link (%s, %s)", - output_name, input_name); - if (unlink (output_name) < 0) -- error (EXIT_FAILURE, errno, "unlink (%s)", output_name); -+ err (EXIT_FAILURE, "unlink (%s)", output_name); - #endif - - /* Adjust the time stamp for the new file. */ -@@ -958,7 +959,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"), - fflush (stderr); - } - else if (!quiet_flag) -- error (0, 0, _("%s failed: %s in step `%s..%s'"), -+ warnx ( _("%s failed: %s in step `%s..%s'"), - input_name, task_perror (task), - task->error_at_step->before->name, - task->error_at_step->after->name); -@@ -981,7 +982,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"), - { - success = false; - if (!quiet_flag) -- error (0, 0, _("%s in step `%s..%s'"), -+ warnx ( _("%s in step `%s..%s'"), - task_perror (task), - task->error_at_step->before->name, - task->error_at_step->after->name); -diff --git a/src/xmalloc.c b/src/xmalloc.c -index 8206a94..9c5080e 100644 ---- a/src/xmalloc.c -+++ b/src/xmalloc.c -@@ -20,6 +20,7 @@ - #endif - - #include <sys/types.h> -+#include <err.h> - - #if STDC_HEADERS - # include <stdlib.h> -@@ -39,7 +40,6 @@ void free (); - #endif - #define N_(Text) Text - --#include "error.h" - #include "xalloc.h" - - #ifndef EXIT_FAILURE -@@ -70,11 +70,7 @@ xalloc_die (void) - { - if (xalloc_fail_func) - (*xalloc_fail_func) (); -- error (xalloc_exit_failure, 0, "%s", _(xalloc_msg_memory_exhausted)); -- /* The `noreturn' cannot be given to error, since it may return if -- its first argument is 0. To help compilers understand the -- xalloc_die does terminate, call exit. */ -- exit (EXIT_FAILURE); -+ errx (xalloc_exit_failure, "%s", _(xalloc_msg_memory_exhausted)); - } - - /* Allocate N bytes of memory dynamically, with error checking. */ --- -2.7.0 - |