Commit 2a59a03b authored by deuce's avatar deuce
Browse files

Set teh entire scfg_t to zeros, use fgets() instead of gets(), and

display the date format in the menu.
parent 2d7ced5a
......@@ -24,7 +24,7 @@ main(int argc, char **argv)
time32_t t;
scfg_t cfg;
cfg.sys_misc = 0;
memset(&cfg, 0, sizeof(cfg));
if (argc > 1)
strcpy(path, argv[1]);
......@@ -51,7 +51,7 @@ main(int argc, char **argv)
close(file);
while (1) {
printf("Synchronet Daily Statistics Editor v1.01\r\n\r\n");
printf("S) %-25s: %13s\n", "Date Stamp", unixtodstr(&cfg, t, str));
printf("S) %-25s: %13s\n", "Date Stamp (MM/DD/YY)", unixtodstr(&cfg, t, str));
printf(lst, 'L', "Total Logons", stats.logons);
printf(lst, 'O', "Logons Today", stats.ltoday);
printf(lst, 'T', "Total Time on", stats.timeon);
......@@ -76,79 +76,79 @@ main(int argc, char **argv)
switch (ch) {
case 'S':
printf("Date stamp (MM/DD/YY): ");
gets(str);
fgets(str, sizeof(str), stdin);
if (str[0])
t = dstrtounix(&cfg, str);
break;
case 'L':
printf(nv);
gets(str);
fgets(str, sizeof(str), stdin);
if (str[0])
stats.logons = atol(str);
break;
case 'O':
printf(nv);
gets(str);
fgets(str, sizeof(str), stdin);
if (str[0])
stats.ltoday = atol(str);
break;
case 'T':
printf(nv);
gets(str);
fgets(str, sizeof(str), stdin);
if (str[0])
stats.timeon = atol(str);
break;
case 'I':
printf(nv);
gets(str);
fgets(str, sizeof(str), stdin);
if (str[0])
stats.ttoday = atol(str);
break;
case 'U':
printf(nv);
gets(str);
fgets(str, sizeof(str), stdin);
if (str[0])
stats.uls = atol(str);
break;
case 'B':
printf(nv);
gets(str);
fgets(str, sizeof(str), stdin);
if (str[0])
stats.ulb = atol(str);
break;
case 'D':
printf(nv);
gets(str);
fgets(str, sizeof(str), stdin);
if (str[0])
stats.dls = atol(str);
break;
case 'W':
printf(nv);
gets(str);
fgets(str, sizeof(str), stdin);
if (str[0])
stats.dlb = atol(str);
break;
case 'P':
printf(nv);
gets(str);
fgets(str, sizeof(str), stdin);
if (str[0])
stats.ptoday = atol(str);
break;
case 'E':
printf(nv);
gets(str);
fgets(str, sizeof(str), stdin);
if (str[0])
stats.etoday = atol(str);
break;
case 'F':
printf(nv);
gets(str);
fgets(str, sizeof(str), stdin);
if (str[0])
stats.ftoday = atol(str);
break;
case 'N':
printf(nv);
gets(str);
fgets(str, sizeof(str), stdin);
if (str[0])
stats.nusers = atoi(str);
break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment