X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=utilities%2Fpspp-output.c;h=b3b4b57fa0fe42d2f9c88cebd462d8773a8bc85b;hb=833f9c6ce6e386f6b6b3451ba578d8e6899d7389;hp=4b9710a020bc1c3c24ddb7a08e22f8e60c511fb3;hpb=308c33df7c1be1edd6b2ebdf10b901fe05903438;p=pspp diff --git a/utilities/pspp-output.c b/utilities/pspp-output.c index 4b9710a020..b3b4b57fa0 100644 --- a/utilities/pspp-output.c +++ b/utilities/pspp-output.c @@ -77,7 +77,7 @@ static bool raw; static bool force; /* --table-look: TableLook to replace table style for conversion. */ -static struct spv_table_look *table_look; +static struct pivot_table_look *table_look; /* Number of warnings issued. */ static size_t n_warnings; @@ -355,15 +355,29 @@ run_get_table_look (int argc UNUSED, char **argv) if (!table) error (1, 0, "%s: no tables found", argv[1]); - struct spv_table_look *look = spv_table_look_get (table); - err = spv_table_look_write (argv[2], look); + err = spv_table_look_write (argv[2], pivot_table_get_look (table)); if (err) error (1, 0, "%s", err); - spv_table_look_destroy (look); spv_close (spv); } +static void +run_convert_table_look (int argc UNUSED, char **argv) +{ + struct pivot_table_look *look; + char *err = spv_table_look_read (argv[1], &look); + if (err) + error (1, 0, "%s", err); + + err = spv_table_look_write (argv[2], look); + if (err) + error (1, 0, "%s", err); + + pivot_table_look_uninit (look); + free (look); +} + static void run_dump (int argc UNUSED, char **argv) { @@ -712,6 +726,7 @@ static const struct command commands[] = { "dir", 1, 1, run_directory }, { "convert", 2, 2, run_convert }, { "get-table-look", 2, 2, run_get_table_look }, + { "convert-table-look", 2, 2, run_convert_table_look }, /* Undocumented commands. */ { "dump", 1, 1, run_dump }, @@ -793,7 +808,11 @@ main (int argc, char **argv) c->run (argc, argv); - spv_table_look_destroy (table_look); + if (table_look) + { + pivot_table_look_uninit (table_look); + free (table_look); + } i18n_done (); return n_warnings ? EXIT_FAILURE : EXIT_SUCCESS; @@ -923,7 +942,12 @@ parse_members (const char *arg) static void parse_table_look (const char *arg) { - spv_table_look_destroy (table_look); + if (table_look) + { + pivot_table_look_uninit (table_look); + free (table_look); + } + char *error_s = spv_table_look_read (arg, &table_look); if (error_s) error (1, 0, "%s", error_s); @@ -1094,6 +1118,7 @@ The following commands are available:\n\ dir FILE List tables and other items in FILE.\n\ convert SOURCE DEST Convert .spv SOURCE to DEST.\n\ get-table-look SOURCE DEST Copies first selected TableLook into DEST\n\ + convert-table-look SOURCE DEST Copies .tlo or .stt SOURCE into DEST\n\ \n\ Input selection options for \"dir\" and \"convert\":\n\ --select=CLASS... include only some kinds of objects\n\