delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/04/19/05:32:43

Message-ID: <B0000083789@stargate.astr.lu.lv>
From: "Andris Pavenis" <pavenis AT lanet DOT lv>
To: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>, djgpp-workers AT delorie DOT com
Date: Mon, 19 Apr 1999 12:16:00 +0300
MIME-Version: 1.0
Subject: Re: Update to dtou.c
References: <B0000083442 AT stargate DOT astr DOT lu DOT lv>
In-reply-to: <Pine.SUN.3.91.990418171039.6407D-100000@is>
X-mailer: Pegasus Mail for Win32 (v3.02b14)
Reply-To: djgpp-workers AT delorie DOT com

On 18 Apr 99, at 17:19, Eli Zaretskii wrote:

> 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.

There were one more significant thing:
	Current version of of dtou and utod can replace file with corrupt one
	if there is some problem while writting output file (eg. disk is full).
	I tried to fix this problem and I think it should be fixed.

> 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".

My fault. That also should be handled.

> 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.

I looked in portability section of info file and saw 'not ANSI, not POSIX' for 
dirname(). So I thought it's better to void it.
> 
>   if (l>=0 && l2>=0 && err==0)
>   {
>     remove(fname);
>     rename(tfname, fname);
>     utime(fname, &tim1);
>   }
> 
> I think just `rename' is enough, even in DJGPP.

I simply left that as it was and previous version had also remove().
	
Andris

- Raw text -


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