]>
Commit | Line | Data |
---|---|---|
8186335d CP |
1 | #include "graphing.h" |
2 | #include <stdio.h> | |
3 | #include <time.h> | |
b88719fa CP |
4 | #include <sys/types.h> |
5 | #include <sys/stat.h> | |
8186335d CP |
6 | |
7 | int dump(fsample_m *f, fsample_t start, fsample_t stop) { | |
8 | int i, j; | |
9 | ||
10 | for(i=start;i<stop;i++) { | |
11 | printf("%2d ", i); | |
12 | for(j=0;j<f->pos;j++) { | |
13 | fsample_t t; | |
14 | int moo = fsget_m(f, j, i, &t); | |
15 | ||
16 | if(!moo) { | |
17 | int moo2 = fsget_mr(f, j, i, &t); | |
18 | printf("X%2d(%2d) ", t, moo2); | |
19 | } else { | |
20 | printf(" %2d(%2d) ", t, moo); | |
21 | } | |
22 | } | |
23 | printf("\n"); | |
24 | } | |
25 | ||
26 | return 0; | |
27 | } | |
28 | ||
29 | ||
30 | int main(int cargc, char **cargv) { | |
31 | fsample_m *f; | |
32 | int stop = time(NULL) / GRAPHING_RESOLUTION; | |
b88719fa | 33 | struct stat sb; |
8186335d | 34 | |
b88719fa CP |
35 | if(cargc < 2) { |
36 | puts("insufficient args"); | |
8186335d | 37 | return 1; |
b88719fa | 38 | } |
8186335d | 39 | |
b88719fa CP |
40 | if(stat(cargv[1], &sb) == -1) { |
41 | puts("file doesn't exist"); | |
8186335d | 42 | return 2; |
b88719fa CP |
43 | } |
44 | ||
45 | f = fsopen_m(0, cargv[1], SAMPLES, NULL, NULL); | |
46 | if(!f) | |
47 | return 3; | |
8186335d CP |
48 | |
49 | dump(f, stop - 100, stop); | |
50 | ||
51 | fsclose_m(f); | |
52 | ||
53 | return 0; | |
54 | } | |
55 |