/[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.245 Revision 1.246
1/* 1/*
2 * Copyright 2003-2007 Gentoo Foundation 2 * Copyright 2003-2007 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/Attic/scanelf.c,v 1.245 2012/08/04 06:08:25 vapier Exp $ 4 * $Header: /var/cvsroot/gentoo-projects/pax-utils/Attic/scanelf.c,v 1.246 2012/11/04 06:55:04 vapier Exp $
5 * 5 *
6 * Copyright 2003-2007 Ned Ludd - <solar@gentoo.org> 6 * Copyright 2003-2007 Ned Ludd - <solar@gentoo.org>
7 * Copyright 2004-2007 Mike Frysinger - <vapier@gentoo.org> 7 * Copyright 2004-2007 Mike Frysinger - <vapier@gentoo.org>
8 */ 8 */
9 9
10static const char rcsid[] = "$Id: scanelf.c,v 1.245 2012/08/04 06:08:25 vapier Exp $"; 10static const char rcsid[] = "$Id: scanelf.c,v 1.246 2012/11/04 06:55:04 vapier Exp $";
11const char argv0[] = "scanelf"; 11const char argv0[] = "scanelf";
12 12
13#include "paxinc.h" 13#include "paxinc.h"
14 14
15#define IS_MODIFIER(c) (c == '%' || c == '#' || c == '+') 15#define IS_MODIFIER(c) (c == '%' || c == '#' || c == '+')
125 int ret; 125 int ret;
126 126
127 if ((match == NULL) || (regex == NULL)) 127 if ((match == NULL) || (regex == NULL))
128 return EXIT_FAILURE; 128 return EXIT_FAILURE;
129 129
130 if ((ret = regcomp(&preg, regex, cflags))) { 130 ret = regcomp(&preg, regex, cflags);
131 if (ret) {
131 char err[256]; 132 char err[256];
132
133 if (regerror(ret, &preg, err, sizeof(err))) 133 regerror(ret, &preg, err, sizeof(err));
134 fprintf(stderr, "regcomp failed: %s", err); 134 warnf("regcomp failed: %s", err);
135 else
136 fprintf(stderr, "regcomp failed");
137
138 return EXIT_FAILURE; 135 return EXIT_FAILURE;
139 } 136 }
140 ret = regexec(&preg, match, 0, NULL, 0); 137 ret = regexec(&preg, match, 0, NULL, 0);
141 regfree(&preg); 138 regfree(&preg);
142 139
1270 goto matched; 1267 goto matched;
1271 1268
1272 } else { 1269 } else {
1273 if (g_match) { 1270 if (g_match) {
1274 /* regex match the symbol */ 1271 /* regex match the symbol */
1272 int flags = REG_EXTENDED | REG_NOSUB;
1273 if (g_match > 1)
1274 flags |= REG_ICASE;
1275 if (rematch(this_sym, symname, REG_EXTENDED) != 0) 1275 if (rematch(this_sym, symname, flags) != 0)
1276 continue; 1276 continue;
1277 1277
1278 } else if (*this_sym) { 1278 } else if (*this_sym) {
1279 /* give empty symbols a "pass", else do a normal compare */ 1279 /* give empty symbols a "pass", else do a normal compare */
1280 const size_t len = strlen(this_sym); 1280 const size_t len = strlen(this_sym);
2024 "Print BIND information", 2024 "Print BIND information",
2025 "Print SONAME information", 2025 "Print SONAME information",
2026 "Find a specified symbol", 2026 "Find a specified symbol",
2027 "Find a specified section", 2027 "Find a specified section",
2028 "Find a specified library", 2028 "Find a specified library",
2029 "Use regex matching rather than string compare (use with -s)", 2029 "Use regex rather than string compare (with -s); specify twice for case insensitive",
2030 "Locate cause of TEXTREL", 2030 "Locate cause of TEXTREL",
2031 "Print only ELF files matching etype ET_DYN,ET_EXEC ...", 2031 "Print only ELF files matching etype ET_DYN,ET_EXEC ...",
2032 "Print only ELF files matching numeric bits", 2032 "Print only ELF files matching numeric bits",
2033 "Print Endianness", 2033 "Print Endianness",
2034 "Print OSABI", 2034 "Print OSABI",
2186 ((flags & PF_RANDMMAP) && (flags & PF_NORANDMMAP)))) 2186 ((flags & PF_RANDMMAP) && (flags & PF_NORANDMMAP))))
2187 setpax = flags; 2187 setpax = flags;
2188 break; 2188 break;
2189 } 2189 }
2190 case 'Z': show_size = 1; break; 2190 case 'Z': show_size = 1; break;
2191 case 'g': g_match = 1; break; 2191 case 'g': ++g_match; break;
2192 case 'L': load_cache_config = use_ldcache = 1; break; 2192 case 'L': load_cache_config = use_ldcache = 1; break;
2193 case 'y': scan_symlink = 0; break; 2193 case 'y': scan_symlink = 0; break;
2194 case 'A': scan_archives = 1; break; 2194 case 'A': scan_archives = 1; break;
2195 case 'C': color_init(true); break; 2195 case 'C': color_init(true); break;
2196 case 'B': show_banner = 0; break; 2196 case 'B': show_banner = 0; break;

Legend:
Removed from v.1.245  
changed lines
  Added in v.1.246

  ViewVC Help
Powered by ViewVC 1.1.20