| 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.61 2005/05/28 22:09:36 solar Exp $ |
5 | * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v 1.62 2005/05/29 06:25:48 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 |
| … | |
… | |
| 34 | #include <dirent.h> |
34 | #include <dirent.h> |
| 35 | #include <getopt.h> |
35 | #include <getopt.h> |
| 36 | #include <assert.h> |
36 | #include <assert.h> |
| 37 | #include "paxelf.h" |
37 | #include "paxelf.h" |
| 38 | |
38 | |
| 39 | static const char *rcsid = "$Id: scanelf.c,v 1.61 2005/05/28 22:09:36 solar Exp $"; |
39 | static const char *rcsid = "$Id: scanelf.c,v 1.62 2005/05/29 06:25:48 vapier Exp $"; |
| 40 | #define argv0 "scanelf" |
40 | #define argv0 "scanelf" |
| 41 | |
41 | |
| 42 | |
42 | |
| 43 | |
43 | |
| 44 | /* prototypes */ |
44 | /* prototypes */ |
| … | |
… | |
| 792 | break; |
792 | break; |
| 793 | case 'h': usage(EXIT_SUCCESS); break; |
793 | case 'h': usage(EXIT_SUCCESS); break; |
| 794 | case 'f': |
794 | case 'f': |
| 795 | if (from_file == NULL) |
795 | if (from_file == NULL) |
| 796 | from_file = xstrdup(optarg); |
796 | from_file = xstrdup(optarg); |
|
|
797 | else |
|
|
798 | err("Don't specify -f twice"); |
| 797 | break; |
799 | break; |
| 798 | case 'o': { |
800 | case 'o': { |
| 799 | FILE *fp = NULL; |
801 | FILE *fp = NULL; |
| 800 | fp = freopen(optarg, "w", stdout); |
802 | fp = freopen(optarg, "w", stdout); |
| 801 | if (fp == NULL) |
803 | if (fp == NULL) |
| … | |
… | |
| 804 | break; |
806 | break; |
| 805 | } |
807 | } |
| 806 | |
808 | |
| 807 | case 's': { |
809 | case 's': { |
| 808 | size_t len; |
810 | size_t len; |
|
|
811 | if (!find_sym) |
|
|
812 | err("Don't specify -s twice"); |
| 809 | find_sym = xstrdup(optarg); |
813 | find_sym = xstrdup(optarg); |
| 810 | len = strlen(find_sym) + 1; |
814 | len = strlen(find_sym) + 1; |
| 811 | versioned_symname = (char*)xmalloc(sizeof(char) * (len+1)); |
815 | versioned_symname = (char*)xmalloc(sizeof(char) * (len+1)); |
| 812 | sprintf(versioned_symname, "%s@", find_sym); |
816 | sprintf(versioned_symname, "%s@", find_sym); |
| 813 | break; |
817 | break; |
| 814 | } |
818 | } |
| 815 | |
819 | |
| 816 | case 'F': { |
820 | case 'F': { |
| 817 | if (!out_format) |
821 | if (!out_format) |
| 818 | out_format = xstrdup(optarg); |
822 | out_format = xstrdup(optarg); |
|
|
823 | else |
|
|
824 | err("Don't specify -F twice"); |
| 819 | break; |
825 | break; |
| 820 | } |
826 | } |
| 821 | |
827 | |
| 822 | case 'y': scan_symlink = 0; break; |
828 | case 'y': scan_symlink = 0; break; |
| 823 | case 'B': show_banner = 0; break; |
829 | case 'B': show_banner = 0; break; |