Created
November 5, 2017 13:28
-
-
Save olastor/37cb455734f4268a68a2dc9f00c0bfbc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<stdlib.h> | |
#include<unistd.h> | |
int main(int argc, char *argv[]) { | |
int c; | |
while((c = getopt(argc, argv, "ab:c:")) != -1) { | |
switch(c) { | |
case 'a': | |
printf("Flag 'a' set"); | |
break; | |
case 'b': | |
printf("Parameter b: %s\n", optarg); | |
break; | |
case 'c': | |
printf("Parameter c: %s\n", optarg); | |
break; | |
default: | |
abort(); | |
} | |
} | |
return EXIT_SUCCESS; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment