1. dos.e
- Posted by Robert Craig <rds at ATTCANADA.NET> Mar 09, 1999
- 473 views
- Last edited Mar 10, 1999
Daniel Berstein writes: >> if DosVersion < 7 or atom(getenv("windir")) then > Perhaps my DOS.E file also requiered this path. I'll put the same fix into your dos.e file. Regards, Rob Craig Rapid Deployment Software http://members.aol.com/FilesEu/
2. dos.e
- Posted by jluethje at gmx.de May 18, 2002
- 410 views
Hi all, there are some bugs in dos.e (from Archive/Library Routines) -- tested with Euphoria 2.3: =============================[ deltree() ]============================== <code> global function deltree(string dirname) [...] if not compare(dirname[length(dirname)], "\\") then dirname = dirname[1..length(dirname)-1] end if </code> The condition compare(dirname[length(dirname)], "\\") is *always* -1, because dirname[length(dirname)] is an atom, and "\\" is a sequence. So the statement dirname = dirname[1..length(dirname)-1] will *never* be executed, and therefore the function will not work properly, when called with a dirname that has a backslash at the end. ==> It should be: if not compare(dirname[length(dirname)], '\\') then or (clearer): if dirname[length(dirname)] = '\\' then ---------------------------------------- Also in function deltree: <code> info = dir(dirname) [...] if not match(info[loop][D_ATTRIBUTES],"d") then i = delete(dirname & "\\" & info[loop][D_NAME]) </code> For a normal file, info[loop][D_ATTRIBUTES] is "", and then the error "first argument of match() must be a non-empty sequence" is raised. (BTW: I think this information should be included in the documentation for match().) Furthermore, eg match("da", "d") = 0, which means that the routine will try to delete() a directory with the attributes "da", for instance (which will not work, of cause). ==> It should be: if not find('d', info[loop][D_ATTRIBUTES]) then ---------------------------------------- This is my modified deltree() function: ---------------------------------------- global function deltree (string dirname) object info integer i if dirname[length(dirname)] = '\\' then dirname = dirname[1..length(dirname)-1] end if info = dir(dirname) if atom(info) then return false end if if length(info) < 3 then return rmdir(dirname) end if info = info[3..length(info)] for loop = 1 to length(info) do if not find('d', info[loop][D_ATTRIBUTES]) then i = delete(dirname & "\\" & info[loop][D_NAME]) if not i then return false end if else i = deltree(dirname & "\\" & info[loop][D_NAME]) if not i then return false end if i = rmdir(dirname & "\\" & info[loop][D_NAME]) end if end for return rmdir(dirname) end function ==============================[ rename() ]============================== <code> global function rename(string oldname, string newname) [...] if (not compare(oldname[2],":")) and (not compare(newname[2],":")) then </code> ==> It should be: if oldname[2] = ':' and newname[2] = ':' then (see above) ==========================[ documentation() ]=========================== There is an error in the documentation at the beginning of the file: <snip> -- -- Moves file old to new. Can be used as rename among different -- -- disk drives. -- -- -- Renames file old to new. -- -- NOTE: Can't rename among different disk drives -- Either both move() and rename() can work among different disk drives, or both can't. The only thing move() does, is calling rename(). Best regards, Juergen
3. Re: dos.e
- Posted by Derek Parnell <ddparnell at bigpond.com> May 18, 2002
- 425 views
Good work, J. Maybe not many people use DOS anymore ----- Original Message ----- From: <jluethje at gmx.de> To: "EUforum" <EUforum at topica.com> Subject: dos.e > > Hi all, > > there are some bugs in dos.e (from Archive/Library Routines) > -- tested with Euphoria 2.3: > > > =============================[ deltree() ]============================== > > <code> > global function deltree(string dirname) > [...] > if not compare(dirname[length(dirname)], "\\") then > dirname = dirname[1..length(dirname)-1] > end if > </code> > > The condition compare(dirname[length(dirname)], "\\") > is *always* -1, because dirname[length(dirname)] is an atom, and > "\\" is a sequence. > > So the statement dirname = dirname[1..length(dirname)-1] will > *never* be executed, and therefore the function will not work properly, > when called with a dirname that has a backslash at the end. > > ==> It should be: if not compare(dirname[length(dirname)], '\\') then > or (clearer): if dirname[length(dirname)] = '\\' then > > ---------------------------------------- > > Also in function deltree: > > <code> > info = dir(dirname) > [...] > if not match(info[loop][D_ATTRIBUTES],"d") then > i = delete(dirname & "\\" & info[loop][D_NAME]) > </code> > > For a normal file, info[loop][D_ATTRIBUTES] is "", and then the error > "first argument of match() must be a non-empty sequence" is raised. > (BTW: I think this information should be included in the documentation > for match().) > > Furthermore, eg match("da", "d") = 0, which means that the routine will > try to delete() a directory with the attributes "da", for instance > (which will not work, of cause). > > ==> It should be: if not find('d', info[loop][D_ATTRIBUTES]) then > > ---------------------------------------- > This is my modified deltree() function: > ---------------------------------------- > > global function deltree (string dirname) > object info > integer i > > if dirname[length(dirname)] = '\\' then > dirname = dirname[1..length(dirname)-1] > end if > info = dir(dirname) > if atom(info) then > return false > end if > if length(info) < 3 then > return rmdir(dirname) > end if > info = info[3..length(info)] > for loop = 1 to length(info) do > if not find('d', info[loop][D_ATTRIBUTES]) then > i = delete(dirname & "\\" & info[loop][D_NAME]) > if not i then > return false > end if > else > i = deltree(dirname & "\\" & info[loop][D_NAME]) > if not i then > return false > end if > i = rmdir(dirname & "\\" & info[loop][D_NAME]) > end if > end for > return rmdir(dirname) > end function > > > ==============================[ rename() ]============================== > > <code> > global function rename(string oldname, string newname) > [...] > if (not compare(oldname[2],":")) and (not compare(newname[2],":")) > then > </code> > > ==> It should be: if oldname[2] = ':' and newname[2] = ':' then > (see above) > > > ==========================[ documentation() ]=========================== <snip> > > >
4. Re: dos.e
- Posted by r.schr at t-online.de May 19, 2002
- 428 views
Derek Parnell wrote: > ... > Good work, J. Maybe not many people use DOS anymore > ... Well, besides WinNT, I do! But I never used 'dos.e'. Where to find it? A search under DOS in the EU archive leads to nothing. Have a nice day, Rolf
5. Re: dos.e
- Posted by petelomax at blueyonder.co.uk May 19, 2002
- 436 views
T24gU3VuLCAxOSBNYXkgMjAwMiAxMDoyMTowNCArMDIwMCwgci5zY2hyQHQtb25saW5lLmRlIHdy b3RlOg0KDQo+QnV0IEkgbmV2ZXIgdXNlZCAnZG9zLmUnLiBXaGVyZSB0byBmaW5kIGl0PyBBDQo+ c2VhcmNoIHVuZGVyIERPUyBpbiB0aGUgRVUgYXJjaGl2ZSBsZWFkcyB0byBub3RoaW5nLg0KPg0K U2VhcmNoIGZvciBEYW5pZWwgQmVyc3RlaW4uDQoNCg==
6. Re: dos.e
- Posted by Igor Kachan <kinz at peterlink.ru> May 19, 2002
- 438 views
Hi Rolf, http://www.RapidEuphoria.com/dos.zip Regards, Igor Kachan kinz at peterlink.ru ---------- > Îò: r.schr at t-online.de > Êîìó: EUforum <EUforum at topica.com> > Òåìà: Re: dos.e > Äàòà: âîñêðåñåíüå, Ìàé 19, 2002 12:21 > > Derek Parnell wrote: > > ... > > Good work, J. Maybe not many people use DOS anymore > > ... > > Well, besides WinNT, I do! But I never used 'dos.e'. > Where to find it? A search under DOS in the EU > archive leads to nothing. > > Have a nice day, Rolf
7. Re: dos.e
- Posted by jluethje at gmx.de May 19, 2002
- 504 views
Sorry! For some reason, the last part of my previous message was destroyed. It should have been like this: ===========================[ documentation ]============================= There is an error in the documentation at the beginning of the file: <snip> ------------------------------------------------------------------------------- -- i = move(old,new) -- -- Moves file old to new. Can be used as rename among different -- -- disk drives. -- ------------------------------------------------------------------------------- -- i = rename(old,new) -- -- Renames file old to new. -- -- NOTE: Can't rename among different disk drives -- ------------------------------------------------------------------------------- </snip> There is a contradiction, because both move() and rename() exactly work the same. The only thing move() does, is calling rename(). Best regards, Juergen
8. Re: dos.e
- Posted by jluethje at gmx.de May 19, 2002
- 420 views
Hello Rolf, you wrote: > Derek Parnell wrote: >> ... >> Good work, J. Maybe not many people use DOS anymore >> ... > Well, besides WinNT, I do! But I never used 'dos.e'. Where to find it? A > search under DOS in the EU archive leads to nothing. You can find dos.e in the Archive at the page http://www.rapideuphoria.com/lib.htm under he title "File Commands", or directly download it from http://www.rapideuphoria.com/dos.zip Best regards, Juergen
9. Re: dos.e
- Posted by rforno at tutopia.com May 19, 2002
- 442 views
I, for one, use DOS for several tasks, Windows for many others, and Dragon Linux for a few ones. ----- Original Message ----- From: "Derek Parnell" <ddparnell at bigpond.com> To: "EUforum" <EUforum at topica.com> Subject: Re: dos.e > > Good work, J. Maybe not many people use DOS anymore > > ----- Original Message ----- > From: <jluethje at gmx.de> > To: "EUforum" <EUforum at topica.com> > Sent: Sunday, May 19, 2002 8:11 AM > Subject: dos.e > > > > > > Hi all, > > > > there are some bugs in dos.e (from Archive/Library Routines) > > -- tested with Euphoria 2.3: > > > > > > =============================[ deltree() ]============================== > > > > <code> > > global function deltree(string dirname) > > [...] > > if not compare(dirname[length(dirname)], "\\") then > > dirname = dirname[1..length(dirname)-1] > > end if > > </code> > > > > The condition compare(dirname[length(dirname)], "\\") > > is *always* -1, because dirname[length(dirname)] is an atom, and > > "\\" is a sequence. > > > > So the statement dirname = dirname[1..length(dirname)-1] will > > *never* be executed, and therefore the function will not work properly, > > when called with a dirname that has a backslash at the end. > > > > ==> It should be: if not compare(dirname[length(dirname)], '\\') then > > or (clearer): if dirname[length(dirname)] = '\\' then > > > > ---------------------------------------- > > > > Also in function deltree: > > > > <code> > > info = dir(dirname) > > [...] > > if not match(info[loop][D_ATTRIBUTES],"d") then > > i = delete(dirname & "\\" & info[loop][D_NAME]) > > </code> > > > > For a normal file, info[loop][D_ATTRIBUTES] is "", and then the error > > "first argument of match() must be a non-empty sequence" is raised. > > (BTW: I think this information should be included in the documentation > > for match().) > > > > Furthermore, eg match("da", "d") = 0, which means that the routine will > > try to delete() a directory with the attributes "da", for instance > > (which will not work, of cause). > > > > ==> It should be: if not find('d', info[loop][D_ATTRIBUTES]) then > > > > ---------------------------------------- > > This is my modified deltree() function: > > ---------------------------------------- > > > > global function deltree (string dirname) > > object info > > integer i > > > > if dirname[length(dirname)] = '\\' then > > dirname = dirname[1..length(dirname)-1] > > end if > > info = dir(dirname) > > if atom(info) then > > return false > > end if > > if length(info) < 3 then > > return rmdir(dirname) > > end if > > info = info[3..length(info)] > > for loop = 1 to length(info) do > > if not find('d', info[loop][D_ATTRIBUTES]) then > > i = delete(dirname & "\\" & info[loop][D_NAME]) > > if not i then > > return false > > end if > > else > > i = deltree(dirname & "\\" & info[loop][D_NAME]) > > if not i then > > return false > > end if > > i = rmdir(dirname & "\\" & info[loop][D_NAME]) > > end if > > end for > > return rmdir(dirname) > > end function > > > > > > ==============================[ rename() ]============================== > > > > <code> > > global function rename(string oldname, string newname) <snip> > > >