X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Foptions.c;h=43a0f1c0b895ca3aa16f93699703d298d0a3656e;hb=f8cba0fb13cceeac43fe4b15e2d5b48798ab1a6e;hp=b8921255d3b08e59b592021b7a025f59f7af1e38;hpb=e2da62d735c597afeef2e0e9b36e5a4a83d7da94;p=pspp diff --git a/src/output/options.c b/src/output/options.c index b8921255d3..43a0f1c0b8 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 @@ -48,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; } @@ -228,7 +228,7 @@ parse_int (struct driver_option *o, int min_value, int max_value) else if (max_value == INT_MAX) { if (min_value == 0) - msg (MW, _("%s: `%s' is `%s' but a nonnegative integer " + msg (MW, _("%s: `%s' is `%s' but a non-negative integer " "is required"), o->driver_name, o->name, o->value); else if (min_value == 1) @@ -261,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; @@ -288,7 +288,7 @@ default_chart_file_name (const char *file_name) { const char *extension = strrchr (file_name, '.'); int stem_length = extension ? extension - file_name : strlen (file_name); - return xasprintf ("%.*s-#.png", stem_length, file_name); + return xasprintf ("%.*s-#", stem_length, file_name); } else return NULL;