blob: e50b7ae73e7052e169f1991066297544f87bfb85 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#include <stdbool.h> // for booleans
#include <stdio.h> // for input/output
#include <stdlib.h> // for STD macros
#include <getopt.h> // for getopt
#include "tdo.h"
// for debugging
void print_args(int argc, char* argv[]) {
printf("There are %i arguments\n",argc);
printf("Those arguments are:\n");
for (int i=0; i<argc; ++i) {
printf("argv[%i]: %s", i, argv[i]);
}
}
int main(int argc, char* argv[]) {
char* valid_opts = "nv";
int opt;
while ((opt = getopt(argc, argv, valid_opts)) != -1) {
switch(opt) {
case 'n': new_tdo(argc,argv); break;
case 'v': print_version(); break;
default:
fprintf(stderr, "Usage: %s [%s] <HEADING>\n", argv[0], valid_opts);
exit(EXIT_FAILURE);
}
}
return 0;
}
|