blob: 77da33321d3e876ba681071c6960de4390b6cf3c [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001From: Luk Claes <luk@debian.org>
2Date: Sat, 4 Jul 2009 10:54:53 +0200
3Subject: Don't reuse weak symbol optopt to fix FTBFS on mips*
4
5This patch is taken from
6ftp://ftp.debian.org/debian/pool/main/h/heirloom-mailx/heirloom-mailx_12.5-5.debian.tar.xz
7
8Upstream-Status: Inappropriate [upstream is dead]
9---
10 getopt.c | 10 +++++-----
11 1 file changed, 5 insertions(+), 5 deletions(-)
12
13diff --git a/getopt.c b/getopt.c
14index 83ce628..82e983c 100644
15--- a/getopt.c
16+++ b/getopt.c
17@@ -43,7 +43,7 @@ typedef int ssize_t;
18 char *optarg;
19 int optind = 1;
20 int opterr = 1;
21-int optopt;
22+int optoptc;
23
24 static void
25 error(const char *s, int c)
26@@ -69,7 +69,7 @@ error(const char *s, int c)
27 *bp++ = *s++;
28 while (*msg)
29 *bp++ = *msg++;
30- *bp++ = optopt;
31+ *bp++ = optoptc;
32 *bp++ = '\n';
33 write(2, buf, bp - buf);
34 ac_free(buf);
35@@ -101,13 +101,13 @@ getopt(int argc, char *const argv[], const char *optstring)
36 }
37 curp = &argv[optind][1];
38 }
39- optopt = curp[0] & 0377;
40+ optoptc = curp[0] & 0377;
41 while (optstring[0]) {
42 if (optstring[0] == ':') {
43 optstring++;
44 continue;
45 }
46- if ((optstring[0] & 0377) == optopt) {
47+ if ((optstring[0] & 0377) == optoptc) {
48 if (optstring[1] == ':') {
49 if (curp[1] != '\0') {
50 optarg = (char *)&curp[1];
51@@ -127,7 +127,7 @@ getopt(int argc, char *const argv[], const char *optstring)
52 optind++;
53 optarg = 0;
54 }
55- return optopt;
56+ return optoptc;
57 }
58 optstring++;
59 }