Mail Archives: djgpp/1998/05/18/11:46:05
In article <Pine DOT SUN DOT 3 DOT 91 DOT 980518155852 DOT 18465A-100000 AT is>, eliz AT is DOT elta DOT co DOT il
says...
>
>
>On 18 May 1998, Pierre Muller wrote:
>
>> Using utod with LFN=Y in djgpp.env
>> does not work for me (DJGPP v2.01 in Windows 95 box)
>
>utod works for me, with and without LFN=y. What exactly do you mean by
>``does not work''? What happends when you run it on a file?
>
>> the dtou.exe leaves the dtou.tm$ file and apparently
>> the rename call fails !
>
utod test.c
will perform the conversion but the problem lies in the rename function
it calls rename('utod.tm$','test.c')
which in turn return _rename with the same args
(I recompiled utod.exe with -g and _rename.c also
to be able to debug _rename
And there I discovered a bug :
sizeof(try_char) returned 36
but this is not correct
because
static char try_char[] = "abcdefghijklmnopqrstuvwxyz012345789";
is only 35 bytes long (notice the missing 6 in the digits !!)
so the statement
do
{
if (idx <= 0)
return -1;
*pbase = try_char[--idx];
/* bug sizeof(try_char) returns 36 instead of 35)
so the first is 0 !! */
if (*pbase == 0)
*pbase = try_char[--idx];
} while (_chmod(tempfile, 0) != -1);
Morality : we should not use sizeof here
because it round up to 4 bytes but strlen I suppose
(of course if 6 would not be missing the code would have worked
but I still think that it is not really proper coding way !!)
Adding the extra check worked for me
replacing sizeof by strlen worked also
reinserting the 6 digit would also work ...
>There's something strange in your system setup, or in the files that you
>are trying to convert. Please post the exact command you used to convert
>the files, and also the shortest file that can be used to reproduce your
>problem, including its file name.
>
>Please also post the output of "dir dtou.exe".
- Raw text -