-
Notifications
You must be signed in to change notification settings - Fork 0
/
wine-dumpbin-template
80 lines (70 loc) · 2.24 KB
/
wine-dumpbin-template
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/sh
set -o errexit
set -o nounset
export WINEPREFIX="__WINEPREFIX__";
export WINEDLLOVERRIDES="__WINEDLLOVERRIDES__"
export WINEARCH="__WINEARCH__"
export WINEDEBUG=-all; # otheriwse too many "01c1:err:msvcrt:demangle_datatype Unknown type" outputs
is_help_param(){
[ "$1" = "-h" ] || [ "$1" = "h" ] || [ "$1" = "--help" ] || [ "$1" = "/help" ] || [ "$1" = "help" ] || [ "$1" = "?" ] || [ "$1" = "/?" ];
}
help(){
{ wine "$1" "/nologo" "$2"; printf 'Prefix: __WINEPREFIX__\nExecutable: __EXECUTABLE__'; } | less --quit-if-one-screen --no-init;
}
is_version_param(){
[ "$1" = "-v" ] || [ "$1" = "--version" ];
}
version(){
wine "$1" 2>&1 | head -n 2;
}
main(){
EXE='__EXECUTABLE__';
PARSE=true;
if [ -n "${VERBOSE+x}" ]; then :;
VERBOSE=true;
else :;
VERBOSE=false;
fi
[ $# -eq 0 ] && set -- "$@" '?';
for key in "$@"; do :;
shift
if ! $PARSE; then :;
set -- "$@" "$key";
else
if [ "${key#/}" != "$key" ] && [ -f "$key" ]; then :;
set -- "$@" "$(winepath --windows "$key")";
elif is_help_param "$key"; then :;
help "$EXE" '/?';
exit 0;
elif is_version_param "$key"; then :;
version "$EXE";
exit 0;
elif [ "$key" = "--" ] ; then :;
PARSE=false;
elif [ "$key" = "--verbose" ] ; then :;
VERBOSE=true;
else
for sub in 'IMPORTS' 'OUT'; do
if [ "${key#*/"$sub:"}" != "$key" ] && { val=${key#*/"$sub:"}; [ "${val#/}" != "$val" ]; }; then :;
key="/$sub:$(winepath --windows "${key#*/"$sub:"}")"; break;
elif [ "${key#*-"$sub:"}" != "$key" ] && { val=${key#*-"$sub:"}; [ "${val#/}" != "$val" ]; }; then :;
key="-$sub:$(winepath --windows "${key#*-"$sub:"}")"; break;
fi
done
set -- "$@" "$key";
fi
fi
done
if $VERBOSE; then
printf 'INCLUDE env: %s\n' "${INCLUDE_DEFAULT_PATHS}";
printf 'CL env: %s\n' "${CL:-}";
printf '_CL_ env: %s\n' "${_CL_:-}";
printf 'LIBPATH env: %s\n' "${LIBPATH:-}";
printf 'LIB env: %s\n' "${LIB_DEFAULT_PATH}";
printf 'executable: %s\n' "$EXE";
printf 'wine prefix: %s\n' "$WINEPREFIX";
printf 'parameters: '; printf '"%s" ' "$@"; printf '\n';
fi
exec wine "$EXE" "/nologo" "$@";
}
main "$@";