Commit | Line | Data |
---|---|---|
6999d532 | 1 | /*- |
80baa34f KB |
2 | * Copyright (c) 1990, 1993 |
3 | * The Regents of the University of California. All rights reserved. | |
6999d532 KB |
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% | |
d0aeaf5a DF |
9 | */ |
10 | ||
34aa0635 | 11 | #ifndef lint |
80baa34f KB |
12 | static char copyright[] = |
13 | "@(#) Copyright (c) 1990, 1993\n\ | |
14 | The Regents of the University of California. All rights reserved.\n"; | |
6999d532 | 15 | #endif /* not lint */ |
d0aeaf5a DF |
16 | |
17 | #ifndef lint | |
80baa34f | 18 | static char sccsid[] = "@(#)ranlib.c 8.1 (Berkeley) %G%"; |
6999d532 | 19 | #endif /* not lint */ |
d0aeaf5a | 20 | |
1372f8b5 | 21 | #include <sys/types.h> |
6999d532 | 22 | #include <dirent.h> |
1372f8b5 | 23 | #include <stdio.h> |
d6db39e0 | 24 | #include <stdlib.h> |
6999d532 | 25 | #include <archive.h> |
1372f8b5 | 26 | |
6999d532 KB |
27 | CHDR chdr; |
28 | u_int options; /* UNUSED -- keep open_archive happy */ | |
29 | char *archive; | |
1372f8b5 BJ |
30 | |
31 | main(argc, argv) | |
6999d532 KB |
32 | int argc; |
33 | char **argv; | |
1372f8b5 | 34 | { |
6999d532 KB |
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(); | |
1372f8b5 | 47 | } |
6999d532 KB |
48 | argc -= optind; |
49 | argv += optind; | |
1372f8b5 | 50 | |
6999d532 KB |
51 | if (!*argv) |
52 | usage(); | |
1372f8b5 | 53 | |
6999d532 KB |
54 | for (eval = 0; archive = *argv++;) |
55 | eval |= tflag ? touch() : build(); | |
56 | exit(eval); | |
1372f8b5 BJ |
57 | } |
58 | ||
6999d532 | 59 | usage() |
1372f8b5 | 60 | { |
6999d532 KB |
61 | (void)fprintf(stderr, "usage: ranlib [-t] archive ...\n"); |
62 | exit(1); | |
1372f8b5 | 63 | } |