CLI - DIR switches?

Here you can discuss the development of patches.

CLI - DIR switches?

Postby moejoe » 2008-3-18 @ 22:08

Hi,
I have several apps (old qbasic programs) that use "DIR /B /AD /ON" to get the content of the current directory. however, DOSBox does not support additional DIR parameters. is there any hope those will be included in future versions? I'd really like to run those apps in DOSBox...
Last edited by moejoe on 2014-2-11 @ 21:55, edited 4 times in total.
User avatar
moejoe
Newbie
 
Posts: 25
Joined: 2006-12-08 @ 22:40


Re: DIR switches?

Postby moejoe » 2008-3-18 @ 23:45

even when running the shell inside DOSBox, I don't get the file list inside my QB programs. :\
User avatar
moejoe
Newbie
 
Posts: 25
Joined: 2006-12-08 @ 22:40

Re: DIR switches?

Postby moejoe » 2010-6-27 @ 14:13

I just checked this again and even programmed my own version of DIR. However, even this doesn't work because DOSBox apparently interprets "DIR.exe" (when accessing it from the shell) as "DIR .exe", and is thus listing all exe files in the current directory. I wouldn't mind the lack of accepted parameters if at least I could use my own DIR.exe here. :(
User avatar
moejoe
Newbie
 
Posts: 25
Joined: 2006-12-08 @ 22:40

Re: DIR switches?

Postby h-a-l-9000 » 2010-6-27 @ 14:16

dir /b works in 0.74
1+1=10
h-a-l-9000
DOSBox Author
 
Posts: 4512
Joined: 2005-2-23 @ 00:14

Re: DIR switches?

Postby moejoe » 2010-6-27 @ 14:18

Yes, but not /ON (which this program also uses)
User avatar
moejoe
Newbie
 
Posts: 25
Joined: 2006-12-08 @ 22:40

Re: DIR switches?

Postby moejoe » 2011-10-22 @ 17:43

Bump... It would be nice if DOSBox would at least scan for valid parameters, even if it doesn't apply them. So for example to make /ON work (which I used in various games back then), one would simply have to add
Code: Select all
ScanCMDBool(args,"ON");

To shell_cmds.cpp in void DOS_Shell::CMD_DIR(char * args).
User avatar
moejoe
Newbie
 
Posts: 25
Joined: 2006-12-08 @ 22:40

Re: DIR switches?

Postby ripsaw8080 » 2011-10-23 @ 00:35

The 4DOS shell should work for your purpose; how did you try to use it? Did you set the COMSPEC environment variable to point to the 4DOS program?
User avatar
ripsaw8080
DOSBox Author
 
Posts: 4222
Joined: 2006-4-25 @ 23:24

Re: DIR switches?

Postby moejoe » 2011-10-23 @ 00:42

ripsaw8080 wrote:Did you set the COMSPEC environment variable to point to the 4DOS program?

Of course not, I was not told that this would have to be done.
Anyway, this seems to be quite an overkill solution as opposed to adding a single line of code to the DOSBox code base, especially since I want to make my old games available to other people and not to myself - so everyone of them would have to get through all those hassles.
User avatar
moejoe
Newbie
 
Posts: 25
Joined: 2006-12-08 @ 22:40

Re: DIR switches?

Postby DosFreak » 2011-10-23 @ 00:53

So either modify your games or modify DOSBox.
User avatar
DosFreak
l33t++
 
Posts: 9782
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: DIR switches?

Postby moejoe » 2011-10-23 @ 11:21

DosFreak wrote:So either modify your games or modify DOSBox.

Those are games that were made aeons ago in a language I don't program in anymore, that doesn't even come with its own directory listing facilities (QBasic), so I will certainly not rewrite all of them.
And I have even given instructions on how to emulate the missing switches above, so why not simply incorporate them into the trunk?
User avatar
moejoe
Newbie
 
Posts: 25
Joined: 2006-12-08 @ 22:40

Re: DIR switches?

Postby wd » 2011-10-23 @ 11:45

Add it to your private build, nobody else cares about fake parameters.
wd
DOSBox Author
 
Posts: 10818
Joined: 2003-12-03 @ 21:23

Re: DIR switches?

Postby moejoe » 2011-10-23 @ 11:54

I somehow must have stranded in the wrong forum, I guess. I can somehow understand if you don't want to support demos or other applications that are not games, but games? I am very sure that there are more games than just mine that make use of the /ON switch for the DIR command. It's one damn line you have to add and the games will even work with a standard dosbox installation, without having to resort to a DOSBox version compiled by someone completely else. Standard DOSBox is available for many systems I will never be able to compile programs for, so how is that "private build" supposed to work for other people who want to play those games?

nobody else cares about fake parameters.

Is that how you reply to all patch suggestions, yes? It's one single line of code, even if noone else might care (which I heavily doubt), how would it hurt having this in the trunk? I think you are just denying help here because you love showing power, not because you want to be helpful.
User avatar
moejoe
Newbie
 
Posts: 25
Joined: 2006-12-08 @ 22:40

Re: DIR switches?

Postby wd » 2011-10-23 @ 12:15

I am very sure that there are more games than just mine that make use of the /ON switch

Which one?
If it really uses that switch it would break because your suggestion is to *ignore* that switch.


Is that how you reply to all patch suggestions, yes?

I don't see a patch but some crude hack to make your app work.
wd
DOSBox Author
 
Posts: 10818
Joined: 2003-12-03 @ 21:23

Re: DIR switches?

Postby moejoe » 2011-10-28 @ 17:16

wd wrote:If it really uses that switch it would break because your suggestion is to *ignore* that switch.

No. At the moment, all DOSBox returns to the game is "Illegal Switch: /ON". This is written to a file (using something like "DIR /B /ON > foo.txt") and the game expects to find a list of file names in that file. So in that case it will find one invalid filename ("Illegal switch") in that file, which effectively breaks the game. If the files weren't sorted by name that would still be fine, but not getting any files at all is not.

Which one?

Dungeon 2 (by me) uses /ON in the setup code, so player can't play a custom map.

Paddle Battle (by me) uses /ON to retrieve a list of player graphics, so won't run at all in DOSBox.

Frankus Tracker II (not by me) uses /ON to retrieve a list of songs when loading/saving using the F2/F3 keys.

The point is, DIR emulation is incomplete in its current state and I bet there are even games and applications that make use of the other even less used but still valid switches as well. As most switches are not critical to the output (apart from /B and /AD, which luckily are already supported!), it would be much better to simply ignore them instead of printing an error. That way, some file listings might not be in the expected order, but that's still way better than having no file list at all. I suppose most applications wouldn't crash from a list that is not sorted by file name / date / extension, but as you can see above, there are cases where programs become unusable because there is no file list at all. And believe me, using DIR for getting a directory listing was usual in programming languages that didn't offer native / library commands for this task.
User avatar
moejoe
Newbie
 
Posts: 25
Joined: 2006-12-08 @ 22:40

Re: DIR switches?

Postby wd » 2011-10-28 @ 18:24

I suppose most applications wouldn't crash from a list that is not sorted

Yeah and to avoid the rest of them feel free to post a patch rather than a hack if you really want this to get any attention.
wd
DOSBox Author
 
Posts: 10818
Joined: 2003-12-03 @ 21:23

Re: DIR switches?

Postby moejoe » 2011-10-28 @ 21:01

I didn't do a svn checkout so here's a full copy instead of a diff of my modified shell_cmds.cpp, with support for all /O switches (including reverse sorting).
You do not have the required permissions to view the files attached to this post.
User avatar
moejoe
Newbie
 
Posts: 25
Joined: 2006-12-08 @ 22:40

Re: DIR switches?

Postby moejoe » 2012-3-17 @ 14:09

So, has there been any decision about including this or not yet?
User avatar
moejoe
Newbie
 
Posts: 25
Joined: 2006-12-08 @ 22:40

Re: DIR switches?

Postby moejoe » 2014-2-11 @ 21:31

Updated version of the patch, this time as a patch file, against current trunk, and with some small fixes (/OD wasn't sorting correctly, /A-D was missing).

Maybe this can be moved to the development/patch forum?
You do not have the required permissions to view the files attached to this post.
User avatar
moejoe
Newbie
 
Posts: 25
Joined: 2006-12-08 @ 22:40

Re: DIR switches?

Postby LazerTag » 2016-9-09 @ 12:55

Was this patch ever added to Dosbox or can the patch be obtained from somewhere? I apparently don't have rights currently to download it from this thread. Probably due to not having any posts yet or something. Anyway if this sorts out the 'Illegal switch: /on' I could really use it. Trying to get a pretty old application we use running in Dosbox under Linux so I can finally kill off a Windows XP box that only lives to serve this single purpose. :/

EDIT: ahh, now that I have posted I can see the patch file download. Is this valid for Dosbox 0.74 source?
Last edited by LazerTag on 2016-9-09 @ 14:00, edited 1 time in total.
LazerTag
Newbie
 
Posts: 3
Joined: 2011-5-03 @ 18:31

Next

Return to DOSBox Patches

Who is online

Users browsing this forum: No registered users and 0 guests