Make sourcer's main program execute in X mode.
o Make the dos emulation treat c: and C: the same way. Sourcer was doing a chdir("c:\\") rather than a chdir("C:\\"); o use drlton() in all places where we used to use -'A' so that we're always case independent. o use drntol() in all places where we used to use + 'A' for similar reasons
This commit is contained in:
parent
7f591b7e4b
commit
39a1ad8654
@ -29,7 +29,7 @@
|
||||
*
|
||||
* BSDI config.c,v 2.2 1996/04/08 19:32:22 bostic Exp
|
||||
*
|
||||
* $Id: config.c,v 1.2 1996/09/18 16:12:24 miff Exp $
|
||||
* $Id: config.c,v 1.1 1997/08/09 01:42:35 dyson Exp $
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@ -135,10 +135,8 @@ read_config(FILE *fp)
|
||||
|
||||
if (isdigit(av[1][4])) {
|
||||
drive = atoi(&av[1][4]) - 1;
|
||||
} else if (islower(av[1][4]) && av[1][5] == ':' && !av[1][6]) {
|
||||
drive = av[1][4] - 'a';
|
||||
} else if (isupper(av[1][4]) && av[1][5] == ':' && !av[1][6]) {
|
||||
drive = av[1][4] - 'A';
|
||||
} else if (isalpha(av[1][4]) && av[1][5] == ':' && !av[1][6]) {
|
||||
drive = drlton(av[1][4]);
|
||||
}
|
||||
init_soft:
|
||||
drive = init_floppy(drive, atoi(av[3]), av[2]);
|
||||
@ -149,10 +147,8 @@ read_config(FILE *fp)
|
||||
|
||||
if (isdigit(av[1][4])) {
|
||||
drive = atoi(&av[1][4]) + 1;
|
||||
} else if (islower(av[1][4]) && av[1][5] == ':' && !av[1][6]) {
|
||||
drive = av[1][4] - 'a';
|
||||
} else if (isupper(av[1][4]) && av[1][5] == ':' && !av[1][6]) {
|
||||
drive = av[1][4] - 'A';
|
||||
} else if (isalpha(av[1][4]) && av[1][5] == ':' && !av[1][6]) {
|
||||
drive = drlton(av[1][4]);
|
||||
}
|
||||
|
||||
init_hard:
|
||||
@ -185,10 +181,7 @@ read_config(FILE *fp)
|
||||
fprintf(stderr, "Usage: assign [A-Z]: ...\n");
|
||||
quit(1);
|
||||
}
|
||||
if (isupper(av[1][0]))
|
||||
drive = av[1][0] - 'A';
|
||||
else
|
||||
drive = av[1][0] - 'a';
|
||||
drive = drlton(av[1][0]);
|
||||
|
||||
if (ac == 3) {
|
||||
init_path(drive, (u_char *)av[2], 0);
|
||||
@ -240,10 +233,7 @@ read_config(FILE *fp)
|
||||
fprintf(stderr, "Usage: boot [A: | C:]\n");
|
||||
quit(1);
|
||||
}
|
||||
if (isupper(av[1][0]))
|
||||
bootdrive = av[1][0] - 'A';
|
||||
else
|
||||
bootdrive = av[1][0] - 'a';
|
||||
bootdrive = drlton(av[1][0]);
|
||||
if (bootdrive != 0 && bootdrive != 2) {
|
||||
fprintf(stderr, "Boot drive must be either A: or C:\n");
|
||||
quit(1);
|
||||
|
@ -29,7 +29,7 @@
|
||||
*
|
||||
* BSDI cwd.c,v 2.2 1996/04/08 19:32:25 bostic Exp
|
||||
*
|
||||
* $Id: cwd.c,v 1.6 1996/09/23 09:59:23 miff Exp $
|
||||
* $Id: cwd.c,v 1.1 1997/08/09 01:42:38 dyson Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -89,13 +89,13 @@ init_path(int drive, u_char *base, u_char *dir)
|
||||
free(d->path);
|
||||
|
||||
if ((d->path = ustrdup(base)) == NULL)
|
||||
fatal("strdup in init_path for %c:%s: %s", drive + 'A', base,
|
||||
fatal("strdup in init_path for %c:%s: %s", drntol(drive), base,
|
||||
strerror(errno));
|
||||
|
||||
if (d->maxlen < 2) {
|
||||
d->maxlen = 128;
|
||||
if ((d->cwd = (u_char *)malloc(d->maxlen)) == NULL)
|
||||
fatal("malloc in init_path for %c:%s: %s", drive + 'A', base,
|
||||
fatal("malloc in init_path for %c:%s: %s", drntol(drive), base,
|
||||
strerror(errno));
|
||||
}
|
||||
|
||||
@ -120,7 +120,7 @@ init_path(int drive, u_char *base, u_char *dir)
|
||||
while (*dir == '/')
|
||||
++dir;
|
||||
|
||||
dosname[0] = drive + 'A';
|
||||
dosname[0] = drntol(drive);
|
||||
dosname[1] = ':';
|
||||
real_to_dos(realname, &dosname[2]);
|
||||
|
||||
@ -200,23 +200,25 @@ dos_makepath(u_char *where, u_char *newpath)
|
||||
u_char tmppath[1024];
|
||||
|
||||
if (where[0] != '\0' && where[1] == ':') {
|
||||
drive = *where - 'A';
|
||||
drive = drlton(*where);
|
||||
*newpath++ = *where++;
|
||||
*newpath++ = *where++;
|
||||
} else {
|
||||
drive = diskdrive;
|
||||
*newpath++ = diskdrive + 'A';
|
||||
*newpath++ = drntol(diskdrive);
|
||||
*newpath++ = ':';
|
||||
}
|
||||
|
||||
printf("dos_makepath: Drive = %d\n", drive);
|
||||
|
||||
if (drive < 0 || drive >= MAX_DRIVE) {
|
||||
debug(D_REDIR,"drive %c invalid\n",drive + 'A');
|
||||
debug(D_REDIR,"drive %c invalid\n", drntol(drive));
|
||||
return (DISK_DRIVE_INVALID);
|
||||
}
|
||||
|
||||
d = &paths[drive];
|
||||
if (d->cwd == NULL) {
|
||||
debug(D_REDIR,"no cwd for drive %c\n",drive + 'A');
|
||||
debug(D_REDIR,"no cwd for drive %c\n",drntol(drive));
|
||||
return (DISK_DRIVE_INVALID);
|
||||
}
|
||||
|
||||
@ -298,8 +300,8 @@ dos_setcwd(u_char *where)
|
||||
d->maxlen = d->len + 1 + 32;
|
||||
d->cwd = (u_char *)malloc(d->maxlen);
|
||||
if (d->cwd == NULL)
|
||||
fatal("malloc in dos_setcwd for %c:%s: %s",
|
||||
drive + 'A', newpath, strerror(errno));
|
||||
fatal("malloc in dos_setcwd for %c:%s: %s", drntol(drive),
|
||||
newpath, strerror(errno));
|
||||
}
|
||||
ustrcpy(d->cwd, newpath + 2);
|
||||
return (0);
|
||||
@ -324,7 +326,7 @@ dos_to_real_path(u_char *dospath, u_char *realpath, int *drivep)
|
||||
debug(D_REDIR, "dos_to_real_path(%s)\n", dospath);
|
||||
|
||||
if (dospath[0] != '\0' && dospath[1] == ':') {
|
||||
drive = *dospath - 'A';
|
||||
drive = drlton(*dospath);
|
||||
dospath++;
|
||||
dospath++;
|
||||
} else {
|
||||
|
@ -31,7 +31,7 @@
|
||||
*
|
||||
* BSDI int21.c,v 2.2 1996/04/08 19:32:51 bostic Exp
|
||||
*
|
||||
* $Id: dos.c,v 1.8 1996/09/23 09:59:24 miff Exp $
|
||||
* $Id: dos.c,v 1.1 1997/08/09 01:42:40 dyson Exp $
|
||||
*/
|
||||
|
||||
#include "doscmd.h"
|
||||
@ -2007,7 +2007,7 @@ fcb_to_string(fcbp, buf)
|
||||
{
|
||||
|
||||
if (fcbp->fcbDriveID != 0x00) {
|
||||
*buf++ = fcbp->fcbDriveID - 1 + 'A';
|
||||
*buf++ = drntol(fcbp->fcbDriveID - 1);
|
||||
*buf++ = ':';
|
||||
}
|
||||
pack_name(fcbp->fcbFileName, buf);
|
||||
|
@ -29,7 +29,7 @@
|
||||
*
|
||||
* BSDI doscmd.c,v 2.3 1996/04/08 19:32:30 bostic Exp
|
||||
*
|
||||
* $Id: doscmd.c,v 1.3 1997/09/30 22:03:40 jlemon Exp $
|
||||
* $Id: doscmd.c,v 1.4 1998/02/28 16:02:23 jraynard Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -312,16 +312,12 @@ setup_boot(regcontext_t *REGS)
|
||||
}
|
||||
|
||||
if (fd < 0) { /* can we boot it? */
|
||||
fprintf(stderr, "Cannot boot from %c: (can't open)\n",
|
||||
booting + 'A');
|
||||
quit(1);
|
||||
errx(1, "Cannot boot from %c", drntol(booting));
|
||||
}
|
||||
|
||||
/* read bootblock */
|
||||
if (read(fd, (char *)0x7c00, 512) != 512) {
|
||||
fprintf(stderr, "Short read on boot block from %c:\n",
|
||||
booting + 'A');
|
||||
quit(1);
|
||||
errx(1, "Short read on boot block from %c:", drntol(booting));
|
||||
}
|
||||
|
||||
/* initialise registers for entry to bootblock */
|
||||
@ -370,13 +366,13 @@ setup_command(int argc, char *argv[], regcontext_t *REGS)
|
||||
usage();
|
||||
|
||||
/* look for a working directory XXX ??? */
|
||||
if (dos_getcwd('C' - 'A') == NULL) {
|
||||
if (dos_getcwd(drlton('C')) == NULL) {
|
||||
|
||||
/* try to get our current directory, use '/' if desperate */
|
||||
p = getcwd(buffer, sizeof(buffer));
|
||||
if (!p || !*p) p = getenv("PWD");
|
||||
if (!p || !*p) p = "/";
|
||||
init_path('C' - 'A', (u_char *)"/", (u_char *)p);
|
||||
init_path(drlton('C'), (u_char *)"/", (u_char *)p);
|
||||
|
||||
/* look for PATH= already set, learn from it if possible */
|
||||
for (i = 0; i < ecnt; ++i) {
|
||||
@ -388,8 +384,7 @@ setup_command(int argc, char *argv[], regcontext_t *REGS)
|
||||
/* no PATH in DOS environment? put current directory there*/
|
||||
if (i >= ecnt) {
|
||||
static char path[256];
|
||||
sprintf(path, "PATH=C:%s",
|
||||
dos_getcwd('C' - 'A'));
|
||||
sprintf(path, "PATH=C:%s", dos_getcwd(drlton('C')));
|
||||
put_dosenv(path);
|
||||
dos_path = envs[ecnt-1] + 5;
|
||||
}
|
||||
@ -428,8 +423,8 @@ setup_command(int argc, char *argv[], regcontext_t *REGS)
|
||||
envs[ecnt] = 0;
|
||||
|
||||
/* XXX ??? */
|
||||
if (dos_getcwd('R' - 'A') == NULL)
|
||||
init_path('R' - 'A', (u_char *)"/", 0);
|
||||
if (dos_getcwd(drlton('R')) == NULL)
|
||||
init_path(drlton('R'), (u_char *)"/", 0);
|
||||
|
||||
/* get program name */
|
||||
strncpy(prog, *argv++, sizeof(prog) -1);
|
||||
|
@ -29,7 +29,7 @@
|
||||
*
|
||||
* BSDI doscmd.h,v 2.3 1996/04/08 19:32:32 bostic Exp
|
||||
*
|
||||
* $Id: doscmd.h,v 1.2 1997/08/15 23:41:24 jlemon Exp $
|
||||
* $Id: doscmd.h,v 1.3 1997/09/30 22:03:41 jlemon Exp $
|
||||
*/
|
||||
|
||||
|
||||
@ -61,6 +61,8 @@
|
||||
#include "callback.h"
|
||||
#include "cwd.h"
|
||||
|
||||
#define drlton(a) ((islower((a)) ? toupper((a)) : (a)) - 'A')
|
||||
#define drntol(a) ((a) + 'A')
|
||||
|
||||
/*
|
||||
** assorted hardware/scope constants
|
||||
|
@ -29,7 +29,7 @@
|
||||
*
|
||||
* BSDI int13.c,v 2.3 1996/04/08 19:32:43 bostic Exp
|
||||
*
|
||||
* $Id: int13.c,v 1.3 1996/09/22 15:42:53 miff Exp $
|
||||
* $Id: int13.c,v 1.1 1997/08/09 01:42:46 dyson Exp $
|
||||
*/
|
||||
|
||||
#include "doscmd.h"
|
||||
@ -200,8 +200,8 @@ init_hdisk(int drive, int cyl, int head, int tracksize, char *file, char *fake_p
|
||||
di = &diskinfo[drive];
|
||||
|
||||
if (di->path) {
|
||||
fprintf(stderr, "Drive %c: already assigned to %s\n",
|
||||
drive + 'A', di->path);
|
||||
fprintf(stderr, "Drive %c: already assigned to %s\n", drntol(drive),
|
||||
di->path);
|
||||
return(-1);
|
||||
}
|
||||
di->fd = -1;
|
||||
@ -377,20 +377,19 @@ init_floppy(int drive, int type, char *file)
|
||||
di = &diskinfo[drive];
|
||||
|
||||
if (stat(file, &sb) < 0) {
|
||||
fprintf(stderr, "Drive %c: Could not stat %s\n",
|
||||
drive + 'A', file);
|
||||
fprintf(stderr, "Drive %c: Could not stat %s\n", drntol(drive), file);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if (drive < 2 && (S_ISCHR(sb.st_mode) || S_ISBLK(sb.st_mode))) {
|
||||
if (di->path && !di->removeable) {
|
||||
fprintf(stderr, "Drive %c: is not removeable and hence can only have one assignment\n", drive + 'A');
|
||||
fprintf(stderr, "Drive %c: is not removeable and hence can only have one assignment\n", drntol(drive));
|
||||
return(-1);
|
||||
}
|
||||
di->removeable = 1;
|
||||
} else if (di->removeable) {
|
||||
fprintf(stderr, "Drive %c: already assigned to %s\n",
|
||||
drive + 'A', di->path);
|
||||
fprintf(stderr, "Drive %c: already assigned to %s\n", drntol(drive),
|
||||
di->path);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
@ -398,7 +397,7 @@ init_floppy(int drive, int type, char *file)
|
||||
#if 0 /*XXXXX*/
|
||||
if (di->multi == 4) {
|
||||
fprintf(stderr, "Drive %c: already assigned 4 devices\n",
|
||||
drive + 'A');
|
||||
drntol(drive));
|
||||
return(-1);
|
||||
}
|
||||
#endif
|
||||
@ -406,7 +405,7 @@ init_floppy(int drive, int type, char *file)
|
||||
} else {
|
||||
if (di->path) {
|
||||
fprintf(stderr, "Drive %c: already assigned to %s\n",
|
||||
drive + 'A', di->path);
|
||||
drntol(drive), di->path);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
*
|
||||
* BSDI intff.c,v 2.2 1996/04/08 19:32:56 bostic Exp
|
||||
*
|
||||
* $Id: intff.c,v 1.1 1997/08/09 01:42:51 dyson Exp $
|
||||
* $Id: intff.c,v 1.2 1997/09/30 22:03:57 jlemon Exp $
|
||||
*/
|
||||
|
||||
#include "doscmd.h"
|
||||
@ -673,7 +673,7 @@ int2f11_validate(regcontext_t *REGS)
|
||||
}
|
||||
|
||||
/* translate letter to drive number */
|
||||
r_drive = toupper(path[0]) - 'A';
|
||||
r_drive = drlton(path[0]);
|
||||
} else {
|
||||
path = "(no path)";
|
||||
}
|
||||
@ -685,7 +685,7 @@ int2f11_validate(regcontext_t *REGS)
|
||||
}
|
||||
|
||||
debug(D_REDIR,"%s -> drive %c func %x (%sus)\n",
|
||||
path, 'A'+r_drive, func, doit?"":"not ");
|
||||
path, drntol(r_drive), func, doit?"":"not ");
|
||||
|
||||
/* so do we deal with this one? */
|
||||
return(doit);
|
||||
@ -749,7 +749,7 @@ install_drive(int drive, u_char *path)
|
||||
/* check that DOS considers this a valid drive */
|
||||
if (drive < 0 || drive >= lol->lastdrive) {
|
||||
debug(D_REDIR, "Drive %c beyond limit of %c)\n",
|
||||
drive + 'A', lol->lastdrive - 1 + 'A');
|
||||
drntol(drive), drntol(lol->lastdrive - 1));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -759,15 +759,15 @@ install_drive(int drive, u_char *path)
|
||||
|
||||
#if 0 /* XXX looks OK to me - mjs */
|
||||
if (cds->flag & (CDS_remote | CDS_ready)) {
|
||||
debug(D_REDIR, "Drive %c already installed\n", drive + 'A');
|
||||
debug(D_REDIR, "Drive %c already installed\n", drntol(drive));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
debug(D_REDIR, "Installing %c: as %s\n", drive + 'A', path);
|
||||
debug(D_REDIR, "Installing %c: as %s\n", drntol(drive), path);
|
||||
|
||||
cds->flag |= CDS_remote | CDS_ready | CDS_notnet;
|
||||
cds->path[0] = drive + 'A';
|
||||
cds->path[0] = drntol(drive);
|
||||
cds->path[1] = ':';
|
||||
cds->path[2] = '\\';
|
||||
cds->path[3] = '\0';
|
||||
|
Loading…
Reference in New Issue
Block a user