Started rewriting kiwmi in non-lit-C
This commit is contained in:
parent
c3288cfa9a
commit
ce21043d64
1 changed files with 33 additions and 0 deletions
33
src/kiwmi/main.c
Normal file
33
src/kiwmi/main.c
Normal file
|
@ -0,0 +1,33 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <getopt.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
char config_path[PATH_MAX];
|
||||
int option;
|
||||
|
||||
config_path[0] = '\0';
|
||||
|
||||
while ((option = getopt(argc, argv, "hvc:")) != -1) {
|
||||
switch (option) {
|
||||
case 'h':
|
||||
printf("Usage: %s [-h|-v|-c <config_path>]\n", argv0);
|
||||
exit(EXIT_SUCCESS);
|
||||
break;
|
||||
case 'v':
|
||||
printf("v" VERSION_STRING "\n");
|
||||
exit(EXIT_SUCCESS);
|
||||
break;
|
||||
case 'c':
|
||||
strncpy(config_path, optarg, sizeof(config_path));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue