commit bash-20130809 snapshot

This commit is contained in:
Chet Ramey
2013-09-12 08:54:38 -04:00
parent adbaf2b395
commit 9353cc0550
10 changed files with 97 additions and 37 deletions
+4
View File
@@ -510,6 +510,10 @@ fc_gethnum (command, hlist)
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;
+2 -2
View File
@@ -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
View File
@@ -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;
}
}