X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fprompt.c;h=8701f6c9b5ccce54d4a2e6e7c9e2948dd27557a5;hb=0f1b17abb6bd3e98e0f0747950144fe2ea67ea2f;hp=ede6a5e3b9c8c76d5b5d249113bc2537e3cff82d;hpb=d0b91eae59319ab2756d0d43b9cb15eb9cd3c234;p=pspp-builds.git diff --git a/src/language/prompt.c b/src/language/prompt.c index ede6a5e3..8701f6c9 100644 --- a/src/language/prompt.c +++ b/src/language/prompt.c @@ -29,57 +29,34 @@ #include #include #include -#include #include #include #include #include "xalloc.h" -/* Current prompts in each style. */ -static char *prompts[PROMPT_CNT]; - /* Current prompting style. */ static enum prompt_style current_style; -/* Initializes prompts. */ -void -prompt_init (void) -{ - prompts[PROMPT_FIRST] = xstrdup ("PSPP> "); - prompts[PROMPT_LATER] = xstrdup (" > "); - prompts[PROMPT_DATA] = xstrdup ("data> "); - current_style = PROMPT_FIRST; -} - -/* Frees prompts. */ -void -prompt_done (void) -{ - int i; - - for (i = 0; i < PROMPT_CNT; i++) - { - free (prompts[i]); - prompts[i] = NULL; - } -} - /* Gets the command prompt for the given STYLE. */ const char * prompt_get (enum prompt_style style) { - assert (style < PROMPT_CNT); - return prompts[style]; -} + switch (style) + { + case PROMPT_FIRST: + return "PSPP> "; -/* Sets the given STYLE's prompt to STRING. */ -void -prompt_set (enum prompt_style style, const char *string) -{ - assert (style < PROMPT_CNT); - free (prompts[style]); - prompts[style] = xstrdup (string); + case PROMPT_LATER: + return " > "; + + case PROMPT_DATA: + return "data> "; + + case PROMPT_CNT: + NOT_REACHED (); + } + NOT_REACHED (); } /* Sets STYLE as the current prompt style. */