mirror of
https://github.com/kiedtl/fire.git
synced 2024-12-22 06:06:40 +00:00
argument parsing
This commit is contained in:
parent
a5c3fe1992
commit
6d2b6ffcca
5
args.h
5
args.h
@ -19,10 +19,7 @@
|
||||
extern char *argv0;
|
||||
|
||||
typedef struct Options {
|
||||
bool perf_opt1;
|
||||
bool perf_opt2;
|
||||
bool perf_opt3;
|
||||
bool verbose;
|
||||
bool stub; // no real options... yet
|
||||
} Options;
|
||||
|
||||
/* use main(int argc, char *argv[]) */
|
||||
|
23
main.c
23
main.c
@ -7,13 +7,32 @@
|
||||
#include "termbox.h"
|
||||
#include "args.h"
|
||||
|
||||
#define VERSION "0.1.0"
|
||||
|
||||
// argument parsing (args.h)
|
||||
char *argv0;
|
||||
struct Options *opts;
|
||||
|
||||
int
|
||||
main ( void )
|
||||
main ( int argc, char *argv[] )
|
||||
{
|
||||
// argument parsing
|
||||
argv0 = argv[0];
|
||||
|
||||
ARGBEGIN {
|
||||
case 'V':
|
||||
PRINT("%s %s\n", argv0, VERSION);
|
||||
exit(0);
|
||||
case 'h':
|
||||
default:
|
||||
PRINT("fire %s\n(c) Kied Llaentenn and contributors\n", VERSION);
|
||||
PRINT("https://github.com/lptstr/fire\n");
|
||||
PRINT("\nUSAGE:\n\t$ fire\n\n");
|
||||
PRINT("OPTIONS:\n\t-V\tshow version and exit.\n");
|
||||
PRINT("\t-h\tshow this help message and exit.\n\n");
|
||||
exit(1);
|
||||
} ARGEND
|
||||
|
||||
// initialize termbox
|
||||
tb_init();
|
||||
tb_select_output_mode(TB_OUTPUT_NORMAL);
|
||||
@ -40,7 +59,7 @@ main ( void )
|
||||
tb_shutdown();
|
||||
|
||||
// cleanup framebuffer
|
||||
free(buf.tmp_buf);
|
||||
free(buf.buf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user