Remove "Written by Ben Pfaff <blp@gnu.org>" lines everywhere.
[pspp-builds.git] / src / ui / terminal / command-line.c
index cf5b660c939d0b91a054f1a08e61bb93da76e65a..cb1fb332fd9daa0049405c3b043e5d0162944030 100644 (file)
@@ -1,6 +1,5 @@
 /* PSPP - computes sample statistics.
    Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
-   Written by Ben Pfaff <blp@gnu.org>.
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -19,6 +18,7 @@
 
 #include <config.h>
 #include "command-line.h"
+#include "msg-ui.h"
 #include <libpspp/message.h>
 #include <ctype.h>
 #include <stdio.h>
 #include <getopt.h>
 #include <stdlib.h>
 #include <libpspp/alloc.h>
+#include <libpspp/assertion.h>
 #include <libpspp/copyleft.h>
 #include <libpspp/message.h>
-#include <language/line-buffer.h>
+#include <language/syntax-file.h>
 #include "progname.h"
 #include <data/settings.h>
-#include "read-line.h"
 #include <output/output.h>
-#include <data/filename.h>
+#include <data/file-name.h>
+#include <libpspp/getl.h>
 #include <libpspp/str.h>
 #include <libpspp/version.h>
+#include <libpspp/verbose-msg.h>
+#include "read-line.h"
 
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
@@ -46,11 +49,12 @@ static void usage (void);
 
 char *subst_vars (char *);
 
+
 /* Parses the command line specified by ARGC and ARGV as received by
    main().  Returns true if normal execution should proceed,
    false if the command-line indicates that PSPP should exit. */
 bool
-parse_command_line (int argc, char **argv)
+parse_command_line (int argc, char **argv, struct source_stream *ss)
 {
   static struct option long_options[] =
   {
@@ -60,6 +64,7 @@ parse_command_line (int argc, char **argv)
     {"device", required_argument, NULL, 'o'},
     {"dry-run", no_argument, NULL, 'n'},
     {"edit", no_argument, NULL, 'n'},
+    {"error-file", required_argument, NULL, 'e'},
     {"help", no_argument, NULL, 'h'},
     {"include-directory", required_argument, NULL, 'I'},
     {"interactive", no_argument, NULL, 'i'},
@@ -87,7 +92,7 @@ parse_command_line (int argc, char **argv)
 
   for (;;)
     {
-      c = getopt_long (argc, argv, "a:x:B:c:f:hiI:lno:prsvV", long_options, NULL);
+      c = getopt_long (argc, argv, "a:x:B:c:e:f:hiI:lno:prsvV", long_options, NULL);
       if (c == -1)
        break;
 
@@ -117,7 +122,9 @@ parse_command_line (int argc, char **argv)
               return false;
            }
          break;
-
+       case 'e':
+         msg_ui_set_error_file (optarg);
+         break;
        case 'B':
          config_path = optarg;
          break;
@@ -133,9 +140,9 @@ parse_command_line (int argc, char **argv)
          break;
        case 'I':
          if (optarg == NULL || !strcmp (optarg, "-"))
-           getl_clear_include_path ();
+           getl_clear_include_path (ss);
          else
-           getl_add_include_dir (optarg);
+           getl_add_include_dir (ss, optarg);
          break;
        case 'l':
          outp_list_classes ();
@@ -163,7 +170,7 @@ parse_command_line (int argc, char **argv)
          set_safer_mode ();
          break;
        case 'v':
-         err_verbosity++;
+         verbose_increment_level ();
          break;
        case 'V':
          puts (version);
@@ -179,16 +186,17 @@ parse_command_line (int argc, char **argv)
        case 0:
          break;
        default:
-         assert (0);
+         NOT_REACHED ();
        }
     }
 
   if (process_statrc)
     {
-      char *pspprc_fn = fn_search_path ("rc", config_path, NULL);
+      char *pspprc_fn = fn_search_path ("rc", config_path);
       if (pspprc_fn != NULL) 
         {
-          getl_append_syntax_file (pspprc_fn);
+         getl_append_source (ss, create_syntax_file_source (pspprc_fn));
+
           free (pspprc_fn); 
         }
     }
@@ -198,12 +206,12 @@ parse_command_line (int argc, char **argv)
       outp_configure_macro (argv[i]);
     else 
       {
-        getl_append_syntax_file (argv[i]);
+       getl_append_source (ss, create_syntax_file_source (argv[i]));
         syntax_files++;
       }
 
   if (!syntax_files || interactive_mode)
-    getl_append_interactive (readln_read);
+    getl_append_source (ss, create_readln_source () );
 
   return true;
 }
@@ -221,12 +229,13 @@ N_("PSPP, a program for statistical analysis of sample data.\n"
 "  -B, --config-dir=DIR      set configuration directory to DIR\n"
 "  -o, --device=DEVICE       select output driver DEVICE and disable defaults\n"
 "\nInput and output:\n"
+"  -e, --error-file=FILE     send error messages to FILE (appended)\n"
 "  -f, --out-file=FILE       send output to FILE (overwritten)\n"
-"  -p, --pipe                read script from stdin, send output to stdout\n"
+"  -p, --pipe                read syntax from stdin, send output to stdout\n"
 "  -I-, --no-include         clear include path\n"
 "  -I, --include=DIR         append DIR to include path\n"
 "\nLanguage modifiers:\n"
-"  -i, --interactive         interpret scripts in interactive mode\n"
+"  -i, --interactive         interpret syntax in interactive mode\n"
 "  -n, --edit                just check syntax; don't actually run the code\n"
 "  -r, --no-statrc           disable execution of .pspp/rc at startup\n"
 "  -s, --safer               don't allow some unsafe operations\n"