Back to index

tor  0.2.3.18-rc
Functions
test-child.c File Reference
#include <stdio.h>
#include "orconfig.h"
#include <unistd.h>

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 Trivial test program which prints out its command line arguments so we can check if tor_spawn_background() works.

Function Documentation

int main ( int  argc,
char **  argv 
)

Trivial test program which prints out its command line arguments so we can check if tor_spawn_background() works.

Definition at line 16 of file test-child.c.

{
  int i;

  fprintf(stdout, "OUT\n");
  fprintf(stderr, "ERR\n");
  for (i = 1; i < argc; i++)
    fprintf(stdout, "%s\n", argv[i]);
  fprintf(stdout, "SLEEPING\n");
  /* 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);
#ifdef _WIN32
  Sleep(1000);
#else
  sleep(1);
#endif
  fprintf(stdout, "DONE\n");
#ifdef _WIN32
  Sleep(1000);
#else
  sleep(1);
#endif

  return 0;
}