Implemented the SHOW command and massaged the SET command to fit
[pspp-builds.git] / src / command.c
index 7e9bb7742b7fba2f76dc4769d0c14e57594ad1f1..163f9845742ee095096f8791c7d18d64d47f4a52 100644 (file)
@@ -201,7 +201,8 @@ cmd_parse (void)
 
   /* If we're in a FILE TYPE structure, only certain commands can be
      allowed. */
-  if (pgm_state == STATE_INPUT && vfm_source == &file_type_source
+  if (pgm_state == STATE_INPUT
+      && case_source_is_class (vfm_source, &file_type_source_class)
       && !FILE_TYPE_okay (cp))
     return CMD_FAILURE;
 
@@ -249,7 +250,7 @@ cmd_parse (void)
     
     /* Perform the state transition if the command completed
        successfully (at least in part). */
-    if (result != 0)
+    if (result != CMD_FAILURE)
       {
        pgm_state = cp->transition[pgm_state];
 
@@ -561,7 +562,7 @@ int
 cmd_execute (void)
 {
   lex_match_id ("EXECUTE");
-  procedure (NULL, NULL, NULL);
+  procedure (NULL, NULL);
   return lex_end_of_command ();
 }
 
@@ -569,11 +570,13 @@ cmd_execute (void)
 int
 cmd_erase (void)
 {
-  if (set_safer)
-    {
-      msg (SE, _("This command not allowed when the SAFER option is set."));
-      return CMD_FAILURE;
-    }
+
+  if ( safer_mode() ) 
+    { 
+      msg (SE, _("This command not allowed when the SAFER option is set.")); 
+      return CMD_FAILURE; 
+    } 
+
   
   lex_match_id ("ERASE");
   if (!lex_force_match_id ("FILE"))
@@ -589,10 +592,10 @@ cmd_erase (void)
       return CMD_FAILURE;
     }
 
-  return lex_end_of_command ();
+  return CMD_SUCCESS;
 }
 
-#if unix
+#ifdef unix
 /* Spawn a shell process. */
 static int
 shell (void)
@@ -700,15 +703,15 @@ cmd_host (void)
 {
   int code;
 
-  if (set_safer)
-    {
-      msg (SE, _("This command not allowed when the SAFER option is set."));
-      return CMD_FAILURE;
-    }
-  
+  if ( safer_mode() ) 
+    { 
+      msg (SE, _("This command not allowed when the SAFER option is set.")); 
+      return CMD_FAILURE; 
+    } 
+
   lex_match_id ("HOST");
 
-#if unix
+#ifdef unix
   /* Figure out whether to invoke an interactive shell or to execute a
      single shell command. */
   if (lex_look_ahead () == '.')