X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fcmdline.c;h=b9205a14ed5a6358c5bff387e11d7a8afa4c8d6c;hb=92fb12eb06716d14c05b781f5d9dcde956d77c30;hp=6d45bd68c0aeeae04bae42d47352f4a4ad070e56;hpb=4fdeb2145d081ff1b84e3f6c99f9d1c048c0d64a;p=pspp diff --git a/src/cmdline.c b/src/cmdline.c index 6d45bd68c0..b9205a14ed 100644 --- a/src/cmdline.c +++ b/src/cmdline.c @@ -26,17 +26,22 @@ #include #include #include "alloc.h" +#include "copyleft.h" #include "error.h" #include "filename.h" -#include "getline.h" +#include "getl.h" +#include "glob.h" #include "main.h" #include "output.h" +#include "progname.h" #include "settings.h" #include "str.h" #include "var.h" #include "version.h" -#include "copyleft.h" -#include "glob.h" + +#include "gettext.h" +#define _(msgid) gettext (msgid) +#define N_(msgid) msgid void welcome (void); static void usage (void); @@ -48,7 +53,6 @@ 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'}, @@ -69,7 +73,7 @@ parse_command_line (int argc, char **argv) {"recon", no_argument, NULL, 'n'}, {"safer", no_argument, NULL, 's'}, {"syntax", required_argument, NULL, 'x'}, - {"testing-mode", no_argument, &testing_mode, 1}, + {"testing-mode", no_argument, NULL, 'T'}, {"verbose", no_argument, NULL, 'v'}, {"version", no_argument, NULL, 'V'}, {0, 0, 0, 0}, @@ -77,8 +81,8 @@ parse_command_line (int argc, char **argv) int c, i; - int cleared_device_defaults = 0; - int no_statrc = 0; + bool cleared_device_defaults = false; + bool no_statrc = false; for (;;) { @@ -138,7 +142,7 @@ parse_command_line (int argc, char **argv) config_path = optarg; break; case 'f': - printf(_("%s is not yet implemented."), "-f"); + printf (_("%s is not yet implemented."), "-f"); putchar('\n'); break; case 'h': @@ -155,7 +159,7 @@ parse_command_line (int argc, char **argv) break; case 'l': outp_list_classes (); - err_hcf (1); + terminate (true); case 'n': printf (_("%s is not yet implemented."),"-n"); putchar('\n'); @@ -164,7 +168,7 @@ parse_command_line (int argc, char **argv) if (!cleared_device_defaults) { outp_configure_clear (); - cleared_device_defaults = 1; + cleared_device_defaults = true; } outp_configure_add (optarg); break; @@ -173,10 +177,10 @@ parse_command_line (int argc, char **argv) putchar('\n'); break; case 'r': - no_statrc = 1; + no_statrc = true; break; case 's': - make_safe(); + set_safer_mode (); break; case 'v': err_verbosity++; @@ -184,7 +188,11 @@ parse_command_line (int argc, char **argv) case 'V': puts (version); puts (legal); - err_hcf (1); + terminate (true); + case 'T': + force_long_view (); + set_testing_mode (true); + break; case '?': usage (); assert (0); @@ -195,15 +203,6 @@ parse_command_line (int argc, char **argv) } } - - if (testing_mode) - { - /* FIXME: Later this option should do some other things, too. */ - force_long_view(); - test_mode = 1; - } - - for (i = optind; i < argc; i++) { int separate = 1; @@ -284,9 +283,9 @@ static const char post_syntax_message[] = N_("\nReport bugs to <%s>.\n"); static void usage (void) { - printf (gettext (pre_syntax_message), pgmname); + printf (gettext (pre_syntax_message), program_name); outp_list_classes (); - printf (gettext (post_syntax_message),PACKAGE_BUGREPORT); + printf (gettext (post_syntax_message), PACKAGE_BUGREPORT); - err_hcf (1); + terminate (true); }