-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTIMELOG.C
125 lines (109 loc) · 2.93 KB
/
TIMELOG.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#include <stdio.h>
#include <ctype.h>
#include <bbs.h>
/* display the time log array. */
char dayz[7][4] = { "Sun","Mon","Tue","Wed","Thu","Fri","Sat" };
int pozflg,numflg,prtflg;
main(argc,argv)
int argc;
char **argv;
{
int day,hour;
int f;
int m;
char sw[40],file[20];
char *p;
struct _tlog tlg;
printf("Fido's Timelog Utility -- Version %s (/? for help)\r\n",VER);
pozflg= numflg= 0;
strcpy(file,"");
if (argc > 1) {
strip_switch(sw,argv[1]);
cpyarg(file,argv[1]);
p= sw;
while (*p) {
switch (*p) {
case 'P':
pozflg= 1;
break;
case 'N':
numflg= 1;
break;
case 'F':
prtflg= 1;
break;
case '?':
printf("/P Pause every graph\r\n");
printf("/N Numeric Listing\r\n");
printf("/F Format for a printer\r\n");
printf("Optionally enter a filename \r\n");
printf("to be used instead of TIMELOG.BBS\r\n");
printf("i.e. TIMELOG 04APR84.BBS/P\r\n");
break;
}
++p;
}
}
if (strlen(file) == 0) strcpy(file,"timelog.bbs");
f= _xopen(file,0);
if (f == -1) {
printf("Cant find %s\r\n",file);
exit();
}
_xread(f,&tlg,sizeof(struct _tlog));
_xclose(f);
printf("%u calls, from %s to %s\r\n",tlg.calls,tlg.fdate,tlg.ldate);
if (numflg) {
printf(" Sun Mon Tue Wed Thu Fri Sat\r\n");
for (hour= 0; hour < 24; hour++) {
printf("%2u:00 ",hour);
for (day= 0; day < 7; day++) {
if (tlg.log[day][hour])
printf("%5u",tlg.log[day][hour]);
else printf("%5s","");
}
printf("\r\n");
}
pause();
}
/* Now draw a crude graph. */
printf("\r\n Call Frequency by Day of the Week\r\n");
printf(" 0 10 20 30 40 60 70\r\n");
printf(" | | | | | | |\r\n");
for (day= 0; day < 7; day++) {
m= 0;
for (hour= 0; hour < 24; hour++) {
m+= tlg.log[day][hour];
}
printf("%s |",dayz[day]);
while (m--) printf("*");
printf("\r\n");
}
printf(" | | | | | | |\r\n");
pause();
printf("\r\nCall Frequency by the Hour, each Day\r\n");
for (day= 0; day < 7; day++) {
printf("%s\r\n",dayz[day]);
printf(" 0 5 10 15 20 25 30\r\n");
printf(" | | | | | | |\r\n");
for (hour= 0; hour < 24; hour++) {
printf("%2u:00 |",hour);
m= tlg.log[day][hour];
while (m--) printf(" *");
printf("\r\n");
}
printf(" | | | | | | |\r\n");
printf("\r\n");
if (prtflg && (day % 1 == 0)) printf("\014");
pause();
}
printf("\r\n\r\n");
}
/* If the pause flag is set, do th strike any key business. */
pause() {
if (pozflg && ! prtflg) {
cprintf("Strike any key . . . ");
getch();
cprintf("\r\n");
}
}