home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / crt / src / execvp.c < prev    next >
C/C++ Source or Header  |  1998-06-17  |  2KB  |  49 lines

  1. /***
  2. *execvp.c - execute a file and search along PATH
  3. *
  4. *       Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. *       defines _execvp() - execute a file and search along PATH
  8. *
  9. *******************************************************************************/
  10.  
  11. #include <cruntime.h>
  12. #include <stdlib.h>
  13. #include <process.h>
  14. #include <tchar.h>
  15.  
  16. /***
  17. *int _execvp(filename, argvector) - execute file; search along PATH
  18. *
  19. *Purpose:
  20. *       Execute the given file with given path and current environ.
  21. *       try to execute the file. start with the name itself (directory '.'),
  22. *       and if that doesn't work start prepending pathnames from the
  23. *       environment until one works or we run out. if the file is a pathname,
  24. *       don't go to the environment to get alternate paths. if errno comes
  25. *       back ENOEXEC, try it as a shell command file with up to MAXARGS-2
  26. *       arguments from the original vector. if a needed text file is busy,
  27. *       wait a little while and try again before despairing completely
  28. *       Actually calls _execvpe() to do all the work.
  29. *
  30. *Entry:
  31. *       _TSCHAR *filename        - file to execute
  32. *       _TSCHAR **argvector - vector of arguments
  33. *
  34. *Exit:
  35. *       destroys the calling process (hopefully)
  36. *       if fails, returns -1
  37. *
  38. *Exceptions:
  39. *
  40. *******************************************************************************/
  41.  
  42. int __cdecl _texecvp (
  43.         REG3 const _TSCHAR *filename,
  44.         const _TSCHAR * const *argvector
  45.         )
  46. {
  47.         return _texecvpe( filename, argvector, NULL );
  48. }
  49.