From d3bb911bf13f8fb0d10c83d42e130184e0a599ab Mon Sep 17 00:00:00 2001 From: John Darrington Date: Fri, 1 Jul 2011 17:58:33 +0200 Subject: [PATCH] Fix building when readline library is not present --- src/ui/terminal/terminal-reader.c | 59 ++++++++++++++++--------------- 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/src/ui/terminal/terminal-reader.c b/src/ui/terminal/terminal-reader.c index 7c80d27b..db561a9a 100644 --- a/src/ui/terminal/terminal-reader.c +++ b/src/ui/terminal/terminal-reader.c @@ -153,6 +153,36 @@ terminal_reader_create (void) return &r->reader; } + + +static const char * +readline_prompt (enum prompt_style style) +{ + switch (style) + { + case PROMPT_FIRST: + return "PSPP> "; + + case PROMPT_LATER: + return " > "; + + case PROMPT_DATA: + return "data> "; + + case PROMPT_COMMENT: + return "comment> "; + + case PROMPT_DOCUMENT: + return "document> "; + + case PROMPT_DO_REPEAT: + return "DO REPEAT> "; + } + + NOT_REACHED (); +} + + #if HAVE_READLINE #include #include @@ -189,33 +219,6 @@ readline_done (void) free (history_file); } -static const char * -readline_prompt (enum prompt_style style) -{ - switch (style) - { - case PROMPT_FIRST: - return "PSPP> "; - - case PROMPT_LATER: - return " > "; - - case PROMPT_DATA: - return "data> "; - - case PROMPT_COMMENT: - return "comment> "; - - case PROMPT_DOCUMENT: - return "document> "; - - case PROMPT_DO_REPEAT: - return "DO REPEAT> "; - } - - NOT_REACHED (); -} - static struct substring readline_read (enum prompt_style style) { @@ -295,7 +298,7 @@ readline_done (void) static struct substring readline_read (enum prompt_style style) { - const char *prompt = prompt_get (style); + const char *prompt = readline_prompt (style); struct string line; fputs (prompt, stdout); -- 2.30.2