/[gentoo-projects]/pax-utils/scanelf.c
Gentoo

Diff of /pax-utils/scanelf.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.85 Revision 1.86
1/* 1/*
2 * Copyright 2003-2005 Gentoo Foundation 2 * Copyright 2003-2005 Gentoo Foundation
3 * Distributed under the terms of the GNU General Public License v2 3 * Distributed under the terms of the GNU General Public License v2
4 * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v 1.85 2005/07/25 23:31:32 vapier Exp $ 4 * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v 1.86 2005/09/24 16:17:53 solar Exp $
5 * 5 *
6 ******************************************************************** 6 ********************************************************************
7 * This program is free software; you can redistribute it and/or 7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as 8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of the 9 * published by the Free Software Foundation; either version 2 of the
33#include <dirent.h> 33#include <dirent.h>
34#include <getopt.h> 34#include <getopt.h>
35#include <assert.h> 35#include <assert.h>
36#include "paxelf.h" 36#include "paxelf.h"
37 37
38static const char *rcsid = "$Id: scanelf.c,v 1.85 2005/07/25 23:31:32 vapier Exp $"; 38static const char *rcsid = "$Id: scanelf.c,v 1.86 2005/09/24 16:17:53 solar Exp $";
39#define argv0 "scanelf" 39#define argv0 "scanelf"
40 40
41#define IS_MODIFIER(c) (c == '%' || c == '#') 41#define IS_MODIFIER(c) (c == '%' || c == '#')
42 42
43 43
76static char be_wewy_wewy_quiet = 0; 76static char be_wewy_wewy_quiet = 0;
77static char *find_sym = NULL, *versioned_symname = NULL; 77static char *find_sym = NULL, *versioned_symname = NULL;
78static char *find_lib = NULL; 78static char *find_lib = NULL;
79static char *out_format = NULL; 79static char *out_format = NULL;
80static char *search_path = NULL; 80static char *search_path = NULL;
81 81static char gmatch = 0;
82 82
83 83
84/* sub-funcs for scanelf_file() */ 84/* sub-funcs for scanelf_file() */
85static void scanelf_file_get_symtabs(elfobj *elf, void **sym, void **tab) 85static void scanelf_file_get_symtabs(elfobj *elf, void **sym, void **tab)
86{ 86{
496 if (*found_needed) xchrcat(ret, ',', ret_len); \ 496 if (*found_needed) xchrcat(ret, ',', ret_len); \
497 xstrcat(ret, needed, ret_len); \ 497 xstrcat(ret, needed, ret_len); \
498 } \ 498 } \
499 *found_needed = 1; \ 499 *found_needed = 1; \
500 } else { \ 500 } else { \
501 if (!strcmp(find_lib, needed)) { \ 501 if (!strncmp(find_lib, needed, strlen( !gmatch ? needed : find_lib))) { \
502 *found_lib = 1; \ 502 *found_lib = 1; \
503 return (be_wewy_wewy_quiet ? NULL : find_lib); \ 503 return (be_wewy_wewy_quiet ? NULL : needed); \
504 } \ 504 } \
505 } \ 505 } \
506 } \ 506 } \
507 ++dyn; \ 507 ++dyn; \
508 } \ 508 } \
980} 980}
981 981
982 982
983 983
984/* usage / invocation handling functions */ 984/* usage / invocation handling functions */
985#define PARSE_FLAGS "plRmyxetrnibSs:N:TaqvF:f:o:BhV" 985#define PARSE_FLAGS "plRmyxetrnibSs:gN:TaqvF:f:o:BhV"
986#define a_argument required_argument 986#define a_argument required_argument
987static struct option const long_opts[] = { 987static struct option const long_opts[] = {
988 {"path", no_argument, NULL, 'p'}, 988 {"path", no_argument, NULL, 'p'},
989 {"ldpath", no_argument, NULL, 'l'}, 989 {"ldpath", no_argument, NULL, 'l'},
990 {"recursive", no_argument, NULL, 'R'}, 990 {"recursive", no_argument, NULL, 'R'},
998 {"interp", no_argument, NULL, 'i'}, 998 {"interp", no_argument, NULL, 'i'},
999 {"bind", no_argument, NULL, 'b'}, 999 {"bind", no_argument, NULL, 'b'},
1000 {"soname", no_argument, NULL, 'S'}, 1000 {"soname", no_argument, NULL, 'S'},
1001 {"symbol", a_argument, NULL, 's'}, 1001 {"symbol", a_argument, NULL, 's'},
1002 {"lib", a_argument, NULL, 'N'}, 1002 {"lib", a_argument, NULL, 'N'},
1003 {"gmatch", no_argument, NULL, 'g'},
1003 {"textrels", no_argument, NULL, 'T'}, 1004 {"textrels", no_argument, NULL, 'T'},
1004 {"all", no_argument, NULL, 'a'}, 1005 {"all", no_argument, NULL, 'a'},
1005 {"quiet", no_argument, NULL, 'q'}, 1006 {"quiet", no_argument, NULL, 'q'},
1006 {"verbose", no_argument, NULL, 'v'}, 1007 {"verbose", no_argument, NULL, 'v'},
1007 {"format", a_argument, NULL, 'F'}, 1008 {"format", a_argument, NULL, 'F'},
1027 "Print INTERP information", 1028 "Print INTERP information",
1028 "Print BIND information", 1029 "Print BIND information",
1029 "Print SONAME information", 1030 "Print SONAME information",
1030 "Find a specified symbol", 1031 "Find a specified symbol",
1031 "Find a specified library", 1032 "Find a specified library",
1033 "Use strncmp to match libraries. (use with -N)",
1032 "Locate cause of TEXTREL", 1034 "Locate cause of TEXTREL",
1033 "Print all scanned info (-x -e -t -r -b)\n", 1035 "Print all scanned info (-x -e -t -r -b)\n",
1034 "Only output 'bad' things", 1036 "Only output 'bad' things",
1035 "Be verbose (can be specified more than once)", 1037 "Be verbose (can be specified more than once)",
1036 "Use specified format for output", 1038 "Use specified format for output",
1120 if (out_format) err("Don't specify -F twice"); 1122 if (out_format) err("Don't specify -F twice");
1121 out_format = xstrdup(optarg); 1123 out_format = xstrdup(optarg);
1122 break; 1124 break;
1123 } 1125 }
1124 1126
1127 case 'g': gmatch = 1;
1125 case 'y': scan_symlink = 0; break; 1128 case 'y': scan_symlink = 0; break;
1126 case 'B': show_banner = 0; break; 1129 case 'B': show_banner = 0; break;
1127 case 'l': scan_ldpath = 1; break; 1130 case 'l': scan_ldpath = 1; break;
1128 case 'p': scan_envpath = 1; break; 1131 case 'p': scan_envpath = 1; break;
1129 case 'R': dir_recurse = 1; break; 1132 case 'R': dir_recurse = 1; break;

Legend:
Removed from v.1.85  
changed lines
  Added in v.1.86

  ViewVC Help
Powered by ViewVC 1.1.20