X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fcmdline.c;h=56ce1d94e67ecd53697adec48a3853847ce70226;hb=f98e66bead58bd287261d7bc14dab07515498f55;hp=cd29b9903de3c0b12230da62b1f4264221fb9c0d;hpb=79240dcf50d4d2f9b2742ff4638d8cf8969c2f98;p=pspp-builds.git diff --git a/src/cmdline.c b/src/cmdline.c index cd29b990..56ce1d94 100644 --- a/src/cmdline.c +++ b/src/cmdline.c @@ -18,7 +18,8 @@ 02111-1307, USA. */ #include -#include +#include "cmdline.h" +#include "error.h" #include #include #include @@ -40,6 +41,8 @@ static void usage (void); char *subst_vars (char *); +static int testing_mode=0; + /* Parses the command line specified by ARGC and ARGV as received by main(). */ void @@ -47,6 +50,7 @@ parse_command_line (int argc, char **argv) { 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'}, @@ -63,7 +67,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}, @@ -77,12 +82,37 @@ parse_command_line (int argc, char **argv) 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; @@ -108,7 +138,8 @@ parse_command_line (int argc, char **argv) config_path = optarg; break; case 'f': - printf (_("-f not yet implemented\n")); + printf(_("%s is not yet implemented."), "-f"); + putchar('\n'); break; case 'h': usage (); @@ -126,7 +157,8 @@ parse_command_line (int argc, char **argv) outp_list_classes (); err_hcf (1); case 'n': - printf (_("-n not yet implemented\n")); + printf (_("%s is not yet implemented."),"-n"); + putchar('\n'); break; case 'o': if (!cleared_device_defaults) @@ -137,13 +169,14 @@ parse_command_line (int argc, char **argv) outp_configure_add (optarg); break; case 'p': - printf (_("-p not yet implemented\n")); + printf (_("%s is not yet implemented."),"-p"); + putchar('\n'); break; case 'r': no_statrc = 1; break; case 's': - set_safer = 1; + make_safe(); break; case 'v': err_verbosity++; @@ -168,11 +201,13 @@ 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(); } + for (i = optind; i < argc; i++) { @@ -215,6 +250,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" @@ -230,6 +268,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" @@ -242,8 +283,7 @@ N_("PSPP, a program for statistical analysis of sample data.\n" "\n"); /* Message that describes PSPP command-line syntax, continued. */ -static const char post_syntax_message[] = -N_("\nReport bugs to .\n"); +static const char post_syntax_message[] = N_("\nReport bugs to <%s>.\n"); /* Writes a syntax description to stdout and terminates. */ static void @@ -251,7 +291,7 @@ usage (void) { printf (gettext (pre_syntax_message), pgmname); outp_list_classes (); - printf (gettext (post_syntax_message)); + printf (gettext (post_syntax_message),PACKAGE_BUGREPORT); err_hcf (1); }