/[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.91 Revision 1.93
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/Attic/scanelf.c,v 1.91 2005/12/07 01:04:52 vapier Exp $ 4 * $Header: /var/cvsroot/gentoo-projects/pax-utils/Attic/scanelf.c,v 1.93 2005/12/10 04:07:55 vapier Exp $
5 * 5 *
6 * Copyright 2003-2005 Ned Ludd - <solar@gentoo.org> 6 * Copyright 2003-2005 Ned Ludd - <solar@gentoo.org>
7 * Copyright 2004-2005 Mike Frysinger - <vapier@gentoo.org> 7 * Copyright 2004-2005 Mike Frysinger - <vapier@gentoo.org>
8 */ 8 */
9 9
10#include <stdio.h> 10#include <stdio.h>
11#include <stdlib.h> 11#include <stdlib.h>
12#include <sys/types.h> 12#include <sys/types.h>
13#include <libgen.h> 13#include <libgen.h>
14#include <limits.h> 14#include <limits.h>
15#define __USE_GNU
16#include <string.h> 15#include <string.h>
17#include <errno.h> 16#include <errno.h>
18#include <unistd.h> 17#include <unistd.h>
19#include <sys/stat.h> 18#include <sys/stat.h>
20#include <dirent.h> 19#include <dirent.h>
21#include <getopt.h> 20#include <getopt.h>
22#include <assert.h> 21#include <assert.h>
23#include "paxinc.h" 22#include "paxinc.h"
24 23
25static const char *rcsid = "$Id: scanelf.c,v 1.91 2005/12/07 01:04:52 vapier Exp $"; 24static const char *rcsid = "$Id: scanelf.c,v 1.93 2005/12/10 04:07:55 vapier Exp $";
26#define argv0 "scanelf" 25#define argv0 "scanelf"
27 26
28#define IS_MODIFIER(c) (c == '%' || c == '#') 27#define IS_MODIFIER(c) (c == '%' || c == '#')
29 28
30 29
1122 SET_STDOUT(fp); 1121 SET_STDOUT(fp);
1123 break; 1122 break;
1124 } 1123 }
1125 1124
1126 case 's': { 1125 case 's': {
1127 size_t len;
1128 if (find_sym) err("Don't specify -s twice"); 1126 if (find_sym) warn("You prob don't want to specify -s twice");
1129 find_sym = xstrdup(optarg); 1127 find_sym = optarg;
1130 len = strlen(find_sym) + 1;
1131 versioned_symname = (char*)xmalloc(sizeof(char) * (len+1)); 1128 versioned_symname = (char*)xmalloc(sizeof(char) * (strlen(find_sym)+1+1));
1132 sprintf(versioned_symname, "%s@", find_sym); 1129 sprintf(versioned_symname, "%s@", find_sym);
1133 break; 1130 break;
1134 } 1131 }
1135 case 'N': { 1132 case 'N': {
1136 if (find_lib) err("Don't specify -N twice"); 1133 if (find_lib) warn("You prob don't want to specify -N twice");
1137 find_lib = xstrdup(optarg); 1134 find_lib = optarg;
1138 break; 1135 break;
1139 } 1136 }
1140 1137
1141 case 'F': { 1138 case 'F': {
1142 if (out_format) err("Don't specify -F twice"); 1139 if (out_format) warn("You prob don't want to specify -F twice");
1143 out_format = xstrdup(optarg); 1140 out_format = optarg;
1144 break; 1141 break;
1145 } 1142 }
1146 1143
1147 case 'g': gmatch = 1; 1144 case 'g': gmatch = 1;
1148 case 'y': scan_symlink = 0; break; 1145 case 'y': scan_symlink = 0; break;
1241 search_path = argv[optind++]; 1238 search_path = argv[optind++];
1242 scanelf_dir(search_path); 1239 scanelf_dir(search_path);
1243 } 1240 }
1244 1241
1245 /* clean up */ 1242 /* clean up */
1246 if (find_sym) { 1243 if (versioned_symname) free(versioned_symname);
1247 free(find_sym);
1248 free(versioned_symname);
1249 }
1250 if (find_lib) free(find_lib);
1251 if (out_format) free(out_format);
1252 for (i = 0; ldpaths[i]; ++i) 1244 for (i = 0; ldpaths[i]; ++i)
1253 free(ldpaths[i]); 1245 free(ldpaths[i]);
1254} 1246}
1255 1247
1256 1248

Legend:
Removed from v.1.91  
changed lines
  Added in v.1.93

  ViewVC Help
Powered by ViewVC 1.1.20