Admin/Linux/Isabelle.c
changeset 54314 8f7061babae4
parent 54313 da2e6282a4f5
child 71547 373dcdd363dc
equal deleted inserted replaced
54313:da2e6282a4f5 54314:8f7061babae4
    20 int main(int argc, char *argv[])
    20 int main(int argc, char *argv[])
    21 {
    21 {
    22   char **cmd_line = NULL;
    22   char **cmd_line = NULL;
    23   int i = 0;
    23   int i = 0;
    24 
    24 
    25   cmd_line = malloc(sizeof(char *) * argc);
    25   cmd_line = malloc(sizeof(char *) * (argc + 1));
    26   if (cmd_line == NULL) fail("Failed to allocate command line");
    26   if (cmd_line == NULL) fail("Failed to allocate command line");
    27 
    27 
    28   cmd_line[0] = malloc(strlen(argv[0]) + 5);
    28   cmd_line[0] = malloc(strlen(argv[0]) + 5);
    29   if (cmd_line[0] == NULL) fail("Failed to allocate command line");
    29   if (cmd_line[0] == NULL) fail("Failed to allocate command line");
    30 
    30 
    31   strcpy(cmd_line[0], argv[0]);
    31   strcpy(cmd_line[0], argv[0]);
    32   strcat(cmd_line[0], ".run");
    32   strcat(cmd_line[0], ".run");
    33 
    33 
    34   for (i = 1; i < argc; i++) cmd_line[i] = argv[i];
    34   for (i = 1; i < argc; i++) cmd_line[i] = argv[i];
    35 
    35 
       
    36   cmd_line[argc] = NULL;
       
    37 
    36   execvp(cmd_line[0], cmd_line);
    38   execvp(cmd_line[0], cmd_line);
    37   fail("Failed to execute application script");
    39   fail("Failed to execute application script");
    38 }
    40 }
    39 
    41