* Copyright (c) 1988 Regents of the University of California.
* Redistribution and use in source and binary forms are permitted
* provided that this notice is preserved and that due credit is given
* to the University of California at Berkeley. The name of the University
* may not be used to endorse or promote products derived from this
* software without specific prior written permission. This software
* is provided ``as is'' without express or implied warranty.
static char sccsid
[] = "@(#)spintc.c 3.2 (Berkeley) %G%";
#include "../general/general.h"
#define PSP_ENVIRONMENT 0x2c
environment
, /* Segment address of environment */
cmd_ptr_offset
, /* Offset of command to execute */
cmd_ptr_segment
, /* Segment where command lives */
fcb1_ptr_offset
, /* Offset of FCB 1 */
fcb1_ptr_segment
, /* Segment of FCB 1 */
fcb2_ptr_offset
, /* Offset of FCB 2 */
fcb2_ptr_segment
; /* Segment of FCB 2 */
static int int_offset
, int_segment
;
return; /* Not done yet */
* Restore old interrupt handler.
regs
.h
.al
= spint
->int_no
;
intdosx(®s
, ®s
, &sregs
);
if (spint
->regs
.x
.cflag
) {
fprintf(stderr
, "0x%x return code from EXEC.\n", spint
->regs
.x
.ax
);
regs
.h
.ah
= 0x4d; /* Get return code */
_spint_continue(spint
); /* Return to caller */
spint_start(command
, spint
)
comspec
= getenv("COMSPEC");
if (comspec
== 0) { /* Can't find where command.com is */
fprintf(stderr
, "Unable to find COMSPEC in the environment.");
spint
->rc
= 99; /* XXX */
* Now, hook up our interrupt routine.
regs
.h
.al
= spint
->int_no
;
intdosx(®s
, ®s
, &sregs
);
regs
.h
.al
= spint
->int_no
;
regs
.x
.dx
= (int) _spint_int
;
intdosx(®s
, ®s
, &sregs
);
* Read in segment registers.
* Set up registers for the EXEC call.
spint
->regs
.x
.dx
= (int) comspec
;
spint
->sregs
.es
= spint
->sregs
.ds
; /* Superfluous, probably */
spint
->regs
.x
.bx
= (int) &mylist
;
* Set up EXEC parameter list.
mylist
.cmd_ptr_offset
= (int) command
;
mylist
.cmd_ptr_segment
= spint
->sregs
.ds
;
mylist
.fcb1_ptr_offset
= PSP_FCB1
;
mylist
.fcb1_ptr_segment
= _psp
;
mylist
.fcb2_ptr_offset
= PSP_FCB2
;
mylist
.fcb2_ptr_segment
= _psp
;
mylist
.environment
= *((int far
*)(((long)_psp
<<16)|PSP_ENVIRONMENT
));
* Call to assembly language routine to actually set up for