Imported from ../bash-2.04.tar.gz.

This commit is contained in:
Jari Aalto 2000-03-17 21:46:59 +00:00
commit bb70624e96
387 changed files with 28522 additions and 9334 deletions

View file

@ -7,7 +7,7 @@ This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 1, or (at your option) any later
Software Foundation; either version 2, or (at your option) any later
version.
Bash is distributed in the hope that it will be useful, but WITHOUT ANY
@ -17,17 +17,19 @@ for more details.
You should have received a copy of the GNU General Public License along
with Bash; see the file COPYING. If not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
$PRODUCES help.c
$BUILTIN help
$FUNCTION help_builtin
$DEPENDS_ON HELP_BUILTIN
$SHORT_DOC help [pattern ...]
$SHORT_DOC help [-s] [pattern ...]
Display helpful information about builtin commands. If PATTERN is
specified, gives detailed help on all commands matching PATTERN,
otherwise a list of the builtins is printed.
otherwise a list of the builtins is printed. The -s option
restricts the output for each builtin command matching PATTERN to
a short usage synopsis.
$END
#include <config.h>
@ -64,14 +66,17 @@ help_builtin (list)
{
register int i, j;
char *pattern, *name;
int plen, match_found;
int plen, match_found, sflag;
/* Placeholder for future options. */
sflag = 0;
reset_internal_getopt ();
while ((i = internal_getopt (list, "")) != -1)
while ((i = internal_getopt (list, "s")) != -1)
{
switch (i)
{
case 's':
sflag = 1;
break;
default:
builtin_usage ();
return (EX_USAGE);
@ -108,8 +113,9 @@ help_builtin (list)
{
printf ("%s: %s\n", name, shell_builtins[i].short_doc);
for (j = 0; shell_builtins[i].long_doc[j]; j++)
printf (" %s\n", shell_builtins[i].long_doc[j]);
if (sflag == 0)
for (j = 0; shell_builtins[i].long_doc[j]; j++)
printf (" %s\n", shell_builtins[i].long_doc[j]);
match_found++;
}