Bash-4.4 distribution sources and documentation

This commit is contained in:
Chet Ramey 2016-09-15 16:59:08 -04:00
commit a0c0a00fc4
588 changed files with 130746 additions and 80164 deletions

View file

@ -1,7 +1,7 @@
This file is getopts.def, from which is created getopts.c.
It implements the builtin "getopts" in Bash.
Copyright (C) 1987-2004 Free Software Foundation, Inc.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@ -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 **));
@ -99,6 +101,17 @@ getopts_reset (newind)
sh_badopt = 0;
}
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);
}
@ -316,9 +329,12 @@ getopts_builtin (list)
}
reset_internal_getopt ();
if (internal_getopt (list, "") != -1)
if ((ret = internal_getopt (list, "")) != -1)
{
builtin_usage ();
if (ret == GETOPT_HELP)
builtin_help ();
else
builtin_usage ();
return (EX_USAGE);
}
list = loptend;