X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Fdriver.c;h=f656845527f4603937ebd02d6698a37865b041cf;hb=319a66b560b7ca7144b88ced1982ba5e490e6e57;hp=c0a525edae2f4963c3b34067c8c8f474b5b1a017;hpb=fe8dc2171009e90d2335f159d05f7e6660e24780;p=pspp diff --git a/src/output/driver.c b/src/output/driver.c index c0a525edae..f656845527 100644 --- a/src/output/driver.c +++ b/src/output/driver.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2007, 2009, 2010, 2011 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2007, 2009, 2010, 2011, 2012 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 @@ -235,7 +235,7 @@ extern const struct output_driver_factory txt_driver_factory; extern const struct output_driver_factory list_driver_factory; extern const struct output_driver_factory html_driver_factory; extern const struct output_driver_factory csv_driver_factory; -#ifdef ODT_SUPPORT +#ifdef ODF_WRITE_SUPPORT extern const struct output_driver_factory odt_driver_factory; #endif #ifdef HAVE_CAIRO @@ -250,7 +250,7 @@ static const struct output_driver_factory *factories[] = &list_driver_factory, &html_driver_factory, &csv_driver_factory, -#ifdef ODT_SUPPORT +#ifdef ODF_WRITE_SUPPORT &odt_driver_factory, #endif #ifdef HAVE_CAIRO @@ -294,16 +294,23 @@ output_driver_create (struct string_map *options) char *file_name; char *format; + format = string_map_find_and_delete (options, "format"); file_name = string_map_find_and_delete (options, "output-file"); - if (file_name == NULL) - file_name = xstrdup ("-"); - format = string_map_find_and_delete (options, "format"); if (format == NULL) { - const char *extension = strrchr (file_name, '.'); - format = xstrdup (extension != NULL ? extension + 1 : ""); + if (file_name != NULL) + { + const char *extension = strrchr (file_name, '.'); + format = xstrdup (extension != NULL ? extension + 1 : ""); + } + else + format = xstrdup ("txt"); } + f = find_factory (format); + + if (file_name == NULL) + file_name = xstrdup (f->default_file_name); /* XXX should use parse_enum(). */ device_string = string_map_find_and_delete (options, "device"); @@ -315,13 +322,11 @@ output_driver_create (struct string_map *options) device_type = SETTINGS_DEVICE_LISTING; else { - /* TRANSLATORS: Don't translate the words `terminal' or `listing'. */ - error (0, 0, _("%s is not a valid device type (the choices are " - "`terminal' and `listing')"), device_string); + error (0, 0, _("%s is not a valid device type (the choices are `%s' and `%s')"), + device_string, "terminal", "listing"); device_type = default_device_type (file_name); } - f = find_factory (format); driver = f->create (file_name, device_type, options); if (driver != NULL) {