projects
/
rrdtool.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix use of setlocale all over the place ...
[rrdtool.git]
/
src
/
rrd_create.c
diff --git
a/src/rrd_create.c
b/src/rrd_create.c
index
9a971cc
..
c8996ce
100644
(file)
--- a/
src/rrd_create.c
+++ b/
src/rrd_create.c
@@
-1,5
+1,5
@@
/*****************************************************************************
/*****************************************************************************
- * RRDtool 1.4.
2 Copyright by Tobi Oetiker, 1997-2009
+ * RRDtool 1.4.
3 Copyright by Tobi Oetiker, 1997-2010
*****************************************************************************
* rrd_create.c creates new rrds
*****************************************************************************/
*****************************************************************************
* rrd_create.c creates new rrds
*****************************************************************************/
@@
-13,6
+13,7
@@
#include "rrd_hw.h"
#include "rrd_is_thread_safe.h"
#include "rrd_hw.h"
#include "rrd_is_thread_safe.h"
+static int opt_no_overwrite = 0;
#ifdef WIN32
# include <process.h>
#ifdef WIN32
# include <process.h>
@@
-39,6
+40,7
@@
int rrd_create(
struct option long_options[] = {
{"start", required_argument, 0, 'b'},
{"step", required_argument, 0, 's'},
struct option long_options[] = {
{"start", required_argument, 0, 'b'},
{"step", required_argument, 0, 's'},
+ {"no-overwrite", no_argument, 0, 'O'},
{0, 0, 0, 0}
};
int option_index = 0;
{0, 0, 0, 0}
};
int option_index = 0;
@@
-54,7
+56,7
@@
int rrd_create(
opterr = 0; /* initialize getopt */
while (1) {
opterr = 0; /* initialize getopt */
while (1) {
- opt = getopt_long(argc, argv, "b:s:", long_options, &option_index);
+ opt = getopt_long(argc, argv, "
O
b:s:", long_options, &option_index);
if (opt == EOF)
break;
if (opt == EOF)
break;
@@
-90,6
+92,10
@@
int rrd_create(
pdp_step = long_tmp;
break;
pdp_step = long_tmp;
break;
+ case 'O':
+ opt_no_overwrite = 1;
+ break;
+
case '?':
if (optopt != 0)
rrd_set_error("unknown option '%c'", optopt);
case '?':
if (optopt != 0)
rrd_set_error("unknown option '%c'", optopt);
@@
-565,7
+571,8
@@
void parseGENERIC_DS(
&(rrd -> ds_def[ds_idx].par[DS_mrhb_cnt].u_cnt),
minstr,maxstr);
*/
&(rrd -> ds_def[ds_idx].par[DS_mrhb_cnt].u_cnt),
minstr,maxstr);
*/
- old_locale = setlocale(LC_NUMERIC, "C");
+ old_locale = setlocale(LC_NUMERIC, NULL);
+ setlocale(LC_NUMERIC, "C");
if (sscanf(def, "%lu:%18[^:]:%18[^:]",
&(rrd->ds_def[ds_idx].par[DS_mrhb_cnt].u_cnt),
minstr, maxstr) == 3) {
if (sscanf(def, "%lu:%18[^:]:%18[^:]",
&(rrd->ds_def[ds_idx].par[DS_mrhb_cnt].u_cnt),
minstr, maxstr) == 3) {
@@
-679,6
+686,10
@@
int rrd_create_fn(
rrd_t rrd_dn;
unsigned rrd_flags = RRD_READWRITE | RRD_CREAT;
rrd_t rrd_dn;
unsigned rrd_flags = RRD_READWRITE | RRD_CREAT;
+ if (opt_no_overwrite) {
+ rrd_flags |= RRD_EXCL ;
+ }
+
unkn_cnt = 0;
for (i = 0; i < rrd->stat_head->rra_cnt; i++)
unkn_cnt += rrd->stat_head->ds_cnt * rrd->rra_def[i].row_cnt;
unkn_cnt = 0;
for (i = 0; i < rrd->stat_head->rra_cnt; i++)
unkn_cnt += rrd->stat_head->ds_cnt * rrd->rra_def[i].row_cnt;