]> code.citadel.org Git - citadel.git/blobdiff - citadel/routines.c
* strlen holy war: loops. in loops it's very evil. the easy ones go away now.
[citadel.git] / citadel / routines.c
index ecbdc3cf579bd54d0621b967483a485c1bc7ae1b..6e509e3350c8d95602aec2095eeb12b3755fcbd4 100644 (file)
@@ -82,12 +82,12 @@ void hit_any_key(CtdlIPC *ipc) {    /* hit any key to continue */
        color(DIM_RED);
        scr_printf("%s\r", ipc->ServInfo.moreprompt);
        color(COLOR_POP);
-       sttybbs(0);
+       stty_ctdl(0);
        b=inkey();
-       for (a=0; a<strlen(ipc->ServInfo.moreprompt); ++a)
+       for (a=0; !IsEmptyStr(&ipc->ServInfo.moreprompt[0]); ++a)
                scr_putc(' ');
        scr_putc(13);
-       sttybbs(1);
+       stty_ctdl(1);
        if ( (rc_prompt_control == 1)
           || ((rc_prompt_control == 3) && (userflags & US_PROMPTCTL)) ) {
                if (b == 'q' || b == 'Q' || b == 's' || b == 'S')
@@ -136,11 +136,13 @@ void edituser(CtdlIPC *ipc, int cmd)
                }
        
                user->axlevel = intprompt("Access level", user->axlevel, 0, 6);
-       
-               user->flags = set_attr(ipc, user->flags,
+/*             user->flags = set_attr(ipc, user->flags,
                        "Permission to send Internet mail",
-                       US_INTERNET, 0);
-       
+                       US_INTERNET, 0); */
+               if (boolprompt("Permission to send Internet mail", (user->flags & US_INTERNET)))
+                       user->flags |= US_INTERNET;
+               else
+                       user->flags &= ~US_INTERNET;
                if (boolprompt("Ask user to register again", !(user->flags & US_REGIS)))
                        user->flags &= ~US_REGIS;
                else
@@ -180,7 +182,7 @@ int set_attr(CtdlIPC *ipc, unsigned int sval, char *prompt, unsigned int sbit, i
 
        temp = sval;
        color(DIM_WHITE);
-       scr_printf("%45s ", prompt);
+       scr_printf("%50s ", prompt);
        color(DIM_MAGENTA);
        scr_printf("[");
        color(BRIGHT_MAGENTA);
@@ -225,10 +227,16 @@ void enter_config(CtdlIPC *ipc, int mode)
 
        if (mode == 0 || mode == 1) {
 
+               /* Does anyone still use dialup connections with manual
+                * screen dimensions setting anymore?  For now we'll keep
+                * the system's ability to set these, but remove the prompts
+                * because they're spurious for nearly everyone.
+                * 
                user->USscreenwidth = intprompt("Enter your screen width",
                                                user->USscreenwidth, 20, 255);
                user->USscreenheight = intprompt("Enter your screen height",
                                                 user->USscreenheight, 3, 255);
+                */
  
                user->flags = set_attr(ipc, user->flags,
                                       "Are you an experienced Citadel user",
@@ -276,6 +284,13 @@ void enter_config(CtdlIPC *ipc, int mode)
                user->flags = set_attr(ipc, user->flags,
                                       "Be unlisted in userlog",
                                       US_UNLISTED, 0);
+
+               if (!IsEmptyStr(editor_paths[0])) {
+                       user->flags = set_attr(ipc, user->flags,
+                               "Always enter messages with the full-screen editor",
+                               US_EXTEDIT, 0);
+               }
+
        }
 
        if (mode == 2) {
@@ -330,10 +345,11 @@ int getstring(FILE *fp, char *string)
 
 /* Searches for patn in search string */
 int pattern(char *search, char *patn) {
-       int a,b;
-
-       for (a=0; a<strlen(search); ++a) {
-               b=strncasecmp(&search[a],patn,strlen(patn));
+       int a,b,len;
+       
+       len = strlen(patn);
+       for (a=0; !IsEmptyStr(&search[a]); ++a) {
+               b=strncasecmp(&search[a],patn,len);
                if (b==0) return(b);
        }
        return(-1);
@@ -344,10 +360,10 @@ void strproc(char *string)
 {
        int a;
 
-       if (strlen(string)==0) return;
+       if (IsEmptyStr(string)) return;
 
        /* Convert non-printable characters to blanks */
-       for (a=0; a<strlen(string); ++a) {
+       for (a=0; !IsEmptyStr(&string[a]); ++a) {
                if (string[a]<32) string[a]=32;
                if (string[a]>126) string[a]=32;
        }
@@ -401,7 +417,7 @@ void progress(CtdlIPC* ipc, unsigned long curr, unsigned long cmax)
 
        if (curr >= cmax) {
                sln_printf("\r%79s\r","");
-               status_line(ipc->ServInfo.humannode, ipc->ServInfo.bbs_city,
+               status_line(ipc->ServInfo.humannode, ipc->ServInfo.site_location,
                        room_name, secure, 0);
        } else {
                /* a will be range 0-50 rather than 0-100 */
@@ -436,7 +452,7 @@ void locate_host(CtdlIPC* ipc, char *hbuf)
        pclose(who);
 
        b = 0;
-       for (a=0; a<strlen(buf); ++a) {
+       for (a=0; !IsEmptyStr(&buf[a]); ++a) {
                if ((buf[a]=='(')||(buf[a]==')')) ++b;
        }
        if (b<2) {
@@ -453,7 +469,7 @@ void locate_host(CtdlIPC* ipc, char *hbuf)
                if (buf[a]==')') buf[a] = 0;
        }
 
-       if (strlen(buf)==0) strcpy(hbuf, ipc->ServInfo.fqdn);
+       if (IsEmptyStr(buf)) strcpy(hbuf, ipc->ServInfo.fqdn);
        else strncpy(hbuf,buf,24);
 #else
        char *tty = ttyname(0);