]> git.ipfire.org Git - thirdparty/bash.git/blobdiff - builtins/pushd.def~
commit bash-20080207 snapshot
[thirdparty/bash.git] / builtins / pushd.def~
index 4a7c284b11d8b85bafe688a8d7a586c71a60dfc1..f8599c05c618c6df18f71d370f352b34b91fb021 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-2006 Free Software Foundation, Inc.
+Copyright (C) 1987-2008 Free Software Foundation, Inc.
 
 This file is part of GNU Bash, the Bourne Again SHell.
 
@@ -29,43 +29,50 @@ Adds a directory to the top of the directory stack, or rotates
 the stack, making the new top of the stack the current working
 directory.  With no arguments, exchanges the top two directories.
 
--n     Suppresses the normal change of directory when adding directories
-       to the stack, so only the stack is manipulated.
+Options:
 
-+N     Rotates the stack so that the Nth directory (counting
+  -n   Suppresses the normal change of directory when adding
+       directorie to the stack, so only the stack is manipulated.
+
+Arguments:
+
+  +N   Rotates the stack so that the Nth directory (counting
        from the left of the list shown by `dirs', starting with
        zero) is at the top.
 
--N     Rotates the stack so that the Nth directory (counting
+  -N   Rotates the stack so that the Nth directory (counting
        from the right of the list shown by `dirs', starting with
        zero) is at the top.
 
-dir    Adds DIR to the directory stack at the top, making it the
+  dir  Adds DIR to the directory stack at the top, making it the
        new current working directory.
 
-You can see the directory stack with the `dirs' command.
+The `dirs' builtin displays the directory stack.
 $END
 
 $BUILTIN popd
 $FUNCTION popd_builtin
 $DEPENDS_ON PUSHD_AND_POPD
 $SHORT_DOC popd [-n] [+N | -N]
-Removes entries from the directory stack.  With no arguments,
-removes the top directory from the stack, and cd's to the new
-top directory.
+Removes entries from the directory stack.  With no arguments, removes
+the top directory from the stack, and changes to the new top directory.
+
+Options:
 
--n     Suppresses the normal change of directory when removing directories
-       from the stack, so only the stack is manipulated.
+  -n   Suppresses the normal change of directory when removing
+       directories from the stack, so only the stack is manipulated.
 
-+N     Removes the Nth entry counting from the left of the list
+Arguments:
+
+  +N   Removes the Nth entry counting from the left of the list
        shown by `dirs', starting with zero.  For example: `popd +0'
        removes the first directory, `popd +1' the second.
 
--N     Removes the Nth entry counting from the right of the list
+  -N   Removes the Nth entry counting from the right of the list
        shown by `dirs', starting with zero.  For example: `popd -0'
        removes the last directory, `popd -1' the next to last.
 
-You can see the directory stack with the `dirs' command.
+The `dirs' builtin displays the directory stack.
 $END
 
 $BUILTIN dirs
@@ -76,18 +83,21 @@ Display the list of currently remembered directories.  Directories
 find their way onto the list with the `pushd' command; you can get
 back up through the list with the `popd' command.
 
-The -c flag clears the directory stack by deleting all of the elements.
-The -l flag specifies that `dirs' should not print shorthand versions
-of directories which are relative to your home directory.  This means
-that `~/bin' might be displayed as `/homes/bfox/bin'.  The -p flag
-causes `dirs' to print the directory stack with one entry per line.
-The -v flag does the same thing, prefixing each directory name with its
-position in the stack.
+Options:
+
+  -c   clear the directory stack by deleting all of the elements
+  -l   do not print tilde-prefixed versions of directories relative
+       to your home directory
+  -p   print the directory stack with one entry per line
+  -v   print the directory stack with one entry per line prefixed
+       with its position in the stack
 
-+N     Displays the Nth entry counting from the left of the list shown by
+Arguments:
+
+  +N   Displays the Nth entry counting from the left of the list shown by
        dirs when invoked without options, starting with zero.
 
--N     Displays the Nth entry counting from the right of the list shown by
+  -N   Displays the Nth entry counting from the right of the list shown by
        dirs when invoked without options, starting with zero.
 $END
 
@@ -448,7 +458,7 @@ dirs_builtin (list)
       if (index_flag)
        {
          putchar ('\n');
-         return EXECUTION_SUCCESS;
+         return (sh_chkwrite (EXECUTION_SUCCESS));
        }
     }
 
@@ -473,8 +483,8 @@ dirs_builtin (list)
        printf ("%s%s", (vflag & 1) ? "\n" : " ", DIRSTACK_ENTRY (i));
 
   putchar ('\n');
-  fflush (stdout);
-  return (EXECUTION_SUCCESS);
+
+  return (sh_chkwrite (EXECUTION_SUCCESS));
 }
 
 static void
@@ -664,18 +674,18 @@ N_("Display the list of currently remembered directories.  Directories\n\
     find their way onto the list with the `pushd' command; you can get\n\
     back up through the list with the `popd' command.\n\
     \n\
+    The -c flag clears the directory stack by deleting all of the elements.\n\
     The -l flag specifies that `dirs' should not print shorthand versions\n\
     of directories which are relative to your home directory.  This means\n\
-    that `~/bin' might be displayed as `/homes/bfox/bin'.  The -v flag\n\
-    causes `dirs' to print the directory stack with one entry per line,\n\
-    prepending the directory name with its position in the stack.  The -p\n\
-    flag does the same thing, but the stack position is not prepended.\n\
-    The -c flag clears the directory stack by deleting all of the elements.\n\
+    that `~/bin' might be displayed as `/homes/bfox/bin'.  The -p flag\n\
+    causes `dirs' to print the directory stack with one entry per line.\n\
+    The -v flag does the same thing, prefixing each directory name with its\n\
+    position in the stack.\n\
     \n\
-    +N  displays the Nth entry counting from the left of the list shown by\n\
+    +N  Displays the Nth entry counting from the left of the list shown by\n\
         dirs when invoked without options, starting with zero.\n\
     \n\
-    -N  displays the Nth entry counting from the right of the list shown by\n\
+    -N  Displays the Nth entry counting from the right of the list shown by\n\
         dirs when invoked without options, starting with zero."),
   (char *)NULL
 };
@@ -685,6 +695,9 @@ N_("Adds a directory to the top of the directory stack, or rotates\n\
     the stack, making the new top of the stack the current working\n\
     directory.  With no arguments, exchanges the top two directories.\n\
     \n\
+    -n  Suppresses the normal change of directory when adding directories\n\
+        to the stack, so only the stack is manipulated.\n\
+    \n\
     +N  Rotates the stack so that the Nth directory (counting\n\
         from the left of the list shown by `dirs', starting with\n\
         zero) is at the top.\n\
@@ -693,10 +706,7 @@ N_("Adds a directory to the top of the directory stack, or rotates\n\
         from the right of the list shown by `dirs', starting with\n\
         zero) is at the top.\n\
     \n\
