summaryrefslogtreecommitdiff
path: root/builtins/getopts.def
diff options
context:
space:
mode:
authorChet Ramey <chet.ramey@case.edu>2016-07-11 16:52:30 -0400
committerChet Ramey <chet.ramey@case.edu>2016-07-11 16:52:30 -0400
commita4eef1991c25c9d1c55f777952cd522c762c6fc3 (patch)
tree4e2ab6a10c616251cc92eccf0d58a22691bb8222 /builtins/getopts.def
parent690150f9e5e860a4211e71ef4446938bb57ee983 (diff)
downloadbash-a4eef1991c25c9d1c55f777952cd522c762c6fc3.tar.gz
bash-4.4 beta2 releasebash-4.4-beta2
Diffstat (limited to 'builtins/getopts.def')
-rw-r--r--builtins/getopts.def19
1 files changed, 16 insertions, 3 deletions
diff --git a/builtins/getopts.def b/builtins/getopts.def
index 7eef2fa6..590b1103 100644
--- a/builtins/getopts.def
+++ b/builtins/getopts.def
@@ -74,6 +74,7 @@ $END
#endif
#include "../bashansi.h"
+#include "../bashintl.h"
#include "../shell.h"
#include "common.h"
@@ -86,6 +87,7 @@ $END
extern char *this_command_name;
+static int getopts_unbind_variable __P((char *));
static int getopts_bind_variable __P((char *, char *));
static int dogetopts __P((int, char **));
@@ -100,6 +102,17 @@ getopts_reset (newind)
}
static int
+getopts_unbind_variable (name)
+ char *name;
+{
+#if 0
+ return (unbind_variable (name));
+#else
+ return (unbind_variable_noref (name));
+#endif
+}
+
+static int
getopts_bind_variable (name, value)
char *name, *value;
{
@@ -253,7 +266,7 @@ dogetopts (argc, argv)
if (ret == G_EOF)
{
- unbind_variable ("OPTARG");
+ getopts_unbind_variable ("OPTARG");
getopts_bind_variable (name, "?");
return (EXECUTION_FAILURE);
}
@@ -270,7 +283,7 @@ dogetopts (argc, argv)
bind_variable ("OPTARG", strval, 0);
}
else
- unbind_variable ("OPTARG");
+ getopts_unbind_variable ("OPTARG");
return (ret);
}
@@ -289,7 +302,7 @@ dogetopts (argc, argv)
else
{
ret = getopts_bind_variable (name, "?");
- unbind_variable ("OPTARG");
+ getopts_unbind_variable ("OPTARG");
}
return (ret);
}