aboutsummaryrefslogtreecommitdiffstats
path: root/builtins/cd.def
diff options
context:
space:
mode:
authorJari Aalto <jari.aalto@cante.net>2000-03-17 21:46:59 +0000
committerJari Aalto <jari.aalto@cante.net>2009-09-12 16:46:53 +0000
commitbb70624e964126b7ac4ff085ba163a9c35ffa18f (patch)
treeba2dd4add13ada94b1899c6d4aca80195b80b74b /builtins/cd.def
parentb72432fdcc59300c6fe7c9d6c8a31ad3447933f5 (diff)
downloadandroid_external_bash-bb70624e964126b7ac4ff085ba163a9c35ffa18f.tar.gz
android_external_bash-bb70624e964126b7ac4ff085ba163a9c35ffa18f.tar.bz2
android_external_bash-bb70624e964126b7ac4ff085ba163a9c35ffa18f.zip
Imported from ../bash-2.04.tar.gz.
Diffstat (limited to 'builtins/cd.def')
-rw-r--r--builtins/cd.def51
1 files changed, 6 insertions, 45 deletions
diff --git a/builtins/cd.def b/builtins/cd.def
index b6bf692..4761623 100644
--- a/builtins/cd.def
+++ b/builtins/cd.def
@@ -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,7 +17,7 @@ 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 cd.c
#include <config.h>
@@ -30,8 +30,8 @@ $PRODUCES cd.c
#endif
#include "../bashtypes.h"
-#include "../posixdir.h"
-#include "../posixstat.h"
+#include "posixdir.h"
+#include "posixstat.h"
#ifndef _MINIX
#include <sys/param.h>
#endif
@@ -45,7 +45,7 @@ $PRODUCES cd.c
#include "../shell.h"
#include "../flags.h"
-#include "../maxpath.h"
+#include "maxpath.h"
#include "common.h"
#include "bashgetopt.h"
@@ -83,45 +83,6 @@ instead of following symbolic links; the -L option forces symbolic links
to be followed.
$END
-/* Take PATH, an element from $CDPATH, and DIR, a directory name, and paste
- them together into PATH/DIR. Tilde expansion is performed on PATH if
- DOTILDE is non-zero. If PATH is the empty string, it is converted to
- `./', since a null element in $CDPATH means the current directory. */
-static char *
-mkpath (path, dir, dotilde)
- char *path, *dir;
- int dotilde;
-{
- int dirlen, pathlen;
- char *ret, *xpath;
-
- if (*path == '\0')
- {
- xpath = xmalloc (2);
- xpath[0] = '.';
- xpath[1] = '\0';
- pathlen = 1;
- }
- else
- {
- xpath = (dotilde && *path == '~') ? bash_tilde_expand (path) : path;
- pathlen = strlen (xpath);
- }
-
- dirlen = strlen (dir);
- ret = xmalloc (2 + dirlen + pathlen);
- strcpy (ret, xpath);
- if (xpath[pathlen - 1] != '/')
- {
- ret[pathlen++] = '/';
- ret[pathlen] = '\0';
- }
- strcpy (ret + pathlen, dir);
- if (xpath != path)
- free (xpath);
- return (ret);
-}
-
static int
bindpwd (no_symlinks)
int no_symlinks;
@@ -245,7 +206,7 @@ cd_builtin (list)
{
/* OPT is 1 if the path element is non-empty */
opt = path[0] != '\0';
- temp = mkpath (path, dirname, 1);
+ temp = sh_makepath (path, dirname, MP_DOTILDE);
free (path);
if (stat (temp, &sb) < 0 || S_ISDIR (sb.st_mode) == 0)