#undef tolower
#define tolower(x) ( ((x>='A')&&(x<='Z')) ? (x+'a'-'A') : x )
-#define strucmp(lstr,rstr) struncmp(lstr,rstr,32767)
#define NEW_CONFIG
+#define strucmp(lstr,rstr) struncmp(lstr,rstr,32767)
+
/*
* The only typedef we do is an 8-bit unsigned, for screen dimensions.
* All other defs are done using standard C types. The code assumes that
char OUTGOING_FQDN[128];
int RUN_NETPROC = 1;
-int struncmp(lstr,rstr,l)
-char lstr[],rstr[]; {
- int pos = 0;
- char lc,rc;
- while (1) {
- if (pos==l) return(0);
- lc=tolower(lstr[pos]);
- rc=tolower(rstr[pos]);
- if ((lc==0)&&(rc==0)) return(0);
- if (lc<rc) return(-1);
- if (lc>rc) return(1);
- pos=pos+1;
- }
- }
-
long conv_date(sdbuf)
char sdbuf[]; {
int a,b,cpos,tend,tval;
int a;
/* What name is the local host known by? */
- /* if (!strucmp(host, config.c_fqdn)) { */
+ /* if (!strcasecmp(host, config.c_fqdn)) { */
if (IsHostLocal(host)) {
strcpy(host, config.c_nodename);
return;
/* Other hosts in the gateway domain? */
for (a=0; a<strlen(host); ++a) {
- if ((host[a]=='.') && (!strucmp(&host[a+1], GW_DOMAIN))) {
+ if ((host[a]=='.') && (!strcasecmp(&host[a+1], GW_DOMAIN))) {
host[a] = 0;
for (a=0; a<strlen(host); ++a) {
if (host[a]=='.') host[a] = 0;
for (a=0; a<strlen(abuf); ++a) {
if (abuf[a]==',') {
abuf[a]=0;
- if (!strucmp(name,abuf)) {
+ if (!strcasecmp(name,abuf)) {
strcpy(name,&abuf[a+1]);
}
}
syslog(LOG_NOTICE,"zapping nulled message");
}
- else if (!struncmp(recp,"room_",5)) {
+ else if (!strncasecmp(recp,"room_",5)) {
syslog(LOG_NOTICE,"to room %s",recp);
if (is_test == 0) do_roommail(recp);
}
buf[strlen(buf)+2] = 0;
buf[strlen(buf)+3] = 0;
- if (!struncmp(buf, "QUIT", 4)) {
+ if (!strncasecmp(buf, "QUIT", 4)) {
printf("221 Later, dude.\n");
}
- else if (!struncmp(buf, "HELP", 4)) {
+ else if (!strncasecmp(buf, "HELP", 4)) {
printf("214 You think _you_ need help?\n");
}
- else if (!struncmp(buf, "HELO", 4)) {
+ else if (!strncasecmp(buf, "HELO", 4)) {
printf("250 Howdy ho, Mr. Hankey!\n");
}
- else if (!struncmp(buf, "MAIL", 4)) {
+ else if (!strncasecmp(buf, "MAIL", 4)) {
printf("250 Sure, whatever...\n");
}
- else if (!struncmp(buf, "RCPT To: ", 9)) {
+ else if (!strncasecmp(buf, "RCPT To: ", 9)) {
if (strlen(recp) > 0) {
printf("571 Multiple recipients not supported.\n");
}
- else if (!struncmp(buf, "RCPT", 4)) {
+ else if (!strncasecmp(buf, "RCPT", 4)) {
printf("501 Only 'To:' commands are supported.\n");
}
- else if (!struncmp(buf, "DATA", 4)) {
+ else if (!strncasecmp(buf, "DATA", 4)) {
if (strlen(recp) > 0) {
printf("354 Sock it to me, baby...\n");
fflush(stdout);
printf("500 Huh?\n");
}
- } while (struncmp(buf,"QUIT",4));
+ } while (strncasecmp(buf,"QUIT",4));
}
else {
{
CC->cs_flags &= ~CS_STEALTH;
bzero(CC->fake_username, 32);
- if (struncmp(newusername, CC->curr_user, strlen(CC->curr_user)))
+ if (strncasecmp(newusername, CC->curr_user, strlen(CC->curr_user)))
strncpy(CC->fake_username, newusername, 31);
}
else
char buf[256];
FILE *fp;
- if (!strucmp(where,"localhost")) return(1);
- if (!strucmp(where,config.c_fqdn)) return(1);
+ if (!strcasecmp(where,"localhost")) return(1);
+ if (!strcasecmp(where,config.c_fqdn)) return(1);
fp = fopen("public_clients","r");
if (fp == NULL) return(0);
while (fgets(buf,256,fp)!=NULL) {
while (isspace((buf[strlen(buf)-1])))
buf[strlen(buf)-1] = 0;
- if (!strucmp(buf,where)) {
+ if (!strcasecmp(buf,where)) {
fclose(fp);
return(1);
}
* Let other clients see the last command we executed, but
* exclude NOOP because that would be boring.
*/
- if (struncmp(cmdbuf, "NOOP", 4)) {
+ if (strncasecmp(cmdbuf, "NOOP", 4)) {
strcpy(CC->lastcmdname, " ");
strncpy(CC->lastcmdname, cmdbuf, 4);
time(&CC->lastidle);
}
- if ((struncmp(cmdbuf, "ENT0", 4)) && (struncmp(cmdbuf, "MESG", 4)) && (struncmp(cmdbuf, "MSGS", 4)))
+ if ((strncasecmp(cmdbuf, "ENT0", 4)) && (strncasecmp(cmdbuf, "MESG", 4)) && (strncasecmp(cmdbuf, "MSGS", 4)))
{
CC->cs_flags &= ~CS_POSTING;
}
* This loop recognizes all server commands.
*/
- if (!struncmp(cmdbuf,"NOOP",4)) {
+ if (!strncasecmp(cmdbuf,"NOOP",4)) {
cprintf("%d%cok\n",OK,check_express());
}
- else if (!struncmp(cmdbuf,"QUIT",4)) {
+ else if (!strncasecmp(cmdbuf,"QUIT",4)) {
cprintf("%d Goodbye.\n",OK);
}
- else if (!struncmp(cmdbuf,"LOUT",4)) {
+ else if (!strncasecmp(cmdbuf,"LOUT",4)) {
if (CC->logged_in) logout(CC);
cprintf("%d logged out.\n",OK);
}
- else if (!struncmp(cmdbuf,"USER",4)) {
+ else if (!strncasecmp(cmdbuf,"USER",4)) {
cmd_user(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"PASS",4)) {
+ else if (!strncasecmp(cmdbuf,"PASS",4)) {
cmd_pass(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"NEWU",4)) {
+ else if (!strncasecmp(cmdbuf,"NEWU",4)) {
cmd_newu(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"SETP",4)) {
+ else if (!strncasecmp(cmdbuf,"SETP",4)) {
cmd_setp(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"LRMS",4)) {
+ else if (!strncasecmp(cmdbuf,"LRMS",4)) {
cmd_lrms(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"LKRA",4)) {
+ else if (!strncasecmp(cmdbuf,"LKRA",4)) {
cmd_lkra(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"LKRN",4)) {
+ else if (!strncasecmp(cmdbuf,"LKRN",4)) {
cmd_lkrn(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"LKRO",4)) {
+ else if (!strncasecmp(cmdbuf,"LKRO",4)) {
cmd_lkro(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"LZRM",4)) {
+ else if (!strncasecmp(cmdbuf,"LZRM",4)) {
cmd_lzrm(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"GETU",4)) {
+ else if (!strncasecmp(cmdbuf,"GETU",4)) {
cmd_getu();
}
- else if (!struncmp(cmdbuf,"SETU",4)) {
+ else if (!strncasecmp(cmdbuf,"SETU",4)) {
cmd_setu(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"GOTO",4)) {
+ else if (!strncasecmp(cmdbuf,"GOTO",4)) {
cmd_goto(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"MSGS",4)) {
+ else if (!strncasecmp(cmdbuf,"MSGS",4)) {
cmd_msgs(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"WHOK",4)) {
+ else if (!strncasecmp(cmdbuf,"WHOK",4)) {
cmd_whok();
}
- else if (!struncmp(cmdbuf,"RDIR",4)) {
+ else if (!strncasecmp(cmdbuf,"RDIR",4)) {
cmd_rdir();
}
- else if (!struncmp(cmdbuf,"MSG0",4)) {
+ else if (!strncasecmp(cmdbuf,"MSG0",4)) {
cmd_msg0(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"MSG2",4)) {
+ else if (!strncasecmp(cmdbuf,"MSG2",4)) {
cmd_msg2(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"MSG3",4)) {
+ else if (!strncasecmp(cmdbuf,"MSG3",4)) {
cmd_msg3(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"INFO",4)) {
+ else if (!strncasecmp(cmdbuf,"INFO",4)) {
cmd_info();
}
- else if (!struncmp(cmdbuf,"SLRP",4)) {
+ else if (!strncasecmp(cmdbuf,"SLRP",4)) {
cmd_slrp(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"INVT",4)) {
+ else if (!strncasecmp(cmdbuf,"INVT",4)) {
cmd_invt_kick(&cmdbuf[5],1);
}
- else if (!struncmp(cmdbuf,"KICK",4)) {
+ else if (!strncasecmp(cmdbuf,"KICK",4)) {
cmd_invt_kick(&cmdbuf[5],0);
}
- else if (!struncmp(cmdbuf,"GETR",4)) {
+ else if (!strncasecmp(cmdbuf,"GETR",4)) {
cmd_getr();
}
- else if (!struncmp(cmdbuf,"SETR",4)) {
+ else if (!strncasecmp(cmdbuf,"SETR",4)) {
cmd_setr(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"GETA",4)) {
+ else if (!strncasecmp(cmdbuf,"GETA",4)) {
cmd_geta();
}
- else if (!struncmp(cmdbuf,"SETA",4)) {
+ else if (!strncasecmp(cmdbuf,"SETA",4)) {
cmd_seta(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"ENT0",4)) {
+ else if (!strncasecmp(cmdbuf,"ENT0",4)) {
cmd_ent0(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"ENT3",4)) {
+ else if (!strncasecmp(cmdbuf,"ENT3",4)) {
cmd_ent3(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"RINF",4)) {
+ else if (!strncasecmp(cmdbuf,"RINF",4)) {
cmd_rinf();
}
- else if (!struncmp(cmdbuf,"DELE",4)) {
+ else if (!strncasecmp(cmdbuf,"DELE",4)) {
cmd_dele(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"KILL",4)) {
+ else if (!strncasecmp(cmdbuf,"KILL",4)) {
cmd_kill(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"CRE8",4)) {
+ else if (!strncasecmp(cmdbuf,"CRE8",4)) {
cmd_cre8(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"MOVE",4)) {
+ else if (!strncasecmp(cmdbuf,"MOVE",4)) {
cmd_move(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"FORG",4)) {
+ else if (!strncasecmp(cmdbuf,"FORG",4)) {
cmd_forg();
}
- else if (!struncmp(cmdbuf,"MESG",4)) {
+ else if (!strncasecmp(cmdbuf,"MESG",4)) {
cmd_mesg(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"EMSG",4)) {
+ else if (!strncasecmp(cmdbuf,"EMSG",4)) {
cmd_emsg(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"GNUR",4)) {
+ else if (!strncasecmp(cmdbuf,"GNUR",4)) {
cmd_gnur();
}
- else if (!struncmp(cmdbuf,"GREG",4)) {
+ else if (!strncasecmp(cmdbuf,"GREG",4)) {
cmd_greg(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"VALI",4)) {
+ else if (!strncasecmp(cmdbuf,"VALI",4)) {
cmd_vali(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"EINF",4)) {
+ else if (!strncasecmp(cmdbuf,"EINF",4)) {
cmd_einf(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"LIST",4)) {
+ else if (!strncasecmp(cmdbuf,"LIST",4)) {
cmd_list();
}
- else if (!struncmp(cmdbuf,"REGI",4)) {
+ else if (!strncasecmp(cmdbuf,"REGI",4)) {
cmd_regi();
}
- else if (!struncmp(cmdbuf,"CHEK",4)) {
+ else if (!strncasecmp(cmdbuf,"CHEK",4)) {
cmd_chek();
}
- else if (!struncmp(cmdbuf,"DELF",4)) {
+ else if (!strncasecmp(cmdbuf,"DELF",4)) {
cmd_delf(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"MOVF",4)) {
+ else if (!strncasecmp(cmdbuf,"MOVF",4)) {
cmd_movf(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"NETF",4)) {
+ else if (!strncasecmp(cmdbuf,"NETF",4)) {
cmd_netf(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"RWHO",4)) {
+ else if (!strncasecmp(cmdbuf,"RWHO",4)) {
cmd_rwho();
}
- else if (!struncmp(cmdbuf,"OPEN",4)) {
+ else if (!strncasecmp(cmdbuf,"OPEN",4)) {
cmd_open(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"CLOS",4)) {
+ else if (!strncasecmp(cmdbuf,"CLOS",4)) {
cmd_clos();
}
- else if (!struncmp(cmdbuf,"UOPN",4)) {
+ else if (!strncasecmp(cmdbuf,"UOPN",4)) {
cmd_uopn(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"UCLS",4)) {
+ else if (!strncasecmp(cmdbuf,"UCLS",4)) {
cmd_ucls(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"READ",4)) {
+ else if (!strncasecmp(cmdbuf,"READ",4)) {
cmd_read(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"WRIT",4)) {
+ else if (!strncasecmp(cmdbuf,"WRIT",4)) {
cmd_writ(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"QUSR",4)) {
+ else if (!strncasecmp(cmdbuf,"QUSR",4)) {
cmd_qusr(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"ECHO",4)) {
+ else if (!strncasecmp(cmdbuf,"ECHO",4)) {
cmd_echo(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"OIMG",4)) {
+ else if (!strncasecmp(cmdbuf,"OIMG",4)) {
cmd_oimg(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"MORE",4)) {
+ else if (!strncasecmp(cmdbuf,"MORE",4)) {
cmd_more();
}
- else if (!struncmp(cmdbuf,"NETP",4)) {
+ else if (!strncasecmp(cmdbuf,"NETP",4)) {
cmd_netp(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"NDOP",4)) {
+ else if (!strncasecmp(cmdbuf,"NDOP",4)) {
cmd_ndop(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"NUOP",4)) {
+ else if (!strncasecmp(cmdbuf,"NUOP",4)) {
cmd_nuop(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"LFLR",4)) {
+ else if (!strncasecmp(cmdbuf,"LFLR",4)) {
cmd_lflr();
}
- else if (!struncmp(cmdbuf,"CFLR",4)) {
+ else if (!strncasecmp(cmdbuf,"CFLR",4)) {
cmd_cflr(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"KFLR",4)) {
+ else if (!strncasecmp(cmdbuf,"KFLR",4)) {
cmd_kflr(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"EFLR",4)) {
+ else if (!strncasecmp(cmdbuf,"EFLR",4)) {
cmd_eflr(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"IDEN",4)) {
+ else if (!strncasecmp(cmdbuf,"IDEN",4)) {
cmd_iden(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"IPGM",4)) {
+ else if (!strncasecmp(cmdbuf,"IPGM",4)) {
cmd_ipgm(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"CHAT",4)) {
+ else if (!strncasecmp(cmdbuf,"CHAT",4)) {
cmd_chat(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"PEXP",4)) {
+ else if (!strncasecmp(cmdbuf,"PEXP",4)) {
cmd_pexp();
}
- else if (!struncmp(cmdbuf,"SEXP",4)) {
+ else if (!strncasecmp(cmdbuf,"SEXP",4)) {
cmd_sexp(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"EBIO",4)) {
+ else if (!strncasecmp(cmdbuf,"EBIO",4)) {
cmd_ebio();
}
- else if (!struncmp(cmdbuf,"RBIO",4)) {
+ else if (!strncasecmp(cmdbuf,"RBIO",4)) {
cmd_rbio(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"LBIO",4)) {
+ else if (!strncasecmp(cmdbuf,"LBIO",4)) {
cmd_lbio();
}
- else if (!struncmp(cmdbuf,"STEL",4)) {
+ else if (!strncasecmp(cmdbuf,"STEL",4)) {
cmd_stel(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"TERM",4)) {
+ else if (!strncasecmp(cmdbuf,"TERM",4)) {
cmd_term(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf,"DOWN",4)) {
+ else if (!strncasecmp(cmdbuf,"DOWN",4)) {
cmd_down();
}
- else if (!struncmp(cmdbuf,"SCDN",4)) {
+ else if (!strncasecmp(cmdbuf,"SCDN",4)) {
cmd_scdn(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf, "NSET", 4)) {
+ else if (!strncasecmp(cmdbuf, "NSET", 4)) {
cmd_nset(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf, "UIMG", 4)) {
+ else if (!strncasecmp(cmdbuf, "UIMG", 4)) {
cmd_uimg(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf, "UCHG", 4)) {
+ else if (!strncasecmp(cmdbuf, "UCHG", 4)) {
cmd_uchg(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf, "TIME", 4)) {
+ else if (!strncasecmp(cmdbuf, "TIME", 4)) {
cmd_time(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf, "HCHG", 4)) {
+ else if (!strncasecmp(cmdbuf, "HCHG", 4)) {
cmd_hchg(&cmdbuf[5]);
}
- else if (!struncmp(cmdbuf, "RCHG", 4)) {
+ else if (!strncasecmp(cmdbuf, "RCHG", 4)) {
cmd_rchg(&cmdbuf[5]);
}
else {
ERROR);
}
- } while(struncmp(cmdbuf,"QUIT",4));
+ } while(strncasecmp(cmdbuf,"QUIT",4));
cleanup(EXIT_NORMAL);
return(NULL);
long finduser();
-void get_config(); struct config config;
-
-int struncmp(lstr,rstr,len)
-char lstr[],rstr[];
-int len; {
- int pos = 0;
- char lc,rc;
- while (pos<len) {
- lc=tolower(lstr[pos]);
- rc=tolower(rstr[pos]);
- if ((lc==0)&&(rc==0)) return(0);
- if (lc<rc) return(-1);
- if (lc>rc) return(1);
- pos=pos+1;
- }
- return(0);
- }
+void get_config();
+struct config config;
+
main(argc,argv)
int argc;
a=strlen(tbuf);
while (a--) if (tbuf[a]==',') commapos=a;
tbuf[commapos]=0;
- if (!strucmp(&tbuf[commapos+1],roomname))
+ if (!strcasecmp(&tbuf[commapos+1],roomname))
strcpy(newsgroup,tbuf);
}
fclose(fp);
for (a=0; a<MAXROOMS; ++a) {
getroom(&qrbuf,a);
- if (!strucmp(qrbuf.QRname,newroom)) target_room = a;
+ if (!strcasecmp(qrbuf.QRname,newroom)) target_room = a;
}
if (target_room < 0) {
cprintf("%d Room '%s' not found.\n",
return;
}
- if (!strucmp(filename, "_userpic_")) {
+ if (!strcasecmp(filename, "_userpic_")) {
extract(which_user, cmdbuf, 1);
if (getuser(&usbuf, which_user) != 0) {
cprintf("%d No such user.\n", ERROR+NO_SUCH_USER);
}
sprintf(pathname, "./userpics/%ld.gif", usbuf.usernum);
}
- else if (!strucmp(filename, "_floorpic_")) {
+ else if (!strcasecmp(filename, "_floorpic_")) {
which_floor = extract_int(cmdbuf, 1);
sprintf(pathname, "./images/floor.%d.gif", which_floor);
}
- else if (!strucmp(filename, "_roompic_")) {
+ else if (!strcasecmp(filename, "_roompic_")) {
sprintf(pathname, "./images/room.%d.gif", CC->curr_rm);
}
else {
sprintf(CC->upl_path, "./images/%s", basenm);
}
- if (!strucmp(basenm, "_userpic_")) {
+ if (!strcasecmp(basenm, "_userpic_")) {
sprintf(CC->upl_path, "./userpics/%ld.gif",
CC->usersupp.usernum);
}
- if ( (!strucmp(basenm, "_floorpic_")) && (CC->usersupp.axlevel >= 6) ) {
+ if ( (!strcasecmp(basenm, "_floorpic_")) && (CC->usersupp.axlevel >= 6) ) {
which_floor = extract_int(cmdbuf, 2);
sprintf(CC->upl_path, "./images/floor.%d.gif", which_floor);
}
- if ( (!strucmp(basenm, "_roompic_")) && (is_room_aide()) ) {
+ if ( (!strcasecmp(basenm, "_roompic_")) && (is_room_aide()) ) {
sprintf(CC->upl_path, "./images/room.%d.gif", CC->curr_rm);
}
fclose(CC->upload_fp);
CC->upload_fp = NULL;
- if ((!strucmp(cmd,"1")) && (CC->upload_type != UPL_FILE)) {
+ if ((!strcasecmp(cmd,"1")) && (CC->upload_type != UPL_FILE)) {
CC->upload_type = UPL_FILE;
cprintf("%d Upload completed.\n", OK);
return;
}
- if (!strucmp(cmd,"1")) {
+ if (!strcasecmp(cmd,"1")) {
cprintf("%d File '%s' saved.\n",OK,CC->upl_path);
fp = fopen(CC->upl_filedir,"a");
if (fp==NULL) fp=fopen(CC->upl_filedir,"w");
char buf[256];
extract(buf,cmdbuf,1);
- if (strucmp(buf,config.c_net_password)) {
+ if (strcasecmp(buf,config.c_net_password)) {
cprintf("%d authentication failed\n",ERROR);
return;
}
extern struct config config;
-int struncmp();
char metoo[10][128];
int mecount = 0;
StripLeadingAndTrailingWhitespace(ParamName);
StripLeadingAndTrailingWhitespace(ParamValue);
- if (!strucmp(ParamName, "aliases"))
+ if (!strcasecmp(ParamName, "aliases"))
strcpy(ALIASES, ParamValue);
- if (!strucmp(ParamName, "cit86net spoolin"))
+ if (!strcasecmp(ParamName, "cit86net spoolin"))
strcpy(CIT86NET, ParamValue);
- if (!strucmp(ParamName, "sendmail"))
+ if (!strcasecmp(ParamName, "sendmail"))
strcpy(SENDMAIL, ParamValue);
- if (!strucmp(ParamName, "fallback"))
+ if (!strcasecmp(ParamName, "fallback"))
strcpy(FALLBACK, ParamValue);
- if (!strucmp(ParamName, "gateway domain"))
+ if (!strcasecmp(ParamName, "gateway domain"))
strcpy(GW_DOMAIN, ParamValue);
- if (!strucmp(ParamName, "table file"))
+ if (!strcasecmp(ParamName, "table file"))
strcpy(TABLEFILE, ParamValue);
- if (!strucmp(ParamName, "deliver local"))
+ if (!strcasecmp(ParamName, "deliver local"))
strcpy(metoo[mecount++], ParamValue);
- if (!strucmp(ParamName, "run netproc"))
+ if (!strcasecmp(ParamName, "run netproc"))
RUN_NETPROC = atoi(ParamValue);
}
}
int IsHostLocal(char *WhichHost) {
int a;
- if (!strucmp(WhichHost, FQDN)) return(1);
+ if (!strcasecmp(WhichHost, FQDN)) return(1);
if (mecount > 0) {
for (a=0; a<mecount; ++a) {
- if (!strucmp(WhichHost, metoo[a])) return(1);
+ if (!strcasecmp(WhichHost, metoo[a])) return(1);
}
}
char OUTGOING_FQDN[128];
int RUN_NETPROC = 1;
-int struncmp(lstr,rstr,len)
-char lstr[],rstr[];
-int len; {
- int pos = 0;
- char lc,rc;
- while (pos<len) {
- lc=tolower(lstr[pos]);
- rc=tolower(rstr[pos]);
- if ((lc==0)&&(rc==0)) return(0);
- if (lc<rc) return(-1);
- if (lc>rc) return(1);
- pos=pos+1;
- }
- return(0);
- }
-
/*
* Consult the mailinglists table to find out where we should send the
* mailing list postings to.
while (fgets(buf,128,fp)!=NULL) {
buf[strlen(buf)-1]=0;
for (a=0; a<strlen(buf); ++a) {
- if ( (buf[a]==',') && (!strucmp(&buf[a+1],room)) ) {
+ if ( (buf[a]==',') && (!strcasecmp(&buf[a+1],room)) ) {
strcpy(listaddr,buf);
listaddr[a] = 0;
}
fclose(fp);
goto DETYPE;
}
- if (strucmp(name,aaa)) goto GNA;
+ if (strcasecmp(name,aaa)) goto GNA;
fclose(fp);
strcpy(name,bbb);
/* cprintf("*** Mail is being forwarded to %s\n",name); */
if (fp==NULL) return(M_ERROR);
GETSN: do {
a=getstring(fp,aaa);
- } while ((a>=0)&&(strucmp(aaa,bbb)));
+ } while ((a>=0)&&(strcasecmp(aaa,bbb)));
a=getstring(fp,aaa);
if (!strncmp(aaa,"use ",4)) {
strcpy(bbb,&aaa[4]);
mode = MSGS_ALL;
strcat(which," ");
- if (!struncmp(which,"OLD",3)) mode = MSGS_OLD;
- if (!struncmp(which,"NEW",3)) mode = MSGS_NEW;
- if (!struncmp(which,"FIRST",5)) {
+ if (!strncasecmp(which,"OLD",3)) mode = MSGS_OLD;
+ if (!strncasecmp(which,"NEW",3)) mode = MSGS_NEW;
+ if (!strncasecmp(which,"FIRST",5)) {
mode = MSGS_FIRST;
cm_howmany = extract_int(cmdbuf,1);
}
- if (!struncmp(which,"LAST",4)) {
+ if (!strncasecmp(which,"LAST",4)) {
mode = MSGS_LAST;
cm_howmany = extract_int(cmdbuf,1);
}
- if (!struncmp(which,"GT",2)) {
+ if (!strncasecmp(which,"GT",2)) {
mode = MSGS_GT;
cm_gt = extract_long(cmdbuf,1);
}
}
if (mode == MT_RFC822) {
- if (!strucmp(snode, NODENAME)) {
+ if (!strcasecmp(snode, NODENAME)) {
strcpy(snode, FQDN);
}
cprintf("Message-ID: <%s@%s>\n", mid, snode);
while(och=ch, ch = *mptr++, ch>0) {
if (ch == 13) ch = 10;
++len;
- if ((ch!=10)||(och!=10)) {
+ /* if ((ch!=10)||(och!=10)) { */
cprintf("%c", ch);
if (ch==10) len = 0;
- }
+ /* } */
if (len>=250) {
len = 0;
/* cprintf("%c", ch); */
/* first try to locate the twit room */
for (a=0; a<MAXROOMS; ++a) {
getroom(&qrbuf,a);
- if (!strucmp(qrbuf.QRname,config.c_twitroom)) {
+ if (!strcasecmp(qrbuf.QRname,config.c_twitroom)) {
twitroom = a;
return;
}
ERROR+HIGHER_ACCESS_REQUIRED);
return;
}
- if (!strucmp(buf,"sysop")) {
+ if (!strcasecmp(buf,"sysop")) {
mtsflag=1;
goto SKFALL;
}
if (e!=M_LOCAL) goto SKFALL; /* don't search local file */
- if (!strucmp(buf,CC->usersupp.fullname)) {
+ if (!strcasecmp(buf,CC->usersupp.fullname)) {
cprintf("%d Can't send mail to yourself!\n",
ERROR+NO_SUCH_USER);
return;
targ_slot = (-1);
for (a=0; a<MAXROOMS; ++a) {
getroom(&qtemp,a);
- if (!strucmp(qtemp.QRname,targ)) {
+ if (!strcasecmp(qtemp.QRname,targ)) {
targ_slot = a;
a = MAXROOMS;
}
#include <syslog.h>
#include "citadel.h"
-int struncmp();
void LoadInternetConfig();
void get_config();
struct config config;
}
-int struncmp(lstr,rstr,len)
-char lstr[],rstr[];
-int len; {
- int pos = 0;
- char lc,rc;
- while (pos<len) {
- lc=tolower(lstr[pos]);
- rc=tolower(rstr[pos]);
- if ((lc==0)&&(rc==0)) return(0);
- if (lc<rc) return(-1);
- if (lc>rc) return(1);
- pos=pos+1;
- }
- return(0);
- }
-
void fpgetfield(fp,string)
FILE *fp;
* accept postings from subscribed addresses, we must always use the
* room's address as the originating user.
*/
- if ( (argc == 3) && (!strucmp(argv[2], "mlist")) ) {
+ if ( (argc == 3) && (!strcasecmp(argv[2], "mlist")) ) {
mlist = 1;
}
* users to receive Internet mail.
*/
fprintf(rmail,"From ");
- if (strucmp(nbuf,NODENAME)) fprintf(rmail,"%s!",nbuf);
+ if (strcasecmp(nbuf,NODENAME)) fprintf(rmail,"%s!",nbuf);
- if (!strucmp(nbuf,NODENAME)) strcpy(nbuf, FQDN);
+ if (!strcasecmp(nbuf,NODENAME)) strcpy(nbuf, FQDN);
if (mlist) {
fprintf(rmail,"%s\n", rmname);
}
else {
- if (!strucmp(nbuf, NODENAME)) { /* from this system */
+ if (!strcasecmp(nbuf, NODENAME)) { /* from this system */
fprintf(rmail,"%s\n",pbuf);
fprintf(rmail,"From: %s@%s (%s)\n",
sbuf, FQDN, fstr);
extern char bbs_home_directory[];
extern int home_specified;
-int struncmp(lstr,rstr,len)
-char lstr[],rstr[];
-int len; {
- int pos = 0;
- char lc,rc;
- while (pos<len) {
- lc=tolower(lstr[pos]);
- rc=tolower(rstr[pos]);
- if ((lc==0)&&(rc==0)) return(0);
- if (lc<rc) return(-1);
- if (lc>rc) return(1);
- pos=pos+1;
- }
- return(0);
- }
-
-/* redefine strucmp, just in case we're using an old version of citadel.h
- * that has it as a separate routine
- */
-#ifndef strucmp
-#undef strucmp
-#endif
-#define strucmp(lstr,rstr) struncmp(lstr,rstr,32767)
-
#ifdef NO_STRERROR
/*
slocal = NULL;
for (stemp=slist; stemp!=NULL; stemp=stemp->next) {
- if (!strucmp(stemp->s_name,config.c_nodename)) slocal=stemp;
+ if (!strcasecmp(stemp->s_name,config.c_nodename)) slocal=stemp;
}
if (slocal==NULL) {
slocal =(struct syslist *)malloc(sizeof(struct syslist));
slocal = NULL;
for (stemp=slist; stemp!=NULL; stemp=stemp->next) {
- if (!strucmp(stemp->s_name,"internet")) slocal=stemp;
+ if (!strcasecmp(stemp->s_name,"internet")) slocal=stemp;
}
if (slocal==NULL) {
slocal =(struct syslist *)malloc(sizeof(struct syslist));
time(&now);
newfp=fopen("network/mail.sysinfo","w");
for (stemp=slist; stemp!=NULL; stemp=stemp->next) {
- if (!strucmp(stemp->s_name,config.c_nodename)) {
+ if (!strcasecmp(stemp->s_name,config.c_nodename)) {
time(&stemp->s_lastcontact);
strcpy(stemp->s_type,"bin");
strcpy(stemp->s_humannode,config.c_humannode);
struct filterlist *fptr;
for (fptr=filter; fptr!=NULL; fptr=fptr->next) if (
- ((!strucmp(fptr->f_person,k_person))||(!strcmp(fptr->f_person,"*")))
+ ((!strcasecmp(fptr->f_person,k_person))||(!strcmp(fptr->f_person,"*")))
&&
- ((!strucmp(fptr->f_room,k_room))||(!strcmp(fptr->f_room,"*")))
+ ((!strcasecmp(fptr->f_room,k_room))||(!strcmp(fptr->f_room,"*")))
&&
- ((!strucmp(fptr->f_system,k_system))||(!strcmp(fptr->f_system,"*")))
+ ((!strcasecmp(fptr->f_system,k_system))||(!strcmp(fptr->f_system,"*")))
) return(1);
return(0);
char name[]; {
struct syslist *stemp;
GETSN: for (stemp=slist; stemp!=NULL; stemp=stemp->next) {
- if (!strucmp(stemp->s_name,name)) {
- if (!strucmp(stemp->s_type,"use")) {
+ if (!strcasecmp(stemp->s_name,name)) {
+ if (!strcasecmp(stemp->s_type,"use")) {
strcpy(name,stemp->s_nexthop);
goto GETSN;
}
- if (!strucmp(stemp->s_type,"bin")) {
+ if (!strcasecmp(stemp->s_type,"bin")) {
return(M_BINARY);
}
- if (!strucmp(stemp->s_type,"uum")) {
+ if (!strcasecmp(stemp->s_type,"uum")) {
return(M_INTERNET);
}
}
if (a!='M') {
fpgetfield(tfp,buf);
if (a=='O') for (b=0; b<MAXROOMS; ++b) {
- if (!strucmp(buf,roomnames[b]))
+ if (!strcasecmp(buf,roomnames[b]))
strcpy(dest_dir,roomdirs[b]);
}
}
printf("\n");
}
fflush(stdout);
- if (!strucmp(minfo.D,FQDN)) strcpy(minfo.D,NODENAME);
+ if (!strcasecmp(minfo.D,FQDN)) strcpy(minfo.D,NODENAME);
/* this routine updates our info on the system that sent the message */
stemp = get_sys_ptr(minfo.N);
strcpy(slist->s_nexthop,minfo.nexthop);
time(&slist->s_lastcontact);
}
- else if ((stemp == NULL) && (!strucmp(minfo.N,minfo.nexthop))) {
+ else if ((stemp == NULL) && (!strcasecmp(minfo.N,minfo.nexthop))) {
/* add neighbor system to map */
printf("Adding neighbor system <%s> to map\n", slist->s_name);
sprintf(aaa,"%s/network/systems/%s",bbs_home_directory,minfo.N);
}
/* route the message if necessary */
- if ((strucmp(minfo.D,NODENAME))&&(minfo.D[0]!=0)) {
+ if ((strcasecmp(minfo.D,NODENAME))&&(minfo.D[0]!=0)) {
a = get_sysinfo_type(minfo.D);
printf("netproc: routing message to system <%s>\n",minfo.D);
fflush(stdout);
}
/* check to see if it's a file transfer */
- else if (!struncmp(minfo.S,"FILE",4)) {
+ else if (!strncasecmp(minfo.S,"FILE",4)) {
proc_file_transfer(tname);
}
/* otherwise process it as a normal message */
else {
- if (!strucmp(minfo.R, "postmaster")) {
+ if (!strcasecmp(minfo.R, "postmaster")) {
strcpy(minfo.R, "");
strcpy(minfo.C, "Aide");
}
for (cmptr=cmlist; cmptr!=NULL; cmptr=cmptr->next) {
/* make sure we're in the correct room... */
- if (strucmp(curr_rm, cmptr->m_rmname)) {
+ if (strcasecmp(curr_rm, cmptr->m_rmname)) {
sprintf(buf, "GOTO %s", cmptr->m_rmname);
serv_puts(buf);
serv_gets(buf);
strip_trailing_whitespace(rmptr->rm_name);
rmptr->rm_lastsent = atol(lbuf);
if (crmlist==NULL) crmlist=rmptr;
- else if (!strucmp(rmptr->rm_name,"control")) {
+ else if (!strcasecmp(rmptr->rm_name,"control")) {
/* control has to be first in room list */
rmptr->next = crmlist;
crmlist = rmptr;
void get_config();
struct config config;
-/*
- * struncmp() - case-insensitive version of strncmp()
- * citadel.h will #define a strucmp() based on this
- */
-int struncmp(lstr,rstr,len)
-char lstr[],rstr[];
-int len; {
- int pos = 0;
- char lc,rc;
- while (pos<len) {
- lc=tolower(lstr[pos]);
- rc=tolower(rstr[pos]);
- if ((lc==0)&&(rc==0)) return(0);
- if (lc<rc) return(-1);
- if (lc>rc) return(1);
- pos=pos+1;
- }
- return(0);
- }
-
-
-
struct netnode *load_node(nodename)
char *nodename; {
}
for (rsptr = nnptr->nn_first; rsptr != NULL; rsptr = rsptr->next) {
- if (!strucmp(rsptr->rs_name, roomname)) {
+ if (!strcasecmp(rsptr->rs_name, roomname)) {
foundit = 1;
}
if (rsptr->rs_lastsent > highest) {
}
if (nnptr->nn_first != NULL)
- if (!strucmp(nnptr->nn_first->rs_name, roomname)) {
+ if (!strcasecmp(nnptr->nn_first->rs_name, roomname)) {
rshold = nnptr->nn_first;
nnptr->nn_first = nnptr->nn_first->next;
free(rshold);
if (nnptr->nn_first != NULL)
for (rsptr = nnptr->nn_first; rsptr->next != NULL; rsptr = rsptr->next) {
- if (!strucmp(rsptr->next->rs_name, roomname)) {
+ if (!strcasecmp(rsptr->next->rs_name, roomname)) {
rshold = rsptr->next;
rsptr->next = rsptr->next->next;
free(rshold);
fclose(fp);
}
-int struncmp(lstr,rstr,len)
-char lstr[],rstr[];
-int len; {
- int pos = 0;
- char lc,rc;
- while (pos<len) {
- lc=tolower(lstr[pos]);
- rc=tolower(rstr[pos]);
- if ((lc==0)&&(rc==0)) return(0);
- if (lc<rc) return(-1);
- if (lc>rc) return(1);
- pos=pos+1;
- }
- return(0);
- }
int rnewsxref(room,ngroup) /* xref table */
fclose(fp);
return(1);
}
- if (strucmp(ngroup,aaa)) goto GNA;
+ if (strcasecmp(ngroup,aaa)) goto GNA;
fclose(fp);
strcpy(room,bbb);
return(0);
if (!rnewsxref(room,tryme)) return;
room[sizeof(qbuf.QRname)-1]=0;
for (b=0; b<MAXROOMS; ++b) {
- if (!strucmp(roomlist[b],room)) return;
+ if (!strcasecmp(roomlist[b],room)) return;
}
strcpy(ngbuf,&ngbuf[a+1]);
a=(-1);
getuser(&CC->usersupp,CC->curr_user);
for (a=0; a<MAXROOMS; ++a) {
getroom(&QRscratch,a);
- if ((a==0)&&(!strucmp(towhere,"_BASEROOM_"))) {
+ if ((a==0)&&(!strcasecmp(towhere,"_BASEROOM_"))) {
strncpy(towhere,QRscratch.QRname,31);
}
- if ((a==1)&&(!strucmp(towhere,"_MAIL_"))) {
+ if ((a==1)&&(!strcasecmp(towhere,"_MAIL_"))) {
strncpy(towhere,QRscratch.QRname,31);
}
- if ((!strucmp(QRscratch.QRname,config.c_twitroom))
- &&(!strucmp(towhere,"_BITBUCKET_"))) {
+ if ((!strcasecmp(QRscratch.QRname,config.c_twitroom))
+ &&(!strcasecmp(towhere,"_BITBUCKET_"))) {
strncpy(towhere,QRscratch.QRname,31);
}
strcpy(bbb,QRscratch.QRname);
ok = 0;
/* let internal programs go directly to any room */
- if (((CC->internal_pgm))&&(!strucmp(bbb,towhere))) {
+ if (((CC->internal_pgm))&&(!strcasecmp(bbb,towhere))) {
usergoto(a,1);
return;
}
/* normal clients have to pass through security */
if (
- (strucmp(bbb,towhere)==0)
+ (strcasecmp(bbb,towhere)==0)
&& ((QRscratch.QRflags&QR_INUSE)!=0)
&& ( ((QRscratch.QRflags&QR_PREFONLY)==0)
if ( (QRscratch.QRflags&QR_PASSWORDED) &&
(CC->usersupp.axlevel<6) &&
(QRscratch.QRgen!=CC->usersupp.generation[a]) &&
- (strucmp(QRscratch.QRpasswd,password))
+ (strcasecmp(QRscratch.QRpasswd,password))
) {
cprintf("%d wrong or missing passwd\n",
ERROR+PASSWORD_REQUIRED);
ls = fopen(CC->temp,"r");
while (fgets(flnm,256,ls)!=NULL) {
flnm[strlen(flnm)-1]=0;
- if (strucmp(flnm,"filedir")) {
+ if (strcasecmp(flnm,"filedir")) {
sprintf(buf,"%s/files/%s/%s",
BBSDIR,CC->quickroom.QRdirname,flnm);
stat(buf,&statbuf);
while ((fgets(buf,256,fd)!=NULL)
&&(strlen(comment)==0)) {
buf[strlen(buf)-1] = 0;
- if ((!struncmp(buf,flnm,strlen(flnm)))
+ if ((!strncasecmp(buf,flnm,strlen(flnm)))
&& (buf[strlen(flnm)]==' '))
strncpy(comment,
&buf[strlen(flnm)+1],255);
for (a=0; a<MAXROOMS; ++a) {
getroom(&qrbuf,a);
- if ( (!strucmp(qrbuf.QRname,new_room_name))
+ if ( (!strcasecmp(qrbuf.QRname,new_room_name))
&& (qrbuf.QRflags & QR_INUSE) ) {
cprintf("%d '%s' already exists.\n",
ERROR,qrbuf.QRname);
&& (free_slot < 0) ) free_slot = a;
/* check to see if it already exists */
- if ( (!strucmp(flbuf.f_name,new_floor_name))
+ if ( (!strcasecmp(flbuf.f_name,new_floor_name))
&& (flbuf.f_flags & F_INUSE) ) {
cprintf("%d Floor '%s' already exists.\n",
ERROR+ALREADY_EXISTS,
{
sprintf(bcast,":|<%s whispers %s>", un, cmdbuf);
}
- if ((strucmp(cmdbuf,"NOOP")) && (flag !=2)) {
+ if ((strcasecmp(cmdbuf,"NOOP")) && (flag !=2)) {
fp = fopen(CHATLOG,"a");
fprintf(fp,"%s\n",bcast);
fclose(fp);
else
name = t_cc->curr_user;
tptr = *unstr;
- if ((!struncmp(name, tptr, strlen(name))) && (tptr[strlen(name)] == ' '))
+ if ((!strncasecmp(name, tptr, strlen(name))) && (tptr[strlen(name)] == ' '))
{
found_cc = t_cc;
*unstr = &(tptr[strlen(name)+1]);
cprintf(":|\n:| Users currently in chat:\n");
begin_critical_section(S_SESSION_TABLE);
for (ccptr = ContextList; ccptr != NULL; ccptr = ccptr->next) {
- if ( (!strucmp(ccptr->cs_room, "<chat>"))
+ if ( (!strcasecmp(ccptr->cs_room, "<chat>"))
&& ((ccptr->cs_flags & CS_STEALTH) == 0)) {
cprintf(":| %-25s <%s>\n", (ccptr->fake_username[0]) ? ccptr->fake_username : ccptr->curr_user, ccptr->chat_room);
}
cprintf(":|\n:| Users not in chat:\n");
for (ccptr = ContextList; ccptr != NULL; ccptr = ccptr->next)
{
- if ( (strucmp(ccptr->cs_room, "<chat>"))
+ if ( (strcasecmp(ccptr->cs_room, "<chat>"))
&& ((ccptr->cs_flags & CS_STEALTH) == 0))
{
cprintf(":| %-25s <%s>:\n", (ccptr->fake_username[0]) ? ccptr->fake_username : ccptr->curr_user, (ccptr->fake_roomname[0]) ? ccptr->fake_roomname : ccptr->cs_room);
time(&CC->lastcmd);
time(&CC->lastidle);
- if ( (!strucmp(cmdbuf,"exit"))
- ||(!strucmp(cmdbuf,"/exit"))
- ||(!strucmp(cmdbuf,"quit"))
- ||(!strucmp(cmdbuf,"logout"))
- ||(!strucmp(cmdbuf,"logoff"))
- ||(!strucmp(cmdbuf,"/q"))
- ||(!strucmp(cmdbuf,".q"))
- ||(!strucmp(cmdbuf,"/quit"))
+ if ( (!strcasecmp(cmdbuf,"exit"))
+ ||(!strcasecmp(cmdbuf,"/exit"))
+ ||(!strcasecmp(cmdbuf,"quit"))
+ ||(!strcasecmp(cmdbuf,"logout"))
+ ||(!strcasecmp(cmdbuf,"logoff"))
+ ||(!strcasecmp(cmdbuf,"/q"))
+ ||(!strcasecmp(cmdbuf,".q"))
+ ||(!strcasecmp(cmdbuf,"/quit"))
) strcpy(cmdbuf,"000");
if (!strcmp(cmdbuf,"000")) {
return;
}
- if ((!strucmp(cmdbuf,"/help"))
- ||(!strucmp(cmdbuf,"help"))
- ||(!strucmp(cmdbuf,"/?"))
- ||(!strucmp(cmdbuf,"?"))) {
+ if ((!strcasecmp(cmdbuf,"/help"))
+ ||(!strcasecmp(cmdbuf,"help"))
+ ||(!strcasecmp(cmdbuf,"/?"))
+ ||(!strcasecmp(cmdbuf,"?"))) {
cprintf(":|\n");
cprintf(":|Available commands: \n");
cprintf(":|/help (prints this message) \n");
cprintf(":|\n");
ok_cmd = 1;
}
- if (!strucmp(cmdbuf,"/who")) {
+ if (!strcasecmp(cmdbuf,"/who")) {
do_chat_listing(0);
ok_cmd = 1;
}
- if (!strucmp(cmdbuf,"/whobbs")) {
+ if (!strcasecmp(cmdbuf,"/whobbs")) {
do_chat_listing(1);
ok_cmd = 1;
}
- if (!struncmp(cmdbuf,"/me ",4)) {
+ if (!strncasecmp(cmdbuf,"/me ",4)) {
allwrite(&cmdbuf[4],1, CC->chat_room, NULL);
ok_cmd = 1;
}
- if (!struncmp(cmdbuf,"/msg ", 5))
+ if (!strncasecmp(cmdbuf,"/msg ", 5))
{
ok_cmd =1;
strptr1 = &cmdbuf[5];
if ((t_context = find_context(&strptr1)))
{
allwrite(strptr1, 2, "", CC->curr_user);
- if (strucmp(CC->curr_user, t_context->curr_user))
+ if (strcasecmp(CC->curr_user, t_context->curr_user))
allwrite(strptr1, 2, "", t_context->curr_user);
}
else
cprintf("\n");
}
- if (!struncmp(cmdbuf,"/join ", 6))
+ if (!strncasecmp(cmdbuf,"/join ", 6))
{
ok_cmd = 1;
allwrite("<changing rooms>",0, CC->chat_room, NULL);
ThisLastMsg = ChatLastMsg;
for (clptr=ChatQueue; clptr!=NULL; clptr=clptr->next)
{
- if ((clptr->chat_seq > MyLastMsg) && ((!clptr->chat_username[0]) || (!struncmp(un, clptr->chat_username, 32))))
+ if ((clptr->chat_seq > MyLastMsg) && ((!clptr->chat_username[0]) || (!strncasecmp(un, clptr->chat_username, 32))))
{
- if ((!clptr->chat_room[0]) || (!struncmp(CC->chat_room, clptr->chat_room, 20)))
+ if ((!clptr->chat_room[0]) || (!strncasecmp(CC->chat_room, clptr->chat_room, 20)))
{
cprintf("%s\n", clptr->chat_text);
}
return;
}
- if ( (!strucmp(x_user, "broadcast")) && (CC->usersupp.axlevel < 6) ) {
+ if ( (!strcasecmp(x_user, "broadcast")) && (CC->usersupp.axlevel < 6) ) {
cprintf("%d Higher access required to send a broadcast.\n",
ERROR+HIGHER_ACCESS_REQUIRED);
return;
else
un = ccptr->usersupp.fullname;
- if ( (!strucmp(un, x_user))
- || (!strucmp(x_user, "broadcast")) ) {
+ if ( (!strcasecmp(un, x_user))
+ || (!strcasecmp(x_user, "broadcast")) ) {
strcpy(ccptr->last_pager, CC->curr_user);
emnew = (struct ExpressMessage *)
malloc(sizeof(struct ExpressMessage));
emnew->next = NULL;
sprintf(emnew->em_text, "%s from %s:\n %s\n",
- ( (!strucmp(x_user, "broadcast")) ? "Broadcast message" : "Message" ),
+ ( (!strcasecmp(x_user, "broadcast")) ? "Broadcast message" : "Message" ),
lun, x_msg);
if (ccptr->FirstExpressMessage == NULL) {
#include "server.h"
#include "proto.h"
-/*
- * struncmp() - case-insensitive version of strncmp()
- * citadel.h will #define a strucmp() based on this
- */
-int struncmp(char *lstr, char *rstr, int len)
-{
- int pos = 0;
- char lc,rc;
- while (pos<len) {
- lc=tolower(lstr[pos]);
- rc=tolower(rstr[pos]);
- if ((lc==0)&&(rc==0)) return(0);
- if (lc<rc) return(-1);
- if (lc>rc) return(1);
- pos=pos+1;
- }
- return(0);
- }
-
/*
* strproc() - make a string 'nice'
{
int a;
for (a=0; a<strlen(search); ++a) {
- if (!struncmp(&search[a],patn,strlen(patn))) return(a);
+ if (!strncasecmp(&search[a],patn,strlen(patn))) return(a);
}
return(-1);
}
while(fgets(buf,255,ls)!=NULL) {
while (isspace(buf[strlen(buf)-1]))
buf[strlen(buf)-1] = 0;
- if (!strucmp(buf,searchfor)) {
+ if (!strcasecmp(buf,searchfor)) {
pclose(ls);
sprintf(targ,"%s/%s",dirs[a],buf);
return;
/* If this user's name is the name of the system administrator
* (as specified in setup), automatically assign access level 6.
*/
- if (!strucmp(CC->usersupp.fullname, config.c_sysadm)) {
+ if (!strcasecmp(CC->usersupp.fullname, config.c_sysadm)) {
CC->usersupp.axlevel = 6;
}
if (CC->usersupp.USuid == BBSUID) {
strproc(password);
strproc(CC->usersupp.password);
- code = strucmp(CC->usersupp.password,password);
+ code = strcasecmp(CC->usersupp.password,password);
}
else {
p = (struct passwd *)getpwuid(CC->usersupp.USuid);
}
a = create_user(username);
- if ((!strucmp(username, "bbs")) ||
- (!strucmp(username, "new")) ||
- (!strucmp(username, ".")))
+ if ((!strcasecmp(username, "bbs")) ||
+ (!strcasecmp(username, "new")) ||
+ (!strcasecmp(username, ".")))
{
cprintf("%d '%s' is an invalid login name.\n", ERROR);
return;
return;
}
- if (!struncmp(new_ptr,"highest",7)) {
+ if (!strncasecmp(new_ptr,"highest",7)) {
newlr = CC->quickroom.QRhighest;
}
else {
return;
}
- if (!strucmp(who,"_SELF_")) strcpy(who,CC->curr_user);
+ if (!strcasecmp(who,"_SELF_")) strcpy(who,CC->curr_user);
- if ((CC->usersupp.axlevel < 6) && (strucmp(who,CC->curr_user))) {
+ if ((CC->usersupp.axlevel < 6) && (strcasecmp(who,CC->curr_user))) {
cprintf("%d Higher access required.\n",
ERROR+HIGHER_ACCESS_REQUIRED);
return;