"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/cfg.c" between
vnstat-2.7.tar.gz and vnstat-2.8.tar.gz

About: vnStat is a console-based network traffic monitor (using the /proc filesystem).

cfg.c  (vnstat-2.7):cfg.c  (vnstat-2.8)
#include "common.h" #include "common.h"
#include "cfg.h" #include "cfg.h"
int loadcfg(const char *cfgfile) int loadcfg(const char *cfgfile, const ConfigType type)
{ {
FILE *fd; FILE *fd;
int i; int i;
unsigned int linelen, cfglen; unsigned int linelen, cfglen;
char value[512], cfgline[512]; char value[512], cfgline[512];
struct cfgsetting cset[] = struct cfgsetting cset[] =
{/* cfg string, char var name, int var name, char len, fill statu s */ {/* cfg string, char var name, int var name, char len, fill statu s */
{"Interface", cfg.iface, 0, 32, 0}, {"Interface", cfg.iface, 0, 32, 0},
skipping to change at line 60 skipping to change at line 60
{"MonthlyMonths", 0, &cfg.monthlymonths, 0, 0}, {"MonthlyMonths", 0, &cfg.monthlymonths, 0, 0},
{"YearlyYears", 0, &cfg.yearlyyears, 0, 0}, {"YearlyYears", 0, &cfg.yearlyyears, 0, 0},
{"TopDayEntries", 0, &cfg.topdayentries, 0, 0}, {"TopDayEntries", 0, &cfg.topdayentries, 0, 0},
{"DaemonUser", cfg.daemonuser, 0, 33, 0}, {"DaemonUser", cfg.daemonuser, 0, 33, 0},
{"DaemonGroup", cfg.daemongroup, 0, 33, 0}, {"DaemonGroup", cfg.daemongroup, 0, 33, 0},
{"TimeSyncWait", 0, &cfg.timesyncwait, 0, 0}, {"TimeSyncWait", 0, &cfg.timesyncwait, 0, 0},
{"UpdateInterval", 0, &cfg.updateinterval, 0, 0}, {"UpdateInterval", 0, &cfg.updateinterval, 0, 0},
{"PollInterval", 0, &cfg.pollinterval, 0, 0}, {"PollInterval", 0, &cfg.pollinterval, 0, 0},
{"SaveInterval", 0, &cfg.saveinterval, 0, 0}, {"SaveInterval", 0, &cfg.saveinterval, 0, 0},
{"OfflineSaveInterval", 0, &cfg.offsaveinterval, 0, 0}, {"OfflineSaveInterval", 0, &cfg.offsaveinterval, 0, 0},
{"AlwaysAddNewInterfaces", 0, &cfg.alwaysadd, 0, 0},
{"BandwidthDetectionInterval", 0, &cfg.bwdetectioninterval, 0, 0 }, {"BandwidthDetectionInterval", 0, &cfg.bwdetectioninterval, 0, 0 },
{"SaveOnStatusChange", 0, &cfg.savestatus, 0, 0}, {"SaveOnStatusChange", 0, &cfg.savestatus, 0, 0},
{"UseLogging", 0, &cfg.uselogging, 0, 0}, {"UseLogging", 0, &cfg.uselogging, 0, 0},
{"CreateDirs", 0, &cfg.createdirs, 0, 0}, {"CreateDirs", 0, &cfg.createdirs, 0, 0},
{"UpdateFileOwner", 0, &cfg.updatefileowner, 0, 0}, {"UpdateFileOwner", 0, &cfg.updatefileowner, 0, 0},
{"LogFile", cfg.logfile, 0, 512, 0}, {"LogFile", cfg.logfile, 0, 512, 0},
{"PidFile", cfg.pidfile, 0, 512, 0}, {"PidFile", cfg.pidfile, 0, 512, 0},
{"64bitInterfaceCounters", 0, &cfg.is64bit, 0, 0}, {"64bitInterfaceCounters", 0, &cfg.is64bit, 0, 0},
{"DatabaseWriteAheadLogging", 0, &cfg.waldb, 0, 0}, {"DatabaseWriteAheadLogging", 0, &cfg.waldb, 0, 0},
{"DatabaseSynchronous", 0, &cfg.dbsynchronous, 0, 0}, {"DatabaseSynchronous", 0, &cfg.dbsynchronous, 0, 0},
{"UseUTC", 0, &cfg.useutc, 0, 0},
{"HeaderFormat", cfg.hformat, 0, 64, 0}, {"HeaderFormat", cfg.hformat, 0, 64, 0},
{"HourlyRate", 0, &cfg.hourlyrate, 0, 0}, {"HourlyRate", 0, &cfg.hourlyrate, 0, 0},
{"SummaryRate", 0, &cfg.summaryrate, 0, 0}, {"SummaryRate", 0, &cfg.summaryrate, 0, 0},
{"TransparentBg", 0, &cfg.transbg, 0, 0}, {"TransparentBg", 0, &cfg.transbg, 0, 0},
{"LargeFonts", 0, &cfg.largefonts, 0, 0}, {"LargeFonts", 0, &cfg.largefonts, 0, 0},
{"LineSpacingAdjustment", 0, &cfg.linespaceadjust, 0, 0}, {"LineSpacingAdjustment", 0, &cfg.linespaceadjust, 0, 0},
{"ImageScale", 0, &cfg.imagescale, 0, 0}, {"ImageScale", 0, &cfg.imagescale, 0, 0},
{"5MinuteGraphResultCount", 0, &cfg.fivegresultcount, 0, 0}, {"5MinuteGraphResultCount", 0, &cfg.fivegresultcount, 0, 0},
{"5MinuteGraphHeight", 0, &cfg.fivegheight, 0, 0}, {"5MinuteGraphHeight", 0, &cfg.fivegheight, 0, 0},
{"SummaryGraph", 0, &cfg.summarygraph, 0, 0}, {"SummaryGraph", 0, &cfg.summarygraph, 0, 0},
skipping to change at line 152 skipping to change at line 154
break; break;
} }
if ((debug) && (!cset[i].found) && (strncasecmp(cfgline, "MaxBW", 5) != 0)) if ((debug) && (!cset[i].found) && (strncasecmp(cfgline, "MaxBW", 5) != 0))
printf("Unknown configuration line: %s", cfgline); printf("Unknown configuration line: %s", cfgline);
} }
fclose(fd); fclose(fd);
/* validate config */ /* validate config */
validatecfg(); validatecfg(type);
return 1; return 1;
} }
void validatebool(const char *cfgname, int32_t *cfgptr, const int32_t defaultval ue) void validatebool(const char *cfgname, int32_t *cfgptr, const int32_t defaultval ue)
{ {
validateint(cfgname, cfgptr, defaultvalue, 0, 1); validateint(cfgname, cfgptr, defaultvalue, 0, 1);
} }
void validateint(const char *cfgname, int32_t *cfgptr, const int32_t defaultvalu e, const int32_t minvalue, const int32_t maxvalue) void validateint(const char *cfgname, int32_t *cfgptr, const int32_t defaultvalu e, const int32_t minvalue, const int32_t maxvalue)
{ {
if (maxvalue > minvalue) { if (maxvalue > minvalue) {
if (*cfgptr < minvalue || *cfgptr > maxvalue) { if (*cfgptr < minvalue || *cfgptr > maxvalue) {
*cfgptr = defaultvalue; snprintf(errorstring, 1024, "Invalid value \"%d\" for %s.
snprintf(errorstring, 1024, "Invalid value for %s, resett Value needs to be between %d and %d. Using default value %d.", *cfgptr, cfgname
ing to \"%d\".", cfgname, *cfgptr); , minvalue, maxvalue, defaultvalue);
printe(PT_Config); printe(PT_Config);
*cfgptr = defaultvalue;
} }
} else { } else {
if (*cfgptr < minvalue) { if (*cfgptr < minvalue) {
*cfgptr = defaultvalue; snprintf(errorstring, 1024, "Invalid value \"%d\" for %s.
snprintf(errorstring, 1024, "Invalid value for %s, resett Value needs to be at least %d. Using default value %d.", *cfgptr, cfgname, minv
ing to \"%d\".", cfgname, *cfgptr); alue, defaultvalue);
printe(PT_Config); printe(PT_Config);
*cfgptr = defaultvalue;
} }
} }
} }
void validatecfg(void) void validatecfg(const ConfigType type)
{ {
uint32_t rolloversecs; uint32_t rolloversecs;
const char *invalidvalue = "Invalid value for"; const char *invalidvalue = "Invalid value for";
const char *resettingto = "resetting to"; const char *resettingto = "using default value";
const char *noslashstart = "doesn't start with \"/\", resetting to defaul const char *noslashstart = "doesn't start with \"/\", using default value
t."; instead.";
validateint("UnitMode", &cfg.unitmode, UNITMODE, 0, 2); validateint("UnitMode", &cfg.unitmode, UNITMODE, 0, 2);
validatebool("RateUnitMode", &cfg.rateunitmode, RATEUNITMODE); validatebool("RateUnitMode", &cfg.rateunitmode, RATEUNITMODE);
validateint("OutputStyle", &cfg.ostyle, OSTYLE, 0, 3); validateint("OutputStyle", &cfg.ostyle, OSTYLE, 0, 3);
validatebool("EstimateBarVisible", &cfg.estimatebarvisible, ESTIMATEBARVI SIBLE); validatebool("EstimateBarVisible", &cfg.estimatebarvisible, ESTIMATEBARVI SIBLE);
validateint("DefaultDecimals", &cfg.defaultdecimals, DEFAULTDECIMALS, 0, 2); validateint("DefaultDecimals", &cfg.defaultdecimals, DEFAULTDECIMALS, 0, 2);
validateint("HourlyDecimals", &cfg.hourlydecimals, HOURLYDECIMALS, 0, 2); validateint("HourlyDecimals", &cfg.hourlydecimals, HOURLYDECIMALS, 0, 2);
validateint("HourlySectionStyle", &cfg.hourlystyle, HOURLYSTYLE, 0, 3); validateint("HourlySectionStyle", &cfg.hourlystyle, HOURLYSTYLE, 0, 3);
validateint("BootVariation", &cfg.bvar, BVAR, 0, 300); validateint("BootVariation", &cfg.bvar, BVAR, 0, 300);
validateint("Sampletime", &cfg.sampletime, DEFSAMPTIME, 2, 600); validateint("Sampletime", &cfg.sampletime, DEFSAMPTIME, 2, 600);
skipping to change at line 208 skipping to change at line 210
validatebool("CheckDiskSpace", &cfg.spacecheck, USESPACECHECK); validatebool("CheckDiskSpace", &cfg.spacecheck, USESPACECHECK);
validateint("TimeSyncWait", &cfg.timesyncwait, TIMESYNCWAIT, 0, 60); validateint("TimeSyncWait", &cfg.timesyncwait, TIMESYNCWAIT, 0, 60);
validateint("PollInterval", &cfg.pollinterval, POLLINTERVAL, 2, 60); validateint("PollInterval", &cfg.pollinterval, POLLINTERVAL, 2, 60);
validatebool("SaveOnStatusChange", &cfg.savestatus, SAVESTATUS); validatebool("SaveOnStatusChange", &cfg.savestatus, SAVESTATUS);
validateint("UseLogging", &cfg.uselogging, USELOGGING, 0, 2); validateint("UseLogging", &cfg.uselogging, USELOGGING, 0, 2);
validateint("CreateDirs", &cfg.createdirs, CREATEDIRS, 0, 2); validateint("CreateDirs", &cfg.createdirs, CREATEDIRS, 0, 2);
validateint("UpdateFileOwner", &cfg.updatefileowner, UPDATEFILEOWNER, 0, 2); validateint("UpdateFileOwner", &cfg.updatefileowner, UPDATEFILEOWNER, 0, 2);
validateint("64bitInterfaceCounters", &cfg.is64bit, IS64BIT, -2, 1); validateint("64bitInterfaceCounters", &cfg.is64bit, IS64BIT, -2, 1);
validatebool("DatabaseWriteAheadLogging", &cfg.waldb, WALDB); validatebool("DatabaseWriteAheadLogging", &cfg.waldb, WALDB);
validateint("DatabaseSynchronous", &cfg.dbsynchronous, DBSYNCHRONOUS, -1, 3); validateint("DatabaseSynchronous", &cfg.dbsynchronous, DBSYNCHRONOUS, -1, 3);
validatebool("TransparentBg", &cfg.transbg, TRANSBG); validatebool("UseUTC", &cfg.useutc, USEUTC);
validatebool("LargeFonts", &cfg.largefonts, LARGEFONTS); if (type == CT_Image || type == CT_All) {
validateint("LineSpacingAdjustment", &cfg.linespaceadjust, LINESPACEADJUS validatebool("TransparentBg", &cfg.transbg, TRANSBG);
T, -5, 10); validatebool("LargeFonts", &cfg.largefonts, LARGEFONTS);
validateint("ImageScale", &cfg.imagescale, IMAGESCALE, 50, 500); validateint("LineSpacingAdjustment", &cfg.linespaceadjust, LINESP
validateint("5MinuteGraphResultCount", &cfg.fivegresultcount, FIVEGRESULT ACEADJUST, -5, 10);
COUNT, FIVEGMINRESULTCOUNT, 2000); validateint("ImageScale", &cfg.imagescale, IMAGESCALE, 50, 500);
validateint("5MinuteGraphHeight", &cfg.fivegheight, FIVEGHEIGHT, FIVEGMIN validateint("5MinuteGraphResultCount", &cfg.fivegresultcount, FIV
HEIGHT, 2000); EGRESULTCOUNT, FIVEGMINRESULTCOUNT, 2000);
validatebool("SummaryGraph", &cfg.summarygraph, SUMMARYGRAPH); validateint("5MinuteGraphHeight", &cfg.fivegheight, FIVEGHEIGHT,
validateint("EstimateStyle", &cfg.estimatestyle, ESTIMATESTYLE, 0, 2); FIVEGMINHEIGHT, 2000);
validatebool("BarColumnShowsRate", &cfg.barshowsrate, BARSHOWSRATE); validatebool("SummaryGraph", &cfg.summarygraph, SUMMARYGRAPH);
validatebool("HourlyRate", &cfg.hourlyrate, HOURLYRATE); validateint("EstimateStyle", &cfg.estimatestyle, ESTIMATESTYLE, 0
validatebool("SummaryRate", &cfg.summaryrate, SUMMARYRATE); , 2);
validatebool("BarColumnShowsRate", &cfg.barshowsrate, BARSHOWSRAT
E);
validatebool("HourlyRate", &cfg.hourlyrate, HOURLYRATE);
validatebool("SummaryRate", &cfg.summaryrate, SUMMARYRATE);
}
validatebool("TrafficlessEntries", &cfg.trafficlessentries, TRAFFICLESSEN TRIES); validatebool("TrafficlessEntries", &cfg.trafficlessentries, TRAFFICLESSEN TRIES);
validateint("List5Mins", &cfg.listfivemins, LISTFIVEMINS, 0, 0); validateint("List5Mins", &cfg.listfivemins, LISTFIVEMINS, 0, 0);
validateint("ListHours", &cfg.listhours, LISTHOURS, 0, 0); validateint("ListHours", &cfg.listhours, LISTHOURS, 0, 0);
validateint("ListDays", &cfg.listdays, LISTDAYS, 0, 0); validateint("ListDays", &cfg.listdays, LISTDAYS, 0, 0);
validateint("ListMonths", &cfg.listmonths, LISTMONTHS, 0, 0); validateint("ListMonths", &cfg.listmonths, LISTMONTHS, 0, 0);
validateint("ListYears", &cfg.listyears, LISTYEARS, 0, 0); validateint("ListYears", &cfg.listyears, LISTYEARS, 0, 0);
validateint("ListTop", &cfg.listtop, LISTTOP, 0, 0); validateint("ListTop", &cfg.listtop, LISTTOP, 0, 0);
validateint("5MinuteHours", &cfg.fiveminutehours, FIVEMINUTEHOURS, -1, -1 ); validateint("5MinuteHours", &cfg.fiveminutehours, FIVEMINUTEHOURS, -1, -1 );
validateint("HourlyDays", &cfg.hourlydays, HOURLYDAYS, -1, -1); validateint("HourlyDays", &cfg.hourlydays, HOURLYDAYS, -1, -1);
validateint("DailyDays", &cfg.dailydays, DAILYDAYS, -1, -1); validateint("DailyDays", &cfg.dailydays, DAILYDAYS, -1, -1);
validateint("MonthlyMonths", &cfg.monthlymonths, MONTHLYMONTHS, -1, -1); validateint("MonthlyMonths", &cfg.monthlymonths, MONTHLYMONTHS, -1, -1);
validateint("YearlyYears", &cfg.yearlyyears, YEARLYYEARS, -1, -1); validateint("YearlyYears", &cfg.yearlyyears, YEARLYYEARS, -1, -1);
validateint("TopDayEntries", &cfg.topdayentries, TOPDAYENTRIES, -1, -1); validateint("TopDayEntries", &cfg.topdayentries, TOPDAYENTRIES, -1, -1);
validatebool("BandwidthDetection", &cfg.bwdetection, BWDETECT); validatebool("BandwidthDetection", &cfg.bwdetection, BWDETECT);
validateint("BandwidthDetectionInterval", &cfg.bwdetectioninterval, BWDET ECTINTERVAL, 0, 30); validateint("BandwidthDetectionInterval", &cfg.bwdetectioninterval, BWDET ECTINTERVAL, 0, 30);
validatebool("Experimental", &cfg.experimental, 0); validatebool("Experimental", &cfg.experimental, 0);
if (cfg.useutc) {
strncpy_nt(cfg.dbtzmodifier, "", 14);
} else {
strncpy_nt(cfg.dbtzmodifier, DATABASELOCALTIMEMODIFIER, 14);
}
if (cfg.dbdir[0] != '/') { if (cfg.dbdir[0] != '/') {
strncpy_nt(cfg.dbdir, DATABASEDIR, 512); strncpy_nt(cfg.dbdir, DATABASEDIR, 512);
snprintf(errorstring, 1024, "DatabaseDir %s", noslashstart); snprintf(errorstring, 1024, "DatabaseDir %s", noslashstart);
printe(PT_Config); printe(PT_Config);
} }
if (cfg.logfile[0] != '/') { if (cfg.logfile[0] != '/') {
strncpy_nt(cfg.logfile, LOGFILE, 512); strncpy_nt(cfg.logfile, LOGFILE, 512);
snprintf(errorstring, 1024, "LogFile %s", noslashstart); snprintf(errorstring, 1024, "LogFile %s", noslashstart);
printe(PT_Config); printe(PT_Config);
} }
if (cfg.pidfile[0] != '/') { if (cfg.pidfile[0] != '/') {
strncpy_nt(cfg.pidfile, PIDFILE, 512); strncpy_nt(cfg.pidfile, PIDFILE, 512);
snprintf(errorstring, 1024, "PidFile %s", noslashstart); snprintf(errorstring, 1024, "PidFile %s", noslashstart);
printe(PT_Config); printe(PT_Config);
} }
if (cfg.updateinterval < cfg.pollinterval || cfg.updateinterval > 300) { if (type == CT_Daemon || type == CT_All) {
if (cfg.pollinterval > UPDATEINTERVAL) { validatebool("RescanDatabaseOnSave", &cfg.rescanonsave, RESCANONS
cfg.updateinterval = cfg.pollinterval; AVE);
} else { validatebool("AlwaysAddNewInterfaces", &cfg.alwaysadd, ALWAYSADD)
cfg.updateinterval = UPDATEINTERVAL; ;
if (cfg.updateinterval < cfg.pollinterval || cfg.updateinterval >
300) {
if (cfg.pollinterval > UPDATEINTERVAL) {
cfg.updateinterval = cfg.pollinterval;
} else {
cfg.updateinterval = UPDATEINTERVAL;
}
snprintf(errorstring, 1024, "%s UpdateInterval, %s %d.",
invalidvalue, resettingto, cfg.updateinterval);
printe(PT_Config);
} }
snprintf(errorstring, 1024, "%s UpdateInterval, %s \"%d\".", inva
lidvalue, resettingto, cfg.updateinterval);
printe(PT_Config);
}
if ((cfg.saveinterval * 60) < cfg.updateinterval || cfg.saveinterval > 60 if ((cfg.saveinterval * 60) < cfg.updateinterval || cfg.saveinter
) { val > 60) {
if (cfg.updateinterval > (SAVEINTERVAL * 60)) { if (cfg.updateinterval > (SAVEINTERVAL * 60)) {
cfg.saveinterval = cfg.updateinterval; cfg.saveinterval = cfg.updateinterval;
} else { } else {
cfg.saveinterval = SAVEINTERVAL; cfg.saveinterval = SAVEINTERVAL;
}
snprintf(errorstring, 1024, "%s SaveInterval, %s %d.", in
validvalue, resettingto, cfg.saveinterval);
printe(PT_Config);
} }
snprintf(errorstring, 1024, "%s SaveInterval, %s \"%d\".", invali
dvalue, resettingto, cfg.saveinterval);
printe(PT_Config);
}
if (cfg.offsaveinterval < cfg.saveinterval || cfg.offsaveinterval > 60) { if (cfg.offsaveinterval < cfg.saveinterval || cfg.offsaveinterval
if (cfg.saveinterval > OFFSAVEINTERVAL) { > 60) {
cfg.offsaveinterval = cfg.saveinterval; if (cfg.saveinterval > OFFSAVEINTERVAL) {
} else { cfg.offsaveinterval = cfg.saveinterval;
cfg.offsaveinterval = OFFSAVEINTERVAL; } else {
cfg.offsaveinterval = OFFSAVEINTERVAL;
}
snprintf(errorstring, 1024, "%s OfflineSaveInterval, %s %
d.", invalidvalue, resettingto, cfg.offsaveinterval);
printe(PT_Config);
} }
snprintf(errorstring, 1024, "%s OfflineSaveInterval, %s \"%d\".",
invalidvalue, resettingto, cfg.offsaveinterval);
printe(PT_Config);
}
/* enforce update interval to be short enough that 32-bit interface count /* enforce update interval to be short enough that 32-bit interfa
er rollover can be detected */ ce counter rollover can be detected */
/* 1.02 is the same 2% safety buffer as used in processifinfo() in daemon /* 1.02 is the same 2% safety buffer as used in processifinfo() i
.c */ n daemon.c */
/* noexit check results in warning being shown only when the daemon is st if (cfg.maxbw > 0) {
arted */ rolloversecs = (uint32_t)((float)MAX32 / ((float)cfg.maxb
if (noexit && cfg.maxbw > 0) { w * 1024 * 1024 * (float)1.02 / 8));
rolloversecs = (uint32_t)((float)MAX32 / ((float)cfg.maxbw * 1024
* 1024 * (float)1.02 / 8));
if (rolloversecs <= (uint32_t)cfg.updateinterval) {
cfg.updateinterval = UPDATEINTERVAL;
if (rolloversecs <= (uint32_t)cfg.updateinterval) { if (rolloversecs <= (uint32_t)cfg.updateinterval) {
cfg.updateinterval /= 2; cfg.updateinterval = UPDATEINTERVAL;
if (rolloversecs <= (uint32_t)cfg.updateinterval)
{
cfg.updateinterval /= 2;
}
snprintf(errorstring, 1024, "UpdateInterval has b
een reset to %d seconds in order to ensure correct counter rollover detection at
%d Mbit.", cfg.updateinterval, cfg.maxbw);
printe(PT_Config);
} }
snprintf(errorstring, 1024, "UpdateInterval has been rese
t to %d seconds in order to ensure correct counter rollover detection at %d Mbit
.", cfg.updateinterval, cfg.maxbw);
printe(PT_Config);
} }
} }
/* affects only image output */ /* affects only image output */
if (cfg.barshowsrate && cfg.estimatebarvisible) { if (type == CT_Image || type == CT_All) {
cfg.estimatestyle = 0; if (cfg.barshowsrate && cfg.estimatebarvisible) {
if (debug) { cfg.estimatestyle = 0;
printf("BarColumnShowsRate and EstimateBarVisible both en if (debug) {
abled -> EstimateStyle set to 0\n"); printf("BarColumnShowsRate and EstimateBarVisible
both enabled -> EstimateStyle set to 0\n");
}
} }
}
if (cfg.fiveminutehours > 0 && cfg.fivegresultcount > cfg.fiveminutehours if (cfg.fiveminutehours > 0 && cfg.fivegresultcount > cfg.fivemin
* 12) { utehours * 12) {
cfg.fivegresultcount = cfg.fiveminutehours * 12; if (cfg.fiveminutehours * 12 < FIVEGMINRESULTCOUNT) {
snprintf(errorstring, 1024, "5MinuteGraphResultCount has been res snprintf(errorstring, 1024, "Value \"%d\" for 5Mi
et to %d due to request being larger than data retention configured with 5Minute nuteHours is too small for 5MinuteGraphResultCount with value \"%d\" (smallest s
Hours.", cfg.fivegresultcount); upported value: %d). Value for 5MinuteHours needs to be at least %d if 5MinuteGr
printe(PT_Config); aphResultCount is set to %d.", cfg.fiveminutehours, cfg.fivegresultcount, FIVEGM
INRESULTCOUNT, FIVEGMINRESULTCOUNT / 12, FIVEGMINRESULTCOUNT);
cfg.fivegresultcount = FIVEGMINRESULTCOUNT;
} else {
snprintf(errorstring, 1024, "5MinuteGraphResultCo
unt has been adjusted to %d because requested \"%d\" requires more data than can
be available with value %d for 5MinuteHours.", cfg.fiveminutehours * 12, cfg.fi
vegresultcount, cfg.fiveminutehours);
cfg.fivegresultcount = cfg.fiveminutehours * 12;
}
printe(PT_Config);
}
} }
} }
void defaultcfg(void) void defaultcfg(void)
{ {
ifacebw = NULL; ifacebw = NULL;
cfg.bvar = BVAR; cfg.bvar = BVAR;
cfg.qmode = DEFQMODE; cfg.qmode = DEFQMODE;
cfg.sampletime = DEFSAMPTIME; cfg.sampletime = DEFSAMPTIME;
skipping to change at line 356 skipping to change at line 378
cfg.listjsonxml = LISTJSONXML; cfg.listjsonxml = LISTJSONXML;
cfg.fiveminutehours = FIVEMINUTEHOURS; cfg.fiveminutehours = FIVEMINUTEHOURS;
cfg.hourlydays = HOURLYDAYS; cfg.hourlydays = HOURLYDAYS;
cfg.dailydays = DAILYDAYS; cfg.dailydays = DAILYDAYS;
cfg.monthlymonths = MONTHLYMONTHS; cfg.monthlymonths = MONTHLYMONTHS;
cfg.yearlyyears = YEARLYYEARS; cfg.yearlyyears = YEARLYYEARS;
cfg.topdayentries = TOPDAYENTRIES; cfg.topdayentries = TOPDAYENTRIES;
strncpy_nt(cfg.dbdir, DATABASEDIR, 512); strncpy_nt(cfg.dbdir, DATABASEDIR, 512);
strncpy_nt(cfg.dbtzmodifier, DATABASELOCALTIMEMODIFIER, 14);
strncpy_nt(cfg.iface, DEFIFACE, 32); strncpy_nt(cfg.iface, DEFIFACE, 32);
strncpy_nt(cfg.locale, LOCALE, 32); strncpy_nt(cfg.locale, LOCALE, 32);
strncpy_nt(cfg.dformat, DFORMAT, 64); strncpy_nt(cfg.dformat, DFORMAT, 64);
strncpy_nt(cfg.mformat, MFORMAT, 64); strncpy_nt(cfg.mformat, MFORMAT, 64);
strncpy_nt(cfg.tformat, TFORMAT, 64); strncpy_nt(cfg.tformat, TFORMAT, 64);
strncpy_nt(cfg.hformat, HFORMAT, 64); strncpy_nt(cfg.hformat, HFORMAT, 64);
strncpy_nt(cfg.rxchar, RXCHAR, 2); strncpy_nt(cfg.rxchar, RXCHAR, 2);
strncpy_nt(cfg.txchar, TXCHAR, 2); strncpy_nt(cfg.txchar, TXCHAR, 2);
strncpy_nt(cfg.rxhourchar, RXHOURCHAR, 2); strncpy_nt(cfg.rxhourchar, RXHOURCHAR, 2);
strncpy_nt(cfg.txhourchar, TXHOURCHAR, 2); strncpy_nt(cfg.txhourchar, TXHOURCHAR, 2);
cfg.daemonuser[0] = '\0'; cfg.daemonuser[0] = '\0';
cfg.daemongroup[0] = '\0'; cfg.daemongroup[0] = '\0';
cfg.timesyncwait = TIMESYNCWAIT; cfg.timesyncwait = TIMESYNCWAIT;
cfg.updateinterval = UPDATEINTERVAL; cfg.updateinterval = UPDATEINTERVAL;
cfg.pollinterval = POLLINTERVAL; cfg.pollinterval = POLLINTERVAL;
cfg.saveinterval = SAVEINTERVAL; cfg.saveinterval = SAVEINTERVAL;
cfg.offsaveinterval = OFFSAVEINTERVAL; cfg.offsaveinterval = OFFSAVEINTERVAL;
cfg.rescanonsave = RESCANONSAVE;
cfg.alwaysadd = ALWAYSADD;
cfg.savestatus = SAVESTATUS; cfg.savestatus = SAVESTATUS;
cfg.uselogging = USELOGGING; cfg.uselogging = USELOGGING;
cfg.createdirs = CREATEDIRS; cfg.createdirs = CREATEDIRS;
cfg.updatefileowner = UPDATEFILEOWNER; cfg.updatefileowner = UPDATEFILEOWNER;
strncpy_nt(cfg.logfile, LOGFILE, 512); strncpy_nt(cfg.logfile, LOGFILE, 512);
strncpy_nt(cfg.pidfile, PIDFILE, 512); strncpy_nt(cfg.pidfile, PIDFILE, 512);
cfg.is64bit = IS64BIT; cfg.is64bit = IS64BIT;
cfg.waldb = WALDB; cfg.waldb = WALDB;
cfg.dbsynchronous = DBSYNCHRONOUS; cfg.dbsynchronous = DBSYNCHRONOUS;
cfg.useutc = USEUTC;
cfg.transbg = TRANSBG; cfg.transbg = TRANSBG;
cfg.largefonts = LARGEFONTS; cfg.largefonts = LARGEFONTS;
cfg.linespaceadjust = LINESPACEADJUST; cfg.linespaceadjust = LINESPACEADJUST;
cfg.imagescale = IMAGESCALE; cfg.imagescale = IMAGESCALE;
cfg.fivegresultcount = FIVEGRESULTCOUNT; cfg.fivegresultcount = FIVEGRESULTCOUNT;
cfg.fivegheight = FIVEGHEIGHT; cfg.fivegheight = FIVEGHEIGHT;
cfg.summarygraph = SUMMARYGRAPH; cfg.summarygraph = SUMMARYGRAPH;
cfg.estimatestyle = ESTIMATESTYLE; cfg.estimatestyle = ESTIMATESTYLE;
cfg.barshowsrate = BARSHOWSRATE; cfg.barshowsrate = BARSHOWSRATE;
 End of changes. 27 change blocks. 
83 lines changed or deleted 122 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)