Changed all of the proprietary strucmp() and struncmp() calls to the more
authorArt Cancro <ajc@citadel.org>
Thu, 30 Jul 1998 00:50:11 +0000 (00:50 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 30 Jul 1998 00:50:11 +0000 (00:50 +0000)
standardized strcasecmp() and strncasecmp(), EXCEPT in the client.  The client
was left alone in order to allow it to be more portable -- strcasecmp() is
on most systems these days, but it's still not universal.

16 files changed:
citadel/citadel.h
citadel/citmail.c
citadel/citserver.c
citadel/cux2ascii.c
citadel/file_ops.c
citadel/internetmail.c
citadel/mailinglist.c
citadel/msgbase.c
citadel/netmailer.c
citadel/netproc.c
citadel/netsetup.c
citadel/rcit.c
citadel/room_ops.c
citadel/serv_chat.c
citadel/support.c
citadel/user_ops.c

index 05c9b9dd7d7e2d2e958558ba7515211c9fe7d6f2..ff9fc30d7fa58087f8c3fe801b179b81e1be02f3 100644 (file)
 
 #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
index 2f4a12cc42058f861a4c3ede894c0ca499d14495..84987138783c3ffdbf3400d20d35d751a2ff71e2 100644 (file)
@@ -55,21 +55,6 @@ char TABLEFILE[128];
 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;
@@ -185,7 +170,7 @@ void host_alias(char host[]) {
        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;
@@ -193,7 +178,7 @@ void host_alias(char host[]) {
 
        /* 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;
@@ -518,7 +503,7 @@ char *name; {
                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]);
                                        }
                                }
@@ -555,7 +540,7 @@ void deliver(char recp[], int is_test, int deliver_to_ignet) {
                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);
                }
@@ -626,21 +611,21 @@ char *argv[]; {
                        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");
                                        }
@@ -690,10 +675,10 @@ char *argv[]; {
 
 
 
-                       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);
@@ -708,7 +693,7 @@ char *argv[]; {
                                printf("500 Huh?\n");
                                }
        
-                       } while (struncmp(buf,"QUIT",4));
+                       } while (strncasecmp(buf,"QUIT",4));
                }
 
        else {
index 8b3cdaa50a2815255590c4d1a5dc94bedfcb3bf5..51ddd9a180d8aeddebf7d0d46fcd22bc7c1d6ef8 100644 (file)
@@ -167,7 +167,7 @@ void cmd_uchg(char *newusername)
    {
       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
@@ -195,8 +195,8 @@ int is_public_client(char *where)
        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);
@@ -204,7 +204,7 @@ int is_public_client(char *where)
        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);
                        }
@@ -658,13 +658,13 @@ void *context_loop(struct CitContext *con)
                 * 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;
                }
@@ -673,340 +673,340 @@ void *context_loop(struct CitContext *con)
  * 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 {
@@ -1014,7 +1014,7 @@ void *context_loop(struct CitContext *con)
                                ERROR);
                        }
 
-               } while(struncmp(cmdbuf,"QUIT",4));
+               } while(strncasecmp(cmdbuf,"QUIT",4));
 
        cleanup(EXIT_NORMAL);
        return(NULL);
index ce4bd6a5623cb607925210fd325596483b94e052..010a8f33b7c0e783759faebbad9d167923e1fb31 100644 (file)
 
 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;
@@ -187,7 +173,7 @@ char *roomname,*newsgroup; {
                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);
index 0168837d0f7ba824306f26efc3fd8b055388f787..340915874e9944f4cf63691b9b99be9064d0e8ac 100644 (file)
@@ -100,7 +100,7 @@ void cmd_movf(char *cmdbuf)
 
        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",
@@ -299,7 +299,7 @@ void cmd_oimg(char *cmdbuf)
                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);
@@ -307,11 +307,11 @@ void cmd_oimg(char *cmdbuf)
                        }
                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 {
@@ -421,17 +421,17 @@ void cmd_uimg(char *cmdbuf)
                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);
                }
 
@@ -511,13 +511,13 @@ void cmd_ucls(char *cmd)
        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");
@@ -618,7 +618,7 @@ void cmd_netp(char *cmdbuf)
        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;
                }
index 351f63f111a1b6a5b1dc6de51c4ba1d4051497bb..d0471d664eca9b32019adefd22ec25b75e64ba4b 100644 (file)
@@ -16,7 +16,6 @@
 
 extern struct config config;
 
-int struncmp();
 char metoo[10][128];
 int mecount = 0;
 
@@ -64,21 +63,21 @@ void LoadInternetConfig() {
                        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);
                        }
                }
@@ -92,11 +91,11 @@ void LoadInternetConfig() {
 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);
                        }
                }
        
index be2b04f06fa438a1a777bf3c5f48986903b2bda5..a9817fcc7c934132864d25153471f571d9761a77 100644 (file)
@@ -37,22 +37,6 @@ char TABLEFILE[128];
 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.
@@ -69,7 +53,7 @@ char listaddr[]; {
        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;
                                }
index 95f369d3bb5bfa91faf1320c62e64c64bf6720c9..93eab6e989c0f7f859fc44c660eaf211d381790d 100644 (file)
@@ -60,7 +60,7 @@ GNA:  strcpy(aaa,""); strcpy(bbb,"");
                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); */
@@ -84,7 +84,7 @@ DETYPE:       /* determine local or remote type, see citadel.h */
                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]);
@@ -142,17 +142,17 @@ void cmd_msgs(char *cmdbuf)
 
        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);
                }
