Avoid compiler warnings when building without readline
[pspp] / src / ui / terminal / terminal-reader.c
index 96a69d7bc452ab6e934270d850168b264924907f..0a1337d4ea0f3f8448a3f44df1524c7604825af6 100644 (file)
@@ -38,7 +38,6 @@ static const bool have_readline = true;
 
 #else
 static const bool have_readline = false;
-static int rl_end;
 #endif
 
 
@@ -52,7 +51,6 @@ static int rl_end;
 #include <stdint.h>
 #include <stdlib.h>
 
-#include "data/file-name.h"
 #include "data/settings.h"
 #include "language/command.h"
 #include "language/lexer/lexer.h"
@@ -98,7 +96,7 @@ welcome (void)
         "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);
-  puts (stat_version);
+  puts (announced_version);
   journal_init ();
 }
 
@@ -128,7 +126,7 @@ rl_echo_signal_char (int sig)
   if (0 == tcgetattr (0, &t))
     {
       cc_t c = t.c_cc[VINTR];
-  
+
       if (c >= 0  && c <= 'Z' - 'A')
        fprintf (rl_outstream, "^%c", 'A' + c - 1);
       else
@@ -139,7 +137,7 @@ rl_echo_signal_char (int sig)
     fprintf (rl_outstream, "^C");
 
   fflush (rl_outstream);
-}  
+}
 #endif
 #endif
 
@@ -252,21 +250,12 @@ readline_prompt (enum prompt_style style)
 }
 
 
+#if HAVE_READLINE
 
 static int pfd[2];
 static bool sigint_received ;
 
-static void 
-handler (int sig)
-{
-  rl_end = 0;
-
-  write (pfd[1], "x", 1);
-  rl_echo_signal_char (sig);
-}
-
-
-/* 
+/*
    A function similar to getc from stdio.
    However this one may be interrupted by SIGINT.
    If that happens it will return EOF and the global variable
@@ -316,9 +305,15 @@ interruptible_getc (FILE *fp)
   return c;
 }
 
+static void
+handler (int sig)
+{
+  rl_end = 0;
 
+  write (pfd[1], "x", 1);
+  rl_echo_signal_char (sig);
+}
 
-#if HAVE_READLINE
 
 static void
 readline_init (void)
@@ -354,7 +349,7 @@ readline_done (void)
   free (history_file);
 }
 
-/* Prompt the user for a line of input and return it in LINE. 
+/* Prompt the user for a line of input and return it in LINE.
    Returns true if the LINE should be considered valid, false otherwise.
  */
 static bool
@@ -454,9 +449,9 @@ readline_read (struct substring *line, enum prompt_style style)
   fflush (stdout);
   ds_init_empty (&string);
   ds_read_line (&string, stdin, SIZE_MAX);
-  
+
   *line = string.ss;
-  
+
   return false;
 }
 #endif /* !HAVE_READLINE */