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

View File

@ -13,16 +13,19 @@
#include "input.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;
unsigned char *input;
input = NULL;
while ((o = getopt(argc, argv, "f:ascv")) != -1) {
switch (o) {
while ((o = getopt(argc, argv, "f:ascv")) != -1)
{
switch (o)
{
case 'f':
nmseffect_set_foregroundcolor(optarg);
break;
@ -37,13 +40,18 @@ int main(int argc, char *argv[]) {
break;
case 'v':
printf("nms version " VERSION "\n");
return 0;
return EXIT_SUCCESS;
case '?':
if (isprint(optopt))
fprintf (stderr, "Unknown option '-%c'.\n", optopt);
{
error_log("Unknown option '-%c'.", optopt);
}
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;
}
}