This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Directory separator patches updated


I've updated my directory separator patches to also patch gcc/prefix.c 
and gcc/cccp.c plus I found some more cases in gcc/gcc.c to convert to 
use IS_DIR_SEPARATOR. The gcc/gcc.c patch is synced to the gcc.c 
current in CVS.

Changelog:

* gcc/config/i386/xm-djgpp.h
  (DIR_SEPARATOR): Set to '/'.
  (DIR_SEPARATOR_2): New macro. Set to '\'.
  (HAVE_DOS_BASED_FILESYS): Define.

* gcc/gcc.c
  (IS_DIR_SEPARATOR): Define new macro. Returns true if a character 
is a directory separator.
  (find_a_file): Use it.
  (convert_filename): Likewise.
  (process_command): Likewise.
  (do_spec_1): Likewise.
  (is_directory): Likewise.
  (main): Likewise.

* gcc/cccp.c
  (DIR_SEPARATOR): Move to top of file.
  (is_dir_separator): New inline function. Tests whether a character is a 
directory separator.
  (simplify_filename): Use it.

* gcc/prefix.c
  (IS_DIR_SEPARATOR): Define. Tests whether a character is  a 
directory separator.
  (translate_name): Use it.
  (update_path): Change DIR_SEPARATOR_2 to DIR_SEPARATOR. Fix 
warning in block where '/' is changed to DIR_SEPARATOR.

The patch is attached.

Mark

--- 
Mark Elbrecht, snowball3@usa.net
http://snowball.digitalspace.net/

*** gcc/config/i386/xm-djgpp.h.orig	Wed Mar 24 18:35:34 1999
--- gcc/config/i386/xm-djgpp.h	Thu Mar 25 21:03:44 1999
*************** Boston, MA 02111-1307, USA.  */
*** 28,34 ****
  #define EXECUTABLE_SUFFIX ".exe"
  
  /* Even though we support "/", allow "\" since everybody tests both.  */
! #define DIR_SEPARATOR '\\'
  
  #define NO_SYS_SIGLIST 1
  
--- 28,38 ----
  #define EXECUTABLE_SUFFIX ".exe"
  
  /* Even though we support "/", allow "\" since everybody tests both.  */
! #define DIR_SEPARATOR '/'
! #define DIR_SEPARATOR_2 '\\'
! 
! /* Allow test for DOS drive names.  */
! #define HAVE_DOS_BASED_FILESYSTEM
  
  #define NO_SYS_SIGLIST 1
  
*** gcc/gcc.c.orig	Thu Mar 25 18:36:34 1999
--- gcc/gcc.c	Fri Mar 26 12:09:10 1999
*************** compilation is specified by a string cal
*** 66,71 ****
--- 66,79 ----
  #define DIR_SEPARATOR '/'
  #endif
  
