APPLE 'C' pwd command
John E. Duncan III
jed at mb2c.UUCP
Mon Nov 7 06:39:28 AEST 1983
/* 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 );
}
More information about the Comp.sources.unix
mailing list