MacOS: added a setup section to avoid script in application bundle
[pspp] / src / ui / terminal / terminal-reader.c
index 0b47a3d3ed30cf0dd7a0e5331640c186ef30c8ba..2f2a533d1577f4d6cf46a95e3f60cd1b26ce7dd8 100644 (file)
@@ -33,12 +33,6 @@ static char *history_file;
 static char **complete_command_name (const char *, int, int);
 static char **dont_complete (const char *, int, int);
 static char *command_generator (const char *text, int state);
-
-static const bool have_readline = true;
-
-#else
-static const bool have_readline = false;
-static int rl_end;
 #endif
 
 
@@ -47,7 +41,6 @@ static int rl_end;
 #include <sys/time.h>
 #include <sys/types.h>
 
-#include <assert.h>
 #include <errno.h>
 #include <stdint.h>
 #include <stdlib.h>
@@ -63,7 +56,6 @@ static int rl_end;
 #include "libpspp/version.h"
 #include "output/driver.h"
 #include "output/journal.h"
-#include "ui/terminal/terminal.h"
 
 #include "gl/minmax.h"
 #include "gl/xalloc.h"
@@ -97,7 +89,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 ();
 }
 
@@ -127,7 +119,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
@@ -138,7 +130,7 @@ rl_echo_signal_char (int sig)
     fprintf (rl_outstream, "^C");
 
   fflush (rl_outstream);
-}  
+}
 #endif
 #endif
 
@@ -165,15 +157,6 @@ terminal_reader_read (struct lex_reader *r_, char *buf, size_t n,
        }
       r->offset = 0;
       r->eof = ss_is_empty (r->s);
-
-      /* Check whether the size of the window has changed, so that
-         the output drivers can adjust their settings as needed.  We
-         only do this for the first line of a command, as it's
-         possible that the output drivers are actually in use
-         afterward, and we don't want to confuse them in the middle
-         of output. */
-      if (prompt_style == PROMPT_FIRST)
-        terminal_check_size ();
     }
 
   chunk = MIN (n, r->s.length - r->offset);
@@ -251,12 +234,12 @@ readline_prompt (enum prompt_style style)
 }
 
 
+#if HAVE_READLINE
 
 static int pfd[2];
 static bool sigint_received ;
 
-
-/* 
+/*
    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
@@ -306,11 +289,7 @@ interruptible_getc (FILE *fp)
   return c;
 }
 
-
-
-#if HAVE_READLINE
-
-static void 
+static void
 handler (int sig)
 {
   rl_end = 0;
@@ -354,7 +333,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 +433,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 */