#include int main(int argc, char *argv[]) { unsigned long start,end,dunno; unsigned int i; char p[200]; int dh, dl; char modes[5]; char buf[512]; int tot = 0; FILE *fp; int verbose=0; if(argv[1] && strcmp(argv[1], "-v")==0) { argv++; verbose=1; } while(argv[1]!=NULL) { fp=fopen(argv[1], "r"); if(fp==NULL) { perror(argv[1]); argv++; continue; } argv++; while(fgets(buf,512,fp)!=NULL) { *p =0; sscanf(buf, "%lx-%lx %4s %lx %x:%x %d %200s\n", &start, &end, modes, &dunno, &dh, &dl, &i, p); if(!strlen(p)) { if(verbose) printf("Anon Pages: %d\n", (end-start+1)>>12); tot+=(end-start+1)>>12; } else if(modes[1]=='w' && modes[3]=='p') { if(verbose) printf("Priv Pages: %d - %s\n", (end-start+1)>>12, p); tot+=(end-start+1)>>12; } } fclose(fp); } printf("Sum %d\n", tot); }