summaryrefslogtreecommitdiffstats
path: root/sbin/ldconfig/ldconfig.c
diff options
context:
space:
mode:
authorcharnier <charnier@FreeBSD.org>1998-07-06 07:02:26 +0000
committercharnier <charnier@FreeBSD.org>1998-07-06 07:02:26 +0000
commit2cac39e5e4ae74db4c76294806405e2ced576fa7 (patch)
treef1ef6fcb1a0141a3b8666a822effa583780ae42c /sbin/ldconfig/ldconfig.c
parentf910b5ad8b94bd4fdd22e946719bf5e1598048ea (diff)
downloadFreeBSD-src-2cac39e5e4ae74db4c76294806405e2ced576fa7.zip
FreeBSD-src-2cac39e5e4ae74db4c76294806405e2ced576fa7.tar.gz
Add rcsid. remove unused #includes. Getopt returns -1 not EOF. Add usage().
Cosmetics in err(3) string.
Diffstat (limited to 'sbin/ldconfig/ldconfig.c')
-rw-r--r--sbin/ldconfig/ldconfig.c50
1 files changed, 27 insertions, 23 deletions
diff --git a/sbin/ldconfig/ldconfig.c b/sbin/ldconfig/ldconfig.c
index 1b9e837..301a871 100644
--- a/sbin/ldconfig/ldconfig.c
+++ b/sbin/ldconfig/ldconfig.c
@@ -26,34 +26,29 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $Id: ldconfig.c,v 1.21 1998/05/26 20:12:50 sos Exp $
*/
+#ifndef lint
+static const char rcsid[] =
+ "$Id$";
+#endif /* not lint */
+
#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <sys/file.h>
-#include <sys/time.h>
#include <sys/mman.h>
-#include <sys/resource.h>
+#include <a.out.h>
+#include <ctype.h>
#include <dirent.h>
-#include <errno.h>
#include <err.h>
-#include <ctype.h>
+#include <errno.h>
#include <fcntl.h>
-#include <ar.h>
-#include <ranlib.h>
-#include <a.out.h>
-#include <stab.h>
+#include <link.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <machine/param.h>
-
-#include <link.h>
#include "shlib.h"
#include "support.h"
@@ -89,9 +84,11 @@ static char *dir_list;
static void enter __P((char *, char *, char *, int *, int));
static int dodir __P((char *, int));
+int dofile __P((char *, int));
static int buildhints __P((void));
static int readhints __P((void));
static void listhints __P((void));
+static void usage __P((void));
int
main(argc, argv)
@@ -101,7 +98,7 @@ char *argv[];
int i, c;
int rval = 0;
- while ((c = getopt(argc, argv, "Rf:mrsv")) != EOF) {
+ while ((c = getopt(argc, argv, "Rf:mrsv")) != -1) {
switch (c) {
case 'R':
rescan = 1;
@@ -122,8 +119,7 @@ char *argv[];
verbose = 1;
break;
default:
- errx(1, "Usage: %s [-Rmrsv] [-f hints_file] "
- "[dir | file ...]", argv[0]);
+ usage();
break;
}
}
@@ -183,6 +179,14 @@ char *argv[];
return rval;
}
+static void
+usage()
+{
+ fprintf(stderr,
+ "usage: ldconfig [-Rmrsv] [-f hints_file] [dir | file ...]\n");
+ exit(1);
+}
+
int
dofile(fname, silent)
char *fname;
@@ -210,7 +214,7 @@ int silent;
if (*cp != '\n') {
*cp = '\0';
- warnx("%s: Trailing characters ignored", sp);
+ warnx("%s: trailing characters ignored", sp);
}
*cp = '\0';
@@ -403,7 +407,7 @@ buildhints()
break;
}
if (i == hdr.hh_nbucket) {
- warnx("Bummer!");
+ warnx("bummer!");
return -1;
}
while (bp->hi_next != -1)
@@ -507,13 +511,13 @@ readhints()
hdr = (struct hints_header *)addr;
if (HH_BADMAG(*hdr)) {
- warnx("%s: Bad magic: %lo", hints_file, hdr->hh_magic);
+ warnx("%s: bad magic: %lo", hints_file, hdr->hh_magic);
return -1;
}
if (hdr->hh_version != LD_HINTS_VERSION_1 &&
hdr->hh_version != LD_HINTS_VERSION_2) {
- warnx("Unsupported version: %ld", hdr->hh_version);
+ warnx("unsupported version: %ld", hdr->hh_version);
return -1;
}
@@ -545,11 +549,11 @@ readhints()
/* Sanity check */
if (bp->hi_namex >= hdr->hh_strtab_sz) {
- warnx("Bad name index: %#x", bp->hi_namex);
+ warnx("bad name index: %#x", bp->hi_namex);
return -1;
}
if (bp->hi_pathx >= hdr->hh_strtab_sz) {
- warnx("Bad path index: %#x", bp->hi_pathx);
+ warnx("bad path index: %#x", bp->hi_pathx);
return -1;
}
OpenPOWER on IntegriCloud