X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fterminal%2Fread-line.c;h=f28fb6fe3912a989a1df8ef74d234ffc402474c4;hb=44326932c8227c64a87f7a92ef16ce83c2fba2d4;hp=41e270f28ec7b0cd6118ee697f712e076cfaafcc;hpb=d8749acaf878dccf9e4527c27d06d06eb5e03091;p=pspp-builds.git diff --git a/src/ui/terminal/read-line.c b/src/ui/terminal/read-line.c index 41e270f2..f28fb6fe 100644 --- a/src/ui/terminal/read-line.c +++ b/src/ui/terminal/read-line.c @@ -70,16 +70,18 @@ readln_initialize (void) #if HAVE_READLINE rl_basic_word_break_characters = "\n"; -#ifdef unix + using_history (); + stifle_history (500); if (history_file == NULL) { - history_file = tilde_expand ("~/.pspp_history"); - using_history (); - read_history (history_file); - stifle_history (500); + const char *home_dir = getenv ("HOME"); + if (home_dir != NULL) + { + history_file = xasprintf ("%s/.pspp_history", home_dir); + read_history (history_file); + } } #endif -#endif } /* Close getl. */ @@ -88,7 +90,7 @@ readln_uninitialize (void) { initialised = false; -#if HAVE_READLINE && unix +#if HAVE_READLINE if (history_file != NULL && false == get_testing_mode() ) write_history (history_file); clear_history (); @@ -127,23 +129,9 @@ welcome (void) "conditions.\nThere is ABSOLUTELY NO WARRANTY for PSPP; type \"show " "warranty.\" for details.\n", stdout); puts (stat_version); - -#if HAVE_READLINE && unix - if (history_file == NULL) - { - history_file = tilde_expand ("~/.pspp_history"); - using_history (); - read_history (history_file); - stifle_history (500); - } -#endif + readln_initialize (); } - - - - - /* Gets a line from the user and stores it into LINE. Prompts the user with PROMPT. Returns true if successful, false at end of file.