mirror of
https://github.com/SEPPDROID/Digital-Research-Source-Code.git
synced 2025-10-23 16:34:07 +00:00
Upload
Digital Research
This commit is contained in:
54
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102a/clib/exec.c
Normal file
54
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v102a/clib/exec.c
Normal file
@@ -0,0 +1,54 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* E x e c F u n c t i o n
|
||||
* -------------------------
|
||||
* Copyright 1982 by Digital Research Inc. All rights reserved.
|
||||
*
|
||||
* The execl function is called from anywhere to pass control to
|
||||
* another program from the the executing C program.
|
||||
* Note that the stream files are closed via '_cleanup()'.
|
||||
*
|
||||
* Calling Sequence:
|
||||
*
|
||||
* execl(name,arg0,arg1,...,argn,NULLPTR);
|
||||
*
|
||||
* Where:
|
||||
* name, arg0, arg1...argn are pointers to character strings
|
||||
*
|
||||
****************************************************************************/
|
||||
#include "portab.h"
|
||||
#include "osif.h"
|
||||
#include "osiferr.h"
|
||||
#include "errno.h"
|
||||
#include "ctype.h"
|
||||
|
||||
UWORD execl(name,arg0) /* CLEAR FUNCTION ***********/
|
||||
UBYTE *name,*arg0; /* pointers arguments */
|
||||
{ /* */
|
||||
REG UBYTE **args; /* used to index into args */
|
||||
UBYTE cmdline[128]; /* CP/M command line area */
|
||||
REG WORD i; /***************************/
|
||||
/* */
|
||||
_cleanup(); /* Close all (stream) files*/
|
||||
/* now build cmdline */
|
||||
strcpy(cmdline,name); /* Copy name portion */
|
||||
#if PCDOS == 0 /* Don't do for PCDOS */
|
||||
for(i = strlen(cmdline); --i >= 0; ) /* uppercase command name */
|
||||
cmdline[i] = toupper(cmdline[i]); /* */
|
||||
#endif /***************************/
|
||||
args = &arg0; /* Copy args */
|
||||
args++; /* arg0 is a dup of the */
|
||||
/* command name */
|
||||
while(*args != NULLPTR) /***************************/
|
||||
{ /* */
|
||||
strcat(cmdline," "); /* Add a blank */
|
||||
strcat(cmdline,*args++); /* Add next arg */
|
||||
} /***************************/
|
||||
#if PCDOS /* handle differently ifso */
|
||||
_pc_chain(cmdline); /* special home grown func */
|
||||
#else /* O.S. handles it? */
|
||||
__OSIF(SETDMA,cmdline); /* DMA -> Command line */
|
||||
__OSIF(P_CHAIN,0); /* chain to program */
|
||||
#endif
|
||||
RETERR(FAILURE,ENOENT); /* error: file not found */
|
||||
} /***************************/
|
Reference in New Issue
Block a user