+ /* Define IS_DIR_SEPARATOR.  */
+ #ifndef DIR_SEPARATOR_2
+ # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
+ #else /* DIR_SEPARATOR_2 */
+ # define IS_DIR_SEPARATOR(ch) \
+ 	(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
+ #endif /* DIR_SEPARATOR_2 */
+ 
  static char dir_separator_str[] = {DIR_SEPARATOR, 0};
  
  #define obstack_chunk_alloc xmalloc
*************** find_a_file (pprefix, name, mode)
*** 1991,2000 ****
  
    /* Determine the filename to execute (special case for absolute paths).  */
  
!   if (*name == '/' || *name == DIR_SEPARATOR
        /* Check for disk name on MS-DOS-based systems.  */
!       || (DIR_SEPARATOR == '\\' && name[1] == ':'
! 	  && (name[2] == DIR_SEPARATOR || name[2] == '/')))
      {
        if (access (name, mode) == 0)
  	{
--- 1999,2010 ----
  
    /* Determine the filename to execute (special case for absolute paths).  */
  
!   if (IS_DIR_SEPARATOR (*name)
! #ifdef HAVE_DOS_BASED_FILESYSTEM
        /* Check for disk name on MS-DOS-based systems.  */
!       || (name[0] && name[1] == ':' && IS_DIR_SEPARATOR (name[2]))
! #endif
!       )
      {
        if (access (name, mode) == 0)
  	{
*************** convert_filename (name, do_exe)
*** 2434,2440 ****
      return name;
  
    for (i = len - 1; i >= 0; i--)
!     if (name[i] == '/' || name[i] == DIR_SEPARATOR)
        break;
  
    for (i++; i < len; i++)
--- 2444,2450 ----
      return name;
  
    for (i = len - 1; i >= 0; i--)
!     if (IS_DIR_SEPARATOR (name[i]))
        break;
  
    for (i++; i < len; i++)
*************** process_command (argc, argv)
*** 2597,2609 ****
      {
        int len = strlen (gcc_exec_prefix);
        if (len > (int) sizeof ("/lib/gcc-lib/")-1
! 	  && (gcc_exec_prefix[len-1] == '/'
! 	      || gcc_exec_prefix[len-1] == DIR_SEPARATOR))
  	{
  	  temp = gcc_exec_prefix + len - sizeof ("/lib/gcc-lib/") + 1;
! 	  if ((*temp == '/' || *temp == DIR_SEPARATOR)
  	      && strncmp (temp+1, "lib", 3) == 0
! 	      && (temp[4] == '/' || temp[4] == DIR_SEPARATOR)
  	      && strncmp (temp+5, "gcc-lib", 7) == 0)
  	    len -= sizeof ("/lib/gcc-lib/") - 1;
  	}
--- 2607,2618 ----
      {
        int len = strlen (gcc_exec_prefix);
        if (len > (int) sizeof ("/lib/gcc-lib/")-1
! 	  && (IS_DIR_SEPARATOR (gcc_exec_prefix[len-1])))
  	{
  	  temp = gcc_exec_prefix + len - sizeof ("/lib/gcc-lib/") + 1;
! 	  if (IS_DIR_SEPARATOR (*temp)
  	      && strncmp (temp+1, "lib", 3) == 0
! 	      && IS_DIR_SEPARATOR (temp[4])
  	      && strncmp (temp+5, "gcc-lib", 7) == 0)
  	    len -= sizeof ("/lib/gcc-lib/") - 1;
  	}
*************** process_command (argc, argv)
*** 2630,2636 ****
  	      strncpy (nstore, startp, endp-startp);
  	      if (endp == startp)
  		strcpy (nstore, concat (".", dir_separator_str, NULL_PTR));
! 	      else if (endp[-1] != '/' && endp[-1] != DIR_SEPARATOR)
  		{
  		  nstore[endp-startp] = DIR_SEPARATOR;
  		  nstore[endp-startp+1] = 0;
--- 2639,2645 ----
  	      strncpy (nstore, startp, endp-startp);
  	      if (endp == startp)
  		strcpy (nstore, concat (".", dir_separator_str, NULL_PTR));
! 	      else if (!IS_DIR_SEPARATOR (endp[-1]))
  		{
  		  nstore[endp-startp] = DIR_SEPARATOR;
  		  nstore[endp-startp+1] = 0;
*************** process_command (argc, argv)
*** 2664,2670 ****
  	      strncpy (nstore, startp, endp-startp);
  	      if (endp == startp)
  		strcpy (nstore, concat (".", dir_separator_str, NULL_PTR));
! 	      else if (endp[-1] != '/' && endp[-1] != DIR_SEPARATOR)
  		{
  		  nstore[endp-startp] = DIR_SEPARATOR;
  		  nstore[endp-startp+1] = 0;
--- 2673,2679 ----
  	      strncpy (nstore, startp, endp-startp);
  	      if (endp == startp)
  		strcpy (nstore, concat (".", dir_separator_str, NULL_PTR));
! 	      else if (!IS_DIR_SEPARATOR (endp[-1]))
  		{
  		  nstore[endp-startp] = DIR_SEPARATOR;
  		  nstore[endp-startp+1] = 0;
*************** process_command (argc, argv)
*** 2697,2703 ****
  	      strncpy (nstore, startp, endp-startp);
  	      if (endp == startp)
  		strcpy (nstore, concat (".", dir_separator_str, NULL_PTR));
! 	      else if (endp[-1] != '/' && endp[-1] != DIR_SEPARATOR)
  		{
  		  nstore[endp-startp] = DIR_SEPARATOR;
  		  nstore[endp-startp+1] = 0;
--- 2706,2712 ----
  	      strncpy (nstore, startp, endp-startp);
  	      if (endp == startp)
  		strcpy (nstore, concat (".", dir_separator_str, NULL_PTR));
! 	      else if (!IS_DIR_SEPARATOR (endp[-1]))
  		{
  		  nstore[endp-startp] = DIR_SEPARATOR;
  		  nstore[endp-startp+1] = 0;
*************** process_command (argc, argv)
*** 2902,2913 ****
  		  int len = strlen (value);
  		  if ((len == 7
  		       || (len > 7
! 			   && (value[len - 8] == '/'
! 			       || value[len - 8] == DIR_SEPARATOR)))
  		      && strncmp (value + len - 7, "stage", 5) == 0
  		      && ISDIGIT (value[len - 2])
! 		      && (value[len - 1] == '/'
! 			  || value[len - 1] == DIR_SEPARATOR))
  		    {
  		      if (len == 7)
  			add_prefix (&include_prefixes, "include", NULL_PTR,
--- 2911,2920 ----
  		  int len = strlen (value);
  		  if ((len == 7
  		       || (len > 7
! 			   && (IS_DIR_SEPARATOR (value[len - 8]))))
  		      && strncmp (value + len - 7, "stage", 5) == 0
  		      && ISDIGIT (value[len - 2])
! 		      && (IS_DIR_SEPARATOR (value[len - 1])))
  		    {
  		      if (len == 7)
  			add_prefix (&include_prefixes, "include", NULL_PTR,
*************** process_command (argc, argv)
*** 3074,3080 ****
       directories, so that we can search both the user specified directory
       and the standard place.  */
  
!   if (*tooldir_prefix != '/' && *tooldir_prefix != DIR_SEPARATOR)
      {
        if (gcc_exec_prefix)
  	{
--- 3081,3087 ----
       directories, so that we can search both the user specified directory
       and the standard place.  */
  
!   if (!IS_DIR_SEPARATOR (*tooldir_prefix))
      {
        if (gcc_exec_prefix)
  	{
*************** do_spec_1 (spec, inswitch, soft_matched_
*** 3525,3531 ****
  		  /* Relative directories always come from -B,
  		     and it is better not to use them for searching
  		     at run time.  In particular, stage1 loses  */
! 		  if (pl->prefix[0] != '/' && pl->prefix[0] != DIR_SEPARATOR)
  		    continue;
  #endif
  		  /* Try subdirectory if there is one.  */
--- 3532,3538 ----
  		  /* Relative directories always come from -B,
  		     and it is better not to use them for searching
  		     at run time.  In particular, stage1 loses  */
! 		  if (!IS_DIR_SEPARATOR (pl->prefix[0]))
  		    continue;
  #endif
  		  /* Try subdirectory if there is one.  */
*************** do_spec_1 (spec, inswitch, soft_matched_
*** 3582,3589 ****
  			  buffer = (char *) xrealloc (buffer, bufsize);
  			  strcpy (buffer, machine_suffix);
  			  idx = strlen (buffer);
! 			  if (buffer[idx - 1] == '/'
! 			      || buffer[idx - 1] == DIR_SEPARATOR)
  			    buffer[idx - 1] = 0;
  			  do_spec_1 (buffer, 1, NULL_PTR);
  			  /* Make this a separate argument.  */
--- 3589,3595 ----
  			  buffer = (char *) xrealloc (buffer, bufsize);
  			  strcpy (buffer, machine_suffix);
  			  idx = strlen (buffer);
! 			  if (IS_DIR_SEPARATOR (buffer[idx - 1]))
  			    buffer[idx - 1] = 0;
  			  do_spec_1 (buffer, 1, NULL_PTR);
  			  /* Make this a separate argument.  */
*************** do_spec_1 (spec, inswitch, soft_matched_
*** 3604,3611 ****
  			  buffer = (char *) xrealloc (buffer, bufsize);
  			  strcpy (buffer, pl->prefix);
  			  idx = strlen (buffer);
! 			  if (buffer[idx - 1] == '/'
! 			      || buffer[idx - 1] == DIR_SEPARATOR)
  			    buffer[idx - 1] = 0;
  			  do_spec_1 (buffer, 1, NULL_PTR);
  			  /* Make this a separate argument.  */
--- 3610,3616 ----
  			  buffer = (char *) xrealloc (buffer, bufsize);
  			  strcpy (buffer, pl->prefix);
  			  idx = strlen (buffer);
! 			  if (IS_DIR_SEPARATOR (buffer[idx - 1]))
  			    buffer[idx - 1] = 0;
  			  do_spec_1 (buffer, 1, NULL_PTR);
  			  /* Make this a separate argument.  */
*************** is_directory (path1, path2, linker)
*** 4598,4604 ****
    memcpy (path, path1, len1);
    memcpy (path + len1, path2, len2);
    cp = path + len1 + len2;
!   if (cp[-1] != '/' && cp[-1] != DIR_SEPARATOR)
      *cp++ = DIR_SEPARATOR;
    *cp++ = '.';
    *cp = '\0';
--- 4603,4609 ----
    memcpy (path, path1, len1);
    memcpy (path + len1, path2, len2);
    cp = path + len1 + len2;
!   if (!IS_DIR_SEPARATOR (cp[-1]))
      *cp++ = DIR_SEPARATOR;
    *cp++ = '.';
    *cp = '\0';
*************** main (argc, argv)
*** 4646,4652 ****
    struct user_specs *uptr;
  
    p = argv[0] + strlen (argv[0]);
!   while (p != argv[0] && p[-1] != '/' && p[-1] != DIR_SEPARATOR) --p;
    programname = p;
  
  #ifdef HAVE_LC_MESSAGES
--- 4651,4658 ----
    struct user_specs *uptr;
  
    p = argv[0] + strlen (argv[0]);
!   while (p != argv[0] && !IS_DIR_SEPARATOR (p[-1]))
!     --p;
    programname = p;
  
  #ifdef HAVE_LC_MESSAGES
*************** main (argc, argv)
*** 4848,4861 ****
  	 standard_exec_prefix.  This lets us move the installed tree
  	 as a unit.  If GCC_EXEC_PREFIX is defined, base
  	 standard_startfile_prefix on that as well.  */
!       if (*standard_startfile_prefix == '/'
! 	  || *standard_startfile_prefix == DIR_SEPARATOR
! 	  || *standard_startfile_prefix == '$'
! #ifdef __MSDOS__
! 	  /* Check for disk name on MS-DOS-based systems.  */
            || (standard_startfile_prefix[1] == ':'
! 	      && (standard_startfile_prefix[2] == DIR_SEPARATOR
! 		  || standard_startfile_prefix[2] == '/'))
  #endif
  	  )
  	add_prefix (&startfile_prefixes, standard_startfile_prefix, "BINUTILS",
--- 4854,4865 ----
  	 standard_exec_prefix.  This lets us move the installed tree
  	 as a unit.  If GCC_EXEC_PREFIX is defined, base
  	 standard_startfile_prefix on that as well.  */
!       if (IS_DIR_SEPARATOR (*standard_startfile_prefix)
! 	    || *standard_startfile_prefix == '$'
! #ifdef HAVE_DOS_BASED_FILESYSTEM
!   	    /* Check for disk name on MS-DOS-based systems.  */
            || (standard_startfile_prefix[1] == ':'
! 	      && (IS_DIR_SEPARATOR (standard_startfile_prefix[2])))
  #endif
  	  )
  	add_prefix (&startfile_prefixes, standard_startfile_prefix, "BINUTILS",
*************** main (argc, argv)
*** 4884,4890 ****
      }
    else
      {
!       if (*standard_startfile_prefix != DIR_SEPARATOR && gcc_exec_prefix)
  	add_prefix (&startfile_prefixes,
  		    concat (gcc_exec_prefix, machine_suffix,
  			    standard_startfile_prefix, NULL_PTR),
--- 4888,4894 ----
      }
    else
      {
!       if (!IS_DIR_SEPARATOR (*standard_startfile_prefix) && gcc_exec_prefix)
  	add_prefix (&startfile_prefixes,
  		    concat (gcc_exec_prefix, machine_suffix,
  			    standard_startfile_prefix, NULL_PTR),
*************** main (argc, argv)
*** 5046,5052 ****
  
  	  input_basename = input_filename;
  	  for (p = input_filename; *p; p++)
! 	    if (*p == '/' || *p == DIR_SEPARATOR)
  	      input_basename = p + 1;
  
  	  /* Find a suffix starting with the last period,
--- 5050,5056 ----
  
  	  input_basename = input_filename;
  	  for (p = input_filename; *p; p++)
! 	    if (IS_DIR_SEPARATOR (*p))
  	      input_basename = p + 1;
  
  	  /* Find a suffix starting with the last period,
*** gcc/cccp.c.orig	Fri Mar 19 12:43:42 1999
--- gcc/cccp.c	Fri Mar 26 10:26:26 1999
*************** typedef unsigned char U_CHAR;
*** 51,56 ****
--- 51,61 ----
  # define PATH_SEPARATOR ':'
  #endif
  
+ /* By default, a slash separates directory names.  */
+ #ifndef DIR_SEPARATOR
+ # define DIR_SEPARATOR '/'
+ #endif
+ 
  /* By default, the suffix for object files is ".o".  */
  #ifdef OBJECT_SUFFIX
  # define HAVE_OBJECT_SUFFIX
*************** absolute_filename (filename)
*** 4926,4931 ****
--- 4931,4950 ----
    return 0;
  }
  
+ /* Returns whether or not a given character is a directory separator.
+    Used by simplify_filename.  */
+ static inline
+ int
+ is_dir_separator(ch)
+      char ch;
+ {
+   return (ch == DIR_SEPARATOR)
+ #if defined (DIR_SEPARATOR_2)
+           || (ch == DIR_SEPARATOR_2)
+ #endif
+          ;
+ }
+ 
  /* Remove unnecessary characters from FILENAME in place,
     to avoid unnecessary filename aliasing.
     Return the length of the resulting string.
*************** simplify_filename (filename)
*** 4943,4997 ****
    char *to0;
  
    /* Remove redundant initial /s.  */
!   if (*from == '/') {
!     *to++ = '/';
!     if (*++from == '/') {
!       if (*++from == '/') {
! 	/* 3 or more initial /s are equivalent to 1 /.  */
! 	while (*++from == '/')
! 	  continue;
!       } else {
! 	/* On some hosts // differs from /; Posix allows this.  */
! 	static int slashslash_vs_slash;
! 	if (slashslash_vs_slash == 0) {
! 	  struct stat s1, s2;
! 	  slashslash_vs_slash = ((stat ("/", &s1) == 0 && stat ("//", &s2) == 0
! 				  && INO_T_EQ (s1.st_ino, s2.st_ino)
! 				  && s1.st_dev == s2.st_dev)
! 				 ? 1 : -1);
! 	}
! 	if (slashslash_vs_slash < 0)
! 	  *to++ = '/';
!       }
      }
!   }
    to0 = to;
  
!   for (;;) {
  #ifndef VMS
!     if (from[0] == '.' && from[1] == '/')
!       from += 2;
!     else
  #endif
!       {
!       /* Copy this component and trailing /, if any.  */
!       while ((*to++ = *from++) != '/') {
! 	if (!to[-1]) {
! 	  /* Trim . component at end of nonempty name.  */
! 	  to -= filename <= to - 3 && to[-3] == '/' && to[-2] == '.';
! 
! 	  /* Trim unnecessary trailing /s.  */
! 	  while (to0 < --to && to[-1] == '/')
! 	    continue;
! 
! 	  *to = 0;
! 	  return to - filename;
! 	}
!       }
!     }
  
      /* Skip /s after a /.  */
!     while (*from == '/')
        from++;
    }
  }
--- 4962,5030 ----
    char *to0;
  
    /* Remove redundant initial /s.  */
!   if (is_dir_separator (*from))
!     {
!       *to++ = DIR_SEPARATOR;
!       if (is_dir_separator (*++from))
!         {
!           if (is_dir_separator (*++from))
!             {
!               /* 3 or more initial /s are equivalent to 1 /.  */
!               while (is_dir_separator (*++from))
!                 continue;
!             }
!           else
!             {
! /* On some hosts // differs from /; Posix allows this.  */
!               static int slashslash_vs_slash;
!               if (slashslash_vs_slash == 0)
!                 {
!                   struct stat s1, s2;
!                   slashslash_vs_slash = ((stat ("/", &s1) == 0 && stat ("//", &s2) == 0
!                                         && INO_T_EQ (s1.st_ino, s2.st_ino)
!                                         && s1.st_dev == s2.st_dev)
!                                         ? 1 : -1);
!                 }
!              if (slashslash_vs_slash < 0)
!                *to++ = DIR_SEPARATOR;
!             }
!         }
      }
! 
    to0 = to;
  
!   for (;;)
!     {
  #ifndef VMS
!       if (from[0] == '.' && from[1] == '/')
!         from += 2;
!       else
  #endif
!         {
!           /* Copy this component and trailing DIR_SEPARATOR, if any.  */
!           while (!is_dir_separator (*to++ = *from++))
!             {
!               if (!to[-1])
!                 {
!                   /* Trim . component at end of nonempty name.  */
!                   to -= filename <= to - 3 && to[-3] == DIR_SEPARATOR && to[-2] == '.';
! 
!                   /* Trim unnecessary trailing /s.  */
!                   while (to0 < --to && to[-1] == DIR_SEPARATOR)
!                     continue;
! 
!                   *to = 0;
!                   return to - filename;
!                 }
!             }
! #if defined(DIR_SEPARATOR_2)
!           /* Simplify to one directory separator.  */
!           to[-1] = DIR_SEPARATOR;
! #endif
!         }
  
      /* Skip /s after a /.  */
!     while (is_dir_separator (*from))
        from++;
    }
  }
*************** make_assertion (option, str)
*** 10468,10477 ****
    --indepth;
  }
  
- #ifndef DIR_SEPARATOR
- #define DIR_SEPARATOR '/'
- #endif
- 
  /* The previous include prefix, if any, is PREV_FILE_NAME.
     Translate any pathnames with COMPONENT.
     Allocate a new include prefix whose name is the
--- 10501,10506 ----
*** gcc/prefix.c.orig	Wed Jan  6 19:54:34 1999
--- gcc/prefix.c	Fri Mar 26 12:43:02 1999
*************** static char *lookup_key		PROTO((char *))
*** 81,86 ****
--- 81,97 ----
  static HKEY reg_key = (HKEY) INVALID_HANDLE_VALUE;
  #endif
  
+ #ifndef DIR_SEPARATOR
+ # define IS_DIR_SEPARATOR(ch) ((ch) == '/')
+ #else /* DIR_SEPARATOR */
+ # ifndef DIR_SEPARATOR_2
+ #  define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
+ # else /* DIR_SEPARATOR && DIR_SEPARATOR_2 */
+ #  define IS_DIR_SEPARATOR(ch) \
+ 	(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
+ # endif /* DIR_SEPARATOR && DIR_SEPARATOR_2 */
+ #endif /* DIR_SEPARATOR */
+ 
  /* Given KEY, as above, return its value.  */
  
  static const char *
*************** translate_name (name)
*** 241,251 ****
      return name;
  
    for (keylen = 0;
!        (name[keylen + 1] != 0 && name[keylen + 1] != '/'
! #ifdef DIR_SEPARATOR
! 	&& name[keylen + 1] != DIR_SEPARATOR
! #endif
! 	);
         keylen++)
      ;
  
--- 252,258 ----
      return name;
  
    for (keylen = 0;
!        (name[keylen + 1] != 0 && !IS_DIR_SEPARATOR (name[keylen + 1]));
         keylen++)
      ;
  
*************** translate_name (name)
*** 268,278 ****
      prefix = PREFIX;
  
    /* Remove any trailing directory separator from what we got.  */
!   if (prefix[strlen (prefix) - 1] == '/'
! #ifdef DIR_SEPARATOR
!       || prefix[strlen (prefix) - 1] == DIR_SEPARATOR
! #endif
!       )
      {
        char * temp = save_string (prefix, strlen (prefix));
        temp[strlen (temp) - 1] = 0;
--- 275,281 ----
      prefix = PREFIX;
  
    /* Remove any trailing directory separator from what we got.  */
!   if (IS_DIR_SEPARATOR (prefix[strlen (prefix) - 1]))
      {
        char * temp = save_string (prefix, strlen (prefix));
        temp[strlen (temp) - 1] = 0;
*************** update_path (path, key)
*** 299,315 ****
        while (path[0] == '@' || path[0] == '$')
  	path = translate_name (path);
      }
        
! #ifdef DIR_SEPARATOR
    if (DIR_SEPARATOR != '/')
      {
        int i;
        int len = strlen (path);
  
-       path = save_string (path, len);
        for (i = 0; i < len; i++)
! 	if (path[i] == '/')
! 	  path[i] = DIR_SEPARATOR;
      }
  #endif
  
--- 302,334 ----
        while (path[0] == '@' || path[0] == '$')
  	path = translate_name (path);
      }
+ 
+ #ifdef DIR_SEPARATOR_2
+   /* Convert DIR_SEPARATOR_2 to DIR_SEPARATOR. */
+   if (DIR_SEPARATOR != DIR_SEPARATOR_2)
+     {
+       int i;
+       int len = strlen (path);
+       char *new_path = save_string (path, len);
+       for (i = 0; i < len; i++)
+         if (new_path[i] == DIR_SEPARATOR_2)
+           new_path[i] = DIR_SEPARATOR;
+       path = new_path;
+     }
+ #endif
        
! #if defined (DIR_SEPARATOR) && !defined (DIR_SEPARATOR_2)
    if (DIR_SEPARATOR != '/')
      {
        int i;
        int len = strlen (path);
+       char *new_path = save_string (path, len);
  
        for (i = 0; i < len; i++)
!         if (new_path[i] == '/')
!           new_path[i] = DIR_SEPARATOR;
! 
!       path = new_path;
      }
  #endif
  

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]