main.c
changeset 14 286b248e402a
parent 12 6a372f8b4b8a
child 15 0acf8c3c4fe0
equal deleted inserted replaced
13:aec966cdbaa2 14:286b248e402a
    10 #include <unistd.h>
    10 #include <unistd.h>
    11 #include <errno.h>
    11 #include <errno.h>
    12 
    12 
    13 #include "main.h"
    13 #include "main.h"
    14 
    14 
    15 static const char version[] = "0.9";
    15 static const char version[] = "0.9.1";
    16 
    16 
    17 static int max(int a, int b)
    17 static int max(int a, int b)
    18 {
    18 {
    19     if (a > b)
    19     if (a > b)
    20         return a;
    20         return a;
    49             if (res == -1) perror("Dup2 3");
    49             if (res == -1) perror("Dup2 3");
    50             close(p_output[0]);
    50             close(p_output[0]);
    51 
    51 
    52             execvp(command[0], command);
    52             execvp(command[0], command);
    53 
    53 
    54             perror("Cannot execlp mpg321");
    54             error("Cannot execlp %s", command[0]);
    55             exit(-1);
       
    56         case -1:
    55         case -1:
    57             perror("Failed fork");
    56             error("Failed fork");
    58             exit(-1);
       
    59         default: /* parent */
    57         default: /* parent */
    60             close(p_input[1]);
    58             close(p_input[1]);
    61             close(p_output[0]);
    59             close(p_output[0]);
    62     }
    60     }
    63 
    61