From 6692f1159045b81b89c7b17b440729fedffaf7ab Mon Sep 17 00:00:00 2001 From: Emil Date: Sun, 6 Aug 2023 22:42:33 -0600 Subject: [PATCH] version function and error codes fixed --- CHANGELOG | 8 +++++++- include/error.h | 4 ++-- src/main.c | 22 +++++++++------------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index e1ec601..5b2d9dc 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +VERSION 1 + Upgraded to just Make New entries in project_list.sql Deleted various irrelevant files @@ -8,4 +10,8 @@ Reduced creds struct ADDED NVULN=1 build option to remove kill, raw and dump ADDED new -url option -Updated Version to 1 +VERSION X + +Added -identify +ircmsg is now more useful +Fixed some error return values being too high diff --git a/include/error.h b/include/error.h index 8595431..be2e428 100644 --- a/include/error.h +++ b/include/error.h @@ -15,8 +15,8 @@ fputs(msg "\n", stderr) #define DB_ERROR 100 -#define IRC_ERROR 200 -#define CREDS_ERROR 300 +#define IRC_ERROR 101 +#define CREDS_ERROR 102 #define ERROR_H_ #endif diff --git a/src/main.c b/src/main.c index a4254e8..4c6f44e 100644 --- a/src/main.c +++ b/src/main.c @@ -16,16 +16,18 @@ #define VERSION_STRING "1" -void +DECL void help(void) { ERRMSG(PROGN ": usage\n" "-channel CHANNEL - Sets the target channel\n" "-url URL - Sets the target URL\n" - "Use format username[:password]@server[:port], port defaults to 6667.\n"); + "-db DBFILE - Sets the database file (default: probotic_data.sqlite)\n" + "-identify PASSWORD - Identifies against NickServ\n" + "\nUse format username[:password]@server[:port], port defaults to 6667.\n"); } -void +DECL void version(void) { ERRMSG(PROGN ": " VERSION_STRING); @@ -45,7 +47,10 @@ main (int argc, { ++arg; if (strcmp(arg, "version") == 0) - { ERR(1, PROGN ": Version " VERSION_STRING); } + { + version(); + return 1; + } else if (strcmp(arg, "help") == 0) { goto help; } if (argc < 2) @@ -54,19 +59,10 @@ main (int argc, { db = argv[1]; } else if (strcmp(arg, "url") == 0) { parse_url(argv[1]); } - /* else if (strcmp(arg, "server") == 0) */ - /* { free(creds.server); creds.server = strdup(argv[1]); } */ - /* else if (strcmp(arg, "port") == 0) */ - /* { creds.port = atoi(argv[1]); } */ else if (strcmp(arg, "channel") == 0) { free(creds.channel); creds.channel = strdup(argv[1]); } else if (strcmp(arg, "identify") == 0) { ident_password = argv[1]; } - - /* else if (strcmp(arg, "username") == 0) */ - /* { free(creds.username); creds.username = strdup(argv[1]); } */ - /* else if (strcmp(arg, "password") == 0) */ - /* { free(creds.password); creds.password = strdup(argv[1]); } */ else { ERR(1,"Unknown command provided");