home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GEMini Atari
/
GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso
/
zip
/
mint
/
mntlib16.lzh
/
MNTLIB16
/
SPAWNVP.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-08-03
|
989b
|
48 lines
/* spawnvp, spawnlp: try to execute a program on the default system
execution path. WARNING: the current directory is always searched
first.
Written by Eric R. Smith and placed in the public domain.
*/
#include <stdio.h>
#include <stdlib.h>
#include <process.h>
#include <stdarg.h>
#include <errno.h>
__EXTERN char * findfile __PROTO((char *, char *, char **));
static char *extensions[] = { "ttp", "prg", "tos", NULL };
int
spawnvp(mode, name, argv)
int mode;
char *name;
char **argv;
{
char *execname;
execname = findfile(name, getenv("PATH"), extensions);
if (!execname) {
errno = ENOENT;
return -1; /* file not found */
}
return spawnve(mode, execname, argv, (char **)NULL);
}
#ifdef __STDC__
int spawnlp(int mode, char *name, ...)
#else
int spawnlp(mode, name) int mode; char *name;
#endif
{
va_list args;
int r;
va_start(args, name);
r = spawnvp(mode, name, (char **)args);
va_end(args);
return r;
}