test-child.c 628 B

123456789101112131415161718192021222324252627282930313233343536
  1. #include <stdio.h>
  2. #include "orconfig.h"
  3. #ifdef MS_WINDOWS
  4. #define WINDOWS_LEAN_AND_MEAN
  5. #include <windows.h>
  6. #else
  7. #include <unistd.h>
  8. #endif
  9. /** Trivial test program which prints out its command line arguments so we can
  10. * check if tor_spawn_background() works */
  11. int
  12. main(int argc, char **argv)
  13. {
  14. int i;
  15. fprintf(stdout, "OUT\n");
  16. fprintf(stderr, "ERR\n");
  17. for (i = 1; i < argc; i++)
  18. fprintf(stdout, "%s\n", argv[i]);
  19. fprintf(stdout, "SLEEPING\n");
  20. #ifdef MS_WINDOWS
  21. Sleep(1000);
  22. #else
  23. sleep(1);
  24. #endif
  25. fprintf(stdout, "DONE\n");
  26. #ifdef MS_WINDOWS
  27. Sleep(1000);
  28. #else
  29. sleep(1);
  30. #endif
  31. return 0;
  32. }