www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/05/10/00:18:04

Message-Id: <199905100416.EAA57068@out2.ibm.net>
From: "Mark E." <snowball3 AT bigfoot DOT com>
To: djgpp-workers AT delorie DOT com
Date: Mon, 10 May 1999 00:17:14 -0400
MIME-Version: 1.0
Subject: RE: v2.03: wrapping up
In-reply-to: <199905091945.TAA123402@out1.ibm.net>
X-mailer: Pegasus Mail for Win32 (v3.01d)
Reply-To: djgpp-workers AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> I missed the debate over the delimiter change while working on 
> changing my email address, but if it isn't too late I would suggest  " as
> a possible delimiter, as in: /dev/env/DJDIR"c:/djgpp"/include
> 

I'd be willing to bet there is some problem with using quotes. At any 
rate, I've come up with one way to have '~' at the beginning of the 
default string and still let '~' be in the variable name too.

If the first character following the delimiter separating the variable 
name from the default string is a certain character, ':' for example, then 
skip and ignore that character. For example:

/dev/env/djfoo~:~~out.tmp~ would evaluate to '~out.tmp'.

Here's an updated suggested patch for this feature and for solving the 
garbage problem:

*** putpath.c.eli	Sun May  9 15:31:18 1999
--- putpath.c	Mon May 10 00:09:36 1999
*************** _put_path2(const char *path, int offset)
*** 81,86 ****
--- 81,90 ----
        }
        if (*p == '~')    /* use or skip the default value if present */
        {
+         /* If the first character is a ':', skip it. This allows
+            the delimiter to be the first character in a default string. */
+         if (p[1] == ':')
+           ++p;
          for (++p; *p; p++)
          {
            if (*p == '~')
*************** _put_path2(const char *path, int offset)
*** 107,116 ****
  
        /* if the rest of path begins with a slash, remove the trailing
           slash in the transfer buffer */
!       if ((p[1] == '/' || p[1] == '\\') && o-1 >= __tb+offset
!           && ((c = _farnspeekb(o-1)) == '/' || c == '\\'))
!         o--;
!       path = p + 1;
      }
      else if (p[5])
        path = p + 5;
--- 111,129 ----
  
        /* if the rest of path begins with a slash, remove the trailing
           slash in the transfer buffer */
!       if (*p)
!       {
!         if ((p[1] == '/' || p[1] == '\\') && o-1 >= __tb+offset
!             && ((c = _farnspeekb(o-1)) == '/' || c == '\\'))
!           o--;
!         path = p + 1;
!       }
!       else
!       {
!         if ((c = _farnspeekb(o-1)) == '/' || c == '\\')
!           o--;
!         path = p;
!       }
      }
      else if (p[5])
        path = 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