"Fossies" - the Fresh Open Source Software Archive  

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

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

cfg.c  (vnstat-2.8):cfg.c  (vnstat-2.9)
skipping to change at line 47 skipping to change at line 47
{"QueryMode", 0, &cfg.qmode, 0, 0}, {"QueryMode", 0, &cfg.qmode, 0, 0},
{"CheckDiskSpace", 0, &cfg.spacecheck, 0, 0}, {"CheckDiskSpace", 0, &cfg.spacecheck, 0, 0},
{"BootVariation", 0, &cfg.bvar, 0, 0}, {"BootVariation", 0, &cfg.bvar, 0, 0},
{"TrafficlessEntries", 0, &cfg.trafficlessentries, 0, 0}, {"TrafficlessEntries", 0, &cfg.trafficlessentries, 0, 0},
{"List5Mins", 0, &cfg.listfivemins, 0, 0}, {"List5Mins", 0, &cfg.listfivemins, 0, 0},
{"ListHours", 0, &cfg.listhours, 0, 0}, {"ListHours", 0, &cfg.listhours, 0, 0},
{"ListDays", 0, &cfg.listdays, 0, 0}, {"ListDays", 0, &cfg.listdays, 0, 0},
{"ListMonths", 0, &cfg.listmonths, 0, 0}, {"ListMonths", 0, &cfg.listmonths, 0, 0},
{"ListYears", 0, &cfg.listyears, 0, 0}, {"ListYears", 0, &cfg.listyears, 0, 0},
{"ListTop", 0, &cfg.listtop, 0, 0}, {"ListTop", 0, &cfg.listtop, 0, 0},
{"InterfaceMatchMethod", 0, &cfg.ifacematchmethod, 0, 0},
{"5MinuteHours", 0, &cfg.fiveminutehours, 0, 0}, {"5MinuteHours", 0, &cfg.fiveminutehours, 0, 0},
{"HourlyDays", 0, &cfg.hourlydays, 0, 0}, {"HourlyDays", 0, &cfg.hourlydays, 0, 0},
{"DailyDays", 0, &cfg.dailydays, 0, 0}, {"DailyDays", 0, &cfg.dailydays, 0, 0},
{"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},
{"RescanDatabaseOnSave", 0, &cfg.rescanonsave, 0, 0},
{"AlwaysAddNewInterfaces", 0, &cfg.alwaysadd, 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},
skipping to change at line 81 skipping to change at line 83
{"UseUTC", 0, &cfg.useutc, 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},
{"HourlyGraphMode", 0, &cfg.hourlygmode, 0, 0},
{"SummaryGraph", 0, &cfg.summarygraph, 0, 0}, {"SummaryGraph", 0, &cfg.summarygraph, 0, 0},
{"EstimateStyle", 0, &cfg.estimatestyle, 0, 0}, {"EstimateStyle", 0, &cfg.estimatestyle, 0, 0},
{"BarColumnShowsRate", 0, &cfg.barshowsrate, 0, 0}, {"BarColumnShowsRate", 0, &cfg.barshowsrate, 0, 0},
{"CBackground", cfg.cbg, 0, 8, 0}, {"CBackground", cfg.cbg, 0, 8, 0},
{"CEdge", cfg.cedge, 0, 8, 0}, {"CEdge", cfg.cedge, 0, 8, 0},
{"CHeader", cfg.cheader, 0, 8, 0}, {"CHeader", cfg.cheader, 0, 8, 0},
{"CHeaderTitle", cfg.cheadertitle, 0, 8, 0}, {"CHeaderTitle", cfg.cheadertitle, 0, 8, 0},
{"CHeaderDate", cfg.cheaderdate, 0, 8, 0}, {"CHeaderDate", cfg.cheaderdate, 0, 8, 0},
{"CText", cfg.ctext, 0, 8, 0}, {"CText", cfg.ctext, 0, 8, 0},
{"CLine", cfg.cline, 0, 8, 0}, {"CLine", cfg.cline, 0, 8, 0},
skipping to change at line 117 skipping to change at line 120
/* parse every config file line */ /* parse every config file line */
while (!feof(fd)) { while (!feof(fd)) {
cfgline[0] = '\0'; cfgline[0] = '\0';
if (fgets(cfgline, 512, fd) == NULL) { if (fgets(cfgline, 512, fd) == NULL) {
break; break;
} }
linelen = (unsigned int)strlen(cfgline); linelen = (unsigned int)strlen(cfgline);
if (linelen <= 2 || cfgline[0] == '#') { if (linelen <= 2 || cfgline[0] == '#' || cfgline[0] == ';') {
continue; continue;
} }
for (i = 0; cset[i].name != 0; i++) { for (i = 0; cset[i].name != 0; i++) {
if (cset[i].found) { if (cset[i].found) {
continue; continue;
} }
cfglen = (unsigned int)strlen(cset[i].name); cfglen = (unsigned int)strlen(cset[i].name);
skipping to change at line 218 skipping to change at line 221
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("UseUTC", &cfg.useutc, USEUTC); validatebool("UseUTC", &cfg.useutc, USEUTC);
if (type == CT_Image || type == CT_All) { if (type == CT_Image || type == CT_All) {
validatebool("TransparentBg", &cfg.transbg, TRANSBG); validatebool("TransparentBg", &cfg.transbg, TRANSBG);
validatebool("LargeFonts", &cfg.largefonts, LARGEFONTS); validatebool("LargeFonts", &cfg.largefonts, LARGEFONTS);
validateint("LineSpacingAdjustment", &cfg.linespaceadjust, LINESP ACEADJUST, -5, 10); validateint("LineSpacingAdjustment", &cfg.linespaceadjust, LINESP ACEADJUST, -5, 10);
validateint("ImageScale", &cfg.imagescale, IMAGESCALE, 50, 500); validateint("ImageScale", &cfg.imagescale, IMAGESCALE, 50, 500);
validateint("5MinuteGraphResultCount", &cfg.fivegresultcount, FIV EGRESULTCOUNT, FIVEGMINRESULTCOUNT, 2000); validateint("5MinuteGraphResultCount", &cfg.fivegresultcount, FIV EGRESULTCOUNT, FIVEGMINRESULTCOUNT, 2000);
validateint("5MinuteGraphHeight", &cfg.fivegheight, FIVEGHEIGHT, FIVEGMINHEIGHT, 2000); validateint("5MinuteGraphHeight", &cfg.fivegheight, FIVEGHEIGHT, FIVEGMINHEIGHT, 2000);
validateint("HourlyGraphMode", &cfg.hourlygmode, HOURLYGMODE, 0, 1);
validatebool("SummaryGraph", &cfg.summarygraph, SUMMARYGRAPH); validatebool("SummaryGraph", &cfg.summarygraph, SUMMARYGRAPH);
validateint("EstimateStyle", &cfg.estimatestyle, ESTIMATESTYLE, 0 , 2); validateint("EstimateStyle", &cfg.estimatestyle, ESTIMATESTYLE, 0 , 2);
validatebool("BarColumnShowsRate", &cfg.barshowsrate, BARSHOWSRAT E); validatebool("BarColumnShowsRate", &cfg.barshowsrate, BARSHOWSRAT E);
validatebool("HourlyRate", &cfg.hourlyrate, HOURLYRATE); validatebool("HourlyRate", &cfg.hourlyrate, HOURLYRATE);
validatebool("SummaryRate", &cfg.summaryrate, SUMMARYRATE); 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("InterfaceMatchMethod", &cfg.ifacematchmethod, IFACEMATCHMETH OD, 0, 3);
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);
skipping to change at line 361 skipping to change at line 366
cfg.hourlydecimals = HOURLYDECIMALS; cfg.hourlydecimals = HOURLYDECIMALS;
cfg.hourlystyle = HOURLYSTYLE; cfg.hourlystyle = HOURLYSTYLE;
cfg.bwdetection = BWDETECT; cfg.bwdetection = BWDETECT;
cfg.bwdetectioninterval = BWDETECTINTERVAL; cfg.bwdetectioninterval = BWDETECTINTERVAL;
cfg.maxbw = DEFMAXBW; cfg.maxbw = DEFMAXBW;
cfg.spacecheck = USESPACECHECK; cfg.spacecheck = USESPACECHECK;
cfg.hourlyrate = HOURLYRATE; cfg.hourlyrate = HOURLYRATE;
cfg.summaryrate = SUMMARYRATE; cfg.summaryrate = SUMMARYRATE;
cfg.trafficlessentries = TRAFFICLESSENTRIES; cfg.trafficlessentries = TRAFFICLESSENTRIES;
cfg.utflocale = UTFLOCALE; cfg.utflocale = UTFLOCALE;
cfg.ifacematchmethod = IFACEMATCHMETHOD;
cfg.listfivemins = LISTFIVEMINS; cfg.listfivemins = LISTFIVEMINS;
cfg.listhours = LISTHOURS; cfg.listhours = LISTHOURS;
cfg.listdays = LISTDAYS; cfg.listdays = LISTDAYS;
cfg.listmonths = LISTMONTHS; cfg.listmonths = LISTMONTHS;
cfg.listyears = LISTYEARS; cfg.listyears = LISTYEARS;
cfg.listtop = LISTTOP; cfg.listtop = LISTTOP;
cfg.listjsonxml = LISTJSONXML; cfg.listjsonxml = LISTJSONXML;
cfg.fiveminutehours = FIVEMINUTEHOURS; cfg.fiveminutehours = FIVEMINUTEHOURS;
skipping to change at line 416 skipping to change at line 422
cfg.waldb = WALDB; cfg.waldb = WALDB;
cfg.dbsynchronous = DBSYNCHRONOUS; cfg.dbsynchronous = DBSYNCHRONOUS;
cfg.useutc = USEUTC; 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.hourlygmode = HOURLYGMODE;
cfg.summarygraph = SUMMARYGRAPH; cfg.summarygraph = SUMMARYGRAPH;
cfg.estimatestyle = ESTIMATESTYLE; cfg.estimatestyle = ESTIMATESTYLE;
cfg.barshowsrate = BARSHOWSRATE; cfg.barshowsrate = BARSHOWSRATE;
strncpy_nt(cfg.cbg, CBACKGROUND, 8); strncpy_nt(cfg.cbg, CBACKGROUND, 8);
strncpy_nt(cfg.cedge, CEDGE, 8); strncpy_nt(cfg.cedge, CEDGE, 8);
strncpy_nt(cfg.cheader, CHEADER, 8); strncpy_nt(cfg.cheader, CHEADER, 8);
strncpy_nt(cfg.cheadertitle, CHEADERTITLE, 8); strncpy_nt(cfg.cheadertitle, CHEADERTITLE, 8);
strncpy_nt(cfg.cheaderdate, CHEADERDATE, 8); strncpy_nt(cfg.cheaderdate, CHEADERDATE, 8);
strncpy_nt(cfg.ctext, CTEXT, 8); strncpy_nt(cfg.ctext, CTEXT, 8);
strncpy_nt(cfg.cline, CLINE, 8); strncpy_nt(cfg.cline, CLINE, 8);
strncpy_nt(cfg.clinel, CLINEL, 8); strncpy_nt(cfg.clinel, CLINEL, 8);
strncpy_nt(cfg.crx, CRX, 8); strncpy_nt(cfg.crx, CRX, 8);
strncpy_nt(cfg.crxd, CRXD, 8); strncpy_nt(cfg.crxd, CRXD, 8);
strncpy_nt(cfg.ctx, CTX, 8); strncpy_nt(cfg.ctx, CTX, 8);
strncpy_nt(cfg.ctxd, CTXD, 8); strncpy_nt(cfg.ctxd, CTXD, 8);
cfg.timestampprints = 0;
cfg.experimental = 0; cfg.experimental = 0;
} }
int opencfgfile(const char *cfgfile, FILE **fd) int opencfgfile(const char *cfgfile, FILE **fd)
{ {
char buffer[512]; char buffer[512];
int i, tryhome; int i, tryhome;
/* clear buffer */ /* clear buffer */
for (i = 0; i < 512; i++) { for (i = 0; i < 512; i++) {
skipping to change at line 543 skipping to change at line 551
printf(" i: %s -> \"%s\": %d\n", cfgline, cset->name, *cset->loci); printf(" i: %s -> \"%s\": %d\n", cfgline, cset->name, *cset->loci);
} else { } else {
return 0; return 0;
} }
return 1; return 1;
} }
void configlocale(void) void configlocale(void)
{ {
const char *env = getenv("LC_ALL");
if (cfg.locale[0] != '-' && strlen(cfg.locale) > 0) { if (cfg.locale[0] != '-' && strlen(cfg.locale) > 0) {
setlocale(LC_ALL, cfg.locale); setlocale(LC_ALL, cfg.locale);
} else { } else {
if (getenv("LC_ALL")) { if (env) {
setlocale(LC_ALL, getenv("LC_ALL")); setlocale(LC_ALL, env);
} else { } else {
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");
} }
} }
if (getenv("LC_ALL")) { if (env) {
if (strstr(getenv("LC_ALL"), "UTF") != NULL) { if (strstr(env, "UTF") != NULL) {
cfg.utflocale = 1; cfg.utflocale = 1;
} else { } else {
cfg.utflocale = 0; cfg.utflocale = 0;
} }
} }
} }
 End of changes. 12 change blocks. 
5 lines changed or deleted 15 lines changed or added

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