* Copyright (c) 1988 Regents of the University of California.
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, 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'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
static char sccsid
[] = "@(#)spintc.c 4.1 (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