xref: /original-bsd/usr.bin/ranlib/ranlib.c (revision 82cc5172)
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.5 (Berkeley) 01/18/91";
19 #endif /* not lint */
20 
21 #include <sys/types.h>
22 #include <dirent.h>
23 #include <stdio.h>
24 #include <archive.h>
25 
26 CHDR chdr;
27 u_int options;				/* UNUSED -- keep open_archive happy */
28 char *archive;
29 
30 main(argc, argv)
31 	int argc;
32 	char **argv;
33 {
34 	extern int optind;
35 	int ch, eval, tflag;
36 
37 	tflag = 0;
38 	while ((ch = getopt(argc, argv, "t")) != EOF)
39 		switch(ch) {
40 		case 't':
41 			tflag = 1;
42 			break;
43 		case '?':
44 		default:
45 			usage();
46 		}
47 	argc -= optind;
48 	argv += optind;
49 
50 	if (!*argv)
51 		usage();
52 
53 	for (eval = 0; archive = *argv++;)
54 		eval |= tflag ? touch() : build();
55 	exit(eval);
56 }
57 
58 usage()
59 {
60 	(void)fprintf(stderr, "usage: ranlib [-t] archive ...\n");
61 	exit(1);
62 }
63