Deleted Added
full compact
ldconfig.c (1683) ldconfig.c (1741)
1/*
2 * Copyright (c) 1993 Paul Kranenburg
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 13 unchanged lines hidden (view full) ---

22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 *
1/*
2 * Copyright (c) 1993 Paul Kranenburg
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 13 unchanged lines hidden (view full) ---

22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 *
30 * $Id: ldconfig.c,v 1.5 1994/02/13 20:42:30 jkh Exp $
30 * $Id: ldconfig.c,v 1.6 1994/06/05 19:04:11 ats Exp $
31 */
32
33#include <sys/param.h>
31 */
32
33#include <sys/param.h>
34#include <stdio.h>
35#include <stdlib.h>
36#include <sys/types.h>
37#include <sys/stat.h>
38#include <sys/file.h>
39#include <sys/time.h>
40#include <sys/mman.h>
41#include <sys/resource.h>
34#include <sys/types.h>
35#include <sys/stat.h>
36#include <sys/file.h>
37#include <sys/time.h>
38#include <sys/mman.h>
39#include <sys/resource.h>
42#include <fcntl.h>
40#include <dirent.h>
43#include <errno.h>
41#include <errno.h>
42#include <fcntl.h>
44#include <ar.h>
45#include <ranlib.h>
46#include <a.out.h>
47#include <stab.h>
43#include <ar.h>
44#include <ranlib.h>
45#include <a.out.h>
46#include <stab.h>
47#include <stdio.h>
48#include <stdlib.h>
48#include <string.h>
49#include <string.h>
49#include <dirent.h>
50#include <unistd.h>
50
51#include "ld.h"
52
53#undef major
54#undef minor
55
56char *progname;
57static int verbose;

--- 11 unchanged lines hidden (view full) ---

69 struct shlib_list *next;
70};
71
72static struct shlib_list *shlib_head = NULL, **shlib_tail = &shlib_head;
73
74static void enter __P((char *, char *, char *, int *, int));
75static int dodir __P((char *, int));
76static int build_hints __P((void));
51
52#include "ld.h"
53
54#undef major
55#undef minor
56
57char *progname;
58static int verbose;

--- 11 unchanged lines hidden (view full) ---

70 struct shlib_list *next;
71};
72
73static struct shlib_list *shlib_head = NULL, **shlib_tail = &shlib_head;
74
75static void enter __P((char *, char *, char *, int *, int));
76static int dodir __P((char *, int));
77static int build_hints __P((void));
78static int listhints __P((void));
77
78int
79main(argc, argv)
80int argc;
81char *argv[];
82{
83 int i, c;
84 int rval = 0;

--- 21 unchanged lines hidden (view full) ---

106 break;
107 }
108 }
109
110 if (justread)
111 return listhints();
112
113 if (!nostd)
79
80int
81main(argc, argv)
82int argc;
83char *argv[];
84{
85 int i, c;
86 int rval = 0;

--- 21 unchanged lines hidden (view full) ---

108 break;
109 }
110 }
111
112 if (justread)
113 return listhints();
114
115 if (!nostd)
114 std_search_dirs(NULL);
116 std_search_path();
115
116 for (i = 0; i < n_search_dirs; i++)
117 rval |= dodir(search_dirs[i], 1);
118
119 for (i = optind; i < argc; i++)
120 rval |= dodir(argv[i], 0);
121
122 rval |= build_hints();

--- 221 unchanged lines hidden (view full) ---

344 if (rename(tmpfile, _PATH_LD_HINTS) != 0) {
345 perror(_PATH_LD_HINTS);
346 return -1;
347 }
348
349 return 0;
350}
351
117
118 for (i = 0; i < n_search_dirs; i++)
119 rval |= dodir(search_dirs[i], 1);
120
121 for (i = optind; i < argc; i++)
122 rval |= dodir(argv[i], 0);
123
124 rval |= build_hints();

--- 221 unchanged lines hidden (view full) ---

346 if (rename(tmpfile, _PATH_LD_HINTS) != 0) {
347 perror(_PATH_LD_HINTS);
348 return -1;
349 }
350
351 return 0;
352}
353
352int
354static int
353listhints()
354{
355 int fd;
356 caddr_t addr;
357 long msize;
358 struct hints_header *hdr;
359 struct hints_bucket *blist;
360 char *strtab;

--- 9 unchanged lines hidden (view full) ---

370
371 if (addr == (caddr_t)-1) {
372 perror(_PATH_LD_HINTS);
373 return -1;
374 }
375
376 hdr = (struct hints_header *)addr;
377 if (HH_BADMAG(*hdr)) {
355listhints()
356{
357 int fd;
358 caddr_t addr;
359 long msize;
360 struct hints_header *hdr;
361 struct hints_bucket *blist;
362 char *strtab;

--- 9 unchanged lines hidden (view full) ---

372
373 if (addr == (caddr_t)-1) {
374 perror(_PATH_LD_HINTS);
375 return -1;
376 }
377
378 hdr = (struct hints_header *)addr;
379 if (HH_BADMAG(*hdr)) {
378 fprintf(stderr, "%s: Bad magic: %d\n");
380 fprintf(stderr, "%s: Bad magic: %o\n",
381 _PATH_LD_HINTS, hdr->hh_magic);
379 return -1;
380 }
381
382 if (hdr->hh_version != LD_HINTS_VERSION_1) {
383 fprintf(stderr, "Unsupported version: %d\n", hdr->hh_version);
384 return -1;
385 }
386

--- 40 unchanged lines hidden ---
382 return -1;
383 }
384
385 if (hdr->hh_version != LD_HINTS_VERSION_1) {
386 fprintf(stderr, "Unsupported version: %d\n", hdr->hh_version);
387 return -1;
388 }
389

--- 40 unchanged lines hidden ---