delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/06/30/00:33:32

From: sandmann AT clio DOT rice DOT edu (Charles Sandmann)
Message-Id: <10206300423.AA19473@clio.rice.edu>
Subject: Using /dev/ as a real path
To: djgpp-workers AT delorie DOT com (DJGPP developers)
Date: Sat, 29 Jun 2002 23:23:05 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL2]
Mime-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com

Looking in put_path we see:

  if (strncmp(p, "/dev/", 5) == 0)
  {
    if (strcmp(p+5, "null") == 0)
      path = "nul";
    else if (strcmp(p+5, "tty") == 0)
      path = "con";
    else if (strcmp(p+5, "env") == 0)
      /* Keep as is to avoid referencing an 'env' directory in CWD */
      ;
    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:/ */
      ... snip
    }
    else if (strncmp(p+5, "env", 3) == 0
             && (p[8] == '/' || p[8] == '\\') && p[9])
    {
      /* /dev/env/FOO/bar: expand env var FOO and generate %FOO%/bar */
      ... snip
    }
    else if (p[5])
      path = p + 5;

If we removed the last 2 lines, we would not strip /dev from the start of
strings in put_path if we did not recognize the /dev device - which would
allow us to handle a real /dev directory in a more standard manner.

Is there a reason to strip /dev/ from the start of the string if we don't
recognize the device type?

I'm trying to fix the bug with people who use DJGPP toolkit with a \dev
directory.  You couldn't have files/directories which included our 
reserved names, but anything else would be transparent.

- Raw text -


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