/[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.53 Revision 1.54
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.53 2005/05/18 21:01:56 solar Exp $ 5 * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v 1.54 2005/05/18 21:16:32 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
33#include <getopt.h> 33#include <getopt.h>
34#include <assert.h> 34#include <assert.h>
35 35
36#include "paxelf.h" 36#include "paxelf.h"
37 37
38static const char *rcsid = "$Id: scanelf.c,v 1.53 2005/05/18 21:01:56 solar Exp $"; 38static const char *rcsid = "$Id: scanelf.c,v 1.54 2005/05/18 21:16:32 vapier Exp $";
39#define argv0 "scanelf" 39#define argv0 "scanelf"
40 40
41 41
42 42
43/* prototypes */ 43/* prototypes */
49static void parseargs(int argc, char *argv[]); 49static void parseargs(int argc, char *argv[]);
50static char *xstrdup(char *s); 50static char *xstrdup(char *s);
51static void *xmalloc(size_t size); 51static void *xmalloc(size_t size);
52static void xstrcat(char **dst, const char *src, size_t *curr_len); 52static void xstrcat(char **dst, const char *src, size_t *curr_len);
53static inline void xchrcat(char **dst, const char append, size_t *curr_len); 53static inline void xchrcat(char **dst, const char append, size_t *curr_len);
54static int xemptybuffer(const char *buff);
55 54
56/* variables to control behavior */ 55/* variables to control behavior */
57static char *ldpaths[256]; 56static char *ldpaths[256];
58static char scan_ldpath = 0; 57static char scan_ldpath = 0;
59static char scan_envpath = 0; 58static char scan_envpath = 0;
493 case 's': out = scanelf_file_sym(elf, &found_sym, filename); break; 492 case 's': out = scanelf_file_sym(elf, &found_sym, filename); break;
494 } 493 }
495 if (out) xstrcat(&out_buffer, out, &out_len); 494 if (out) xstrcat(&out_buffer, out, &out_len);
496 } 495 }
497 496
498 if (!found_file) { 497#define FOUND_SOMETHING() \
499 if (!be_quiet || found_pax || found_stack || found_textrel || \ 498 (found_pax || found_stack || found_textrel || found_rpath || \
500 found_rpath || found_needed || found_interp || found_bind || \ 499 found_needed || found_interp || found_bind || found_sym)
501 found_sym) 500
502 { 501 if (!found_file && (!be_quiet || (be_quiet && FOUND_SOMETHING()))) {
503 xchrcat(&out_buffer, ' ', &out_len); 502 xchrcat(&out_buffer, ' ', &out_len);
504 xstrcat(&out_buffer, filename, &out_len); 503 xstrcat(&out_buffer, filename, &out_len);
505 } 504 }
506 } 505 if (!be_quiet || (be_quiet && FOUND_SOMETHING()))
507 if (!(be_quiet && xemptybuffer(out_buffer)))
508 puts(out_buffer); 506 puts(out_buffer);
509 507
510 unreadelf(elf); 508 unreadelf(elf);
511} 509}
512 510
905 static char my_app[2]; 903 static char my_app[2];
906 my_app[0] = append; 904 my_app[0] = append;
907 my_app[1] = '\0'; 905 my_app[1] = '\0';
908 xstrcat(dst, my_app, curr_len); 906 xstrcat(dst, my_app, curr_len);
909} 907}
910static int xemptybuffer(const char *buff)
911{
912 long i;
913 for (i = 0; buff[i]; ++i)
914 if (buff[i] != ' ')
915 return 0;
916 return 1;
917}
918 908
919 909
920 910
921int main(int argc, char *argv[]) 911int main(int argc, char *argv[])
922{ 912{

Legend:
Removed from v.1.53  
changed lines
  Added in v.1.54

  ViewVC Help
Powered by ViewVC 1.1.20