www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/04/30/17:47:47

Message-Id: <199904302147.VAA11210@out2.ibm.net>
From: "Mark E." <snowball3 AT bigfoot DOT com>
To: djgpp-workers AT delorie DOT com
Date: Fri, 30 Apr 1999 17:48:12 -0400
MIME-Version: 1.0
Subject: Re: v2.03: wrapping up
X-mailer: Pegasus Mail for Win32 (v3.01d)
Reply-To: djgpp-workers AT delorie DOT com

> One question unrelated to your changes: Shouldn't \dev\null be 
> equivalent to /dev/null? 

I more I think about it, the more I think this is correct since in every other 
place, we treat '/' and '\' the same. Here's a patch that makes this the 
case for \dev\ too:

*** src/libc/dos/io/putpath.c.orig	Thu Oct 29 05:24:44 1998
--- src/libc/dos/io/putpath.c	Thu Apr 29 18:05:02 1999
***************
*** 8,13 ****
--- 8,20 ----
  #include <string.h>
  #include <errno.h>
  
+ static inline
+ int
+ is_dir_separator(char ch)
+ {
+   return (ch == '\\') || (ch == '/');
+ }
+ 
  void
  _put_path(const char *path)
  {
*************** _put_path2(const char *path, int offset)
*** 31,37 ****
  
    if (p[0] && p[1] == ':')
      p += 2;
!   if (strncmp(p, "/dev/", 5) == 0)
    {
      if (strcmp(p+5, "null") == 0)
        path = "nul";
--- 38,46 ----
  
    if (p[0] && p[1] == ':')
      p += 2;
!   if (is_dir_separator(*p)
!       && strncmp(p+1, "dev", 3) == 0
!       && is_dir_separator(*(p+4)))
    {
      if (strcmp(p+5, "null") == 0)
        path = "nul";
*************** _put_path2(const char *path, int offset)
*** 39,45 ****
        path = "con";
      else if (((p[5] >= 'a' && p[5] <= 'z')
  	      || (p[5] >= 'A' && p[5] <= 'Z'))
! 	     && (p[6] == '/' || p[6] == '\\' || p[6] == '\0'))
      {
        /* map /dev/a/ to a:/ */
        _farnspokeb(o++, p[5]);
--- 48,54 ----
        path = "con";
      else if (((p[5] >= 'a' && p[5] <= 'z')
  	      || (p[5] >= 'A' && p[5] <= 'Z'))
! 	     && (is_dir_separator(p[6]) || p[6] == '\0'))
      {
        /* map /dev/a/ to a:/ */
        _farnspokeb(o++, p[5]);


--- 
Mark Elbrecht, snowball3 AT bigfoot DOT com
http://snowball.frogspace.net/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019