-    -n  suppress the normal change of directory when adding directories\n\
-        to the stack, so only the stack is manipulated.\n\
-    \n\
-    dir adds DIR to the directory stack at the top, making it the\n\
+    dir Adds DIR to the directory stack at the top, making it the\n\
         new current working directory.\n\
     \n\
     You can see the directory stack with the `dirs' command."),
@@ -708,17 +718,17 @@ N_("Removes entries from the directory stack.  With no arguments,\n\
     removes the top directory from the stack, and cd's to the new\n\
     top directory.\n\
     \n\
-    +N  removes the Nth entry counting from the left of the list\n\
+    -n  Suppresses the normal change of directory when removing directories\n\
+        from the stack, so only the stack is manipulated.\n\
+    \n\
+    +N  Removes the Nth entry counting from the left of the list\n\
         shown by `dirs', starting with zero.  For example: `popd +0'\n\
         removes the first directory, `popd +1' the second.\n\
     \n\
-    -N  removes the Nth entry counting from the right of the list\n\
+    -N  Removes the Nth entry counting from the right of the list\n\
         shown by `dirs', starting with zero.  For example: `popd -0'\n\
         removes the last directory, `popd -1' the next to last.\n\
     \n\
-    -n  suppress the normal change of directory when removing directories\n\
-        from the stack, so only the stack is manipulated.\n\
-    \n\
     You can see the directory stack with the `dirs' command."),
   (char *)NULL
 };