Bash-4.3 distribution sources and documentation
[platform/upstream/bash.git] / builtins / pushd.def
index 05b7529..9c6548f 100644 (file)
@@ -1,7 +1,7 @@
 This file is pushd.def, from which is created pushd.c.  It implements the
 builtins "pushd", "popd", and "dirs" in Bash.
 
-Copyright (C) 1987-2009 Free Software Foundation, Inc.
+Copyright (C) 1987-2013 Free Software Foundation, Inc.
 
 This file is part of GNU Bash, the Bourne Again SHell.
 
@@ -115,7 +115,7 @@ $END
 
 #if defined (PUSHD_AND_POPD)
 #include <stdio.h>
-#ifndef _MINIX
+#if defined (HAVE_SYS_PARAM_H)
 #  include <sys/param.h>
 #endif
 
@@ -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,7 +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 (EX_USAGE);
        }
       else
        break;
@@ -426,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);
@@ -435,7 +441,7 @@ dirs_builtin (list)
        {
          sh_invalidopt (list->word->word);
          builtin_usage ();
-         return (EXECUTION_FAILURE);
+         return (EX_USAGE);
        }
     }