X-Git-Url: http://pileus.org/git/?p=~andy%2Frsl;a=blobdiff_plain;f=examples%2Fwsr_hist_uf_test.c;h=c7b129ae054202b0eeba22370389c9caeb7a1135;hp=615b5726ea6fff99947d90c1bf877b25e82fdec8;hb=d08a7f8a699a044bc4ac5f93917aa7f6c463923b;hpb=0a59ff8412de3e114b7b5fd081a5fd39102542c1 diff --git a/examples/wsr_hist_uf_test.c b/examples/wsr_hist_uf_test.c index 615b572..c7b129a 100644 --- a/examples/wsr_hist_uf_test.c +++ b/examples/wsr_hist_uf_test.c @@ -20,19 +20,28 @@ #endif #include #include +#include #include "rsl.h" usage() { - fprintf(stderr,"Usage: wsr_hist_uf_test infile\n"); + fprintf(stderr,"Usage: wsr_hist_uf_test infile [-s site_id]\n"); exit(-1); } -process_args(int argc, char **argv, char **in_file) +process_args(int argc, char **argv, char **in_file, char **site) { - if (argc == 2) *in_file = strdup(argv[1]); + int c; + + while ((c = getopt(argc, argv, "s:")) != -1) + switch (c) { + case 's': *site = strdup(optarg); break; + case '?': usage(argv); break; + default: break; + } + if (argc - optind == 1) *in_file = strdup(argv[optind]); else usage(); } @@ -40,14 +49,15 @@ process_args(int argc, char **argv, char **in_file) main(int argc, char **argv) { char *infile; + char *site = NULL; Radar *radar; Histogram *histogram = NULL; - process_args(argc, argv, &infile); + process_args(argc, argv, &infile, &site); RSL_radar_verbose_on(); - if ((radar = RSL_anyformat_to_radar(infile, "KMLB")) == NULL) { + if ((radar = RSL_anyformat_to_radar(infile, site)) == NULL) { /* RSL_wsr88d_to_radar writes an error message to stdout. */ exit(-1); }