void main(int argc, char *argv[]) { int i; Biobuf *bin; Binit(&bout, 1, OWRITE); argv0 = argv[0]; ARGBEGIN { case 'a': aflag = 1; break; case 'g': gflag = 1; break; case 'h': hflag = 1; break; case 'n': nflag = 1; break; case 's': sflag = 1; break; case 'u': uflag = 1; break; } ARGEND if (argc > 1) multifile++; for(i=0; i<argc; i++){ filename = argv[i]; bin = Bopen(filename, OREAD); if(bin == 0){ error("cannot open %s", filename); continue; } if (isar(bin)) doar(bin); else{ Bseek(bin, 0, 0); dofile(bin); } Bterm(bin); } exits(errs); }
void parse_ar(char *file) { Biobuf *bp; if((bp = Bopen(file, OREAD)) == nil) return; if (isar(bp)) doar(bp, file); Bterm(bp); }