magic-elimination.patch from patch #6230.
[pspp-builds.git] / src / language / utilities / set.q
index d2315005f92641ac22415d887ca71068b60775d1..18ead9153809a92658585ce5a48fe354415ae39e 100644 (file)
@@ -1,20 +1,18 @@
-/* PSPP - computes sample statistics.
+/* PSPP - a program for statistical analysis.
    Copyright (C) 1997-9, 2000, 2006 Free Software Foundation, Inc.
 
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
 
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-   02110-1301, USA. */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
 #include <config.h>
 
@@ -40,9 +38,9 @@
 #include <libpspp/copyleft.h>
 #include <libpspp/float-format.h>
 #include <libpspp/integer-format.h>
-#include <libpspp/magic.h>
 #include <libpspp/message.h>
 #include <math/random.h>
+#include <output/journal.h>
 #include <output/output.h>
 
 #if HAVE_LIBTERMCAP
@@ -85,6 +83,7 @@ int tgetnum (const char *);
      histogram=string "x==1" "one character long";
      include=inc:on/off;
      journal=custom;
+     log=custom;
      length=custom;
      listing=custom;
      lowres=lores:auto/on/off;
@@ -509,19 +508,29 @@ static int
 stc_custom_journal (struct lexer *lexer, struct dataset *ds UNUSED, struct cmd_set *cmd UNUSED, void *aux UNUSED)
 {
   lex_match (lexer, '=');
-  if (!lex_match_id (lexer, "ON") && !lex_match_id (lexer, "OFF"))
+  if (lex_match_id (lexer, "ON") || lex_match_id (lexer, "YES"))
+    journal_enable ();
+  else if (lex_match_id (lexer, "OFF") || lex_match_id (lexer, "NO"))
+    journal_disable ();
+  else if (lex_token (lexer) == T_STRING || lex_token (lexer) == T_ID)
     {
-      if (lex_token (lexer) == T_STRING)
-        lex_get (lexer);
-      else
-        {
-          lex_error (lexer, NULL);
-          return 0;
-        }
+      journal_set_file_name (ds_cstr (lex_tokstr (lexer)));
+      lex_get (lexer);
+    }
+  else
+    {
+      lex_error (lexer, NULL);
+      return 0;
     }
   return 1;
 }
 
+static int
+stc_custom_log (struct lexer *lexer, struct dataset *ds UNUSED, struct cmd_set *cmd UNUSED, void *aux UNUSED)
+{
+  return stc_custom_journal (lexer, ds, cmd, aux);
+}
+
 static int
 stc_custom_listing (struct lexer *lexer, struct dataset *ds UNUSED, struct cmd_set *cmd UNUSED, void *aux UNUSED)
 {
@@ -848,13 +857,13 @@ show_all_cc (void)
 static void
 show_warranty (const struct dataset *ds UNUSED)
 {
-  msg (MN, lack_of_warranty);
+  fputs (lack_of_warranty, stdout);
 }
 
 static void
 show_copying (const struct dataset *ds UNUSED)
 {
-  msg (MN, copyleft);
+  fputs (copyleft, stdout);
 }
 
 int