|
|
1.1 ! root 1: #include <stdio.h> ! 2: #include <pwd.h> ! 3: struct passwd pwstruct; ! 4: struct passwd *pw = &pwstruct; ! 5: struct passwd *getpwent(); ! 6: ! 7: main(argc, argv) ! 8: char **argv; ! 9: { ! 10: char cfile[100], cname[100]; ! 11: if(argc > 1) ! 12: process(argv[1], ""); ! 13: else while(pw=getpwent()) { ! 14: strcpy(cname, pw->pw_name); ! 15: strcpy(cfile, pw->pw_dir); ! 16: strcat(cfile, "/calendar"); ! 17: process(cfile, cname); ! 18: } ! 19: return(0); ! 20: } ! 21: ! 22: process(file, name) ! 23: char *file, *name; ! 24: { ! 25: char s[201]; ! 26: FILE *f; ! 27: if(access(file,04)==0 && access(file,01)==-1) ! 28: printf("!%s %s\n",file,name); ! 29: f = fopen(file,"r"); ! 30: if(f!=NULL) { ! 31: while(fgets(s,200,f)) ! 32: if(strncmp("#include",s,8)==0) ! 33: include(s, name); ! 34: fclose(f); ! 35: } ! 36: } ! 37: ! 38: include(s, name) ! 39: char *s, *name; ! 40: { ! 41: char *t; ! 42: for(t=s; *t; t++) ! 43: continue; ! 44: for(;;) { ! 45: switch(t[-1]) { ! 46: case '\n': ! 47: case '"': ! 48: *--t = 0; ! 49: continue; ! 50: } ! 51: break; ! 52: } ! 53: for(t=s+8;;t++) { ! 54: switch(*t) { ! 55: case ' ': ! 56: case '\t': ! 57: case '"': ! 58: continue; ! 59: } ! 60: break; ! 61: } ! 62: if(access(t,04)==0 && access(t,01)==-1) ! 63: printf("!%s %s\n",t,name); ! 64: else if(index(t,'!')!=0) ! 65: printf("%s %s\n",t,name); ! 66: } ! 67:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.