version function and error codes fixed

This commit is contained in:
Emil 2023-08-06 22:42:33 -06:00
parent aaf31c6f78
commit 6692f11590
3 changed files with 18 additions and 16 deletions

View File

@ -1,3 +1,5 @@
VERSION 1
Upgraded to just Make Upgraded to just Make
New entries in project_list.sql New entries in project_list.sql
Deleted various irrelevant files Deleted various irrelevant files
@ -8,4 +10,8 @@ Reduced creds struct
ADDED NVULN=1 build option to remove kill, raw and dump ADDED NVULN=1 build option to remove kill, raw and dump
ADDED new -url option 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

View File

@ -15,8 +15,8 @@
fputs(msg "\n", stderr) fputs(msg "\n", stderr)
#define DB_ERROR 100 #define DB_ERROR 100
#define IRC_ERROR 200 #define IRC_ERROR 101
#define CREDS_ERROR 300 #define CREDS_ERROR 102
#define ERROR_H_ #define ERROR_H_
#endif #endif

View File

@ -16,16 +16,18 @@
#define VERSION_STRING "1" #define VERSION_STRING "1"
void DECL void
help(void) help(void)
{ {
ERRMSG(PROGN ": usage\n" ERRMSG(PROGN ": usage\n"
"-channel CHANNEL - Sets the target channel\n" "-channel CHANNEL - Sets the target channel\n"
"-url URL - Sets the target URL\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) version(void)
{ {
ERRMSG(PROGN ": " VERSION_STRING); ERRMSG(PROGN ": " VERSION_STRING);
@ -45,7 +47,10 @@ main (int argc,
{ {
++arg; ++arg;
if (strcmp(arg, "version") == 0) if (strcmp(arg, "version") == 0)
{ ERR(1, PROGN ": Version " VERSION_STRING); } {
version();
return 1;
}
else if (strcmp(arg, "help") == 0) else if (strcmp(arg, "help") == 0)
{ goto help; } { goto help; }
if (argc < 2) if (argc < 2)
@ -54,19 +59,10 @@ main (int argc,
{ db = argv[1]; } { db = argv[1]; }
else if (strcmp(arg, "url") == 0) else if (strcmp(arg, "url") == 0)
{ parse_url(argv[1]); } { 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) else if (strcmp(arg, "channel") == 0)
{ free(creds.channel); creds.channel = strdup(argv[1]); } { free(creds.channel); creds.channel = strdup(argv[1]); }
else if (strcmp(arg, "identify") == 0) else if (strcmp(arg, "identify") == 0)
{ ident_password = argv[1]; } { 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 else
{ {
ERR(1,"Unknown command provided"); ERR(1,"Unknown command provided");