Skip to content

Commit 29b197f

Browse files
ecm-pushbxPerditionC
authored andcommitted
support up to LASTDRIVE=32 (lDOS or patched MS-DOS v7)
Changing to a drive or running DIR with only a drive letter and colon didn't work. (DIR with drive letter, colon, backslash did work already.) Without this patch applied: C:\>]: Bad command or filename - "]:". C:\>dir ]: File not found. - ']:' C:\>dir ]:\ Volume in drive ] is SRDXMS 2.10 Directory of ]:\ LDEBUG COM 94,208 09-19-25 6:35p 1 file(s) 94,208 bytes 0 dir(s) 948,224 bytes free With this patch applied: C:\>]: ]:\>dir ]: Volume in drive ] is SRDXMS 2.10 Directory of ]:\ LDEBUG COM 94,208 09-19-25 6:35p 1 file(s) 94,208 bytes 0 dir(s) 948,224 bytes free
1 parent b7e3f99 commit 29b197f

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

shell/command.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,14 @@ char switchar(void)
159159
}
160160
#endif
161161

162+
unsigned isdrive(unsigned char cc) {
163+
if (isalpha(cc))
164+
return 1;
165+
if ((cc - 'A') < 32)
166+
return 1;
167+
return 0;
168+
}
169+
162170
void execute(char *first, char *rest, int lh_lf)
163171
{
164172
/*
@@ -177,7 +185,7 @@ void execute(char *first, char *rest, int lh_lf)
177185
assert(rest);
178186

179187
/* check for a drive change (not for loadhigh/loadfix) */
180-
if (!lh_lf && (strcmp(first + 1, ":") == 0) && isalpha(*first))
188+
if (!lh_lf && (strcmp(first + 1, ":") == 0) && isdrive(*first))
181189
{
182190
changeDrive(*first);
183191
return;

suppl/src/dfnpath.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ char *dfnpath(int drive)
7575
DBG_ENTER("dfnpath", Suppl_dfn)
7676
DBG_ARGUMENTS( ("drive=%u ('%c')", drive, drive < 32? '.': drive) )
7777

78-
if(isupper(drive)) drive -= 'A' - 1;
79-
else if(islower(drive)) drive -= 'a' - 1;
80-
else if((unsigned)drive > 32) {
78+
if (islower(drive)) drive -= 'a' - 'A';
79+
if (drive >= 'A') drive -= 'A' - 1;
80+
if ((unsigned)drive > 32) {
8181
eno_set( ENODEV);
8282
DBG_RETURN_S( 0)
8383
}

0 commit comments

Comments
 (0)