X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=utilities%2Fpspp-output.c;fp=utilities%2Fpspp-output.c;h=59c915dd443935e6eda189dfd6b6c12f76460adc;hb=d18d7a08733079d840b50cd52500703dd9dff4be;hp=f9f149bd6360299567a559d99b26b613a6860cdc;hpb=22203a0e0daa6b6ab247b572b191d25bb48f61a3;p=pspp diff --git a/utilities/pspp-output.c b/utilities/pspp-output.c index f9f149bd63..59c915dd44 100644 --- a/utilities/pspp-output.c +++ b/utilities/pspp-output.c @@ -346,20 +346,30 @@ get_first_table (const struct spv_reader *spv) static void run_get_table_look (int argc UNUSED, char **argv) { - struct spv_reader *spv; - char *err = spv_open (argv[1], &spv); - if (err) - error (1, 0, "%s", err); + struct pivot_table_look *look; + if (strcmp (argv[1], "-")) + { + struct spv_reader *spv; + char *err = spv_open (argv[1], &spv); + if (err) + error (1, 0, "%s", err); - const struct pivot_table *table = get_first_table (spv); - if (!table) - error (1, 0, "%s: no tables found", argv[1]); + const struct pivot_table *table = get_first_table (spv); + if (!table) + error (1, 0, "%s: no tables found", argv[1]); - err = spv_table_look_write (argv[2], pivot_table_get_look (table)); + look = pivot_table_look_ref (pivot_table_get_look (table)); + + spv_close (spv); + } + else + look = pivot_table_look_ref (pivot_table_look_builtin_default ()); + + char *err = spv_table_look_write (argv[2], look); if (err) error (1, 0, "%s", err); - spv_close (spv); + pivot_table_look_unref (look); } static void