1 /* PSPP - computes sample statistics.
2 Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful, but
10 WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
27 #include <data/file-name.h>
28 #include <data/settings.h>
29 #include <data/variable.h>
30 #include <language/command.h>
31 #include <language/lexer/lexer.h>
32 #include <libpspp/alloc.h>
33 #include <libpspp/assertion.h>
34 #include <libpspp/message.h>
35 #include <libpspp/message.h>
36 #include <libpspp/str.h>
37 #include <libpspp/verbose-msg.h>
38 #include <libpspp/version.h>
39 #include <output/table.h>
41 /* Current prompts in each style. */
42 static char *prompts[PROMPT_CNT];
44 /* Current prompting style. */
45 static enum prompt_style current_style;
47 /* Initializes prompts. */
51 prompts[PROMPT_FIRST] = xstrdup ("PSPP> ");
52 prompts[PROMPT_LATER] = xstrdup (" > ");
53 prompts[PROMPT_DATA] = xstrdup ("data> ");
54 current_style = PROMPT_FIRST;
63 for (i = 0; i < PROMPT_CNT; i++)
70 /* Gets the command prompt for the given STYLE. */
72 prompt_get (enum prompt_style style)
74 assert (style < PROMPT_CNT);
75 return prompts[style];
78 /* Sets the given STYLE's prompt to STRING. */
80 prompt_set (enum prompt_style style, const char *string)
82 assert (style < PROMPT_CNT);
83 free (prompts[style]);
84 prompts[style] = xstrdup (string);
87 /* Sets STYLE as the current prompt style. */
89 prompt_set_style (enum prompt_style style)
91 assert (style < PROMPT_CNT);
92 current_style = style;
95 /* Returns the current prompt. */
97 prompt_get_style (void)