2010-10-10 18:12:23 +01:00
|
|
|
#include <stdio.h>
|
2011-07-22 15:57:56 +01:00
|
|
|
#include "orconfig.h"
|
2012-01-31 10:59:42 -05:00
|
|
|
#ifdef _WIN32
|
2011-07-22 15:57:56 +01:00
|
|
|
#define WINDOWS_LEAN_AND_MEAN
|
|
|
|
#include <windows.h>
|
|
|
|
#else
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
2010-10-10 18:12:23 +01:00
|
|
|
|
|
|
|
/** Trivial test program which prints out its command line arguments so we can
|
|
|
|
* check if tor_spawn_background() works */
|
|
|
|
int
|
|
|
|
main(int argc, char **argv)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
fprintf(stdout, "OUT\n");
|
|
|
|
fprintf(stderr, "ERR\n");
|
2010-10-11 23:22:52 +01:00
|
|
|
for (i = 1; i < argc; i++)
|
2010-10-10 18:12:23 +01:00
|
|
|
fprintf(stdout, "%s\n", argv[i]);
|
2011-07-22 15:57:56 +01:00
|
|
|
fprintf(stdout, "SLEEPING\n");
|
2011-07-24 23:31:59 +01:00
|
|
|
/* We need to flush stdout so that test_util_spawn_background_partial_read()
|
|
|
|
succeed. Otherwise ReadFile() will get the entire output in one */
|
|
|
|
// XXX: Can we make stdio flush on newline?
|
|
|
|
fflush(stdout);
|
2012-01-31 10:59:42 -05:00
|
|
|
#ifdef _WIN32
|
2011-07-22 15:57:56 +01:00
|
|
|
Sleep(1000);
|
|
|
|
#else
|
|
|
|
sleep(1);
|
|
|
|
#endif
|
2010-10-10 18:12:23 +01:00
|
|
|
fprintf(stdout, "DONE\n");
|
2012-01-31 10:59:42 -05:00
|
|
|
#ifdef _WIN32
|
2011-07-22 15:57:56 +01:00
|
|
|
Sleep(1000);
|
|
|
|
#else
|
|
|
|
sleep(1);
|
|
|
|
#endif
|
2010-10-10 18:12:23 +01:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|