home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / progm / spawno.zip / SPAWNLPE.C < prev    next >
C/C++ Source or Header  |  1990-09-15  |  1KB  |  42 lines

  1. /********************************************************************/
  2. /*   SPAWNO v2.0      XMS/disk swapping replacement for spawn...()  */
  3. /*   (c) Copyright 1990 Ralf Brown  All Rights Reserved         */
  4. /*                                    */
  5. /*   May be freely copied provided that this copyright notice is    */
  6. /*   not altered or removed.                        */
  7. /********************************************************************/
  8.  
  9. #include "spawno.h"
  10. #include <alloc.h>
  11. #include <errno.h>
  12.  
  13. extern int errno ;
  14. extern char *__spawn_env ;
  15. char * pascal __spawn_search(const char *) ;
  16. int pascal __spawn_buildenv(const char **) ;
  17.  
  18. int _Cdecl spawnlpeo(const char *overlay_path,const char *prog_name,...)
  19. {
  20.    char *prog_path = __spawn_search(prog_name) ;
  21.    int retval ;
  22.    void *env ;
  23.  
  24.    if (prog_path)
  25.       {
  26.       va_start((void *)env,1) ;
  27.       while (*((char *)env))  /* find NULL terminating list of program args */
  28.      va_arg(env,void *) ;
  29.       va_arg(env,void *) ;    /* point at pointer to list of env variables */
  30.       retval = __spawnv(overlay_path,prog_path,_va_ptr,__spawn_buildenv(*(char ***)env)) ;
  31.       va_end(env) ;
  32.       free(__spawn_env) ;
  33.       return retval ;
  34.       }
  35.    else
  36.       {
  37.       errno = ENOENT ;    /* not found-- _doserrno was set by __spawn_search() */
  38.       return -1 ;
  39.       }
  40. }
  41.  
  42.