@@ -469,7 +469,7 @@ void output_message(char *msgid, int mode, int headers_only)
                }
 
        if (mode == MT_RFC822) {
-               if (!strucmp(snode, NODENAME)) {
+               if (!strcasecmp(snode, NODENAME)) {
                        strcpy(snode, FQDN);
                        }
                cprintf("Message-ID: <%s@%s>\n", mid, snode);
@@ -512,10 +512,10 @@ void output_message(char *msgid, int mode, int headers_only)
                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); */
@@ -635,7 +635,7 @@ void loadtroom(void) {
        /* 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;
                        }
@@ -1018,12 +1018,12 @@ void cmd_ent0(char *entargs)
                                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;
@@ -1225,7 +1225,7 @@ void cmd_move(char *args)
        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;
                        }
index e657f5a562b1860c9540d9edc1b9c5ef14005093..282cce16c1dcb3149ec79af7498f3838066ed3eb 100644 (file)
@@ -16,7 +16,6 @@
 #include <syslog.h>
 #include "citadel.h"
 
-int struncmp();
 void LoadInternetConfig();
 void get_config();
 struct config config;
@@ -41,22 +40,6 @@ int ch; {
        }
 
 
-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;
@@ -207,7 +190,7 @@ char *argv[]; {
         * 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;
                }
 
@@ -238,9 +221,9 @@ char *argv[]; {
         * 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);
@@ -248,7 +231,7 @@ char *argv[]; {
                }
        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);
index 974c44d8d7f943813bebaa64164929824e3740ec..d06376b48af4e7dddf85dcd32fdb329594a5d048 100644 (file)
@@ -111,30 +111,6 @@ struct config config;
 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
 /*
@@ -254,7 +230,7 @@ void setup_special_nodes() {
 
        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));
@@ -270,7 +246,7 @@ void setup_special_nodes() {
 
        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));
@@ -298,7 +274,7 @@ void rewrite_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);
@@ -472,11 +448,11 @@ char *k_person,*k_room,*k_system; {
        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);
@@ -486,15 +462,15 @@ int get_sysinfo_type(name)        /* determine routing from sysinfo file */
 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);
                        }
                }
@@ -640,7 +616,7 @@ char *tname; {      /* name of temp file containing the whole message */
                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]);
                                }
                        }
@@ -813,7 +789,7 @@ NXMSG:      /* Seek to the beginning of the next message */
                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);
@@ -828,7 +804,7 @@ NXMSG:      /* Seek to the beginning of the next message */
                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);
@@ -854,7 +830,7 @@ NXMSG:      /* Seek to the beginning of the next message */
                }
 
        /* 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);
@@ -880,14 +856,14 @@ NXMSG:    /* Seek to the beginning of the next message */
                }
 
        /* 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");
                        }
@@ -1038,7 +1014,7 @@ char *sysname;
        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);
@@ -1139,7 +1115,7 @@ char *sysname; {
                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;
index e64c9d0cdc335d686fea557de686342c4ebf9aff..87bd96579d0db991088a69e1b6bc37a5f3438b4b 100644 (file)
@@ -28,28 +28,6 @@ struct netnode {
 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; {
@@ -299,7 +277,7 @@ char *roomname; {
                }
 
        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) {
@@ -335,7 +313,7 @@ char *roomname; {
                }
 
        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);
@@ -344,7 +322,7 @@ char *roomname; {
 
        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);
index 5308bf3ed1f8d73a24d3785c7291fcc375973b38..93a91bd917212608537edf442c1176280ff4035f 100644 (file)
@@ -54,21 +54,6 @@ void load_roomlist() {
        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 */
