Use error_log for logging/printing errors

modified:   src/nms.c
This commit is contained in:
Brian Barto 2018-10-24 21:50:42 -04:00
parent d921892576
commit 1cd3657415
1 changed files with 16 additions and 8 deletions

View File

@ -13,16 +13,19 @@
#include "input.h" #include "input.h"
#include "error.h" #include "error.h"
#define VERSION "0.3.3" #define VERSION "0.3.4"
int main(int argc, char *argv[]) { int main(int argc, char *argv[])
{
int r, o; int r, o;
unsigned char *input; unsigned char *input;
input = NULL; input = NULL;
while ((o = getopt(argc, argv, "f:ascv")) != -1) { while ((o = getopt(argc, argv, "f:ascv")) != -1)
switch (o) { {
switch (o)
{
case 'f': case 'f':
nmseffect_set_foregroundcolor(optarg); nmseffect_set_foregroundcolor(optarg);
break; break;
@ -37,13 +40,18 @@ int main(int argc, char *argv[]) {
break; break;
case 'v': case 'v':
printf("nms version " VERSION "\n"); printf("nms version " VERSION "\n");
return 0; return EXIT_SUCCESS;
case '?': case '?':
if (isprint(optopt)) if (isprint(optopt))
fprintf (stderr, "Unknown option '-%c'.\n", optopt); {
error_log("Unknown option '-%c'.", optopt);
}
else else
fprintf (stderr, "Unknown option character '\\x%x'.\n", optopt); {
return 1; error_log("Unknown option character '\\x%x'.", optopt);
}
error_print();
return EXIT_FAILURE;
} }
} }