/[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.2 Revision 1.3
1/* 1/*
2 * Copyright 2003 Ned Ludd <solar@gentoo.org> 2 * Copyright 2003 Ned Ludd <solar@gentoo.org>
3 * Copyright 1999-2003 Gentoo Technologies, Inc. 3 * Copyright 1999-2003 Gentoo Technologies, Inc.
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.2 2003/10/24 22:29:06 solar Exp $ 5 * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v 1.3 2003/10/26 23:42:10 solar 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
17 * 17 *
18 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software 19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, 20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
21 * MA 02111-1307, USA. 21 * MA 02111-1307, USA.
22 ********************************************************************
23 *
24 * This program was written for the hcc suite by (solar|pappy)@g.o.
25 * visit http://www.gentoo.org/proj/en/hardened/etdyn-ssp.xml for more
26 * information on the Gentoo Hardened gcc suite
27 * Also of interest is the pax site http://pageexec.virtualave.net/
28 * but you should know about that already.
29 */ 22 */
30 23
31#include <stdio.h> 24#include <stdio.h>
32#include <stdlib.h> 25#include <stdlib.h>
33#include <sys/types.h> 26#include <sys/types.h>
37#include <dirent.h> 30#include <dirent.h>
38#include <getopt.h> 31#include <getopt.h>
39 32
40#include "paxelf.h" 33#include "paxelf.h"
41 34
42static const char *rcsid = "$Id: scanelf.c,v 1.2 2003/10/24 22:29:06 solar Exp $"; 35static const char *rcsid = "$Id: scanelf.c,v 1.3 2003/10/26 23:42:10 solar Exp $";
43
44int display_pax_flags = 1;
45 36
46#define PARSE_FLAGS "hvlp" 37#define PARSE_FLAGS "hvlp"
47static struct option const long_options[] = { 38static struct option const long_options[] = {
48 {"help", no_argument, 0, 'h'}, 39 {"help", no_argument, 0, 'h'},
49 {"version", no_argument, 0, 'v'}, 40 {"version", no_argument, 0, 'v'},
84 75
85 76
86/* display usage and exit */ 77/* display usage and exit */
87int usage(char **argv) 78int usage(char **argv)
88{ 79{
89 printf 80 fprintf(stderr,
90 ("Usage: %s [options] dir1 dir2 dirN...\n", 81 "Usage: %s [options] dir1 dir2 dirN...\n",
91 (*argv != NULL) ? argv[0] : __FILE__ "\b\b"); 82 (*argv != NULL) ? argv[0] : __FILE__ "\b\b");
92 exit(EXIT_FAILURE); 83 exit(EXIT_FAILURE);
93} 84}
94 85
95 86
96void showopt(int c, char *data) 87void showopt(int c, char *data)
97{ 88{
98 int i; 89 int i;
99 for (i = 0; long_options[i].name; i++) 90 for (i = 0; long_options[i].name; i++)
100 if (long_options[i].val == c) 91 if (long_options[i].val == c)
101 printf(" -%c, --%s\t: %s\n", c, long_options[i].name, data); 92 fprintf(stderr, " -%c, --%s\t: %s\n", c, long_options[i].name, data);
102} 93}
103 94
104/* parse command line arguments and preform needed actions */ 95/* parse command line arguments and preform needed actions */
105void parseargs(int argc, char **argv) 96void parseargs(int argc, char **argv)
106{ 97{
118 showopt('l', "Scan all directories in /etc/ld.so.conf"); 109 showopt('l', "Scan all directories in /etc/ld.so.conf");
119 showopt('h', "Print this help and exit."); 110 showopt('h', "Print this help and exit.");
120 showopt('v', "Print version and exit."); 111 showopt('v', "Print version and exit.");
121 exit(EXIT_SUCCESS); 112 exit(EXIT_SUCCESS);
122 case 'v': 113 case 'v':
123 printf("%s compiled %s\n", __FILE__, __DATE__); 114 fprintf(stderr, "%s compiled %s\n", __FILE__, __DATE__);
124 printf 115 fprintf(stderr,
125 ("%s written for Gentoo Linux <solar@gentoo.org>\n\t%s\n", 116 "%s written for Gentoo Linux <solar@gentoo.org>\n\t%s\n",
126 (*argv != NULL) ? argv[0] : __FILE__ "\b\b", rcsid); 117 (*argv != NULL) ? argv[0] : __FILE__ "\b\b", rcsid);
127 exit(EXIT_SUCCESS); 118 exit(EXIT_SUCCESS);
128 case 'l': 119 case 'l':
129 /* scan ld.so.conf for ldpath */ 120 /* scan ld.so.conf for ldpath */
130 if ((fp = fopen("/etc/ld.so.conf", "r")) != NULL) { 121 if ((fp = fopen("/etc/ld.so.conf", "r")) != NULL) {

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.20