@@ -95,7 +80,7 @@ GNA:  strcpy(aaa,""); strcpy(bbb,"");
                fclose(fp);
                return(1);
                }
-       if (strucmp(ngroup,aaa)) goto GNA;
+       if (strcasecmp(ngroup,aaa)) goto GNA;
        fclose(fp);
        strcpy(room,bbb);
        return(0);
@@ -119,7 +104,7 @@ char ngroup[]; {
                        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);
index df50ab7bfdffe74e46b92725f1c055e3fd9bf372..f9b7461ab8c0e8801900ea3cef65383ea8db9dd8 100644 (file)
@@ -569,28 +569,28 @@ void cmd_goto(char *gargs)
        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)
@@ -614,7 +614,7 @@ void cmd_goto(char *gargs)
                        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);
@@ -717,7 +717,7 @@ void cmd_rdir(void) {
        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);
@@ -726,7 +726,7 @@ void cmd_rdir(void) {
                        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);
@@ -1156,7 +1156,7 @@ void cmd_cre8(char *args)
 
        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);
@@ -1302,7 +1302,7 @@ void cmd_cflr(char *argbuf)
                     && (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,
index 22b36ed07ef3cd73f5acfe9561d6e31f0f6acee6..d9f1c2fd047cd7e9f6d7145bcd9f1f470e6de808 100644 (file)
@@ -54,7 +54,7 @@ void allwrite(char *cmdbuf, int flag, char *roomname, char *username)
        {
                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);
@@ -120,7 +120,7 @@ t_context *find_context(char **unstr)
       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]);
@@ -143,7 +143,7 @@ void do_chat_listing(int allflag)
        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);
                        }
@@ -154,7 +154,7 @@ void do_chat_listing(int allflag)
                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);
@@ -212,14 +212,14 @@ void cmd_chat(char *argbuf)
                        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")) {
@@ -233,10 +233,10 @@ void cmd_chat(char *argbuf)
                                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");
@@ -249,27 +249,27 @@ void cmd_chat(char *argbuf)
                                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
@@ -277,7 +277,7 @@ void cmd_chat(char *argbuf)
                         cprintf("\n");
                         }
 
-                       if (!struncmp(cmdbuf,"/join ", 6))
+                       if (!strncasecmp(cmdbuf,"/join ", 6))
                        {
                           ok_cmd = 1;
                           allwrite("<changing rooms>",0, CC->chat_room, NULL);
@@ -312,9 +312,9 @@ void cmd_chat(char *argbuf)
                        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);
                              }
@@ -406,7 +406,7 @@ void cmd_sexp(char *argbuf)
           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;
@@ -422,14 +422,14 @@ void cmd_sexp(char *argbuf)
                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) {
index 896797617c43b0f8c832621718d6d6cc627ea7f9..e9723bf00802e68684efbb6d5c313312737b583c 100644 (file)
@@ -7,25 +7,6 @@
 #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'
@@ -175,7 +156,7 @@ int pattern2(char *search, char *patn)
 {
        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);
        }
@@ -197,7 +178,7 @@ void mesg_locate(char *targ, char *searchfor, int numdirs, char **dirs)
                        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;
index 922d5db667119c187320a364d075761588eceaf5..7dd7d354c24ae2570fe13df77014f52458b814a1 100644 (file)
@@ -211,7 +211,7 @@ void session_startup(void) {
        /* 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;
                }
 
@@ -279,7 +279,7 @@ void cmd_pass(char *buf)
        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);
@@ -458,9 +458,9 @@ void cmd_newu(char *cmdbuf)
                }
 
        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;
@@ -565,7 +565,7 @@ void cmd_slrp(char *new_ptr)
                return;
                }
 
-       if (!struncmp(new_ptr,"highest",7)) {
+       if (!strncasecmp(new_ptr,"highest",7)) {
                newlr = CC->quickroom.QRhighest;
                }
        else {
@@ -743,9 +743,9 @@ void cmd_greg(char *who)
                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;