X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Foptions.c;h=be2bed42d98ecfd8f4040f81e0f912e4b3a3fec6;hb=17339b8ef2b6c9c403ceccb9f0ab534a943f92e1;hp=694ffc233ebe86aea4b5ba4bcf2b12e4a54f4929;hpb=a258e53c63a08b0ec48aea8f03808eb651729424;p=pspp diff --git a/src/output/options.c b/src/output/options.c index 694ffc233e..be2bed42d9 100644 --- a/src/output/options.c +++ b/src/output/options.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2009, 2010, 2014 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -29,7 +29,6 @@ #include "output/driver-provider.h" #include "output/measure.h" -#include "gl/error.h" #include "gl/xalloc.h" #include "gettext.h" @@ -49,7 +48,7 @@ driver_option_create (const char *driver_name, const char *name, o->driver_name = xstrdup (driver_name); o->name = xstrdup (name); o->value = value != NULL ? xstrdup (value) : NULL; - o->default_value = xstrdup (default_value); + o->default_value = default_value ? xstrdup (default_value) : NULL; return o; } @@ -110,7 +109,7 @@ do_parse_boolean (const char *driver_name, const char *key, return false; else { - error (0, 0, _("%s: `%s' is `%s' but a Boolean value is required"), + msg (MW, _("%s: `%s' is `%s' but a Boolean value is required"), driver_name, value, key); return -1; } @@ -185,7 +184,7 @@ parse_enum (struct driver_option *o, ...) ds_put_format (&choices, "`%s'", s); } - error (0, 0, _("%s: `%s' is `%s' but one of the following " + msg (MW, _("%s: `%s' is `%s' but one of the following " "is required: %s"), o->driver_name, o->name, o->value, ds_cstr (&choices)); ds_destroy (&choices); @@ -229,22 +228,22 @@ parse_int (struct driver_option *o, int min_value, int max_value) else if (max_value == INT_MAX) { if (min_value == 0) - error (0, 0, _("%s: `%s' is `%s' but a nonnegative integer " + msg (MW, _("%s: `%s' is `%s' but a nonnegative integer " "is required"), o->driver_name, o->name, o->value); else if (min_value == 1) - error (0, 0, _("%s: `%s' is `%s' but a positive integer is " + msg (MW, _("%s: `%s' is `%s' but a positive integer is " "required"), o->driver_name, o->name, o->value); else if (min_value == INT_MIN) - error (0, 0, _("%s: `%s' is `%s' but an integer is required"), + msg (MW, _("%s: `%s' is `%s' but an integer is required"), o->driver_name, o->name, o->value); else - error (0, 0, _("%s: `%s' is `%s' but an integer greater " + msg (MW, _("%s: `%s' is `%s' but an integer greater " "than %d is required"), o->driver_name, o->name, o->value, min_value - 1); } else - error (0, 0, _("%s: `%s' is `%s' but an integer between %d and " + msg (MW, _("%s: `%s' is `%s' but an integer between %d and " "%d is required"), o->driver_name, o->name, o->value, min_value, max_value); } @@ -262,9 +261,9 @@ parse_dimension (struct driver_option *o) { int retval; - retval = o->value != NULL ? measure_dimension (o->value) : -1; - if (retval == -1) - retval = measure_dimension (o->default_value); + retval = (o->value != NULL ? measure_dimension (o->value) + : o->default_value != NULL ? measure_dimension (o->default_value) + : -1); driver_option_destroy (o); return retval; @@ -323,7 +322,7 @@ parse_chart_file_name (struct driver_option *o) chart_file_name = xstrdup (o->value); else { - error (0, 0, _("%s: `%s' is `%s' but a file name that contains " + msg (MW, _("%s: `%s' is `%s' but a file name that contains " "`#' is required."), o->name, o->value, o->driver_name); chart_file_name = default_chart_file_name (o->default_value);