forked from ~ljy/RK356X_SDK_RELEASE

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