X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fcmdline.c;h=6d45bd68c0aeeae04bae42d47352f4a4ad070e56;hb=2013acbcc3afa3f974de6ad335248e97a9c7b965;hp=ac33ee4aaa7ee43e451efca6ca36e35551c1ae0b;hpb=55dee937e22a49d01794ef772076d9f9d84199e9;p=pspp diff --git a/src/cmdline.c b/src/cmdline.c index ac33ee4aaa..6d45bd68c0 100644 --- a/src/cmdline.c +++ b/src/cmdline.c @@ -14,12 +14,12 @@ 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., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ #include #include "cmdline.h" -#include +#include "error.h" #include #include #include @@ -35,6 +35,8 @@ #include "str.h" #include "var.h" #include "version.h" +#include "copyleft.h" +#include "glob.h" void welcome (void); static void usage (void); @@ -46,8 +48,10 @@ char *subst_vars (char *); void parse_command_line (int argc, char **argv) { + static int testing_mode = 0; static struct option long_options[] = { + {"algorithm", required_argument, NULL, 'a'}, {"command", required_argument, NULL, 'c'}, {"config-directory", required_argument, NULL, 'B'}, {"device", required_argument, NULL, 'o'}, @@ -64,7 +68,8 @@ parse_command_line (int argc, char **argv) {"pipe", no_argument, NULL, 'p'}, {"recon", no_argument, NULL, 'n'}, {"safer", no_argument, NULL, 's'}, - {"testing-mode", no_argument, &set_testing_mode, 1}, + {"syntax", required_argument, NULL, 'x'}, + {"testing-mode", no_argument, &testing_mode, 1}, {"verbose", no_argument, NULL, 'v'}, {"version", no_argument, NULL, 'V'}, {0, 0, 0, 0}, @@ -73,17 +78,41 @@ parse_command_line (int argc, char **argv) int c, i; int cleared_device_defaults = 0; - int no_statrc = 0; for (;;) { - c = getopt_long (argc, argv, "B:c:f:hiI:lno:prsvV", long_options, NULL); + c = getopt_long (argc, argv, "a:x:B:c:f:hiI:lno:prsvV", long_options, NULL); if (c == -1) break; switch (c) { + /* Compatibility options */ + case 'a': + if ( 0 == strcmp(optarg,"compatible") ) + set_algorithm(COMPATIBLE); + else if ( 0 == strcmp(optarg,"enhanced")) + set_algorithm(ENHANCED); + else + { + usage(); + assert(0); + } + break; + + case 'x': + if ( 0 == strcmp(optarg,"compatible") ) + set_syntax(COMPATIBLE); + else if ( 0 == strcmp(optarg,"enhanced")) + set_syntax(ENHANCED); + else + { + usage(); + assert(0); + } + break; + case 'c': { static int n_cmds; @@ -147,20 +176,14 @@ parse_command_line (int argc, char **argv) no_statrc = 1; break; case 's': - set_safer = 1; + make_safe(); break; case 'v': err_verbosity++; 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 (); @@ -172,11 +195,14 @@ parse_command_line (int argc, char **argv) } } - if (set_testing_mode) + + if (testing_mode) { /* FIXME: Later this option should do some other things, too. */ - set_viewwidth = 9999; + force_long_view(); + test_mode = 1; } + for (i = optind; i < argc; i++) { @@ -219,6 +245,9 @@ N_("PSPP, a program for statistical analysis of sample data.\n" "\nIf a long option shows an argument as mandatory, then it is mandatory\n" "for the equivalent short option also. Similarly for optional arguments.\n" "\nConfiguration:\n" +" -a, --algorithm={compatible|enhanced}\n" +" set to `compatible' if you want output\n" +" calculated from broken algorithms\n" " -B, --config-dir=DIR set configuration directory to DIR\n" " -o, --device=DEVICE select output driver DEVICE and disable defaults\n" " -d, --define=VAR[=VALUE] set environment variable VAR to VALUE, or empty\n" @@ -234,6 +263,9 @@ N_("PSPP, a program for statistical analysis of sample data.\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" +" -x, --syntax={compatible|enhanced}\n" +" set to `compatible' if you want only to accept\n" +" spss compatible syntax\n" "\nInformative output:\n" " -h, --help print this help, then exit\n" " -l, --list print a list of known driver classes, then exit\n"