|
|
1.1 ! root 1: /* DSTSEDIT.C */ ! 2: ! 3: /* Developed 1990-1997 by Rob Swindell; PO Box 501, Yorba Linda, CA 92885 */ ! 4: ! 5: #include <stdio.h> ! 6: #include <sys/stat.h> ! 7: #include <fcntl.h> ! 8: #include <errno.h> ! 9: #include <stdlib.h> ! 10: ! 11: #include "sbbs.h" ! 12: #include "dirwrap.h" ! 13: #include "nopen.h" ! 14: #include "sbbsdefs.h" ! 15: #include "conwrap.h" ! 16: ! 17: int ! 18: main(int argc, char **argv) ! 19: { ! 20: char ch, str[MAX_PATH+1], path[MAX_PATH + 1] ! 21: ,*lst = "%c) %-25s: %13lu\n" ! 22: ,*nv = "\nNew value: ", *p; ! 23: int file; ! 24: stats_t stats; ! 25: time32_t t; ! 26: scfg_t cfg; ! 27: ! 28: memset(&cfg, 0, sizeof(cfg)); ! 29: ! 30: if (argc > 1) ! 31: strcpy(path, argv[1]); ! 32: else { ! 33: p=getenv("SBBSCTRL"); ! 34: if(p) ! 35: SAFECOPY(path, p); ! 36: else ! 37: getcwd(path, sizeof(path)); ! 38: } ! 39: backslash(path); ! 40: ! 41: sprintf(str, "%sdsts.dab", path); ! 42: if ((file = nopen(str, O_RDONLY)) == -1) { ! 43: printf("Can't open %s\r\n", str); ! 44: exit(1); ! 45: } ! 46: read(file, &t, 4L); ! 47: if (read(file, &stats, sizeof(stats_t)) != sizeof(stats_t)) { ! 48: close(file); ! 49: printf("Error reading %u bytes from %s\r\n", sizeof(stats_t), str); ! 50: exit(1); ! 51: } ! 52: close(file); ! 53: while (1) { ! 54: printf("Synchronet Daily Statistics Editor v1.01\r\n\r\n"); ! 55: printf("S) %-25s: %13s\n", "Date Stamp (MM/DD/YY)", unixtodstr(&cfg, t, str)); ! 56: printf(lst, 'L', "Total Logons", stats.logons); ! 57: printf(lst, 'O', "Logons Today", stats.ltoday); ! 58: printf(lst, 'T', "Total Time on", stats.timeon); ! 59: printf(lst, 'I', "Time on Today", stats.ttoday); ! 60: printf(lst, 'U', "Uploaded Files Today", stats.uls); ! 61: printf(lst, 'B', "Uploaded Bytes Today", stats.ulb); ! 62: printf(lst, 'D', "Downloaded Files Today", stats.dls); ! 63: printf(lst, 'W', "Downloaded Bytes Today", stats.dlb); ! 64: printf(lst, 'P', "Posts Today", stats.ptoday); ! 65: printf(lst, 'E', "E-Mails Today", stats.etoday); ! 66: printf(lst, 'F', "Feedback Today", stats.ftoday); ! 67: printf("%c) %-25s: %13u\r\n", 'N', "New Users Today", stats.nusers); ! 68: ! 69: printf("Q) Quit and save changes\r\n"); ! 70: printf("X) Quit and don't save changes\r\n"); ! 71: ! 72: printf("\r\nWhich: "); ! 73: ! 74: ch = toupper(getch()); ! 75: printf("%c\r\n", ch); ! 76: ! 77: switch (ch) { ! 78: case 'S': ! 79: printf("Date stamp (MM/DD/YY): "); ! 80: fgets(str, sizeof(str), stdin); ! 81: if (str[0]) ! 82: t = dstrtounix(&cfg, str); ! 83: break; ! 84: case 'L': ! 85: printf(nv); ! 86: fgets(str, sizeof(str), stdin); ! 87: if (str[0]) ! 88: stats.logons = atol(str); ! 89: break; ! 90: case 'O': ! 91: printf(nv); ! 92: fgets(str, sizeof(str), stdin); ! 93: if (str[0]) ! 94: stats.ltoday = atol(str); ! 95: break; ! 96: case 'T': ! 97: printf(nv); ! 98: fgets(str, sizeof(str), stdin); ! 99: if (str[0]) ! 100: stats.timeon = atol(str); ! 101: break; ! 102: case 'I': ! 103: printf(nv); ! 104: fgets(str, sizeof(str), stdin); ! 105: if (str[0]) ! 106: stats.ttoday = atol(str); ! 107: break; ! 108: case 'U': ! 109: printf(nv); ! 110: fgets(str, sizeof(str), stdin); ! 111: if (str[0]) ! 112: stats.uls = atol(str); ! 113: break; ! 114: case 'B': ! 115: printf(nv); ! 116: fgets(str, sizeof(str), stdin); ! 117: if (str[0]) ! 118: stats.ulb = atol(str); ! 119: break; ! 120: case 'D': ! 121: printf(nv); ! 122: fgets(str, sizeof(str), stdin); ! 123: if (str[0]) ! 124: stats.dls = atol(str); ! 125: break; ! 126: case 'W': ! 127: printf(nv); ! 128: fgets(str, sizeof(str), stdin); ! 129: if (str[0]) ! 130: stats.dlb = atol(str); ! 131: break; ! 132: case 'P': ! 133: printf(nv); ! 134: fgets(str, sizeof(str), stdin); ! 135: if (str[0]) ! 136: stats.ptoday = atol(str); ! 137: break; ! 138: case 'E': ! 139: printf(nv); ! 140: fgets(str, sizeof(str), stdin); ! 141: if (str[0]) ! 142: stats.etoday = atol(str); ! 143: break; ! 144: case 'F': ! 145: printf(nv); ! 146: fgets(str, sizeof(str), stdin); ! 147: if (str[0]) ! 148: stats.ftoday = atol(str); ! 149: break; ! 150: case 'N': ! 151: printf(nv); ! 152: fgets(str, sizeof(str), stdin); ! 153: if (str[0]) ! 154: stats.nusers = atoi(str); ! 155: break; ! 156: case 'Q': ! 157: sprintf(str, "%sdsts.dab", path); ! 158: if ((file = nopen(str, O_WRONLY)) == -1) { ! 159: printf("Error opening %s\r\n", str); ! 160: exit(1); ! 161: } ! 162: write(file, &t, 4L); ! 163: write(file, &stats, sizeof(stats_t)); ! 164: close(file); ! 165: case 'X': ! 166: exit(0); ! 167: default: ! 168: putchar(7); ! 169: break; ! 170: } ! 171: } ! 172: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.