www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/04/18/09:21:22

Date: Sun, 18 Apr 1999 17:19:00 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Andris Pavenis <pavenis AT lanet DOT lv>
cc: djgpp-workers AT delorie DOT com
Subject: Re: Update to dtou.c
In-Reply-To: <B0000083442@stargate.astr.lu.lv>
Message-ID: <Pine.SUN.3.91.990418171039.6407D-100000@is>
MIME-Version: 1.0
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 don't think I will check in this new version for v2.03, since it is 
more than just a bugfix.  I *will* correct the bug in the current version 
that will blow the stack for file names longer than 80 characters.

Some minor comments to your code follow:

  strcpy (tfname, fname);
  for (bn=w=tfname; *w; w++) 
    if (*w=='/' || *w=='\\') 
      bn = w+1;  

I don't think this is good for Unix (a backslash is a normal character 
there).  And for DOS/Windows, this doesn't support names like "d:foo".

Why isn't it better to use `dirname'?  If you are afraid that some Unices 
won't have it (Linux certainly does), then you could put a Unix-only 
version inside dtou.c, properly conditioned with ifdef's.

  if (l>=0 && l2>=0 && err==0)
  {
    remove(fname);
    rename(tfname, fname);
    utime(fname, &tim1);
  }

I think just `rename' is enough, even in DJGPP.

- Raw text -


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