#include "rooms.h"
#include "client_chat.h"
#include "citadel_dirs.h"
+#include "tuiconfig.h"
#ifndef HAVE_SNPRINTF
#include "snprintf.h"
#endif
-/* Gets a line from the terminal */
-/* string == Pointer to string buffer */
-/* lim == Maximum length - if negative, no-show */
+/*
+ * 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
+ */
void ctdl_getline(char *string, int lim)
{
int a, b;
- char flag = 0;
+ char noshow = 0;
if (lim < 0) {
lim = (0 - lim);
- flag = 1;
+ noshow = 1;
}
strcpy(string, "");
gl_string = string;
async_ka_start();
GLA: a = inkey();
- /* a = (a & 127); ** commented out because it isn't just an ASCII world anymore */
if ((a == 8 || a == 23) && (IsEmptyStr(string)))
goto GLA;
if ((a != 10) && (a != 8) && (strlen(string) == lim))
async_ka_end();
return;
}
- if (a < 32)
+ if (a < 32) {
a = '.';
+ }
b = strlen(string);
string[b] = a;
string[b + 1] = 0;
- if (flag == 0)
- scr_putc(a);
- if (flag == 1)
+ if (noshow) {
scr_putc('*');
+ }
+ else {
+ scr_putc(a);
+ }
goto GLA;
}
scr_printf(": ");
color(BRIGHT_CYAN);
ctdl_getline(buf, len);
- if (buf[0] != 0)
+ if (buf[0] != 0) {
strcpy(str, buf);
+ }
color(DIM_WHITE);
}
*/
void newprompt(char *prompt, char *str, int len)
{
+ str[0] = 0;
color(BRIGHT_MAGENTA);
scr_printf("%s", prompt);
color(DIM_MAGENTA);
{
FILE *ccfile;
char buf[1024];
- char editor_key[100];
struct citcmd *cptr;
struct citcmd *lastcmd = NULL;
int a, d;
int b = 0;
- int i;
-
/* first, set up some defaults for non-required variables */
- for (i = 0; i < MAX_EDITORS; i++)
- strcpy(editor_paths[i], "");
+ strcpy(editor_path, "");
strcpy(printcmd, "");
strcpy(imagecmd, "");
strcpy(rc_username, "");
#ifdef HAVE_OPENSSL
rc_encrypt = RC_DEFAULT;
#endif
- rc_alt_semantics = 0;
/* now try to open the citadel.rc file */
#endif
}
- if (!strncasecmp(buf, "editor=", 7))
- strcpy(editor_paths[0], &buf[7]);
-
- for (i = 0; i < MAX_EDITORS; i++)
- {
- sprintf(editor_key, "editor%d=", i);
- if (!strncasecmp(buf, editor_key, strlen(editor_key)))
- strcpy(editor_paths[i], &buf[strlen(editor_key)]);
+ if (!strncasecmp(buf, "editor=", 7)) {
+ strcpy(editor_path, &buf[7]);
}
if (!strncasecmp(buf, "printcmd=", 9))
if (!strncasecmp(&buf[11], "user", 4))
rc_ansi_color = 3; /* user config */
}
+ if (!strncasecmp(buf, "status_line=", 12)) {
+ if (!strncasecmp(&buf[12], "on", 2))
+ enable_status_line = 1;
+ }
if (!strncasecmp(buf, "use_background=", 15)) {
if (!strncasecmp(&buf[15], "on", 2))
rc_color_use_bg = 9;
if (!strncasecmp(buf, "gotmailcmd=", 11))
strcpy(rc_gotmail_cmd, &buf[11]);
- if (!strncasecmp(buf, "alternate_semantics=", 20)) {
- if (!strncasecmp(&buf[20], "yes", 3)) {
- rc_alt_semantics = 1;
- }
- else {
- rc_alt_semantics = 0;
- }
- }
-
if (!strncasecmp(buf, "cmd=", 4)) {
strcpy(buf, &buf[4]);
if (cmdmatch(cmdbuf, cptr, 5)) {
/* We've found our command. */
if (requires_string(cptr, cmdpos)) {
+ argbuf[0] = 0;
ctdl_getline(argbuf, 64);
} else {
scr_printf("\n");