All pastes #1309360 Raw Edit

Someone

public text v1 · immutable
#1309360 ·published 2009-01-15 18:30 UTC
rendered paste body
#include <unistd.h>
#include <string.h>
#include <stdio.h>

int main(int argc, char *argv[])
      {
      char *cmd;
      cmd = strtok(argv[1], ";");
      
      while (cmd != NULL)
          {
          pid_t pid = fork();
          int status;
          if (pid == 0)
              {
              printf("%s\n", cmd);
              execlp(cmd, cmd, (char *)NULL);
              }
          /* if (pid > 0)
              wait(&status); */
              
          cmd = strtok(NULL, ";");
          }
          
      return 0;
      }