X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fgetline.c;h=f55cd9f9b438b38d8f6ee9a1771b13b62ea8f6bb;hb=9b4b94c6d3b5fd98bf396e23d015380b87d2d296;hp=5b8588c88d9d6aa5c06389152921743bc4f43513;hpb=4944c86a9318bc5b5578ab145a95c116ffd2c9fd;p=pspp diff --git a/src/getline.c b/src/getline.c index 5b8588c88d..f55cd9f9b4 100644 --- a/src/getline.c +++ b/src/getline.c @@ -18,15 +18,16 @@ 02111-1307, USA. */ #include -#include +#include "getline.h" +#include "error.h" #include #include #include #include "alloc.h" #include "error.h" #include "filename.h" -#include "getline.h" #include "lexer.h" +#include "repeat.h" #include "settings.h" #include "str.h" #include "tab.h" @@ -56,6 +57,8 @@ extern int write_history (char *); #endif /* no readline/history.h */ #endif /* -lhistory */ +extern struct cmd_set cmd; + static struct string getl_include_path; /* Number of levels of DO REPEAT structures we're nested inside. If @@ -78,7 +81,7 @@ getl_initialize (void) void getl_uninitialize (void) { -#if HAVE_LIBHISTORY && unix +#if HAVE_LIBHISTORY && defined (unix) if (history_file) write_history (history_file); #endif @@ -225,11 +228,11 @@ getl_add_DO_REPEAT_file (struct getl_script *file) } /* Display a welcoming message. */ -void +static void welcome (void) { getl_welcomed = 1; - fputs ("PSPP is free software and you are welcome to distribute copies of" + fputs ("PSPP is free software and you are welcome to distribute copies of " "it\nunder certain conditions; type \"show copying.\" to see the " "conditions.\nThere is ABSOLUTELY NO WARRANTY for PSPP; type \"show " "warranty.\" for details.\n", stdout); @@ -333,7 +336,7 @@ getl_read_line (void) if (ds_length (&getl_buf) > 0 && ds_end (&getl_buf)[-1] == '\n') ds_truncate (&getl_buf, ds_length (&getl_buf) - 1); - if (set_echo) + if (get_echo()) tab_output_text (TAB_LEFT | TAT_FIX, ds_value (&getl_buf)); getl_head->ln++; @@ -423,7 +426,7 @@ read_console (void) #if HAVE_LIBHISTORY if (!history_file) { -#if unix +#ifdef unix history_file = tilde_expand (HISTORY_FILE); #endif using_history (); @@ -435,19 +438,20 @@ read_console (void) switch (getl_prompt) { case GETL_PRPT_STANDARD: - prompt = set_prompt; + prompt = get_prompt(); break; case GETL_PRPT_CONTINUATION: - prompt = set_cprompt; + prompt = get_cprompt(); break; case GETL_PRPT_DATA: - prompt = set_dprompt; + prompt = get_dprompt(); break; default: assert (0); + abort (); } line = readline (prompt); @@ -471,7 +475,7 @@ read_console (void) err_error_count = err_warning_count = 0; err_already_flagged = 0; - fputs (getl_prompt ? set_cprompt : set_prompt, stdout); + fputs (getl_prompt ? get_cprompt() : get_prompt(), stdout); ds_clear (&getl_buf); if (ds_getline (&getl_buf, stdin)) return 1;