xref: /csrg-svn/usr.bin/ranlib/ranlib.c (revision 62197)
146011Sbostic /*-
2*62197Sbostic  * Copyright (c) 1990, 1993
3*62197Sbostic  *	The Regents of the University of California.  All rights reserved.
446011Sbostic  *
546011Sbostic  * This code is derived from software contributed to Berkeley by
646011Sbostic  * Hugh Smith at The University of Guelph.
746011Sbostic  *
846011Sbostic  * %sccs.include.redist.c%
922410Sdist  */
1022410Sdist 
1112673Ssam #ifndef lint
12*62197Sbostic static char copyright[] =
13*62197Sbostic "@(#) Copyright (c) 1990, 1993\n\
14*62197Sbostic 	The Regents of the University of California.  All rights reserved.\n";
1546011Sbostic #endif /* not lint */
1622410Sdist 
1722410Sdist #ifndef lint
18*62197Sbostic static char sccsid[] = "@(#)ranlib.c	8.1 (Berkeley) 06/06/93";
1946011Sbostic #endif /* not lint */
2022410Sdist 
21625Sbill #include <sys/types.h>
2246011Sbostic #include <dirent.h>
23625Sbill #include <stdio.h>
2446698Sbostic #include <stdlib.h>
2546011Sbostic #include <archive.h>
26625Sbill 
2746011Sbostic CHDR chdr;
2846011Sbostic u_int options;				/* UNUSED -- keep open_archive happy */
2946011Sbostic char *archive;
30625Sbill 
main(argc,argv)31625Sbill main(argc, argv)
3246011Sbostic 	int argc;
3346011Sbostic 	char **argv;
34625Sbill {
3546011Sbostic 	extern int optind;
3646011Sbostic 	int ch, eval, tflag;
37625Sbill 
3846011Sbostic 	tflag = 0;
3946011Sbostic 	while ((ch = getopt(argc, argv, "t")) != EOF)
4046011Sbostic 		switch(ch) {
4146011Sbostic 		case 't':
4246011Sbostic 			tflag = 1;
4346011Sbostic 			break;
4446011Sbostic 		case '?':
4546011Sbostic 		default:
4646011Sbostic 			usage();
47625Sbill 		}
4846011Sbostic 	argc -= optind;
4946011Sbostic 	argv += optind;
5019963Smckusick 
5146011Sbostic 	if (!*argv)
5246011Sbostic 		usage();
53625Sbill 
5446011Sbostic 	for (eval = 0; archive = *argv++;)
5546011Sbostic 		eval |= tflag ? touch() : build();
5646011Sbostic 	exit(eval);
57625Sbill }
58625Sbill 
usage()5946011Sbostic usage()
60625Sbill {
6146011Sbostic 	(void)fprintf(stderr, "usage: ranlib [-t] archive ...\n");
6246011Sbostic 	exit(1);
63625Sbill }
64