Mail Archives: djgpp/2003/01/25/09:34:16
From: | "Peter S Tillier" <petert AT deadspam DOT com>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | gawk 3.1.1 DJGPP v2.04 on Windows 2000 Pro problem using system() function and LFNs
|
Date: | Sat, 25 Jan 2003 11:44:28 -0000
|
Organization: | Private
|
Lines: | 117
|
Message-ID: | <b0ttav$pnu$2$8302bc10@news.demon.co.uk>
|
NNTP-Posting-Host: | eq1152.demon.co.uk
|
X-Trace: | news.demon.co.uk 1043495072 26366 158.152.22.92 (25 Jan 2003 11:44:32 GMT)
|
X-Complaints-To: | abuse AT demon DOT net
|
NNTP-Posting-Date: | Sat, 25 Jan 2003 11:44:32 +0000 (UTC)
|
X-MimeOLE: | Produced By Microsoft MimeOLE V6.00.2800.1106
|
X-Priority: | 3
|
X-MSMail-Priority: | Normal
|
X-Newsreader: | Microsoft Outlook Express 6.00.2800.1106
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
gawk 3.1.1 seems to have a problem when using the system() function
on Windows 2000 Pro and LFNs. I have been using the version from
the v2.04 set from the Rice download page at
<url: http://clio.rice.edu/djgpp/win2k/main_204.htm>
Here's an example session running is a W2K "dos" window (i.e.,
not using a full DJGPP environment):
C:\djgpp\home\pt>dir
Volume in drive C has no label.
Volume Serial Number is D8C4-E33B
Directory of C:\djgpp\home\pt
23/01/2003 12:54 <DIR> .
23/01/2003 12:54 <DIR> ..
23/01/2003 12:50 271 lfntest.awk
23/01/2003 10:38 41 long file name.txt
23/01/2003 12:48 106 quite a long file name.log
3 File(s) 418 bytes
2 Dir(s) 7,288,282,112 bytes free
C:\djgpp\home\pt>type lfntest.awk
BEGIN {
logfil="quite a long file name.log"
oldname="long file name.txt"
print oldname > logfil
newname="renamed long file name.txt"
print newname > logfil
cmdline="rename \"" oldname "\" \"" newname "\""
print cmdline > logfil
system(cmdline)
close(logfil)
}
C:\djgpp\home\pt>gawk -f lfntest.awk
Parameter format not correct - "long
So the system() call to rename appears to be failing as rename is
not getting the LFN passed correctly.
I found a work-around that solves the problem:
C:\djgpp\home\pt>edit lfntest2.awk
C:\djgpp\home\pt>type lfntest2.awk
BEGIN {
logfil="quite a long file name.log"
oldname="long file name.txt"
print oldname > logfil
newname="renamed long file name.txt"
print newname > logfil
cmdline="rename \"" oldname "\" \"" newname "\""
print cmdline > logfil
system("cmd /c " cmdline)
close(logfil)
}
C:\djgpp\home\pt>gawk -f lfntest2.awk
C:\djgpp\home\pt>dir
Volume in drive C has no label.
Volume Serial Number is D8C4-E33B
Directory of C:\djgpp\home\pt
23/01/2003 12:58 <DIR> .
23/01/2003 12:58 <DIR> ..
23/01/2003 12:50 271 lfntest.awk
23/01/2003 12:58 281 lfntest2.awk
23/01/2003 12:58 106 quite a long file name.log
23/01/2003 10:38 41 renamed long file name.txt
4 File(s) 699 bytes
2 Dir(s) 7,288,278,016 bytes free
C:\djgpp\home\pt>gawk --version
GNU Awk 3.1.1
Copyright (C) 1989, 1991-2002 Free Software Foundation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
C:\djgpp\home\pt>
i.e., using system("cmd /c whatever") appears to work OK, but
system("whatever") doesn't.
As I'm running the v2.04 version, I'm not using the LFN TSR
mentioned on the Rice pages.
Previous versions of DJGPP gawk have run OK in Windows "DOS"
boxes for me in the past. Is this a known problem with this
combination of "DOS" and LFNs? If so is it a DJGPP or W2K
problem? If the former is there a bug report in hand (I
couldn't find one when I did a quick search at
www.delorie.com/djgpp )
Thanks in advance for any assistance,
Peter
--
Peter S Tillier
"Who needs perl when you can write dc and sokoban in sed?"
- Raw text -