-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
29 lines (29 loc) · 723 Bytes
/
main.c
File metadata and controls
29 lines (29 loc) · 723 Bytes
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
#include "adjlist.h"
#include "ui.h"
#include <stdio.h>
#include <unistd.h>
void usage(char *name) {
printf("USAGE: %s [flags]\n\t-h\t-- help\n\t-u \t-- undirected "
"mode\n\t-e\t-- echo input\n",
name);
}
int main(int argc, char *argv[]) {
int opt;
bool echo = false, dir = true;
while ((opt = getopt(argc, argv, "heu")) != -1) {
switch (opt) {
case 'e':
echo = true;
break;
case 'u':
dir = false;
break;
default:
usage(argv[0]);
exit(EXIT_FAILURE);
}
}
printf("INFO: Running in %sdirected mode\n", dir ? "" : "un");
run(dir, echo);
exit(EXIT_SUCCESS);
}