Imported from ../bash-2.05b.tar.gz.
[platform/upstream/bash.git] / builtins / builtin.def
index f3de5d6..8571f37 100644 (file)
@@ -1,7 +1,7 @@
 This file is builtin.def, from which is created builtin.c.
 It implements the builtin "builtin" in Bash.
 
-Copyright (C) 1987, 1989, 1991 Free Software Foundation, Inc.
+Copyright (C) 1987-2002 Free Software Foundation, Inc.
 
 This file is part of GNU Bash, the Bourne Again SHell.
 
@@ -39,6 +39,7 @@ $END
 
 #include "../shell.h"
 #include "common.h"
+#include "bashgetopt.h"
 
 extern char *this_command_name;
 
@@ -51,10 +52,14 @@ builtin_builtin (list)
   sh_builtin_func_t *function;
   register char *command;
 
-  if (!list)
+  if (no_options (list))
+    return (EX_USAGE);
+  list = loptend;      /* skip over possible `--' */
+
+  if (list == 0)
     return (EXECUTION_SUCCESS);
 
-  command = (list->word->word);
+  command = list->word->word;
 #if defined (DISABLED_BUILTINS)
   function = builtin_address (command);
 #else /* !DISABLED_BUILTINS */