From 7d4b7c2fed667c9d5ab02ac2b60d7a4e30b3b708 Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Mon, 9 Sep 2019 16:13:32 +0200 Subject: [PATCH] Get rid of stricmp/strnicmp (use strcasecmp/strncasecmp) --- include/config.h | 9 +------ include/windows/setup.h | 4 +-- src/api-clicap.c | 4 +-- src/api-command.c | 2 +- src/api-history-backend.c | 2 +- src/api-isupport.c | 2 +- src/api-messagetag.c | 2 +- src/conf.c | 48 ++++++++++++++++----------------- src/extra.c | 2 +- src/modules.c | 2 +- src/modules/extbans/account.c | 2 +- src/modules/help.c | 2 +- src/modules/nick.c | 4 +-- src/modules/restrict-commands.c | 2 +- src/modules/rmtkl.c | 4 +-- src/modules/sasl.c | 8 +++--- src/modules/stats.c | 2 +- src/modules/svsnline.c | 2 +- src/modules/tkl.c | 10 +++---- src/modules/tsctl.c | 4 +-- src/modules/websocket.c | 2 +- src/modules/who_old.c | 4 +-- src/packet.c | 4 +-- src/parse.c | 2 +- src/serv.c | 10 +++---- src/windows/unrealsvc.c | 20 +++++++------- 26 files changed, 76 insertions(+), 83 deletions(-) diff --git a/include/config.h b/include/config.h index 70ed55d90..f84ee1723 100644 --- a/include/config.h +++ b/include/config.h @@ -285,16 +285,9 @@ #define LOGFILE LPATH #else #define Debug(x) ; - #if VMS - #define LOGFILE "NLA0:" - #else - #define LOGFILE "/dev/null" - #endif + #define LOGFILE "/dev/null" #endif -// FIXME: get rid of this -# define stricmp strcasecmp -# define strnicmp strncasecmp #if defined(DEFAULT_RECVQ) # if (DEFAULT_RECVQ < 512) error DEFAULT_RECVQ needs redefining. diff --git a/include/windows/setup.h b/include/windows/setup.h index cae8d56e0..da4ecf2dd 100644 --- a/include/windows/setup.h +++ b/include/windows/setup.h @@ -42,8 +42,8 @@ #define LIST_SHOW_MODES #ifndef mode_t #define GOT_STRCASECMP -#define strcasecmp _stricmp -#define strncasecmp _strnicmp +#define strcasecmp _strcasecmp +#define strncasecmp _strncasecmp #define HAVE_EXPLICIT_BZERO #define explicit_bzero(a,b) SecureZeroMemory(a,b) #define HAVE_INET_PTON diff --git a/src/api-clicap.c b/src/api-clicap.c index 01d34d581..52a3f6ea1 100644 --- a/src/api-clicap.c +++ b/src/api-clicap.c @@ -41,7 +41,7 @@ ClientCapability *ClientCapabilityFindReal(const char *token) for (clicap = clicaps; clicap; clicap = clicap->next) { - if (!stricmp(token, clicap->name)) + if (!strcasecmp(token, clicap->name)) return clicap; } @@ -61,7 +61,7 @@ ClientCapability *ClientCapabilityFind(const char *token, aClient *sptr) for (clicap = clicaps; clicap; clicap = clicap->next) { - if (!stricmp(token, clicap->name)) + if (!strcasecmp(token, clicap->name)) { if (clicap->visible && !clicap->visible(sptr)) return NULL; /* hidden */ diff --git a/src/api-command.c b/src/api-command.c index 704a2c3f2..3dee573ff 100644 --- a/src/api-command.c +++ b/src/api-command.c @@ -25,7 +25,7 @@ int CommandExists(char *name) for (p = CommandHash[toupper(*name)]; p; p = p->next) { - if (!stricmp(p->cmd, name)) + if (!strcasecmp(p->cmd, name)) return 1; } diff --git a/src/api-history-backend.c b/src/api-history-backend.c index 8847f1d13..2b785e6b7 100644 --- a/src/api-history-backend.c +++ b/src/api-history-backend.c @@ -41,7 +41,7 @@ HistoryBackend *HistoryBackendFind(const char *name) for (m = historybackends; m; m = m->next) { - if (!stricmp(name, m->name)) + if (!strcasecmp(name, m->name)) return m; } return NULL; diff --git a/src/api-isupport.c b/src/api-isupport.c index 71478bae0..d9af68f81 100644 --- a/src/api-isupport.c +++ b/src/api-isupport.c @@ -160,7 +160,7 @@ Isupport *IsupportFind(const char *token) for (isupport = Isupports; isupport; isupport = isupport->next) { - if (!stricmp(token, isupport->token)) + if (!strcasecmp(token, isupport->token)) return isupport; } return NULL; diff --git a/src/api-messagetag.c b/src/api-messagetag.c index f9b2af733..fa1ca4747 100644 --- a/src/api-messagetag.c +++ b/src/api-messagetag.c @@ -41,7 +41,7 @@ MessageTagHandler *MessageTagHandlerFind(const char *token) for (m = mtaghandlers; m; m = m->next) { - if (!stricmp(token, m->name)) + if (!strcasecmp(token, m->name)) return m; } return NULL; diff --git a/src/conf.c b/src/conf.c index bee79858a..ed19914e7 100644 --- a/src/conf.c +++ b/src/conf.c @@ -2002,7 +2002,7 @@ int load_conf(char *filename, const char *original_path) continue; } #ifdef _WIN32 - if (!stricmp(filename, inc->file)) + if (!strcasecmp(filename, inc->file)) { counter ++; continue; @@ -2750,7 +2750,7 @@ ConfigItem_alias *Find_alias(char *name) for (e = conf_alias; e; e = e->next) { - if (!stricmp(e->alias, name)) + if (!strcasecmp(e->alias, name)) return e; } return NULL; @@ -2865,7 +2865,7 @@ ConfigItem_ulines *Find_uline(char *host) for(ulines = conf_ulines; ulines; ulines = ulines->next) { - if (!stricmp(host, ulines->servername)) + if (!strcasecmp(host, ulines->servername)) return ulines; } return NULL; @@ -6740,15 +6740,15 @@ void test_tlsblock(ConfigFile *conf, ConfigEntry *cep, int *totalerrors) name++; } - if (!stricmp(name, "All")) + if (!strcasecmp(name, "All")) option = TLS_PROTOCOL_ALL; - else if (!stricmp(name, "TLSv1")) + else if (!strcasecmp(name, "TLSv1")) option = TLS_PROTOCOL_TLSV1; - else if (!stricmp(name, "TLSv1.1")) + else if (!strcasecmp(name, "TLSv1.1")) option = TLS_PROTOCOL_TLSV1_1; - else if (!stricmp(name, "TLSv1.2")) + else if (!strcasecmp(name, "TLSv1.2")) option = TLS_PROTOCOL_TLSV1_2; - else if (!stricmp(name, "TLSv1.3")) + else if (!strcasecmp(name, "TLSv1.3")) option = TLS_PROTOCOL_TLSV1_3; else { @@ -6947,15 +6947,15 @@ void conf_tlsblock(ConfigFile *conf, ConfigEntry *cep, TLSOptions *tlsoptions) name++; } - if (!stricmp(name, "All")) + if (!strcasecmp(name, "All")) option = TLS_PROTOCOL_ALL; - else if (!stricmp(name, "TLSv1")) + else if (!strcasecmp(name, "TLSv1")) option = TLS_PROTOCOL_TLSV1; - else if (!stricmp(name, "TLSv1.1")) + else if (!strcasecmp(name, "TLSv1.1")) option = TLS_PROTOCOL_TLSV1_1; - else if (!stricmp(name, "TLSv1.2")) + else if (!strcasecmp(name, "TLSv1.2")) option = TLS_PROTOCOL_TLSV1_2; - else if (!stricmp(name, "TLSv1.3")) + else if (!strcasecmp(name, "TLSv1.3")) option = TLS_PROTOCOL_TLSV1_3; if (option) @@ -7090,11 +7090,11 @@ int _conf_set(ConfigFile *conf, ConfigEntry *ce) tempiConf.uhnames = config_checkval(cep->ce_vardata, CFG_YESNO); } else if (!strcmp(cep->ce_varname, "allow-userhost-change")) { - if (!stricmp(cep->ce_vardata, "always")) + if (!strcasecmp(cep->ce_vardata, "always")) tempiConf.userhost_allowed = UHALLOW_ALWAYS; - else if (!stricmp(cep->ce_vardata, "never")) + else if (!strcasecmp(cep->ce_vardata, "never")) tempiConf.userhost_allowed = UHALLOW_NEVER; - else if (!stricmp(cep->ce_vardata, "not-on-channels")) + else if (!strcasecmp(cep->ce_vardata, "not-on-channels")) tempiConf.userhost_allowed = UHALLOW_NOCHANS; else tempiConf.userhost_allowed = UHALLOW_REJOIN; @@ -7743,10 +7743,10 @@ int _test_set(ConfigFile *conf, ConfigEntry *ce) else if (!strcmp(cep->ce_varname, "allow-userhost-change")) { CheckNull(cep); CheckDuplicate(cep, allow_userhost_change, "allow-userhost-change"); - if (stricmp(cep->ce_vardata, "always") && - stricmp(cep->ce_vardata, "never") && - stricmp(cep->ce_vardata, "not-on-channels") && - stricmp(cep->ce_vardata, "force-rejoin")) + if (strcasecmp(cep->ce_vardata, "always") && + strcasecmp(cep->ce_vardata, "never") && + strcasecmp(cep->ce_vardata, "not-on-channels") && + strcasecmp(cep->ce_vardata, "force-rejoin")) { config_error("%s:%i: set::allow-userhost-change is invalid", cep->ce_fileptr->cf_filename, @@ -8809,7 +8809,7 @@ int is_blacklisted_module(char *name) ConfigItem_blacklist_module *m; for (m = conf_blacklist_module; m; m = m->next) - if (!stricmp(m->name, name) || !stricmp(m->name, path)) + if (!strcasecmp(m->name, name) || !strcasecmp(m->name, path)) return 1; return 0; @@ -9765,7 +9765,7 @@ static void conf_download_complete(const char *url, const char *file, const char continue; if (inc->flag.type & INCLUDE_NOTLOADED) continue; - if (stricmp(url, inc->url)) + if (strcasecmp(url, inc->url)) continue; inc->flag.type &= ~INCLUDE_DLQUEUED; @@ -9961,7 +9961,7 @@ char *find_remote_include(char *url, char **errorbuf) continue; if (!(inc->flag.type & INCLUDE_REMOTE)) continue; - if (!stricmp(url, inc->url)) + if (!strcasecmp(url, inc->url)) { *errorbuf = inc->errorbuf; return inc->file; @@ -9980,7 +9980,7 @@ char *find_loaded_remote_include(char *url) continue; if (!(inc->flag.type & INCLUDE_REMOTE)) continue; - if (!stricmp(url, inc->url)) + if (!strcasecmp(url, inc->url)) return inc->file; } diff --git a/src/extra.c b/src/extra.c index 7b7010279..c3d8d6f7e 100644 --- a/src/extra.c +++ b/src/extra.c @@ -266,7 +266,7 @@ void ircd_log(int flags, FORMAT_STRING(const char *format), ...) for (logs = conf_log; logs; logs = logs->next) { #ifdef HAVE_SYSLOG - if (!stricmp(logs->file, "syslog") && logs->flags & flags) { + if (!strcasecmp(logs->file, "syslog") && logs->flags & flags) { syslog(LOG_INFO, "%s", buf); written++; continue; diff --git a/src/modules.c b/src/modules.c index 840000595..f91e9de98 100644 --- a/src/modules.c +++ b/src/modules.c @@ -846,7 +846,7 @@ CMD_FUNC(m_module) Hooktype *HooktypeFind(char *string) { Hooktype *hooktype; for (hooktype = Hooktypes; hooktype->string ;hooktype++) { - if (!stricmp(hooktype->string, string)) + if (!strcasecmp(hooktype->string, string)) return hooktype; } return NULL; diff --git a/src/modules/extbans/account.c b/src/modules/extbans/account.c index 8fc89b205..52146634b 100644 --- a/src/modules/extbans/account.c +++ b/src/modules/extbans/account.c @@ -82,7 +82,7 @@ int extban_account_is_banned(aClient *sptr, aChannel *chptr, char *banin, int ty { char *ban = banin+3; - if (!stricmp(ban, sptr->user->svid)) + if (!strcasecmp(ban, sptr->user->svid)) return 1; return 0; diff --git a/src/modules/help.c b/src/modules/help.c index c9dbf909a..752881c48 100644 --- a/src/modules/help.c +++ b/src/modules/help.c @@ -74,7 +74,7 @@ ConfigItem_help *Find_Help(char *command) { if (help->command == NULL) continue; - else if (!stricmp(command,help->command)) + else if (!strcasecmp(command,help->command)) return help; } return NULL; diff --git a/src/modules/nick.c b/src/modules/nick.c index fddd302e0..e44be52af 100644 --- a/src/modules/nick.c +++ b/src/modules/nick.c @@ -365,7 +365,7 @@ CMD_FUNC(m_uid) ** client, just reject it. -Lefler ** Allow opers to use Q-lined nicknames. -Russell */ - if (!stricmp("ircd", nick) || !stricmp("irc", nick)) + if (!strcasecmp("ircd", nick) || !strcasecmp("irc", nick)) { sendnumeric(sptr, ERR_ERRONEUSNICKNAME, nick, "Reserved for internal IRCd purposes"); @@ -706,7 +706,7 @@ CMD_FUNC(m_nick) ** client, just reject it. -Lefler ** Allow opers to use Q-lined nicknames. -Russell */ - if (!stricmp("ircd", nick) || !stricmp("irc", nick)) + if (!strcasecmp("ircd", nick) || !strcasecmp("irc", nick)) { sendnumeric(sptr, ERR_ERRONEUSNICKNAME, nick, "Reserved for internal IRCd purposes"); diff --git a/src/modules/restrict-commands.c b/src/modules/restrict-commands.c index d2afd894e..4e83b9396 100644 --- a/src/modules/restrict-commands.c +++ b/src/modules/restrict-commands.c @@ -125,7 +125,7 @@ RestrictedCmd *find_restrictions_bycmd(char *cmd) { RestrictedCmd *rcmd; for (rcmd = RestrictedCmdList; rcmd; rcmd = rcmd->next) { - if (!stricmp(rcmd->cmd, cmd)) + if (!strcasecmp(rcmd->cmd, cmd)) return rcmd; } return NULL; diff --git a/src/modules/rmtkl.c b/src/modules/rmtkl.c index 4f920e4a7..44a80c749 100644 --- a/src/modules/rmtkl.c +++ b/src/modules/rmtkl.c @@ -128,9 +128,9 @@ static TKLType *find_TKLType_by_flag(char flag) } void rmtkl_check_options(char *param, int *skipperm, int *silent) { - if (!stricmp("-skipperm", param)) + if (!strcasecmp("-skipperm", param)) *skipperm = 1; - if (!stricmp("-silent", param)) + if (!strcasecmp("-silent", param)) *silent = 1; } diff --git a/src/modules/sasl.c b/src/modules/sasl.c index f22a9617d..f562b1dde 100644 --- a/src/modules/sasl.c +++ b/src/modules/sasl.c @@ -90,7 +90,7 @@ static aClient *decode_puid(char *puid) cookie = atoi(it2); } - if (stricmp(me.name, puid)) + if (strcasecmp(me.name, puid)) return NULL; list_for_each_entry(cptr, &unknown_list, lclient_node) @@ -133,7 +133,7 @@ CMD_FUNC(m_svslogin) if (!SASL_SERVER || MyClient(sptr) || (parc < 3) || !parv[3]) return 0; - if (!stricmp(parv[1], me.name)) + if (!strcasecmp(parv[1], me.name)) { aClient *target_p; @@ -180,7 +180,7 @@ CMD_FUNC(m_sasl) if (!SASL_SERVER || MyClient(sptr) || (parc < 4) || !parv[4]) return 0; - if (!stricmp(parv[1], me.name)) + if (!strcasecmp(parv[1], me.name)) { aClient *target_p; @@ -196,7 +196,7 @@ CMD_FUNC(m_sasl) make_user(target_p); /* reject if another SASL agent is answering */ - if (*target_p->local->sasl_agent && stricmp(sptr->name, target_p->local->sasl_agent)) + if (*target_p->local->sasl_agent && strcasecmp(sptr->name, target_p->local->sasl_agent)) return 0; else strlcpy(target_p->local->sasl_agent, sptr->name, sizeof(target_p->local->sasl_agent)); diff --git a/src/modules/stats.c b/src/modules/stats.c index cdc257b40..4824b67db 100644 --- a/src/modules/stats.c +++ b/src/modules/stats.c @@ -276,7 +276,7 @@ static inline int stats_operonly_long(char *s) OperStat *os; for (os = iConf.oper_only_stats_ext; os; os = os->next) { - if (!stricmp(os->flag, s)) + if (!strcasecmp(os->flag, s)) return 1; } return 0; diff --git a/src/modules/svsnline.c b/src/modules/svsnline.c index f419d7c15..1571ce053 100644 --- a/src/modules/svsnline.c +++ b/src/modules/svsnline.c @@ -130,7 +130,7 @@ CMD_FUNC(m_svsnline) continue; if (bconf->flag.type2 != CONF_BAN_TYPE_AKILL) continue; - if (!stricmp(bconf->mask, parv[2])) + if (!strcasecmp(bconf->mask, parv[2])) break; } if (bconf) diff --git a/src/modules/tkl.c b/src/modules/tkl.c index f7ee36cbf..b4adb32f0 100644 --- a/src/modules/tkl.c +++ b/src/modules/tkl.c @@ -3374,8 +3374,8 @@ aTKline *_find_tkl_serverban(int type, char *usermask, char *hostmask, int softb { if (tkl->type == type) { - if (!stricmp(tkl->ptr.serverban->hostmask, hostmask) && - !stricmp(tkl->ptr.serverban->usermask, usermask)) + if (!strcasecmp(tkl->ptr.serverban->hostmask, hostmask) && + !strcasecmp(tkl->ptr.serverban->usermask, usermask)) { /* And an extra check for soft/hard ban mismatches.. */ if ((tkl->ptr.serverban->subtype & TKL_SUBTYPE_SOFT) == softban) @@ -3400,8 +3400,8 @@ aTKline *_find_tkl_banexception(int type, char *usermask, char *hostmask, int so { if (tkl->type == type) { - if (!stricmp(tkl->ptr.banexception->hostmask, hostmask) && - !stricmp(tkl->ptr.banexception->usermask, usermask)) + if (!strcasecmp(tkl->ptr.banexception->hostmask, hostmask) && + !strcasecmp(tkl->ptr.banexception->usermask, usermask)) { /* And an extra check for soft/hard ban mismatches.. */ if ((tkl->ptr.banexception->subtype & TKL_SUBTYPE_SOFT) == softban) @@ -3423,7 +3423,7 @@ aTKline *_find_tkl_nameban(int type, char *name, int hold) for (tkl = tklines[tkl_hash(tpe)]; tkl; tkl = tkl->next) { - if ((tkl->type == type) && !stricmp(tkl->ptr.nameban->name, name)) + if ((tkl->type == type) && !strcasecmp(tkl->ptr.nameban->name, name)) return tkl; } return NULL; /* Not found */ diff --git a/src/modules/tsctl.c b/src/modules/tsctl.c index 8a4cbac56..a6be4fe52 100644 --- a/src/modules/tsctl.c +++ b/src/modules/tsctl.c @@ -56,13 +56,13 @@ CMD_FUNC(m_tsctl) return 0; } - if (MyClient(sptr) && (!parv[1] || stricmp(parv[1], "alltime"))) + if (MyClient(sptr) && (!parv[1] || strcasecmp(parv[1], "alltime"))) { sendnotice(sptr, "/TSCTL now shows the time on all servers. You can now longer MODIFY the time."); parv[1] = "alltime"; } - if (parv[1] && !stricmp(parv[1], "alltime")) + if (parv[1] && !strcasecmp(parv[1], "alltime")) { sendnotice(sptr, "*** Server=%s TStime=%lld", me.name, (long long)TStime()); diff --git a/src/modules/websocket.c b/src/modules/websocket.c index 724dbb945..cdcccbff9 100644 --- a/src/modules/websocket.c +++ b/src/modules/websocket.c @@ -364,7 +364,7 @@ int websocket_handle_handshake(aClient *sptr, char *readbuf, int *length) r; r = websocket_handshake_helper(NULL, 0, &key, &value, &lastloc, &end_of_request)) { - if (!stricmp(key, "Sec-WebSocket-Key")) + if (!strcasecmp(key, "Sec-WebSocket-Key")) { if (strchr(value, ':')) { diff --git a/src/modules/who_old.c b/src/modules/who_old.c index cd4eb475a..dcebbd13d 100644 --- a/src/modules/who_old.c +++ b/src/modules/who_old.c @@ -441,8 +441,8 @@ char has_common_chan = 0; /* if they only want people with a certain server */ if (wfl.want_server != WHO_DONTCARE) { - if (((wfl.want_server == WHO_WANT) && stricmp(wfl.server, acptr->user->server)) || - ((wfl.want_server == WHO_DONTWANT) && !stricmp(wfl.server, acptr->user->server))) + if (((wfl.want_server == WHO_WANT) && strcasecmp(wfl.server, acptr->user->server)) || + ((wfl.want_server == WHO_DONTWANT) && !strcasecmp(wfl.server, acptr->user->server))) { return WHO_CANTSEE; } diff --git a/src/packet.c b/src/packet.c index 1da25fc48..1f0415714 100644 --- a/src/packet.c +++ b/src/packet.c @@ -118,7 +118,7 @@ static inline aCommand *find_Cmd(char *cmd, int flags) continue; if ((flags & M_ALIAS) && !(p->flags & M_ALIAS)) continue; - if (!stricmp(p->cmd, cmd)) + if (!strcasecmp(p->cmd, cmd)) return p; } return NULL; @@ -138,7 +138,7 @@ aCommand *find_Command_simple(char *cmd) aCommand *p; for (p = CommandHash[toupper(*cmd)]; p; p = p->next) { - if (!stricmp(p->cmd, cmd)) + if (!strcasecmp(p->cmd, cmd)) return (p); } diff --git a/src/parse.c b/src/parse.c index 77b75208a..a085a4c14 100644 --- a/src/parse.c +++ b/src/parse.c @@ -284,7 +284,7 @@ int parse2(aClient *cptr, aClient **fromptr, MessageTag *mtags, char *ch) ** This error should indeed not be sent in case ** of notices -- Syzop. */ - if (!IsRegistered(cptr) && stricmp(ch, "NOTICE")) { + if (!IsRegistered(cptr) && strcasecmp(ch, "NOTICE")) { sendnumericfmt(from, ERR_NOTREGISTERED, "You have not registered"); parse_addlag(cptr, bytes); return -1; diff --git a/src/serv.c b/src/serv.c index b615ba0aa..f97b0493c 100644 --- a/src/serv.c +++ b/src/serv.c @@ -678,7 +678,7 @@ CMD_FUNC(m_rehash) } } - if (!BadPtr(parv[1]) && stricmp(parv[1], "-all")) + if (!BadPtr(parv[1]) && strcasecmp(parv[1], "-all")) { if (!ValidatePermissionsForPath("server:rehash",sptr,NULL,NULL,NULL)) @@ -689,13 +689,13 @@ CMD_FUNC(m_rehash) if (*parv[1] == '-') { - if (!strnicmp("-gar", parv[1], 4)) + if (!strncasecmp("-gar", parv[1], 4)) { loop.do_garbage_collect = 1; RunHook3(HOOKTYPE_REHASHFLAG, cptr, sptr, parv[1]); return 0; } - if (!strnicmp("-dns", parv[1], 4)) + if (!strncasecmp("-dns", parv[1], 4)) { reinit_resolver(sptr); return 0; @@ -725,8 +725,8 @@ CMD_FUNC(m_rehash) RunHook3(HOOKTYPE_REHASHFLAG, cptr, sptr, parv[1]); return 0; } - if (!strnicmp("-motd", parv[1], 5) - || !strnicmp("-rules", parv[1], 6)) + if (!strncasecmp("-motd", parv[1], 5) + || !strncasecmp("-rules", parv[1], 6)) { if (cptr != sptr) sendto_umode_global(UMODE_OPER, "Remotely rehasing all MOTDs and RULES on request of %s", sptr->name); diff --git a/src/windows/unrealsvc.c b/src/windows/unrealsvc.c index 0edbe6c3a..5f0afd8e1 100644 --- a/src/windows/unrealsvc.c +++ b/src/windows/unrealsvc.c @@ -48,7 +48,7 @@ int main(int argc, char *argv[]) { } hAdvapi = LoadLibrary("advapi32.dll"); uChangeServiceConfig2 = (UCHANGESERVICECONFIG2)GetProcAddress(hAdvapi, "ChangeServiceConfig2A"); - if (!stricmp(argv[1], "install")) { + if (!strcasecmp(argv[1], "install")) { SC_HANDLE hService, hSCManager; char path[MAX_PATH+1]; char binpath[MAX_PATH+1]; @@ -79,7 +79,7 @@ int main(int argc, char *argv[]) { CloseServiceHandle(hSCManager); return 0; } - else if (!stricmp(argv[1], "uninstall")) { + else if (!strcasecmp(argv[1], "uninstall")) { SC_HANDLE hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); SC_HANDLE hService = OpenService(hSCManager, "UnrealIRCd", DELETE); if (DeleteService(hService)) @@ -90,7 +90,7 @@ int main(int argc, char *argv[]) { CloseServiceHandle(hSCManager); return 0; } - else if (!stricmp(argv[1], "start")) { + else if (!strcasecmp(argv[1], "start")) { SC_HANDLE hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); SC_HANDLE hService = OpenService(hSCManager, "UnrealIRCd", SERVICE_START); if (StartService(hService, 0, NULL)) @@ -101,7 +101,7 @@ int main(int argc, char *argv[]) { CloseServiceHandle(hSCManager); return 0; } - else if (!stricmp(argv[1], "stop")) { + else if (!strcasecmp(argv[1], "stop")) { SERVICE_STATUS status; SC_HANDLE hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); SC_HANDLE hService = OpenService(hSCManager, "UnrealIRCd", SERVICE_STOP); @@ -111,7 +111,7 @@ int main(int argc, char *argv[]) { CloseServiceHandle(hSCManager); return 0; } - else if (!stricmp(argv[1], "restart")) { + else if (!strcasecmp(argv[1], "restart")) { SERVICE_STATUS status; SC_HANDLE hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); SC_HANDLE hService = OpenService(hSCManager, "UnrealIRCd", SERVICE_STOP|SERVICE_START); @@ -122,14 +122,14 @@ int main(int argc, char *argv[]) { CloseServiceHandle(hSCManager); return 0; } - else if (!stricmp(argv[1], "rehash")) { + else if (!strcasecmp(argv[1], "rehash")) { SERVICE_STATUS status; SC_HANDLE hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); SC_HANDLE hService = OpenService(hSCManager, "UnrealIRCd", SERVICE_USER_DEFINED_CONTROL); ControlService(hService, IRCD_SERVICE_CONTROL_REHASH, &status); printf("UnrealIRCd NT Service successfully rehashed"); } - else if (!stricmp(argv[1], "config")) { + else if (!strcasecmp(argv[1], "config")) { SERVICE_STATUS status; SC_HANDLE hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); SC_HANDLE hService = OpenService(hSCManager, "UnrealIRCd", @@ -138,16 +138,16 @@ int main(int argc, char *argv[]) { show_usage(); return -1; } - if (!stricmp(argv[2], "startup")) { + if (!strcasecmp(argv[2], "startup")) { if (ChangeServiceConfig(hService, SERVICE_NO_CHANGE, - !stricmp(argv[3], "auto") ? SERVICE_AUTO_START + !strcasecmp(argv[3], "auto") ? SERVICE_AUTO_START : SERVICE_DEMAND_START, SERVICE_NO_CHANGE, NULL, NULL, NULL, NULL, NULL, NULL, NULL)) printf("UnrealIRCd NT Service configuration changed"); else printf("UnrealIRCd NT Service configuration change failed - %s", show_error(GetLastError())); } - else if (!stricmp(argv[2], "crashrestart")) { + else if (!strcasecmp(argv[2], "crashrestart")) { SERVICE_FAILURE_ACTIONS hFailActions; SC_ACTION hAction; memset(&hFailActions, 0, sizeof(hFailActions));