]> code.citadel.org Git - citadel.git/blobdiff - citadel/textclient/commands.c
The 'negative number for asterisk echo' functionality is no longer in ctdl_getline...
[citadel.git] / citadel / textclient / commands.c
index 98be7a698ac17e9e9a281c34bd9183cd15c0490d..3175f12b350d20005434cafbf1bf54998b19bf08 100644 (file)
@@ -491,17 +491,13 @@ int yesno_d(int d)
  * Function to read a line of text from the terminal.
  *
  * string              Pointer to string buffer
- * lim                 Maximum length - if negative, echo asterisks instead of characters
+ * lim                 Maximum length
+ * noshow              If nonzero, echo asterisks instead of keystrokes
  */
-void ctdl_getline(char *string, int lim
+void ctdl_getline(char *string, int lim, int noshow)
 {
        int a, b;
-       char noshow = 0;
 
-       if (lim < 0) {
-               lim = (0 - lim);
-               noshow = 1;
-       }
        strcpy(string, "");
        gl_string = string;
        async_ka_start();
@@ -574,9 +570,10 @@ void strprompt(char *prompt, char *str, int len)
        color(DIM_WHITE);
        scr_printf(": ");
        color(BRIGHT_CYAN);
-       ctdl_getline(buf, len);
-       if (buf[0] != 0)
+       ctdl_getline(buf, abs(len), (len<0));
+       if (buf[0] != 0) {
                strcpy(str, buf);
+       }
        color(DIM_WHITE);
 }
 
@@ -636,10 +633,11 @@ int intprompt(char *prompt, int ival, int imin, int imax)
  */
 void newprompt(char *prompt, char *str, int len)
 {
+       str[0] = 0;
        color(BRIGHT_MAGENTA);
        scr_printf("%s", prompt);
        color(DIM_MAGENTA);
-       ctdl_getline(str, len);
+       ctdl_getline(str, abs(len), (len<0));
        color(DIM_WHITE);
 }
 
@@ -1054,7 +1052,8 @@ int getcmd(CtdlIPC *ipc, char *argbuf)
                        if (cmdmatch(cmdbuf, cptr, 5)) {
                                /* We've found our command. */
                                if (requires_string(cptr, cmdpos)) {
-                                       ctdl_getline(argbuf, 64);
+                                       argbuf[0] = 0;
+                                       ctdl_getline(argbuf, 64, 0);
                                } else {
                                        scr_printf("\n");
                                }