main.c: proper help message

This commit is contained in:
Kiëd Llaentenn 2020-09-17 11:54:08 +00:00
parent 228292d9f9
commit d1ad444cd0

26
main.c
View File

@ -23,7 +23,7 @@ main ( int argc, char *argv[] )
{ {
opts = (struct Options*) calloc(1, sizeof(struct Options*)); opts = (struct Options*) calloc(1, sizeof(struct Options*));
if (opts == NULL) { if (opts == NULL) {
PRINT("fire: error: cannot "); EPRINT("fire: error: cannot ");
perror("calloc()"); perror("calloc()");
} }
@ -44,17 +44,21 @@ main ( int argc, char *argv[] )
opts->refresh_rate = atoi(ARGF()); opts->refresh_rate = atoi(ARGF());
break; break;
case 'V': case 'V':
PRINT("%s %s\n", argv0, VERSION); printf("%s %s\n", argv0, VERSION);
exit(0); exit(EXIT_SUCCESS);
case 'h': case 'h':
default: default:
PRINT("fire %s\n(c) Kied Llaentenn and contributors\n", VERSION); printf("Usage: %s [-tVh] [-r rate]\n", argv0);
PRINT("https://github.com/lptstr/fire\n"); printf("Display a nice fiery animation.\n\n");
PRINT("\nUSAGE:\n\t$ fire\n\n"); printf("ARGUMENTS:\n");
PRINT("OPTIONS:\n\t-t\tenable true colors.\n"); printf(" -r [rate] Change refresh rate. (default: 5)\n");
PRINT("\t-V\tshow version and exit.\n"); printf(" -t Enable truecolor. (Will not work on *rxvt)\n");
PRINT("\t-h\tshow this help message and exit.\n\n"); printf(" -h Display this help message and exit.\n");
exit(1); printf(" -V Display version and exit.\n\n");
printf("(c) Kiëd Llaentenn, nullgemm\n");
printf("https://github.com/lptstr/fire\n");
exit(EXIT_SUCCESS);
} ARGEND } ARGEND
// initialize termbox // initialize termbox
@ -71,7 +75,7 @@ main ( int argc, char *argv[] )
while (TRUE) while (TRUE)
{ {
// clear the screen // clear the screen
tb_clear(); //tb_clear();
// update framebuffer // update framebuffer
dofire(&buf); dofire(&buf);