aboutsummaryrefslogtreecommitdiffstats
path: root/main/recode
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2016-01-08 15:45:28 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2016-01-08 15:45:28 +0000
commit785e36a70178e4a8ed02817d0aa19c3180a19eba (patch)
tree25db45eab4c6e60572973744a43fdc2faf854db8 /main/recode
parent5d21950a67231990a43562d1f678378ab846647a (diff)
downloadaports-785e36a70178e4a8ed02817d0aa19c3180a19eba.tar.bz2
aports-785e36a70178e4a8ed02817d0aa19c3180a19eba.tar.xz
main/recode: avoid use gnu extension error(3)
Diffstat (limited to 'main/recode')
-rw-r--r--main/recode/0001-avoid-gnu-error-3.patch378
-rw-r--r--main/recode/APKBUILD12
2 files changed, 386 insertions, 4 deletions
diff --git a/main/recode/0001-avoid-gnu-error-3.patch b/main/recode/0001-avoid-gnu-error-3.patch
new file mode 100644
index 0000000000..423ae190c5
--- /dev/null
+++ b/main/recode/0001-avoid-gnu-error-3.patch
@@ -0,0 +1,378 @@
+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
+
diff --git a/main/recode/APKBUILD b/main/recode/APKBUILD
index 2c31c9d95c..807d805da2 100644
--- a/main/recode/APKBUILD
+++ b/main/recode/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer:
pkgname=recode
pkgver=3.6
-pkgrel=0
+pkgrel=1
pkgdesc="Charset converter tool and library"
url="https://github.com/pinard/Recode"
arch="all"
@@ -17,6 +17,7 @@ source="Recode-$pkgver.tar.gz::https://github.com/pinard/Recode/archive/v$pkgver
recode-bool-bitfield.patch
recode-flex-m4.patch
recode-format-security.patch
+ 0001-avoid-gnu-error-3.patch
"
_builddir="$srcdir"/Recode-$pkgver
@@ -60,14 +61,17 @@ md5sums="977d5e836dc6540b120d00ecdf14d25d Recode-3.6.tar.gz
0c9269360d3671e8bc865a16a6243fdd recode-automake.patch
b2b69d392dbb6ba45b77873d3a3b6ce6 recode-bool-bitfield.patch
ed5fa897383f1a8f3b15236d2487d3bc recode-flex-m4.patch
-3ab25ae6bba23ddce1c85ed2af251e03 recode-format-security.patch"
+3ab25ae6bba23ddce1c85ed2af251e03 recode-format-security.patch
+0534962f3ee5018046c5504982624d0d 0001-avoid-gnu-error-3.patch"
sha256sums="1f0c859350a5fb3c555a7b80080e3238bbf2f0dc50f4009af0a407b3e2865503 Recode-3.6.tar.gz
dbe524a4bed3901549294089f05fd05b83cf4517541139622e00fc041de952d5 recode-automake.patch
d48b94231ab9b866dc1abf73de55a5535c8c754751a038fdaf75f3082593a06b recode-bool-bitfield.patch
b3364355bee4f2ea0939ec0a9d924ab6efa923967daf5ea064fdb1750aef6990 recode-flex-m4.patch
-715731dbf03afbf5be8226a808da75b96180f825d31bba74ed8b9851283e042a recode-format-security.patch"
+715731dbf03afbf5be8226a808da75b96180f825d31bba74ed8b9851283e042a recode-format-security.patch
+94172af72807ed15c8ef9acde2297ba571e78327a7599e62afb5c7b76df2f530 0001-avoid-gnu-error-3.patch"
sha512sums="0d2ea3e340811ce1172d1a934af20030fb69a940cc86ab6f1bb90a2f81869b91c7f7d2ce503b527d47228140604c465d08661f4f39ae5bdcb28beef1388c3a17 Recode-3.6.tar.gz
628e3cfddc30c5c4cae5de0a67d9f2539f334a096e8dfaf2aaec04449e1c1f49ab1701a7998d9029506e2935e169fa07c7fbb418c97cbc48497a906f8dc304c8 recode-automake.patch
b10aa58b2da7a3991d9894bde775ce3ae18d3ab5b6db7941824e0dba871cb30c3c530d32dedfd9be1c7fdd874f956819341c53ae946962441b3b84e1dbebee33 recode-bool-bitfield.patch
edb4f9a380744ffdabb5775a2d2cfaaa04f491b2fafa7c47f32197394e03607d48c00dcf19a24b486665bd510428a3ba4e4030e3ebd7f832bb453865c69bd868 recode-flex-m4.patch
-093314da6eb2666dcf7a8268366204669aa82df4e5455f28982595a60025d0ccadc989f08868c7ff4d4f49f3298395ce228fa848aed0dcb470063d07ea1dfae1 recode-format-security.patch"
+093314da6eb2666dcf7a8268366204669aa82df4e5455f28982595a60025d0ccadc989f08868c7ff4d4f49f3298395ce228fa848aed0dcb470063d07ea1dfae1 recode-format-security.patch
+f14c90429c98e39f101e86fbc090eaae88e25c6d912865416d19d53ff50a1a5ba77d73e31861cd3be3c70b5dd12d2770f211ed338b67ee0747bfc6c35b1358a9 0001-avoid-gnu-error-3.patch"