From: John Darrington Date: Mon, 10 Jan 2005 06:50:45 +0000 (+0000) Subject: Added a signal handler to delete temp casefiles on SIGINT and SIGQUIT. X-Git-Tag: v0.4.0~198 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8bc8a011fa9df5b9f5aa00144c8d3478fd7b93fa;p=pspp-builds.git Added a signal handler to delete temp casefiles on SIGINT and SIGQUIT. Inhibited the PERMISSIONS command when SAFER is on. command.def: Added a lot more unimplemented commands. Moved --version information to copyleft.c --- diff --git a/doc/utilities.texi b/doc/utilities.texi index 1d279f57..c6300990 100644 --- a/doc/utilities.texi +++ b/doc/utilities.texi @@ -210,6 +210,7 @@ unwritable either by you or anyone else on the system. If you set the permission to WRITEABLE, then the file will become writeable by you; the permissions afforded to others will be unchanged. +This command cannot be used if the SAFER setting is active. @node QUIT, SET, PERMISSIONS, Utilities @@ -535,6 +536,8 @@ The ERASE command. @item The HOST command. @item +The PERMISSIONS command. +@item Pipe filenames (filenames beginning or ending with @samp{|}). @end itemize diff --git a/src/ChangeLog b/src/ChangeLog index 8576e20f..76e95763 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ +Mon Jan 10 14:43:45 WST 2005 John Darrington + + * casefile.c: Added a signal handler to delete temp files on SIGINT and SIGQUIT + + * permissions.c Inhibited the PERMISSIONS command when SAFER is on. + + * command.def Added a lot more unimplemented commands. + + * copyleft.[ch] cmdline.c Moved legal information to copyleft.c + Sat Jan 8 23:58:34 2005 Ben Pfaff * sort.c: (compare_initial_runs) Needed additional level of diff --git a/src/casefile.c b/src/casefile.c index eca07f83..242fc385 100644 --- a/src/casefile.c +++ b/src/casefile.c @@ -32,6 +32,7 @@ #include "misc.h" #include "settings.h" #include "var.h" +#include "signal.h" #ifdef HAVE_VALGRIND_VALGRIND_H #include @@ -735,6 +736,8 @@ register_atexit (void) if (!registered) { registered = 1; + signal (SIGQUIT, (sighandler_t) exit_handler); + signal (SIGINT, (sighandler_t) exit_handler); atexit (exit_handler); } } diff --git a/src/cmdline.c b/src/cmdline.c index 56ce1d94..630aab88 100644 --- a/src/cmdline.c +++ b/src/cmdline.c @@ -35,6 +35,7 @@ #include "str.h" #include "var.h" #include "version.h" +#include "copyleft.h" void welcome (void); static void usage (void); @@ -183,13 +184,7 @@ parse_command_line (int argc, char **argv) break; case 'V': puts (version); - puts (_("\nCopyright (C) 1997-9, 2000 Free Software Foundation, " - "Inc.\n" - "This is free software; see the source for copying " - "conditions. There is NO\n" - "WARRANTY; not even for MERCHANTABILITY or FITNESS " - "FOR A PARTICULAR PURPOSE.\n\n" - "Written by Ben Pfaff .")); + puts (legal); err_hcf (1); case '?': usage (); diff --git a/src/command.def b/src/command.def index 08eac3ce..b073a9b1 100644 --- a/src/command.def +++ b/src/command.def @@ -24,29 +24,39 @@ #define PROC STATE_PROC #define ERRO STATE_ERROR +UNIMPL ("ACF", ERRO, ERRO, PROC, PROC) UNIMPL ("ADD FILES", TRAN, ERRO, TRAN, TRAN) DEFCMD ("ADD VALUE LABELS", ERRO, INPU, TRAN, TRAN, cmd_add_value_labels) DEFCMD ("AGGREGATE", ERRO, ERRO, PROC, TRAN, cmd_aggregate) +UNIMPL ("ANOVA", ERRO, ERRO, PROC, PROC) DEFCMD ("APPLY DICTIONARY", ERRO, ERRO, TRAN, TRAN, cmd_apply_dictionary) DEFCMD ("AUTORECODE", ERRO, ERRO, PROC, PROC, cmd_autorecode) SPCCMD ("BEGIN DATA", ERRO, ERRO, PROC, PROC, cmd_begin_data) DEFCMD ("BREAK", ERRO, INPU, TRAN, TRAN, cmd_break) +UNIMPL ("CASEPLOT", ERRO, ERRO, PROC, PROC) UNIMPL ("CASESTOVARS", ERRO, ERRO, PROC, PROC) +UNIMPL ("CCF", ERRO, ERRO, PROC, PROC) DEFCMD ("CLEAR TRANSFORMATIONS", ERRO, INPU, TRAN, TRAN, cmd_clear_transformations) +UNIMPL ("CLUSTER", ERRO, ERRO, PROC, PROC) +UNIMPL ("COMMENT", ERRO, ERRO, PROC, PROC) DEFCMD ("COMPUTE", ERRO, INPU, TRAN, TRAN, cmd_compute) +UNIMPL ("CONJOINT", ERRO, ERRO, PROC, PROC) DEFCMD ("CORRELATIONS", ERRO, ERRO, PROC, PROC, cmd_correlations) -DEFCMD ("CONDESCRIPTIVES", ERRO, ERRO, PROC, PROC, cmd_descriptives) DEFCMD ("COUNT", ERRO, INPU, TRAN, TRAN, cmd_count) +UNIMPL ("CREATE", ERRO, ERRO, PROC, PROC) DEFCMD ("CROSSTABS", ERRO, ERRO, PROC, PROC, cmd_crosstabs) +UNIMPL ("CURVEFIT", ERRO, ERRO, PROC, PROC) DEFCMD ("DATA LIST", TRAN, INPU, TRAN, TRAN, cmd_data_list) +UNIMPL ("DATE", ERRO, ERRO, PROC, PROC) DEFCMD ("DEBUG CASEFILE", INIT, INPU, TRAN, PROC, cmd_debug_casefile) DEFCMD ("DEBUG EVALUATE", INIT, INPU, TRAN, PROC, cmd_debug_evaluate) DEFCMD ("DEBUG MOMENTS", INIT, INPU, TRAN, PROC, cmd_debug_moments) DEFCMD ("DESCRIPTIVES", ERRO, ERRO, PROC, PROC, cmd_descriptives) +UNIMPL ("DISCRIMINANT", ERRO, ERRO, PROC, PROC) DEFCMD ("DISPLAY", ERRO, INPU, TRAN, PROC, cmd_display) +SPCCMD ("DOCUMENT", ERRO, INPU, TRAN, TRAN, cmd_document) DEFCMD ("DO IF", ERRO, INPU, TRAN, TRAN, cmd_do_if) DEFCMD ("DO REPEAT", ERRO, INPU, TRAN, TRAN, cmd_do_repeat) -SPCCMD ("DOCUMENT", ERRO, INPU, TRAN, TRAN, cmd_document) DEFCMD ("DROP DOCUMENTS", INIT, INPU, TRAN, PROC, cmd_drop_documents) UNIMPL ("EDIT", INIT, INPU, TRAN, PROC) DEFCMD ("ELSE", ERRO, INPU, TRAN, TRAN, cmd_else) @@ -63,20 +73,26 @@ DEFCMD ("EXAMINE", ERRO, ERRO, PROC, PROC, cmd_examine) DEFCMD ("EXECUTE", ERRO, ERRO, PROC, PROC, cmd_execute) DEFCMD ("EXIT", INIT, INPU, TRAN, PROC, cmd_exit) DEFCMD ("EXPORT", ERRO, ERRO, PROC, PROC, cmd_export) +UNIMPL ("FACTOR", ERRO, ERRO, PROC, PROC) DEFCMD ("FILE HANDLE", INIT, INPU, TRAN, PROC, cmd_file_handle) SPCCMD ("FILE LABEL", INIT, INPU, TRAN, PROC, cmd_file_label) DEFCMD ("FILE TYPE", INPU, ERRO, INPU, INPU, cmd_file_type) DEFCMD ("FILTER", ERRO, ERRO, TRAN, TRAN, cmd_filter) DEFCMD ("FINISH", INIT, INPU, TRAN, PROC, cmd_finish) +UNIMPL ("FIT", ERRO, ERRO, PROC, PROC) DEFCMD ("FLIP", ERRO, ERRO, PROC, PROC, cmd_flip) DEFCMD ("FORMATS", INIT, INPU, TRAN, PROC, cmd_formats) DEFCMD ("FREQUENCIES", ERRO, ERRO, PROC, PROC, cmd_frequencies) DEFCMD ("GET", TRAN, ERRO, TRAN, TRAN, cmd_get) +UNIMPL ("GET TRANSLATE", ERRO, ERRO, PROC, PROC) +UNIMPL ("GLM", ERRO, ERRO, PROC, PROC) +UNIMPL ("GRAPH", ERRO, ERRO, PROC, PROC) DEFCMD ("HOST", INIT, INPU, TRAN, PROC, cmd_host) DEFCMD ("IF", ERRO, INPU, TRAN, TRAN, cmd_if) +UNIMPL ("IGRAPH", ERRO, ERRO, PROC, PROC) +DEFCMD ("IMPORT", TRAN, ERRO, TRAN, TRAN, cmd_import) DEFCMD ("INCLUDE", INIT, INPU, TRAN, PROC, cmd_include) UNIMPL ("INFO", INIT, INPU, TRAN, PROC) -DEFCMD ("IMPORT", TRAN, ERRO, TRAN, TRAN, cmd_import) UNIMPL ("INPUT MATRIX", INIT, INPU, TRAN, PROC) DEFCMD ("INPUT PROGRAM", INPU, ERRO, INPU, INPU, cmd_input_program) UNIMPL ("KEYED DATA LIST", INPU, ERRO, INPU, INPU) @@ -85,55 +101,81 @@ DEFCMD ("LIST", ERRO, ERRO, PROC, PROC, cmd_list) DEFCMD ("LOOP", ERRO, INPU, TRAN, TRAN, cmd_loop) DEFCMD ("MATCH FILES", TRAN, ERRO, TRAN, PROC, cmd_match_files) DEFCMD ("MATRIX DATA", TRAN, ERRO, TRAN, TRAN, cmd_matrix_data) +UNIMPL ("MCONVERT", ERRO, ERRO, PROC, PROC) DEFCMD ("MEANS", ERRO, ERRO, PROC, PROC, cmd_means) DEFCMD ("MISSING VALUES", ERRO, INPU, TRAN, TRAN, cmd_missing_values) DEFCMD ("MODIFY VARS", ERRO, ERRO, TRAN, PROC, cmd_modify_vars) +UNIMPL ("MULT RESPONSE", ERRO, ERRO, PROC, PROC) DEFCMD ("NEW FILE", INIT, ERRO, INIT, INIT, cmd_new_file) DEFCMD ("N", INIT, INPU, TRAN, TRAN, cmd_n_of_cases) DEFCMD ("N OF CASES", INIT, INPU, TRAN, TRAN, cmd_n_of_cases) +UNIMPL ("NONPAR CORR", ERRO, ERRO, PROC, PROC) +UNIMPL ("NPAR TESTS", ERRO, ERRO, PROC, PROC) UNIMPL ("NUMBERED", INIT, INPU, TRAN, PROC) DEFCMD ("NUMERIC", ERRO, INPU, TRAN, TRAN, cmd_numeric) -UNIMPL ("UNNUMBERED", INIT, INPU, TRAN, PROC) DEFCMD ("ONEWAY", ERRO, ERRO, PROC, PROC, cmd_oneway) -DEFCMD ("PERMISSIONS", INIT, INPU, TRAN, PROC, cmd_permissions) +UNIMPL ("PACF", ERRO, ERRO, PROC, PROC) +UNIMPL ("PARTIAL CORR", ERRO, ERRO, PROC, PROC) DEFCMD ("PEARSON CORRELATIONS", ERRO, ERRO, PROC, PROC, cmd_correlations) +DEFCMD ("PERMISSIONS", INIT, INPU, TRAN, PROC, cmd_permissions) +UNIMPL ("PLOT", ERRO, ERRO, PROC, PROC) UNIMPL ("POINT", ERRO, INPU, ERRO, ERRO) +UNIMPL ("PPLOT", ERRO, ERRO, PROC, PROC) +UNIMPL ("PREDICT", ERRO, ERRO, PROC, PROC) UNIMPL ("PRESERVE", INIT, INPU, TRAN, PROC) -DEFCMD ("PRINT", ERRO, INPU, TRAN, TRAN, cmd_print) DEFCMD ("PRINT EJECT", ERRO, INPU, TRAN, TRAN, cmd_print_eject) +DEFCMD ("PRINT", ERRO, INPU, TRAN, TRAN, cmd_print) DEFCMD ("PRINT FORMATS", ERRO, INPU, TRAN, TRAN, cmd_print_formats) DEFCMD ("PRINT SPACE", ERRO, INPU, TRAN, TRAN, cmd_print_space) UNIMPL ("PROCEDURE OUTPUT", INIT, INPU, TRAN, PROC) DEFCMD ("PROCESS IF", ERRO, ERRO, TRAN, TRAN, cmd_process_if) +UNIMPL ("PROXIMITIES", ERRO, ERRO, PROC, PROC) DEFCMD ("Q", INIT, INPU, TRAN, PROC, cmd_exit) +UNIMPL ("QUICK CLUSTER", ERRO, ERRO, PROC, PROC) DEFCMD ("QUIT", INIT, INPU, TRAN, PROC, cmd_exit) +UNIMPL ("RANK", ERRO, ERRO, PROC, PROC) DEFCMD ("RECODE", ERRO, INPU, TRAN, TRAN, cmd_recode) DEFCMD ("RECORD TYPE", ERRO, INPU, ERRO, ERRO, cmd_record_type) UNIMPL ("REFORMAT", ERRO, ERRO, TRAN, TRAN) +UNIMPL ("REGRESSION", ERRO, ERRO, PROC, PROC) DEFCMD ("RENAME VARIABLES", ERRO, INPU, TRAN, PROC, cmd_rename_variables) DEFCMD ("REPEATING DATA", ERRO, INPU, ERRO, ERRO, cmd_repeating_data) +UNIMPL ("REPORT", ERRO, ERRO, PROC, PROC) DEFCMD ("REREAD", ERRO, INPU, ERRO, ERRO, cmd_reread) UNIMPL ("RESTORE", INIT, INPU, TRAN, PROC) +UNIMPL ("RMV", ERRO, ERRO, PROC, PROC) DEFCMD ("SAMPLE", ERRO, ERRO, TRAN, TRAN, cmd_sample) DEFCMD ("SAVE", ERRO, ERRO, PROC, PROC, cmd_save) +UNIMPL ("SAVE TRANSLATE", ERRO, ERRO, PROC, PROC) +UNIMPL ("SCRIPT", ERRO, ERRO, PROC, PROC) DEFCMD ("SELECT IF", ERRO, ERRO, TRAN, TRAN, cmd_select_if) DEFCMD ("SET", INIT, INPU, TRAN, PROC, cmd_set) DEFCMD ("SHOW", INIT, INPU, TRAN, PROC, cmd_show) -DEFCMD ("SORT", ERRO, ERRO, PROC, PROC, cmd_sort_cases) DEFCMD ("SORT CASES", ERRO, ERRO, PROC, PROC, cmd_sort_cases) +DEFCMD ("SORT", ERRO, ERRO, PROC, PROC, cmd_sort_cases) +UNIMPL ("SPCHART", ERRO, ERRO, PROC, PROC) DEFCMD ("SPLIT FILE", ERRO, INPU, TRAN, TRAN, cmd_split_file) DEFCMD ("STRING", ERRO, INPU, TRAN, TRAN, cmd_string) SPCCMD ("SUBTITLE", INIT, INPU, TRAN, PROC, cmd_subtitle) +UNIMPL ("SUMMARIZE", ERRO, ERRO, PROC, PROC) +UNIMPL ("SURVIVAL", ERRO, ERRO, PROC, PROC) DEFCMD ("SYSFILE INFO", INIT, INPU, TRAN, PROC, cmd_sysfile_info) DEFCMD ("TEMPORARY", ERRO, ERRO, TRAN, TRAN, cmd_temporary) SPCCMD ("TITLE", INIT, INPU, TRAN, PROC, cmd_title) +UNIMPL ("TSET", ERRO, ERRO, PROC, PROC) +UNIMPL ("TSHOW", ERRO, ERRO, PROC, PROC) +UNIMPL ("TSPLOT", ERRO, ERRO, PROC, PROC) DEFCMD ("T-TEST", ERRO, ERRO, PROC, PROC, cmd_t_test) +UNIMPL ("UNIANOVA", ERRO, ERRO, PROC, PROC) +UNIMPL ("UNNUMBERED", INIT, INPU, TRAN, PROC) UNIMPL ("UPDATE", TRAN, ERRO, TRAN, TRAN) DEFCMD ("USE", ERRO, ERRO, TRAN, TRAN, cmd_use) DEFCMD ("VALUE LABELS", ERRO, INPU, TRAN, TRAN, cmd_value_labels) DEFCMD ("VARIABLE LABELS", ERRO, INPU, TRAN, TRAN, cmd_variable_labels) +UNIMPL ("VARIABLE LEVEL", ERRO, ERRO, PROC, PROC) UNIMPL ("VARSTOCASES", ERRO, ERRO, PROC, PROC) DEFCMD ("VECTOR", ERRO, INPU, TRAN, TRAN, cmd_vector) +UNIMPL ("VERIFY", ERRO, ERRO, PROC, PROC) DEFCMD ("WEIGHT", ERRO, INPU, TRAN, TRAN, cmd_weight) DEFCMD ("WRITE", ERRO, INPU, TRAN, TRAN, cmd_write) DEFCMD ("WRITE FORMATS", ERRO, INPU, TRAN, TRAN, cmd_write_formats) diff --git a/src/copyleft.c b/src/copyleft.c index 74799f53..368fa2fd 100644 --- a/src/copyleft.c +++ b/src/copyleft.c @@ -1,4 +1,13 @@ -char lack_of_warranty[]="" +const char legal[]="" +"Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.\n" +"GNU PSPP comes with NO WARRANTY,\n" +"to the extent permitted by law.\n" +"You may redistribute copies of GNU PSPP\n" +"under the terms of the GNU General Public License.\n" +"For more information about these matters,\n" +"see the file named COPYING.\n"; + +const char lack_of_warranty[]="" " NO WARRANTY\n" "\n" "BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY " @@ -21,7 +30,7 @@ char lack_of_warranty[]="" "EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY " "OF SUCH DAMAGES."; -char copyleft[]="" +const char copyleft[]="" " GNU GENERAL PUBLIC LICENSE\n " " Version 2, June 1991\n " " \n" diff --git a/src/copyleft.h b/src/copyleft.h index 0467aada..07e0e1ea 100644 --- a/src/copyleft.h +++ b/src/copyleft.h @@ -20,7 +20,8 @@ #if !copyleft_h #define copyleft_h 1 -extern char lack_of_warranty[]; -extern char copyleft[]; +extern const char lack_of_warranty[]; +extern const char copyleft[]; +extern const char legal[]; #endif diff --git a/src/permissions.c b/src/permissions.c index 8737e631..f0ea817f 100644 --- a/src/permissions.c +++ b/src/permissions.c @@ -25,6 +25,7 @@ #include #include +#include "settings.h" #include "command.h" #include "error.h" #include "lexer.h" @@ -95,6 +96,13 @@ change_permissions(const char *filename, enum PER per) struct stat buf; mode_t mode; + if ( safer_mode() ) + { + msg (SE, _("This command not allowed when the SAFER option is set.")); + return CMD_FAILURE; + } + + if ( -1 == stat(filename, &buf) ) { const int errnum = errno;