From 1e7fb61700f1f6f2ed5fdbc4380d7187b0cd187b Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 21 Nov 2009 21:09:03 -0800 Subject: [PATCH] Fix --plot arg handling. Add -all option. The --plot file name handing is special as the library wants a filename instead of a stdio file pointer. Add a --all option that just creates all of the possible outputs. Signed-off-by: Keith Packard --- ao-tools/ao-postflight/ao-postflight.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/ao-tools/ao-postflight/ao-postflight.c b/ao-tools/ao-postflight/ao-postflight.c index 7cedaa5b..ed91be15 100644 --- a/ao-tools/ao-postflight/ao-postflight.c +++ b/ao-tools/ao-postflight/ao-postflight.c @@ -451,12 +451,14 @@ static const struct option options[] = { { .name = "raw", .has_arg = 2, .val = 'r' }, { .name = "gps", .has_arg = 2, .val = 'g' }, { .name = "kml", .has_arg = 2, .val = 'k' }, + { .name = "all", .has_arg = 0, .val = 'a' }, { 0, 0, 0, 0}, }; static void usage(char *program) { fprintf(stderr, "usage: %s\n" + "\t[--all] [-a]\n" "\t[--summary=] [-s ]\n" "\t[--detail=]\n" "\t[--raw= -r serial) raw->serial = serial; - analyse_flight(raw, summary_file, detail_file, raw_file, plot_name, gps_file, kml_file); + analyse_flight(raw, summary_file, detail_file, raw_file, this_plot_name, gps_file, kml_file); cc_flightraw_free(raw); if (has_summary && !summary_name) { fclose(summary_file); summary_file = NULL; @@ -606,7 +618,10 @@ main (int argc, char **argv) if (has_detail && !detail_name) { fclose(detail_file); detail_file = NULL; } - if (has_summary && !raw_name) { + if (this_plot_name && this_plot_name != plot_name) { + free (this_plot_name); this_plot_name = NULL; + } + if (has_raw && !raw_name) { fclose(raw_file); raw_file = NULL; } if (has_gps && !gps_name) { -- 2.30.2