root/user/uw-testbin/argtesttest/argtesttest.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. spawnv
  2. main

   1 /*
   2  * argtesttest
   3  *
   4  *      launch argtest with some arguments
   5  *
   6  *   relies on fork, execv
   7  *
   8  */
   9 
  10 #include <unistd.h>
  11 #include <err.h>
  12 
  13 static char *xargv[4] = { (char *)"argtesttest", (char *)"first", (char *)"second", NULL };
  14 
  15 static
  16 void
  17 spawnv(const char *prog, char **argv)
  18 {
  19   pid_t pid = fork();
  20   switch (pid) {
  21   case -1:
  22     err(1, "fork");
  23   case 0:
  24     /* child */
  25     execv(prog, argv);
  26     err(1, "%s", prog);
  27   default:
  28     /* parent */
  29     break;
  30   }
  31 }
  32 
  33 int
  34 main()
  35 {
  36   spawnv("/testbin/argtest", xargv);
  37   return 0;
  38 }

/* [<][>][^][v][top][bottom][index][help] */