X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fcommand.c;h=163f9845742ee095096f8791c7d18d64d47f4a52;hb=def7e6026513a3ee7c2b38416b30a2e890e34311;hp=f4c76c33b32bde5d8cb9ed67f1cafad17c8ed5a3;hpb=7b98b3a4f58f6dc5a8e9cbc188b627966d5e652d;p=pspp-builds.git diff --git a/src/command.c b/src/command.c index f4c76c33..163f9845 100644 --- a/src/command.c +++ b/src/command.c @@ -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; @@ -561,28 +562,21 @@ int cmd_execute (void) { lex_match_id ("EXECUTE"); - procedure (NULL, NULL, NULL); + procedure (NULL, NULL); return lex_end_of_command (); } - -#define assert_not_safer() \ - do { \ - if (set_safer) \ - { \ - msg (SE, _("This command not allowed when the SAFER option is set.")); \ - return CMD_FAILURE; \ - } \ -} while(0) - - - /* Parses, performs the ERASE command. */ int cmd_erase (void) { - assert_not_safer(); + 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")) @@ -709,8 +703,12 @@ cmd_host (void) { int code; - assert_not_safer(); - + if ( safer_mode() ) + { + msg (SE, _("This command not allowed when the SAFER option is set.")); + return CMD_FAILURE; + } + lex_match_id ("HOST"); #ifdef unix