Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
2.4 KiB

  1. /***
  2. *spawnvp.c - spawn a child process; search along PATH
  3. *
  4. * Copyright (c) 1985-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * defines _spawnvp() - spawn a child process; search along PATH
  8. *
  9. *Revision History:
  10. * 04-15-84 DFW written
  11. * 10-29-85 TC added spawnvpe capability
  12. * 12-11-87 JCR Added "_LOAD_DS" to declaration
  13. * 11-20-89 GJF Fixed copyright, alignment. Added const to arg types
  14. * for filename and argv.
  15. * 03-08-90 GJF Replaced _LOAD_DS with _CALLTYPE1, added #include
  16. * <cruntime.h> and removed #include <register.h>
  17. * 05-21-90 GJF Fixed stack checking pragma syntax.
  18. * 08-24-90 SBM Removed check_stack pragma since workhorse _spawnve
  19. * does stack checks
  20. * 09-27-90 GJF New-style function declarator.
  21. * 01-17-91 GJF ANSI naming.
  22. * 02-14-90 SRW Use NULL instead of _environ to get default.
  23. * 04-06-93 SKS Replace _CRTAPI* with __cdecl
  24. * 12-07-93 CFW Wide char enable.
  25. * 02-06-98 GJF Changes for Win64: changed return type to intptr_t.
  26. *
  27. *******************************************************************************/
  28. #include <cruntime.h>
  29. #include <stdlib.h>
  30. #include <process.h>
  31. #include <tchar.h>
  32. /***
  33. *int _spawnvp(modeflag, filename, argv) - spawn a child process (search PATH)
  34. *
  35. *Purpose:
  36. * Spawns a child process, with search along PATH variable.
  37. * formats the parameters and calls _spawnve to do the actual work. The
  38. * NULL environment pointer indicates the new process will inherit the
  39. * parents process's environment. NOTE - at least one argument must be
  40. * present. This argument is always, by convention, the name of the file
  41. * being spawned.
  42. *
  43. *Entry:
  44. * int modeflag - mode to spawn (WAIT, NOWAIT, or OVERLAY)
  45. * only WAIT and OVERLAY currently supported
  46. * _TSCHAR *pathname - name of file to spawn
  47. * _TSCHAR **argv - vector of arguments
  48. *
  49. *Exit:
  50. * returns exit code of child process
  51. * returns -1 if fails
  52. *
  53. *Exceptions:
  54. *
  55. *******************************************************************************/
  56. intptr_t __cdecl _tspawnvp (
  57. int modeflag,
  58. REG3 const _TSCHAR *filename,
  59. const _TSCHAR * const *argv
  60. )
  61. {
  62. return _tspawnvpe(modeflag, filename, argv, NULL);
  63. }