Advertisement
Guest User

Untitled

a guest
Jun 21st, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.65 KB | None | 0 0
  1. option *set_option(void)
  2. {
  3.         option *flags = malloc(sizeof(option) * 2);
  4.  
  5.         if (flags == NULL) {
  6.                 write(2, "flags' malloc failed\n", 21);
  7.                 return (NULL);
  8.         }
  9.         flags[0] = &new_employee;
  10.         flags[1] = NULL;
  11.         return (flags);
  12. }
  13.  
  14. int get_input(char *input)
  15. {
  16.         char *action = strtok(input, " ");
  17.         option *flags = set_option();
  18.         employee_t *staff = NULL;
  19.         meeting_t *meet = NULL;
  20.  
  21.         if (flags == NULL)
  22.                 return (84);
  23.         for (int i = 0; flags[i](action, input, &staff, &meet) != 0; i++);
  24.         free(flags);
  25.         return (0);
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement