Imported from ../bash-2.04.tar.gz.
[platform/upstream/bash.git] / builtins / cd.def
index b6bf692..4761623 100644 (file)
@@ -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)