Mail Archives: djgpp/2003/06/25/20:45:17
Ben Peddell <killer DOT lightspeed AT bigpond DOT com> writes:
(I wrote)
> >>>I noticed that stat treats some character devices differently, depending
> >>>on whether it is run in a DOS box under Win98 or in plain DOS. The COM
> >>>series (com1, com2, etc.) shows as a character device when run under
> >>>plain DOS, but not in the DOS box under Win98.
>I tested it. It doesn't like long file names in the path.
>
>
>DJGPP CWD=c:/
>Windows CWD=C:\
>crw-r--r-- 1 dosuser dos 0, 0 Jun 26 01:51 $mmxxxx0
>crw-r--r-- 1 dosuser dos 0, 0 Jun 26 01:51 aux
>crw-r--r-- 1 dosuser dos 0, 0 Jun 26 01:51 clock$
>crw-r--r-- 1 dosuser dos 0, 0 Jun 26 01:51 com1
>crw-r--r-- 1 dosuser dos 0, 0 Jun 26 01:51 com2
>crw-r--r-- 1 dosuser dos 0, 0 Jun 26 01:51 com3
>crw-r--r-- 1 dosuser dos 0, 0 Jun 26 01:51 com4
>...
>
>DJGPP CWD=c:/Program Files
>Windows CWD=C:\Program Files
>ls: com1: No such file or directory (ENOENT)
>ls: com2: No such file or directory (ENOENT)
>ls: com3: No such file or directory (ENOENT)
>ls: com4: No such file or directory (ENOENT)
>crw-r--r-- 1 dosuser dos 0, 0 Jun 26 01:51 $mmxxxx0
>crw-r--r-- 1 dosuser dos 0, 0 Jun 26 01:51 aux
>crw-r--r-- 1 dosuser dos 0, 0 Jun 26 01:51 clock$
I can confirm this behavior. When not run under bash it seems
stranger. Under command.com in Win98 (2nd edition), if you cd to
"Program Files" and run the program you get the "No such file"
behavior. If you cd to "progra~1", you get the exact same Windows
prompt of "Program Files", but it shows the character device. So even
though Windows converts the DOS form to a long filename form for the
prompt, the behavior of the program depends on the name used on the
command line by which you change to that directory.
This has some practical effects, since the S_ISCHR testing is used in
renaming files that might not be writable on a DOS or Windows machine
in programs such as djtarx, tar, and the DJGPP port I did of wget. It
isn't very common to need the conversions, but this means that the
programs trying to write these COMx files from a unix machine to a
DOS/Windows machine may fail to write them, depending on the name of
the directory from which the program is run.
Doug
--
Doug Kaufman
Internet: dkaufman AT rahul DOT net
- Raw text -