de666de84537bd2669f2cad5424560e77e4c4482
1 #define _LARGEFILE_SOURCE
2 #define _FILE_OFFSET_BITS 64
13 int main(int argc
, char **argv
)
19 char *filename
= NULL
;
22 for(i
=1; i
<argc
; i
++) {
23 if(!strcmp(argv
[i
], "-p")) {
32 if(filename
== NULL
) {
33 fprintf(stderr
, "No trace file specified\n");
37 fp
= fopen(filename
, "r");
44 unsigned long timestamp
;
49 fscanf(fp
, "%4c", ×tamp
);
53 fscanf(fp
, "%2c", &id
);
55 fscanf(fp
, "%1c", &arglen
);
57 args
= malloc(arglen
);
59 // manually specify length of args
60 fscanf(fp
, "%15c", args
);
65 arg1
= *(unsigned short *)args
;
69 printf("timestamp %lu id %hu args=(arg1=%hu arg2=\"%s\")\n", timestamp
, id
, arg1
, arg2
);
This page took 0.02951 seconds and 3 git commands to generate.