aboutsummaryrefslogtreecommitdiff
path: root/src/smapc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/smapc.c')
-rw-r--r--src/smapc.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/smapc.c b/src/smapc.c
index 3fe930b..3beaa63 100644
--- a/src/smapc.c
+++ b/src/smapc.c
@@ -48,7 +48,8 @@
int smapc_trace_option;
int batch_mode;
struct in_addr source_addr;
-char *prompt = "(smapc) ";
+#define DEFAULT_PROMPT "(smapc) "
+char *prompt;
int cmdprefix = '.';
char *curmap;
char *curserver;
@@ -125,11 +126,15 @@ get_input_line(FILE *fp, int interactive)
static size_t bufsize = 0;
size_t buflevel;
-#ifdef WITH_READLINE
if (interactive) {
+#ifdef WITH_READLINE
return readline(prompt);
- }
+#else
+ fputs(prompt, stdout);
+ fflush(stdout);
#endif
+ }
+
if (bufsize == 0) {
bufsize = sizeof(sbuf);
buf = emalloc(bufsize);
@@ -753,6 +758,9 @@ main(int argc, char **argv)
exit(0);
}
+ if (!prompt)
+ prompt = estrdup(DEFAULT_PROMPT);
+
if (server_option)
smapc_connect(server_option);

Return to:

Send suggestions and report system problems to the System administrator.