Imported from ../bash-4.0-rc1.tar.gz.
This commit is contained in:
parent
f1be666c7d
commit
3185942a52
666 changed files with 188710 additions and 54674 deletions
|
@ -1,94 +1,114 @@
|
|||
This file is pushd.def, from which is created pushd.c. It implements the
|
||||
builtins "pushd", "popd", and "dirs" in Bash.
|
||||
|
||||
Copyright (C) 1987-2004 Free Software Foundation, Inc.
|
||||
Copyright (C) 1987-2009 Free Software Foundation, Inc.
|
||||
|
||||
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 2, or (at your option) any later
|
||||
version.
|
||||
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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
Bash is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License 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, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bash. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
$PRODUCES pushd.c
|
||||
|
||||
$BUILTIN pushd
|
||||
$FUNCTION pushd_builtin
|
||||
$DEPENDS_ON PUSHD_AND_POPD
|
||||
$SHORT_DOC pushd [dir | +N | -N] [-n]
|
||||
$SHORT_DOC pushd [-n] [+N | -N | dir]
|
||||
Add directories to stack.
|
||||
|
||||
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 Rotates the stack so that the Nth directory (counting
|
||||
Options:
|
||||
-n Suppresses the normal change of directory when adding
|
||||
directories 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.
|
||||
|
||||
-n suppress the normal change of directory when adding directories
|
||||
to the stack, so only the stack is manipulated.
|
||||
|
||||
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.
|
||||
|
||||
Exit Status:
|
||||
Returns success unless an invalid argument is supplied or the directory
|
||||
change fails.
|
||||
$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.
|
||||
$SHORT_DOC popd [-n] [+N | -N]
|
||||
Remove directories from stack.
|
||||
|
||||
+N removes the Nth entry counting from the left of the list
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
-n suppress the normal change of directory when removing directories
|
||||
from the stack, so only the stack is manipulated.
|
||||
The `dirs' builtin displays the directory stack.
|
||||
|
||||
You can see the directory stack with the `dirs' command.
|
||||
Exit Status:
|
||||
Returns success unless an invalid argument is supplied or the directory
|
||||
change fails.
|
||||
$END
|
||||
|
||||
$BUILTIN dirs
|
||||
$FUNCTION dirs_builtin
|
||||
$DEPENDS_ON PUSHD_AND_POPD
|
||||
$SHORT_DOC dirs [-clpv] [+N] [-N]
|
||||
Display directory stack.
|
||||
|
||||
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 -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 -v flag
|
||||
causes `dirs' to print the directory stack with one entry per line,
|
||||
prepending the directory name with its position in the stack. The -p
|
||||
flag does the same thing, but the stack position is not prepended.
|
||||
The -c flag clears the directory stack by deleting all of the elements.
|
||||
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.
|
||||
|
||||
Exit Status:
|
||||
Returns success unless an invalid option is supplied or an error occurs.
|
||||
$END
|
||||
|
||||
#include <config.h>
|
||||
|
@ -448,7 +468,7 @@ dirs_builtin (list)
|
|||
if (index_flag)
|
||||
{
|
||||
putchar ('\n');
|
||||
return EXECUTION_SUCCESS;
|
||||
return (sh_chkwrite (EXECUTION_SUCCESS));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -473,8 +493,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
|
||||
|
@ -483,9 +503,9 @@ pushd_error (offset, arg)
|
|||
char *arg;
|
||||
{
|
||||
if (offset == 0)
|
||||
builtin_error ("directory stack empty");
|
||||
builtin_error (_("directory stack empty"));
|
||||
else
|
||||
sh_erange (arg, "directory stack index");
|
||||
sh_erange (arg, _("directory stack index"));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -660,66 +680,70 @@ get_directory_stack (flags)
|
|||
|
||||
#ifdef LOADABLE_BUILTIN
|
||||
char * const dirs_doc[] = {
|
||||
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 -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_(" "),
|
||||
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_(" dirs when invoked without options, starting with zero."),
|
||||
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\
|
||||
Options:\n\
|
||||
-c clear the directory stack by deleting all of the elements\n\
|
||||
-l do not print tilde-prefixed versions of directories relative\n\
|
||||
to your home directory\n\
|
||||
-p print the directory stack with one entry per line\n\
|
||||
-v print the directory stack with one entry per line prefixed\n\
|
||||
with its position in the stack\n\
|
||||
\n\
|
||||
Arguments:\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\
|
||||
dirs when invoked without options, starting with zero."),
|
||||
(char *)NULL
|
||||
};
|
||||
|
||||
char * const pushd_doc[] = {
|
||||
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 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_(" "),
|
||||
N_("-N Rotates the stack so that the Nth directory (counting"),
|
||||
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_(" new current working directory."),
|
||||
N_(" "),
|
||||
N_("You can see the directory stack with the `dirs' command."),
|
||||
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\
|
||||
Options:\n\
|
||||
-n Suppresses the normal change of directory when adding\n\
|
||||
directories to the stack, so only the stack is manipulated.\n\
|
||||
\n\
|
||||
Arguments:\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\
|
||||
\n\
|
||||
-N Rotates the stack so that the Nth directory (counting\n\
|
||||
from the right of the list shown by `dirs', starting with\n\
|
||||
zero) is at the top.\n\
|
||||
\n\
|
||||
dir Adds DIR to the directory stack at the top, making it the\n\
|
||||
new current working directory.\n\
|
||||
\n\
|
||||
The `dirs' builtin displays the directory stack."),
|
||||
(char *)NULL
|
||||
};
|
||||
|
||||
char * const popd_doc[] = {
|
||||
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_(" 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_(" 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."),
|
||||
N_("Removes entries from the directory stack. With no arguments, removes\n\
|
||||
the top directory from the stack, and changes to the new top directory.\n\
|
||||
\n\
|
||||
Options:\n\
|
||||
-n Suppresses the normal change of directory when removing\n\
|
||||
directories from the stack, so only the stack is manipulated.\n\
|
||||
\n\
|
||||
Arguments:\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\
|
||||
shown by `dirs', starting with zero. For example: `popd -0'\n\
|
||||
removes the last directory, `popd -1' the next to last.\n\
|
||||
\n\
|
||||
The `dirs' builtin displays the directory stack."),
|
||||
(char *)NULL
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue