xref: /csrg-svn/usr.bin/ranlib/ranlib.c (revision 46011)
1*46011Sbostic /*-
2*46011Sbostic  * Copyright (c) 1990 The Regents of the University of California.
3*46011Sbostic  * All rights reserved.
4*46011Sbostic  *
5*46011Sbostic  * This code is derived from software contributed to Berkeley by
6*46011Sbostic  * Hugh Smith at The University of Guelph.
7*46011Sbostic  *
8*46011Sbostic  * %sccs.include.redist.c%
922410Sdist  */
1022410Sdist 
1112673Ssam #ifndef lint
1222410Sdist char copyright[] =
13*46011Sbostic "@(#) Copyright (c) 1990 The Regents of the University of California.\n\
1422410Sdist  All rights reserved.\n";
15*46011Sbostic #endif /* not lint */
1622410Sdist 
1722410Sdist #ifndef lint
18*46011Sbostic static char sccsid[] = "@(#)ranlib.c	5.5 (Berkeley) 01/18/91";
19*46011Sbostic #endif /* not lint */
2022410Sdist 
21625Sbill #include <sys/types.h>
22*46011Sbostic #include <dirent.h>
23625Sbill #include <stdio.h>
24*46011Sbostic #include <archive.h>
25625Sbill 
26*46011Sbostic CHDR chdr;
27*46011Sbostic u_int options;				/* UNUSED -- keep open_archive happy */
28*46011Sbostic char *archive;
29625Sbill 
30625Sbill main(argc, argv)
31*46011Sbostic 	int argc;
32*46011Sbostic 	char **argv;
33625Sbill {
34*46011Sbostic 	extern int optind;
35*46011Sbostic 	int ch, eval, tflag;
36625Sbill 
37*46011Sbostic 	tflag = 0;
38*46011Sbostic 	while ((ch = getopt(argc, argv, "t")) != EOF)
39*46011Sbostic 		switch(ch) {
40*46011Sbostic 		case 't':
41*46011Sbostic 			tflag = 1;
42*46011Sbostic 			break;
43*46011Sbostic 		case '?':
44*46011Sbostic 		default:
45*46011Sbostic 			usage();
46625Sbill 		}
47*46011Sbostic 	argc -= optind;
48*46011Sbostic 	argv += optind;
4919963Smckusick 
50*46011Sbostic 	if (!*argv)
51*46011Sbostic 		usage();
52625Sbill 
53*46011Sbostic 	for (eval = 0; archive = *argv++;)
54*46011Sbostic 		eval |= tflag ? touch() : build();
55*46011Sbostic 	exit(eval);
56625Sbill }
57625Sbill 
58*46011Sbostic usage()
59625Sbill {
60*46011Sbostic 	(void)fprintf(stderr, "usage: ranlib [-t] archive ...\n");
61*46011Sbostic 	exit(1);
62625Sbill }
63