Debian Codegraph @

src/bin/dwarfdump/dd_common.c

raw
1 /*
2 Copyright (C) 2008-2010 SN Systems. All Rights Reserved.
3 Portions Copyright (C) 2008-2017 David Anderson. All Rights Reserved.
4 Portions Copyright (C) 2011-2012 SN Systems Ltd. . All Rights Reserved.
5
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of version 2 of the GNU General
8 Public License as published by the Free Software Foundation.
9
10 This program is distributed in the hope that it would be
11 useful, but WITHOUT ANY WARRANTY; without even the implied
12 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13 PURPOSE.
14
15 Further, this software is distributed without any warranty
16 that it is free of the rightful claim of any third person
17 regarding infringement or the like. Any license provided
18 herein, whether implied or otherwise, applies only to this
19 software file. Patent licenses, if any, provided herein
20 do not apply to combinations of this program with other
21 software, or any other product whatsoever.
22
23 You should have received a copy of the GNU General Public
24 License along with this program; if not, write the Free
25 Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
26 Boston MA 02110-1301, USA.
27
28 */
29
30 /* These do little except on Windows */
31
32 #include <config.h>
33
34 #include <stdio.h> /* printf() */
35
36 /* Windows specific header files */
37 #if defined(_WIN32) && defined(HAVE_STDAFX_H)
38 #include "stdafx.h"
39 #endif /* HAVE_STDAFX_H */
40
41 #include "dwarf.h"
42 #include "libdwarf.h"
43 #include "libdwarf_private.h"
44 #include "dd_common.h"
45 #include "dd_checkutil.h"
46 #include "dd_glflags.h"
47 #include "dd_defined_types.h"
48 #include "dd_sanitized.h"
49
50 /* PACKAGE_VERSION is from config.h */
51 /* The Linux/Unix version does not want a version string to print
52 unless -V is on the command line. */
53 void
54 print_version_details(const char * name)
55 {
56 if (glflags.gf_show_args_flag) {
57 const char *pv = dwarf_package_version();
58 printf("%s [%s %s (libdwarf %s dwarfdump %s)]\n",
59 sanitized(name),__DATE__,__TIME__,pv,PACKAGE_VERSION);
60 }
61 }
62
63 void
64 print_args(int argc , char *argv[] )
65 {
66 if (glflags.gf_show_args_flag) {
67 int index = 1;
68 printf("Arguments: ");
69 for (index = 1; index < argc; ++index) {
70 printf("%s ",sanitized(argv[index]));
71 }
72 printf("\n");
73 }
74 }
75
76 /* Going to stdout as of April 2018.
77 dwarfdump only calls if requested by user.
78 At one time this also printed glflags.program_name */
79 void
80 print_usage_message(
81 const char **text)
82 {
83 unsigned i = 0;
84 for (i = 0; *text[i]; ++i) {
85 printf("%s\n", text[i]);
86 }
87 }