1 /*- 2 * Copyright (c) 1990 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Hugh Smith at The University of Guelph. 7 * 8 * %sccs.include.redist.c% 9 */ 10 11 #ifndef lint 12 char copyright[] = 13 "@(#) Copyright (c) 1990 The Regents of the University of California.\n\ 14 All rights reserved.\n"; 15 #endif /* not lint */ 16 17 #ifndef lint 18 static char sccsid[] = "@(#)ranlib.c 5.6 (Berkeley) 02/26/91"; 19 #endif /* not lint */ 20 21 #include <sys/types.h> 22 #include <dirent.h> 23 #include <stdio.h> 24 #include <stdlib.h> 25 #include <archive.h> 26 27 CHDR chdr; 28 u_int options; /* UNUSED -- keep open_archive happy */ 29 char *archive; 30 31 main(argc, argv) 32 int argc; 33 char **argv; 34 { 35 extern int optind; 36 int ch, eval, tflag; 37 38 tflag = 0; 39 while ((ch = getopt(argc, argv, "t")) != EOF) 40 switch(ch) { 41 case 't': 42 tflag = 1; 43 break; 44 case '?': 45 default: 46 usage(); 47 } 48 argc -= optind; 49 argv += optind; 50 51 if (!*argv) 52 usage(); 53 54 for (eval = 0; archive = *argv++;) 55 eval |= tflag ? touch() : build(); 56 exit(eval); 57 } 58 59 usage() 60 { 61 (void)fprintf(stderr, "usage: ranlib [-t] archive ...\n"); 62 exit(1); 63 } 64