ldconfig.c (b7696cdf60510a9c074ae168e59ea4f0aac47711) | ldconfig.c (f709df34c30e8f45f42c2cef968f06a9fed1eb87) |
---|---|
1/* 2 * Copyright (c) 1993,1995 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 --- 208 unchanged lines hidden (view full) --- 217 rval |= dodir(search_dirs[i], 1); 218 219 rval |= buildhints(); 220 221 return rval; 222} 223 224static void | 1/* 2 * Copyright (c) 1993,1995 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 --- 208 unchanged lines hidden (view full) --- 217 rval |= dodir(search_dirs[i], 1); 218 219 rval |= buildhints(); 220 221 return rval; 222} 223 224static void |
225usage() | 225usage(void) |
226{ 227 fprintf(stderr, 228 "usage: ldconfig [-32] [-aout | -elf] [-Rimrsv] [-f hints_file] [directory | file ...]\n"); 229 exit(1); 230} 231 232int | 226{ 227 fprintf(stderr, 228 "usage: ldconfig [-32] [-aout | -elf] [-Rimrsv] [-f hints_file] [directory | file ...]\n"); 229 exit(1); 230} 231 232int |
233dofile(fname, silent) 234char *fname; 235int silent; | 233dofile(char *fname, int silent) |
236{ 237 FILE *hfp; 238 char buf[MAXPATHLEN]; 239 int rval = 0; 240 char *cp, *sp; 241 242 if ((hfp = fopen(fname, "r")) == NULL) { 243 warn("%s", fname); --- 20 unchanged lines hidden (view full) --- 264 rval |= dodir(sp, silent); 265 } 266 267 (void)fclose(hfp); 268 return rval; 269} 270 271int | 234{ 235 FILE *hfp; 236 char buf[MAXPATHLEN]; 237 int rval = 0; 238 char *cp, *sp; 239 240 if ((hfp = fopen(fname, "r")) == NULL) { 241 warn("%s", fname); --- 20 unchanged lines hidden (view full) --- 262 rval |= dodir(sp, silent); 263 } 264 265 (void)fclose(hfp); 266 return rval; 267} 268 269int |
272dodir(dir, silent) 273char *dir; 274int silent; | 270dodir(char *dir, int silent) |
275{ 276 DIR *dd; 277 struct dirent *dp; 278 char name[MAXPATHLEN]; 279 int dewey[MAXDEWEY], ndewey; 280 281 if ((dd = opendir(dir)) == NULL) { 282 if (silent && errno == ENOENT) /* Ignore the error */ --- 40 unchanged lines hidden (view full) --- 323 enter(dir, dp->d_name, name, dewey, ndewey); 324 } 325 326 closedir(dd); 327 return 0; 328} 329 330static void | 271{ 272 DIR *dd; 273 struct dirent *dp; 274 char name[MAXPATHLEN]; 275 int dewey[MAXDEWEY], ndewey; 276 277 if ((dd = opendir(dir)) == NULL) { 278 if (silent && errno == ENOENT) /* Ignore the error */ --- 40 unchanged lines hidden (view full) --- 319 enter(dir, dp->d_name, name, dewey, ndewey); 320 } 321 322 closedir(dd); 323 return 0; 324} 325 326static void |
331enter(dir, file, name, dewey, ndewey) 332char *dir, *file, *name; 333int dewey[], ndewey; | 327enter(char *dir, char *file, char *name, int dewey[], int ndewey) |
334{ 335 struct shlib_list *shp; 336 337 for (shp = shlib_head; shp; shp = shp->next) { 338 if (strcmp(name, shp->name) != 0 || major != shp->major) 339 continue; 340 341 /* Name matches existing entry */ --- 44 unchanged lines hidden (view full) --- 386 k = (((k << 1) + (k >> 14)) ^ (*cp++)) & 0x3fff; 387 388 k = (((k << 1) + (k >> 14)) ^ (vmajor*257)) & 0x3fff; 389 390 return k; 391} 392 393int | 328{ 329 struct shlib_list *shp; 330 331 for (shp = shlib_head; shp; shp = shp->next) { 332 if (strcmp(name, shp->name) != 0 || major != shp->major) 333 continue; 334 335 /* Name matches existing entry */ --- 44 unchanged lines hidden (view full) --- 380 k = (((k << 1) + (k >> 14)) ^ (*cp++)) & 0x3fff; 381 382 k = (((k << 1) + (k >> 14)) ^ (vmajor*257)) & 0x3fff; 383 384 return k; 385} 386 387int |
394buildhints() | 388buildhints(void) |
395{ 396 struct hints_header hdr; 397 struct hints_bucket *blist; 398 struct shlib_list *shp; 399 char *strtab; 400 int i, n, str_index = 0; 401 int strtab_sz = 0; /* Total length of strings */ 402 int nhints = 0; /* Total number of hints */ --- 115 unchanged lines hidden (view full) --- 518 warn("%s", hints_file); 519 return -1; 520 } 521 522 return 0; 523} 524 525static int | 389{ 390 struct hints_header hdr; 391 struct hints_bucket *blist; 392 struct shlib_list *shp; 393 char *strtab; 394 int i, n, str_index = 0; 395 int strtab_sz = 0; /* Total length of strings */ 396 int nhints = 0; /* Total number of hints */ --- 115 unchanged lines hidden (view full) --- 512 warn("%s", hints_file); 513 return -1; 514 } 515 516 return 0; 517} 518 519static int |
526readhints() | 520readhints(void) |
527{ 528 int fd; 529 void *addr; 530 long fsize; 531 long msize; 532 struct hints_header *hdr; 533 struct hints_bucket *blist; 534 char *strtab; --- 83 unchanged lines hidden (view full) --- 618 shlib_tail = &shp->next; 619 } 620 621 free(blist); 622 return 0; 623} 624 625static void | 521{ 522 int fd; 523 void *addr; 524 long fsize; 525 long msize; 526 struct hints_header *hdr; 527 struct hints_bucket *blist; 528 char *strtab; --- 83 unchanged lines hidden (view full) --- 612 shlib_tail = &shp->next; 613 } 614 615 free(blist); 616 return 0; 617} 618 619static void |
626listhints() | 620listhints(void) |
627{ 628 struct shlib_list *shp; 629 int i; 630 631 printf("%s:\n", hints_file); 632 printf("\tsearch directories: %s\n", dir_list); 633 634 for (i = 0, shp = shlib_head; shp; i++, shp = shp->next) 635 printf("\t%d:-l%s.%d.%d => %s\n", 636 i, shp->name, shp->major, shp->minor, shp->path); 637 638 return; 639} | 621{ 622 struct shlib_list *shp; 623 int i; 624 625 printf("%s:\n", hints_file); 626 printf("\tsearch directories: %s\n", dir_list); 627 628 for (i = 0, shp = shlib_head; shp; i++, shp = shp->next) 629 printf("\t%d:-l%s.%d.%d => %s\n", 630 i, shp->name, shp->major, shp->minor, shp->path); 631 632 return; 633} |