Advertisement
symdrome

cli.c

Sep 11th, 2023
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.55 KB | None | 0 0
  1. #include <unistd.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4.  
  5. #include "audio_len.h"
  6.  
  7. struct fileDir cli(int argc, char *argv[]) {
  8.   void help();
  9.   int opt;
  10.   struct fileDir dir = {".", ".", ""};
  11.  
  12.   while ((opt = getopt(argc, argv, "s:d:n:")) != -1) {
  13.     switch (opt) {
  14.     case 's':
  15.       dir.src = optarg;
  16.       break;
  17.     case 'd':
  18.       dir.dst = optarg;
  19.       break;
  20.     case 'n':
  21.       dir.op = optarg;
  22.       break;
  23.     default:
  24.       printf("Unknown option: %c\n", optopt);
  25.       help();
  26.       exit(1);
  27.     }
  28.   }
  29.  
  30.   return dir;
  31. }
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement