Back to index

tor  0.2.3.18-rc
test-child.c
Go to the documentation of this file.
00001 /* Copyright (c) 2011-2012, The Tor Project, Inc. */
00002 /* See LICENSE for licensing information */
00003 
00004 #include <stdio.h>
00005 #include "orconfig.h"
00006 #ifdef _WIN32
00007 #define WINDOWS_LEAN_AND_MEAN
00008 #include <windows.h>
00009 #else
00010 #include <unistd.h>
00011 #endif
00012 
00015 int
00016 main(int argc, char **argv)
00017 {
00018   int i;
00019 
00020   fprintf(stdout, "OUT\n");
00021   fprintf(stderr, "ERR\n");
00022   for (i = 1; i < argc; i++)
00023     fprintf(stdout, "%s\n", argv[i]);
00024   fprintf(stdout, "SLEEPING\n");
00025   /* We need to flush stdout so that test_util_spawn_background_partial_read()
00026      succeed. Otherwise ReadFile() will get the entire output in one */
00027   // XXX: Can we make stdio flush on newline?
00028   fflush(stdout);
00029 #ifdef _WIN32
00030   Sleep(1000);
00031 #else
00032   sleep(1);
00033 #endif
00034   fprintf(stdout, "DONE\n");
00035 #ifdef _WIN32
00036   Sleep(1000);
00037 #else
00038   sleep(1);
00039 #endif
00040 
00041   return 0;
00042 }
00043