From: oetiker Date: Sun, 1 May 2005 10:23:11 +0000 (+0000) Subject: reset optind opterr inside the function calls ... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=96de82bed4332665ef0c25a2f8d96d574b64b47a;p=rrdtool-all.git reset optind opterr inside the function calls ... git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2@460 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/program/bindings/perl-shared/RRDs.xs b/program/bindings/perl-shared/RRDs.xs index 217482ce..f7e5360f 100644 --- a/program/bindings/perl-shared/RRDs.xs +++ b/program/bindings/perl-shared/RRDs.xs @@ -29,7 +29,6 @@ extern "C" { argv[i+1] = (char *) malloc((strlen(handle)+1)*sizeof(char)); \ strcpy(argv[i+1],handle); \ } \ - optind=0; opterr=0; \ rrd_clear_error();\ RETVAL=name(items+1,argv); \ for (i=0; i < items; i++) {\ @@ -53,7 +52,6 @@ extern "C" { argv[i+1] = (char *) malloc((strlen(handle)+1)*sizeof(char)); \ strcpy(argv[i+1],handle); \ } \ - optind=0; opterr=0; \ rrd_clear_error(); \ data=name(items+1, argv); \ for (i=0; i < items; i++) { \ @@ -203,7 +201,6 @@ rrd_graph(...) argv[i+1] = (char *) malloc((strlen(handle)+1)*sizeof(char)); strcpy(argv[i+1],handle); } - optind=0; opterr=0; rrd_clear_error(); rrd_graph(items+1,argv,&calcpr,&xsize,&ysize,NULL,&ymin,&ymax); for (i=0; i < items; i++) { @@ -251,7 +248,6 @@ rrd_fetch(...) argv[i+1] = (char *) malloc((strlen(handle)+1)*sizeof(char)); strcpy(argv[i+1],handle); } - optind=0; opterr=0; rrd_clear_error(); rrd_fetch(items+1,argv,&start,&end,&step,&ds_cnt,&ds_namv,&data); for (i=0; i < items; i++) { @@ -330,7 +326,6 @@ rrd_xport(...) argv[i+1] = (char *) malloc((strlen(handle)+1)*sizeof(char)); strcpy(argv[i+1],handle); } - optind=0; opterr=0; rrd_clear_error(); rrd_xport(items+1,argv,&xsize,&start,&end,&step,&col_cnt,&legend_v,&data); for (i=0; i < items; i++) { diff --git a/program/src/rrd_cgi.c b/program/src/rrd_cgi.c index 51e4c1c9..ee46d5e5 100644 --- a/program/src/rrd_cgi.c +++ b/program/src/rrd_cgi.c @@ -266,6 +266,8 @@ int main(int argc, char *argv[]) { #ifdef MUST_DISABLE_FPMASK fpsetmask(0); #endif + optind = 0; opterr = 0; /* initialize getopt */ + /* what do we get for cmdline arguments? for (i=0;i"; } - optind=0; /* reset gnu getopt */ - opterr=0; /* reset gnu getopt */ calfree(); if( rrd_graph(argc+1, args-1, &calcpr, &xsize, &ysize,NULL,&ymin,&ymax) != -1 ) { return stralloc(calcpr[0]); diff --git a/program/src/rrd_create.c b/program/src/rrd_create.c index bb32a3ec..95dbc143 100644 --- a/program/src/rrd_create.c +++ b/program/src/rrd_create.c @@ -23,6 +23,7 @@ rrd_create(int argc, char **argv) char *parsetime_error = NULL; long long_tmp; int rc; + optind = 0; opterr = 0; /* initialize getopt */ while (1){ static struct option long_options[] = diff --git a/program/src/rrd_fetch.c b/program/src/rrd_fetch.c index c5a73a33..74ab7304 100644 --- a/program/src/rrd_fetch.c +++ b/program/src/rrd_fetch.c @@ -75,6 +75,7 @@ rrd_fetch(int argc, struct rrd_time_value start_tv, end_tv; char *parsetime_error = NULL; + optind = 0; opterr = 0; /* initialize getopt */ /* init start and end time */ parsetime("end-24h", &start_tv); diff --git a/program/src/rrd_first.c b/program/src/rrd_first.c index ab3bd497..eee81408 100644 --- a/program/src/rrd_first.c +++ b/program/src/rrd_first.c @@ -14,6 +14,7 @@ rrd_first(int argc, char **argv) { int target_rraindex=0; char *endptr; + optind = 0; opterr = 0; /* initialize getopt */ while (1){ static struct option long_options[] = @@ -23,6 +24,7 @@ rrd_first(int argc, char **argv) }; int option_index = 0; int opt; + optind = 0; opterr = 0; /* initialize getopt */ opt = getopt_long(argc, argv, "", long_options, &option_index); if(opt == EOF) diff --git a/program/src/rrd_graph.c b/program/src/rrd_graph.c index dc21548d..5efe8275 100644 --- a/program/src/rrd_graph.c +++ b/program/src/rrd_graph.c @@ -2673,7 +2673,6 @@ int rrd_graph(int argc, char **argv, char ***prdata, int *xsize, int *ysize, FILE *stream, double *ymin, double *ymax) { image_desc_t im; - rrd_graph_init(&im); im.graphhandle = stream; @@ -2832,6 +2831,7 @@ rrd_graph_options(int argc, char *argv[],image_desc_t *im) long long_tmp; struct rrd_time_value start_tv, end_tv; gfx_color_t color; + optind = 0; opterr = 0; /* initialize getopt */ parsetime("end-24h", &start_tv); parsetime("now", &end_tv); diff --git a/program/src/rrd_restore.c b/program/src/rrd_restore.c index a3d09adb..4ca223ab 100644 --- a/program/src/rrd_restore.c +++ b/program/src/rrd_restore.c @@ -488,6 +488,7 @@ rrd_restore(int argc, char **argv) char force_overwrite = 0; /* init rrd clean */ + optind = 0; opterr = 0; /* initialize getopt */ rrd_init(&rrd); if (argc<3) { rrd_set_error("usage rrdtool %s [--range-check/-r] [--force-overwrite/-f] file.xml file.rrd",argv[0]); diff --git a/program/src/rrd_tool.c b/program/src/rrd_tool.c index cc178fb6..46a9e9c6 100644 --- a/program/src/rrd_tool.c +++ b/program/src/rrd_tool.c @@ -416,8 +416,6 @@ int HandleInputLine(int argc, char **argv, FILE* out) #if defined(HAVE_SYS_STAT_H) struct stat st; #endif - optind=0; /* reset gnu getopt */ - opterr=0; /* no error messages */ if (RemoteMode){ if (argc>1 && strcmp("quit", argv[1]) == 0){ diff --git a/program/src/rrd_tune.c b/program/src/rrd_tune.c index 94d92930..7e2ac91e 100644 --- a/program/src/rrd_tune.c +++ b/program/src/rrd_tune.c @@ -61,6 +61,7 @@ rrd_tune(int argc, char **argv) double min; double max; char dst[DST_SIZE]; + optind = 0; opterr = 0; /* initialize getopt */ if(rrd_open(argv[1],&rrd_file,&rrd, RRD_READWRITE)==-1){ diff --git a/program/src/rrd_update.c b/program/src/rrd_update.c index a67a93a1..11d92bb5 100644 --- a/program/src/rrd_update.c +++ b/program/src/rrd_update.c @@ -109,6 +109,7 @@ info_t *rrd_update_v(int argc, char **argv) char *template = NULL; info_t *result = NULL; infoval rc; + optind = 0; opterr = 0; /* initialize getopt */ while (1) { static struct option long_options[] = @@ -155,6 +156,7 @@ rrd_update(int argc, char **argv) { char *template = NULL; int rc; + optind = 0; opterr = 0; /* initialize getopt */ while (1) { static struct option long_options[] = diff --git a/program/src/rrd_xport.c b/program/src/rrd_xport.c index 2a0bf760..19c2067a 100644 --- a/program/src/rrd_xport.c +++ b/program/src/rrd_xport.c @@ -46,6 +46,7 @@ rrd_xport(int argc, char **argv, int *xsize, time_t start_tmp=0,end_tmp=0; struct rrd_time_value start_tv, end_tv; char *parsetime_error = NULL; + optind = 0; opterr = 0; /* initialize getopt */ rrd_graph_init(&im);