[BACK]Return to ranlib.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ranlib

Annotation of src/usr.bin/ranlib/ranlib.c, Revision 1.4

1.4     ! espie       1: /*     $OpenBSD: ranlib.c,v 1.3 1997/01/15 23:43:04 millert Exp $      */
1.2       deraadt     2:
1.1       deraadt     3: /*-
                      4:  * Copyright (c) 1990 The Regents of the University of California.
                      5:  * All rights reserved.
                      6:  *
                      7:  * This code is derived from software contributed to Berkeley by
                      8:  * Hugh Smith at The University of Guelph.
                      9:  *
                     10:  * Redistribution and use in source and binary forms, with or without
                     11:  * modification, are permitted provided that the following conditions
                     12:  * are met:
                     13:  * 1. Redistributions of source code must retain the above copyright
                     14:  *    notice, this list of conditions and the following disclaimer.
                     15:  * 2. Redistributions in binary form must reproduce the above copyright
                     16:  *    notice, this list of conditions and the following disclaimer in the
                     17:  *    documentation and/or other materials provided with the distribution.
                     18:  * 3. All advertising materials mentioning features or use of this software
                     19:  *    must display the following acknowledgement:
                     20:  *     This product includes software developed by the University of
                     21:  *     California, Berkeley and its contributors.
                     22:  * 4. Neither the name of the University nor the names of its contributors
                     23:  *    may be used to endorse or promote products derived from this software
                     24:  *    without specific prior written permission.
                     25:  *
                     26:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     27:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     28:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     29:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     30:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     31:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     32:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     33:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     34:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     35:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     36:  * SUCH DAMAGE.
                     37:  */
                     38:
                     39: #ifndef lint
                     40: char copyright[] =
                     41: "@(#) Copyright (c) 1990 The Regents of the University of California.\n\
                     42:  All rights reserved.\n";
                     43: #endif /* not lint */
                     44:
                     45: #ifndef lint
                     46: /*static char sccsid[] = "from: @(#)ranlib.c   5.6 (Berkeley) 2/26/91";*/
1.4     ! espie      47: static char rcsid[] = "$OpenBSD: ranlib.c,v 1.3 1997/01/15 23:43:04 millert Exp $";
1.1       deraadt    48: #endif /* not lint */
                     49:
                     50: #include <sys/types.h>
                     51: #include <dirent.h>
                     52: #include <stdio.h>
                     53: #include <stdlib.h>
                     54: #include <archive.h>
1.4     ! espie      55: #include "extern.h"
1.1       deraadt    56:
                     57: CHDR chdr;
                     58: u_int options;                         /* UNUSED -- keep open_archive happy */
1.4     ! espie      59:
1.1       deraadt    60: char *archive;
                     61:
1.4     ! espie      62: static void
        !            63: usage();
        !            64:
        !            65: int
1.1       deraadt    66: main(argc, argv)
                     67:        int argc;
                     68:        char **argv;
                     69: {
                     70:        int ch, eval, tflag;
                     71:
                     72:        tflag = 0;
1.3       millert    73:        while ((ch = getopt(argc, argv, "t")) != -1)
1.1       deraadt    74:                switch(ch) {
                     75:                case 't':
                     76:                        tflag = 1;
                     77:                        break;
                     78:                case '?':
                     79:                default:
                     80:                        usage();
                     81:                }
                     82:        argc -= optind;
                     83:        argv += optind;
                     84:
                     85:        if (!*argv)
                     86:                usage();
                     87:
                     88:        for (eval = 0; archive = *argv++;)
                     89:                eval |= tflag ? touch() : build();
                     90:        exit(eval);
                     91: }
                     92:
1.4     ! espie      93: static void
1.1       deraadt    94: usage()
                     95: {
                     96:        (void)fprintf(stderr, "usage: ranlib [-t] archive ...\n");
                     97:        exit(1);
                     98: }