DLL dependency listing utility for MinGW applications
Revision | a9475f3822ac2106c801029580e73c315effe970 (tree) |
---|---|
Time | 2020-09-08 03:13:38 |
Author | Keith Marshall <keith@user...> |
Commiter | Keith Marshall |
Adopt a consistent style for shell function definitions.
* mingw32-ldd.sh (usage, set_dllpath, depends, list_depends)
(plot_depends, ref_count, ref_shift, plot_linkage, show_depends):
Insert white-space between '()' and '{'; some shells may object,
when it is omitted.
@@ -6,7 +6,7 @@ | ||
6 | 6 | # executable files and/or dynamic link libraries. |
7 | 7 | # |
8 | 8 | # |
9 | -# $Id: mingw32-ldd.sh,v bf042a552a35 2020/09/06 17:38:10 keith $ | |
9 | +# $Id$ | |
10 | 10 | # |
11 | 11 | # Written by Keith Marshall <keith@users.osdn.me> |
12 | 12 | # Copyright (C) 2016, 2017, 2019, 2020, MinGW.org Project |
@@ -33,7 +33,7 @@ | ||
33 | 33 | # |
34 | 34 | # |
35 | 35 | CMD=`basename $0` |
36 | - usage(){ echo >&2 "Usage: $CMD {EXENAME | DLLNAME} ..."; STATUS=2; echo; } | |
36 | + usage() { echo "Usage: $CMD { EXENAME | DLLNAME } ..."; STATUS=2; echo; } | |
37 | 37 | # |
38 | 38 | # Run-time initialization allows preferences for shell variables, |
39 | 39 | # such as SYSTEM_DRIVE, SYSTEM_DLLPATH, and PROGRAM_FILES, to be |
@@ -46,7 +46,7 @@ | ||
46 | 46 | rcinit "${HOME-`cd;pwd`}/.mingw32rc" |
47 | 47 | EXEPATH=`dirname "$1"` STATUS=0 |
48 | 48 | # |
49 | - set_dllpath(){ | |
49 | + set_dllpath() { | |
50 | 50 | # Usage: set_dllpath "colon:separated:path:list" |
51 | 51 | # |
52 | 52 | # Convert the specified colon separated path list to an equivalent |
@@ -57,8 +57,8 @@ | ||
57 | 57 | }'` |
58 | 58 | } |
59 | 59 | # |
60 | - depends(){ | |
61 | - # Usage: depends {EXENAME | DLLNAME} | |
60 | + depends() { | |
61 | + # Usage: depends { EXENAME | DLLNAME } | |
62 | 62 | # |
63 | 63 | # Extract a list of DLL dependencies from the specified executable or |
64 | 64 | # dynamic link library file; if EXENAME or DLLNAME explicitly names a |
@@ -78,8 +78,8 @@ | ||
78 | 78 | # |
79 | 79 | objdump=`type -p mingw32-objdump || type -p objdump || echo objdump` |
80 | 80 | # |
81 | - list_depends(){ | |
82 | - # Usage: list_depends {EXENAME | DLLNAME} | |
81 | + list_depends() { | |
82 | + # Usage: list_depends { EXENAME | DLLNAME } | |
83 | 83 | # |
84 | 84 | # Helper function, called by depends(), to perform dependency list |
85 | 85 | # extraction from the file explicitly named by EXENAME or DLLNAME. |
@@ -87,8 +87,8 @@ | ||
87 | 87 | $objdump -x "$1" | awk 'BEGIN{IGNORECASE=1}/dll name/{print $NF}' |
88 | 88 | } |
89 | 89 | # |
90 | - plot_depends(){ | |
91 | - # Usage: plot_depends {EXENAME | DLLNAME} [count] [prefix] | |
90 | + plot_depends() { | |
91 | + # Usage: plot_depends { EXENAME | DLLNAME } [count] [prefix] | |
92 | 92 | # |
93 | 93 | # Recursively plot the DLL dependency graph for the executable or |
94 | 94 | # dynamic link library file named by EXENAME or DLLNAME; the count |
@@ -112,10 +112,10 @@ | ||
112 | 112 | # while ref_shift() removes the first such reference from the same list, |
113 | 113 | # (after it has been scheduled for processing). |
114 | 114 | # |
115 | - ref_count(){ echo $#; } | |
116 | - ref_shift(){ test $# -gt 0 && shift; echo "$@"; } | |
115 | + ref_count() { echo $#; } | |
116 | + ref_shift() { test $# -gt 0 && shift; echo "$@"; } | |
117 | 117 | # |
118 | - plot_linkage(){ | |
118 | + plot_linkage() { | |
119 | 119 | # Usage: plot_linkage count |
120 | 120 | # |
121 | 121 | # Select the linkage glyph, for connection of the current node in |
@@ -128,8 +128,8 @@ | ||
128 | 128 | test $1 -gt 0 && echo "|" || echo " " |
129 | 129 | } |
130 | 130 | # |
131 | - show_depends(){ | |
132 | - # Usage: show_depends {EXENAME | DLLNAME} | |
131 | + show_depends() { | |
132 | + # Usage: show_depends { EXENAME | DLLNAME } | |
133 | 133 | # |
134 | 134 | # Wrapper to invoke plot_depends() for EXENAME or DLLNAME, provided |
135 | 135 | # it exists, otherwise display a diagnostic message |
@@ -144,9 +144,9 @@ | ||
144 | 144 | # quoted path list format), then plot the DLL dependency graph for each |
145 | 145 | # EXENAME or DLLNAME specified on the command line. |
146 | 146 | # |
147 | - test $# -gt 0 || { usage; exit 2; } | |
147 | + test $# -gt 0 || { usage >&2; exit $STATUS; } | |
148 | 148 | set_dllpath "${DLLPATH-$PROGRAM_FILES:/mingw/bin:$SYSTEM_DLLPATH}" |
149 | 149 | while test $# -gt 0; do show_depends "$1"; shift; test $# -gt 0 && echo; done |
150 | 150 | exit $STATUS |
151 | 151 | # |
152 | -# $RCSfile: mingw32-ldd.sh,v $: end of file | |
152 | +# $RCSfile$: end of file |