From: Ben Peddell User-Agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.1) Gecko/20020826 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Re: stat and character devices References: <2950-Wed25Jun2003124946+0300-eliz AT elta DOT co DOT il> <1438-Wed25Jun2003224117+0300-eliz AT elta DOT co DOT il> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Lines: 185 Message-ID: <20DKa.1681$p8.68983@newsfeeds.bigpond.com> Date: Thu, 26 Jun 2003 19:39:27 +1000 NNTP-Posting-Host: 144.139.175.171 X-Trace: newsfeeds.bigpond.com 1056636030 144.139.175.171 (Fri, 27 Jun 2003 00:00:30 EST) NNTP-Posting-Date: Fri, 27 Jun 2003 00:00:30 EST Organization: Telstra BigPond Internet Services (http://www.bigpond.com) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Eli Zaretskii wrote: >>From: Ben Peddell >>Newsgroups: comp.os.msdos.djgpp >>Date: Thu, 26 Jun 2003 02:08:01 +1000 >> >>I tested it. It doesn't like long file names in the path. > > > Thanks! > > Hmm... I wonder why does that only affect COMx, not the other devices. > It doesn't sound like a DJGPP problem, since we treat all devices the > same, I think. > > Also note that AUX, which is an alias for one of the COMx, is > supported no matter what's the value of CWD. First, AUX and COM1 are different devices in MS-DOS. From MSD: Device Filename Units Header Attributes ------------ -------- ----- --------- ---------------- ... AUX 0070:0028 1............... PRN 0070:003A 1.1.....11...... CLOCK$ 0070:004C 1...........1... Block Device 3 0070:005E ....1...11....1. COM1 0070:006A 1............... LPT1 0070:007C 1.1.....11...... LPT2 0070:008E 1.1.....11...... LPT3 0070:00A0 1.1.....11...... ... The "Block Device" here is "A:-C:" in mem. Also, I got the names of the devices from "mem /d /p". I could have included nul, but it isn't listed by mem. Also, I couldn't include "DblBuff$" since it has lower-case letters in its name, and will never match the uppercase search. I tried "echo >com1" in COMMAND.COM. When I was in a directory that did not need the LFN API, it basically said "Access Denied writing device com1, Abort, Retry, Ignore, Fail?" (it was a longer error string than that). When I tried it in a directory that needed the LFN API, it said "File Creation Error". I checked in bash, and the same thing resulted in a fail for a short name and "ENOENT" for a long name. I wrote a short program to check it with DJGPP: ===== [Start of file "testopen.c"] ===== #include #include void testopen (char *name){ FILE *f = NULL; int tb; printf ("%s: open ", name); fflush (stdout); errno = 0; if ((f = fopen (name,"wb")) != NULL){ printf ("succeeded"); fflush (stdout); fclose (f); } else { printf ("failed"); fflush (stdout); } if (errno != 0){ perror (""); } else { printf ("\n"); } } int main (int argc, char **argv){ int n; for (n=1; ntestdev.txt 2>&1" in bash: ===== [Start of file "testdev.txt"] ===== Devices are: $mmxxxx0 aux clock$ com1 com2 com3 com4 con config$ dblsysh$ ifs$hlp$ lpt1 lpt2 lpt3 mscd001 prn setverxx xmsxxxx0 DJGPP CWD=c:/ Windows CWD=C:\ $mmxxxx0: open succeeded aux: open succeeded clock$: open succeeded com1: open succeeded com2: open succeeded com3: open succeeded com4: open succeeded con: open succeeded config$: open succeeded dblsysh$: open succeeded ifs$hlp$: open succeeded lpt1: open succeeded lpt2: open succeeded lpt3: open succeeded mscd001: open succeeded prn: open succeeded setverxx: open succeeded xmsxxxx0: open succeeded DJGPP CWD=c:/Program Files Windows CWD=C:\Program Files $mmxxxx0: open succeeded aux: open succeeded clock$: open succeeded com1: open failed: No such file or directory (ENOENT) com2: open failed: No such file or directory (ENOENT) com3: open failed: No such file or directory (ENOENT) com4: open failed: No such file or directory (ENOENT) con: open succeeded config$: open succeeded dblsysh$: open succeeded ifs$hlp$: open succeeded lpt1: open failed: No such file or directory (ENOENT) lpt2: open failed: No such file or directory (ENOENT) lpt3: open failed: No such file or directory (ENOENT) mscd001: open succeeded prn: open failed: No such file or directory (ENOENT) setverxx: open succeeded xmsxxxx0: open succeeded DJGPP CWD=c:/progra~1 Windows CWD=C:\Program Files $mmxxxx0: open succeeded aux: open succeeded clock$: open succeeded com1: open succeeded com2: open succeeded com3: open succeeded com4: open succeeded con: open succeeded config$: open succeeded dblsysh$: open succeeded ifs$hlp$: open succeeded lpt1: open succeeded lpt2: open succeeded lpt3: open succeeded mscd001: open succeeded prn: open succeeded setverxx: open succeeded xmsxxxx0: open succeeded ===== [End of file "testdev.txt"] =====