/[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.23 Revision 1.24
1/* 1/*
2 * Copyright 2003 Ned Ludd <solar@gentoo.org> 2 * Copyright 2003 Ned Ludd <solar@gentoo.org>
3 * Copyright 1999-2005 Gentoo Foundation 3 * Copyright 1999-2005 Gentoo Foundation
4 * Distributed under the terms of the GNU General Public License v2 4 * Distributed under the terms of the GNU General Public License v2
5 * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v 1.23 2005/04/03 18:27:45 vapier Exp $ 5 * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v 1.24 2005/04/03 18:42:27 vapier Exp $
6 * 6 *
7 ******************************************************************** 7 ********************************************************************
8 * This program is free software; you can redistribute it and/or 8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as 9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of the 10 * published by the Free Software Foundation; either version 2 of the
32#include <getopt.h> 32#include <getopt.h>
33#include <assert.h> 33#include <assert.h>
34 34
35#include "paxelf.h" 35#include "paxelf.h"
36 36
37static const char *rcsid = "$Id: scanelf.c,v 1.23 2005/04/03 18:27:45 vapier Exp $"; 37static const char *rcsid = "$Id: scanelf.c,v 1.24 2005/04/03 18:42:27 vapier Exp $";
38 38
39 39
40/* helper functions for showing errors */ 40/* helper functions for showing errors */
41#define argv0 "scanelf" /*((*argv != NULL) ? argv[0] : __FILE__ "\b\b")*/ 41#define argv0 "scanelf" /*((*argv != NULL) ? argv[0] : __FILE__ "\b\b")*/
42#define warn(fmt, args...) \ 42#define warn(fmt, args...) \
295} 295}
296 296
297 297
298 298
299/* usage / invocation handling functions */ 299/* usage / invocation handling functions */
300#define PARSE_FLAGS "plRmxetro:aqvBhV" 300#define PARSE_FLAGS "plRmxetraqvo:BhV"
301static struct option const long_opts[] = { 301static struct option const long_opts[] = {
302 {"path", no_argument, NULL, 'p'}, 302 {"path", no_argument, NULL, 'p'},
303 {"ldpath", no_argument, NULL, 'l'}, 303 {"ldpath", no_argument, NULL, 'l'},
304 {"recursive", no_argument, NULL, 'R'}, 304 {"recursive", no_argument, NULL, 'R'},
305 {"mount", no_argument, NULL, 'm'}, 305 {"mount", no_argument, NULL, 'm'},
306 {"pax", no_argument, NULL, 'x'}, 306 {"pax", no_argument, NULL, 'x'},
307 {"header", no_argument, NULL, 'e'}, 307 {"header", no_argument, NULL, 'e'},
308 {"textrel", no_argument, NULL, 't'}, 308 {"textrel", no_argument, NULL, 't'},
309 {"rpath", no_argument, NULL, 'r'}, 309 {"rpath", no_argument, NULL, 'r'},
310 {"file",required_argument, NULL, 'o'},
311 {"all", no_argument, NULL, 'a'}, 310 {"all", no_argument, NULL, 'a'},
312 {"quiet", no_argument, NULL, 'q'}, 311 {"quiet", no_argument, NULL, 'q'},
313 {"verbose", no_argument, NULL, 'v'}, 312 {"verbose", no_argument, NULL, 'v'},
313 {"file",required_argument, NULL, 'o'},
314 {"nobanner", no_argument, NULL, 'B'}, 314 {"nobanner", no_argument, NULL, 'B'},
315 {"help", no_argument, NULL, 'h'}, 315 {"help", no_argument, NULL, 'h'},
316 {"version", no_argument, NULL, 'V'}, 316 {"version", no_argument, NULL, 'V'},
317 {NULL, no_argument, NULL, 0x0} 317 {NULL, no_argument, NULL, 0x0}
318}; 318};
323 "Don't recursively cross mount points\n", 323 "Don't recursively cross mount points\n",
324 "Print PaX markings", 324 "Print PaX markings",
325 "Print GNU_STACK markings", 325 "Print GNU_STACK markings",
326 "Print TEXTREL information", 326 "Print TEXTREL information",
327 "Print RPATH information", 327 "Print RPATH information",
328 "Write output stream to a filename",
329 "Print all scanned info (-x -e -t -r)\n", 328 "Print all scanned info (-x -e -t -r)\n",
330 "Only output 'bad' things", 329 "Only output 'bad' things",
331 "Be verbose (can be specified more than once)", 330 "Be verbose (can be specified more than once)",
331 "Write output stream to a filename",
332 "Don't display the header", 332 "Don't display the header",
333 "Print this help and exit", 333 "Print this help and exit",
334 "Print version and exit", 334 "Print version and exit",
335 NULL 335 NULL
336}; 336};
369 exit(EXIT_SUCCESS); 369 exit(EXIT_SUCCESS);
370 break; 370 break;
371 case 's': /* reserved for -s, --symbol= */ 371 case 's': /* reserved for -s, --symbol= */
372 case 'h': usage(EXIT_SUCCESS); break; 372 case 'h': usage(EXIT_SUCCESS); break;
373 373
374 case 'o': 374 case 'o': {
375 {
376 FILE *fp = NULL; 375 FILE *fp = NULL;
377 fp = freopen(optarg, "w", stdout); 376 fp = freopen(optarg, "w", stdout);
378 if (fp == NULL) { 377 if (fp == NULL)
379 fputs("open ", stderr); 378 err("Could not open output stream '%s': %s", optarg, strerror(errno));
380 perror(optarg);
381 } else
382 stdout = fp; 379 stdout = fp;
383 break; 380 break;
384 } 381 }
382
385 case 'B': show_banner = 0; break; 383 case 'B': show_banner = 0; break;
386 case 'l': scan_ldpath = 1; break; 384 case 'l': scan_ldpath = 1; break;
387 case 'p': scan_envpath = 1; break; 385 case 'p': scan_envpath = 1; break;
388 case 'R': dir_recurse = 1; break; 386 case 'R': dir_recurse = 1; break;
389 case 'm': dir_crossmount = 0; break; 387 case 'm': dir_crossmount = 0; break;

Legend:
Removed from v.1.23  
changed lines
  Added in v.1.24

  ViewVC Help
Powered by ViewVC 1.1.20