mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-09 03:30:48 +02:00
bash-4.3-beta2 overlay
This commit is contained in:
+2
-1
@@ -2,6 +2,7 @@ This file is caller.def, from which is created caller.c. It implements the
|
||||
builtin "caller" in Bash.
|
||||
|
||||
Copyright (C) 2002-2008 Rocky Bernstein for Free Software Foundation, Inc.
|
||||
Copyright (C) 2008-2013 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -121,7 +122,7 @@ caller_builtin (list)
|
||||
{
|
||||
sh_invalidnum (list->word->word);
|
||||
builtin_usage ();
|
||||
return (EXECUTION_FAILURE);
|
||||
return (EX_USAGE);
|
||||
}
|
||||
|
||||
return (EXECUTION_SUCCESS);
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
This file is cd.def, from which is created cd.c. It implements the
|
||||
builtins "cd" and "pwd" in Bash.
|
||||
|
||||
Copyright (C) 1987-2011 Free Software Foundation, Inc.
|
||||
Copyright (C) 1987-2013 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -219,7 +219,7 @@ cd_builtin (list)
|
||||
break;
|
||||
default:
|
||||
builtin_usage ();
|
||||
return (EXECUTION_FAILURE);
|
||||
return (EX_USAGE);
|
||||
}
|
||||
}
|
||||
list = loptend;
|
||||
@@ -404,7 +404,7 @@ pwd_builtin (list)
|
||||
break;
|
||||
default:
|
||||
builtin_usage ();
|
||||
return (EXECUTION_FAILURE);
|
||||
return (EX_USAGE);
|
||||
}
|
||||
}
|
||||
list = loptend;
|
||||
|
||||
+18
-3
@@ -173,7 +173,7 @@ fc_builtin (list)
|
||||
register int i;
|
||||
register char *sep;
|
||||
int numbering, reverse, listing, execute;
|
||||
int histbeg, histend, last_hist, retval, opt, rh;
|
||||
int histbeg, histend, last_hist, retval, opt, rh, real_last;
|
||||
FILE *stream;
|
||||
REPL *rlist, *rl;
|
||||
char *ename, *command, *newcom, *fcedit;
|
||||
@@ -303,6 +303,14 @@ fc_builtin (list)
|
||||
rh = remember_on_history || ((subshell_environment & SUBSHELL_COMSUB) && enable_history_list);
|
||||
last_hist = i - rh - hist_last_line_added;
|
||||
|
||||
/* Make sure that real_last is calculated the same way here and in
|
||||
fc_gethnum. The return value from fc_gethnum is treated specially if
|
||||
it is == real_last and we are listing commands. */
|
||||
real_last = i;
|
||||
/* back up from the end to the last non-null history entry */
|
||||
while (hlist[real_last] == 0 && real_last > 0)
|
||||
real_last--;
|
||||
|
||||
/* XXX */
|
||||
if (i == last_hist && hlist[last_hist] == 0)
|
||||
while (last_hist >= 0 && hlist[last_hist] == 0)
|
||||
@@ -320,6 +328,8 @@ fc_builtin (list)
|
||||
|
||||
if (list)
|
||||
histend = fc_gethnum (list->word->word, hlist);
|
||||
else if (histbeg == real_last)
|
||||
histend = listing ? real_last : histbeg;
|
||||
else
|
||||
histend = listing ? last_hist : histbeg;
|
||||
}
|
||||
@@ -475,7 +485,7 @@ fc_gethnum (command, hlist)
|
||||
HIST_ENTRY **hlist;
|
||||
{
|
||||
int sign, n, clen, rh;
|
||||
register int i, j, last_hist;
|
||||
register int i, j, last_hist, real_last;
|
||||
register char *s;
|
||||
|
||||
sign = 1;
|
||||
@@ -503,12 +513,17 @@ fc_gethnum (command, hlist)
|
||||
if (last_hist < 0)
|
||||
return (-1);
|
||||
|
||||
real_last = i;
|
||||
i = last_hist;
|
||||
|
||||
/* No specification defaults to most recent command. */
|
||||
if (command == NULL)
|
||||
return (i);
|
||||
|
||||
/* back up from the end to the last non-null history entry */
|
||||
while (hlist[real_last] == 0 && real_last > 0)
|
||||
real_last--;
|
||||
|
||||
/* Otherwise, there is a specification. It can be a number relative to
|
||||
the current position, or an absolute history number. */
|
||||
s = command;
|
||||
@@ -533,7 +548,7 @@ fc_gethnum (command, hlist)
|
||||
return (n < 0 ? 0 : n);
|
||||
}
|
||||
else if (n == 0)
|
||||
return (i);
|
||||
return ((sign == -1) ? real_last : i);
|
||||
else
|
||||
{
|
||||
n -= history_base;
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
This file is hash.def, from which is created hash.c.
|
||||
It implements the builtin "hash" in Bash.
|
||||
|
||||
Copyright (C) 1987-2010 Free Software Foundation, Inc.
|
||||
Copyright (C) 1987-2013 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -31,7 +31,7 @@ no arguments are given, information about remembered commands is displayed.
|
||||
Options:
|
||||
-d forget the remembered location of each NAME
|
||||
-l display in a format that may be reused as input
|
||||
-p pathname use PATHNAME is the full pathname of NAME
|
||||
-p pathname use PATHNAME as the full pathname of NAME
|
||||
-r forget all remembered locations
|
||||
-t print the remembered location of each NAME, preceding
|
||||
each location with the corresponding NAME if multiple
|
||||
|
||||
+34
-20
@@ -1,7 +1,7 @@
|
||||
This file is help.def, from which is created help.c.
|
||||
It implements the builtin "help" in Bash.
|
||||
|
||||
Copyright (C) 1987-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 1987-2013 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -92,7 +92,7 @@ help_builtin (list)
|
||||
{
|
||||
register int i;
|
||||
char *pattern, *name;
|
||||
int plen, match_found, sflag, dflag, mflag;
|
||||
int plen, match_found, sflag, dflag, mflag, m, pass, this_found;
|
||||
|
||||
dflag = sflag = mflag = 0;
|
||||
reset_internal_getopt ();
|
||||
@@ -137,29 +137,43 @@ help_builtin (list)
|
||||
pattern = list->word->word;
|
||||
plen = strlen (pattern);
|
||||
|
||||
for (i = 0; name = shell_builtins[i].name; i++)
|
||||
for (pass = 1, this_found = 0; pass < 3; pass++)
|
||||
{
|
||||
QUIT;
|
||||
if ((strcmp (pattern, name) == 0) ||
|
||||
(strmatch (pattern, name, FNMATCH_EXTFLAG) != FNM_NOMATCH))
|
||||
for (i = 0; name = shell_builtins[i].name; i++)
|
||||
{
|
||||
match_found++;
|
||||
if (dflag)
|
||||
{
|
||||
show_desc (name, i);
|
||||
continue;
|
||||
}
|
||||
else if (mflag)
|
||||
{
|
||||
show_manpage (name, i);
|
||||
continue;
|
||||
}
|
||||
QUIT;
|
||||
|
||||
printf ("%s: %s\n", name, _(shell_builtins[i].short_doc));
|
||||
/* First pass: look for exact string or pattern matches.
|
||||
Second pass: look for prefix matches like bash-4.2 */
|
||||
if (pass == 1)
|
||||
m = (strcmp (pattern, name) == 0) ||
|
||||
(strmatch (pattern, name, FNMATCH_EXTFLAG) != FNM_NOMATCH);
|
||||
else
|
||||
m = strncmp (pattern, name, plen) == 0;
|
||||
|
||||
if (sflag == 0)
|
||||
show_longdoc (i);
|
||||
if (m)
|
||||
{
|
||||
this_found = 1;
|
||||
match_found++;
|
||||
if (dflag)
|
||||
{
|
||||
show_desc (name, i);
|
||||
continue;
|
||||
}
|
||||
else if (mflag)
|
||||
{
|
||||
show_manpage (name, i);
|
||||
continue;
|
||||
}
|
||||
|
||||
printf ("%s: %s\n", name, _(shell_builtins[i].short_doc));
|
||||
|
||||
if (sflag == 0)
|
||||
show_longdoc (i);
|
||||
}
|
||||
}
|
||||
if (pass == 1 && this_found == 1)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -94,7 +94,7 @@ kill_builtin (list)
|
||||
if (list == 0)
|
||||
{
|
||||
builtin_usage ();
|
||||
return (EXECUTION_FAILURE);
|
||||
return (EX_USAGE);
|
||||
}
|
||||
|
||||
any_succeeded = listing = saw_signal = 0;
|
||||
@@ -139,7 +139,7 @@ kill_builtin (list)
|
||||
else if (ISOPTION (word, '?'))
|
||||
{
|
||||
builtin_usage ();
|
||||
return (EXECUTION_SUCCESS);
|
||||
return (EX_USAGE);
|
||||
}
|
||||
/* If this is a signal specification then process it. We only process
|
||||
the first one seen; other arguments may signify process groups (e.g,
|
||||
@@ -168,7 +168,7 @@ kill_builtin (list)
|
||||
if (list == 0)
|
||||
{
|
||||
builtin_usage ();
|
||||
return (EXECUTION_FAILURE);
|
||||
return (EX_USAGE);
|
||||
}
|
||||
|
||||
while (list)
|
||||
|
||||
+7
-7
@@ -228,7 +228,7 @@ pushd_builtin (list)
|
||||
{
|
||||
sh_invalidnum (list->word->word);
|
||||
builtin_usage ();
|
||||
return (EXECUTION_FAILURE);
|
||||
return (EX_USAGE);
|
||||
}
|
||||
|
||||
if (direction == '-')
|
||||
@@ -245,7 +245,7 @@ pushd_builtin (list)
|
||||
{
|
||||
sh_invalidopt (list->word->word);
|
||||
builtin_usage ();
|
||||
return (EXECUTION_FAILURE);
|
||||
return (EX_USAGE);
|
||||
}
|
||||
else
|
||||
break;
|
||||
@@ -339,7 +339,7 @@ popd_builtin (list)
|
||||
{
|
||||
sh_invalidnum (list->word->word);
|
||||
builtin_usage ();
|
||||
return (EXECUTION_FAILURE);
|
||||
return (EX_USAGE);
|
||||
}
|
||||
which_word = list->word->word;
|
||||
}
|
||||
@@ -347,13 +347,13 @@ popd_builtin (list)
|
||||
{
|
||||
sh_invalidopt (list->word->word);
|
||||
builtin_usage ();
|
||||
return (EXECUTION_FAILURE);
|
||||
return (EX_USAGE);
|
||||
}
|
||||
else if (*list->word->word)
|
||||
{
|
||||
builtin_error (_("%s: invalid argument"), list->word->word);
|
||||
builtin_usage ();
|
||||
return (EXECUTION_FAILURE);
|
||||
return (EX_USAGE);
|
||||
}
|
||||
else
|
||||
break;
|
||||
@@ -432,7 +432,7 @@ dirs_builtin (list)
|
||||
{
|
||||
sh_invalidnum (list->word->word);
|
||||
builtin_usage ();
|
||||
return (EXECUTION_FAILURE);
|
||||
return (EX_USAGE);
|
||||
}
|
||||
sign = (*list->word->word == '+') ? 1 : -1;
|
||||
desired_index = get_dirstack_index (i, sign, &index_flag);
|
||||
@@ -441,7 +441,7 @@ dirs_builtin (list)
|
||||
{
|
||||
sh_invalidopt (list->word->word);
|
||||
builtin_usage ();
|
||||
return (EXECUTION_FAILURE);
|
||||
return (EX_USAGE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -639,7 +639,7 @@ read_builtin (list)
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((unsigned char)c == delim)
|
||||
if (ignore_delim == 0 && (unsigned char)c == delim)
|
||||
break;
|
||||
|
||||
if (c == '\0' && delim != '\0')
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
This file is wait.def, from which is created wait.c.
|
||||
It implements the builtin "wait" in Bash.
|
||||
|
||||
Copyright (C) 1987-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 1987-2013 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -112,7 +112,7 @@ wait_builtin (list)
|
||||
#endif
|
||||
default:
|
||||
builtin_usage ();
|
||||
return (EXECUTION_FAILURE);
|
||||
return (EX_USAGE);
|
||||
}
|
||||
}
|
||||
list = loptend;
|
||||
|
||||
Reference in New Issue
Block a user