[comp.os.msdos.programmer] Subst dereferencing

stanley@phoenix.com (John Stanley) (01/05/91)

I have a nice, cute little C program that duplicates the 'which' command
from UNIX. Basically, it searches the path for what will be executed for
any given command (i.e. 'which format' tells me 'C:\DOS\FORMAT.COM').

I have also packed a lot of stuff into my path by using SUBST to create
new drives. E.g., Q: points to D:\WP50. (All 26 drive letters are used,
except G:, which is reserved for a ram disk when I need it.)

Now the problem. I still think in terms of D:\WP50, since that is more
reasonable than Q:. I really want this 'which' to show both the SUBST
drive and the real path. E.g. "Q:\WP.EXE -=> D:\WP50\WP.EXE" 

Is there a system call that will expand a SUBST drive name into the real
path? I see none in any of the docs I have. Right now, the only way I
can think of is to do a system() call, dumping the output of a SUBST
command to a file, and reading that back in. Ick! I do it, and it works,
but, oooohhhh.

><><><><><><><><-----

  stanley@PhoEnix.com
  Tara: "They are carpenters and gardeners, and not tomato men."

ralf+@cs.cmu.edu (Ralf Brown) (01/06/91)

In article <HsBaV2w163w@phoenix.com> stanley@phoenix.com (John Stanley) writes:
}Is there a system call that will expand a SUBST drive name into the real
}path? I see none in any of the docs I have. Right now, the only way I
}can think of is to do a system() call, dumping the output of a SUBST
}command to a file, and reading that back in. Ick! I do it, and it works,
}but, oooohhhh.

There is no system call, but you can grunge around in the DOS data structures
to find out.  Take a look at INT 21/AH=52h in INTER191.ZIP, now available
from
	msdos.archive.umich.edu in /pub or /msdos/info
	grape.ecs.clarkson.edu in /incoming/msdos
	chyde.uwasa.fi in /pc/incoming
and soon (probably by the time you read this) from
	wsmr-simtel20.army.mil in PD1:<MSDOS.INFO>
--
{backbone}!cs.cmu.edu!ralf  ARPA: RALF@CS.CMU.EDU   FIDO: Ralf Brown 1:129/3.1
BITnet: RALF%CS.CMU.EDU@CMUCCVMA   AT&Tnet: (412)268-3053 (school)   FAX: ask
DISCLAIMER?  Did  | Everything is funny as long as it is happening to
I claim something?| someone else.  --Will Rogers

ralf+@cs.cmu.edu (Ralf Brown) (01/06/91)

In article <HsBaV2w163w@phoenix.com> stanley@phoenix.com (John Stanley) writes:
}Is there a system call that will expand a SUBST drive name into the real
}path? I see none in any of the docs I have. Right now, the only way I
}can think of is to do a system() call, dumping the output of a SUBST
}command to a file, and reading that back in. Ick! I do it, and it works,
}but, oooohhhh.

There is an undocumented system call (INT 21/AH=60h) which will expand SUBST
and JOIN paths.  Or you can grunge around in the DOS data structures to find
out--take a look at INT 21/AH=52h in the interrupt list.

I have just released a new version, INTER191.ZIP, now available from
	msdos.archive.umich.edu in /pub or /msdos/info
	grape.ecs.clarkson.edu in /incoming/msdos
	chyde.uwasa.fi in /pc/incoming
and soon (probably by the time you read this) from
	wsmr-simtel20.army.mil in PD1:<MSDOS.INFO>
--
{backbone}!cs.cmu.edu!ralf  ARPA: RALF@CS.CMU.EDU   FIDO: Ralf Brown 1:129/3.1
BITnet: RALF%CS.CMU.EDU@CMUCCVMA   AT&Tnet: (412)268-3053 (school)   FAX: ask
DISCLAIMER?  Did  | Everything is funny as long as it is happening to
I claim something?| someone else.  --Will Rogers