[net.sources] pwd for APPLE AZTEC 'C' system

jed@mb2c.UUCP (John E. Duncan III) (11/07/83)

/* pwd.c
 *		Print the working directory of AZTEC C on the APPLE
 * stdout device.  It should be easy, but since there is no
 * system call to do it, we open an absurdly named file for
 * read and then go peeking around in DOS to see what drive
 * the system tried to read it on.
 */

#define DRIVE	0xB7F8
#define SLOT	0xB7F7
#define VOL		0xB7F6

char mesg[] = "sX, dX, vXXX\n";
main()
{
	register char ch;

	open( "", 0 );
	ch = *SLOT;
	mesg[1] = (ch>>4) + '0';
	ch = *DRIVE;
	mesg[5] = ch + '0';
	ch = *VOL;
	mesg[11] = ch%10 + '0';
	ch = ch/10;
	mesg[10] = ch%10 + '0';
	mesg[9] = ch/10 + '0';
	write( 1, mesg, 13 );
}