-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdbshow.c
More file actions
59 lines (53 loc) · 1.59 KB
/
dbshow.c
File metadata and controls
59 lines (53 loc) · 1.59 KB
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
#include "dbshow.h"
#include "common.h"
void showdb(int qmode)
{
if(data.totalrx+data.totaltx==0 && data.totalrxk+data.totaltxk==0){
printf("%s: not enough data available yet.\n", data.interface);
}else{
switch(qmode) {
case 0:
// showsummary();
break;
case 1:
// showdays();
break;
case 2:
// showmonths();
break;
case 3:
// showtop();
break;
case 4:
dumpdb();
break;
case 5:
// showshort();
break;
default:
printf("Error: not such query mode:%d\n", qmode);
break;
}
}
}
void dumpdb(void)
{
int i;
printf("active;%d\n", data.active);
printf("interface;%s\n",data.interface);
printf("created;%u\n", (unsigned int)data.created);
printf("updated;%u\n", (unsigned int)data.lastupdated);
printf("totalrx;%llu\n", data.totalrx);
printf("totaltx;%llu\n", data.totaltx);
printf("totalrxk;%d\n", data.totalrxk);
printf("totaltxk;%d\n", data.totaltxk);
for(i=0;i<=29;i++){
printf("d;%d;%u;%llu;%llu;%d;%d;%d\n", i, (unsigned int)data.day[i].date, data.day[i].rx, data.day[i].tx, data.day[i].rxk, data.day[i].txk, data.day[i].used);
}
for(i=0;i<=11;i++){
printf("m;%d;%u;%llu;%llu;%d;%d;%d", i, (unsigned int)data.month[i].month, data.month[i].rx, data.month[i].tx, data.month[i].rxk, data.month[i].txk, data.month[i].used);
}
for(i=0;i<=9;i++){
printf("t;%d;%u;%llu;%llu;%d;%d;%d\n", i, (unsigned int)data.top10[i].date, data.top10[i].rx, data.top10[i].tx, data.top10[i].rxk, data.top10[i].txk, data.top10[i].used);
}
}