diff options
author | Alexander Kapshuk <alexander.kapshuk@gmail.com> | 2018-05-12 05:02:30 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-05-14 10:36:39 -0400 |
commit | 4169bc43dbdd6c08436a7d794844b1f09a6367ae (patch) | |
tree | 4ad6506a722143d8881a9caaae68f9256af67e52 /scripts | |
parent | 0eca353e7ae75a56d5a10cd1c0ff1f06d89e60e3 (diff) |
ver_linux: Move stderr redirection from function parameter to function body
Remove stderr redirection to stdout from all the parameters to the
version() function, and put it with the body of the version() function
instead.
This improves code readability.
Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/ver_linux | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/scripts/ver_linux b/scripts/ver_linux index 545ec7388eb7..0b301bd1637d 100755 --- a/scripts/ver_linux +++ b/scripts/ver_linux | |||
@@ -13,23 +13,23 @@ BEGIN { | |||
13 | system("uname -a") | 13 | system("uname -a") |
14 | printf("\n") | 14 | printf("\n") |
15 | 15 | ||
16 | printversion("GNU C", version("gcc -dumpversion 2>&1")) | 16 | printversion("GNU C", version("gcc -dumpversion")) |
17 | printversion("GNU Make", version("make --version 2>&1")) | 17 | printversion("GNU Make", version("make --version")) |
18 | printversion("Binutils", version("ld -v 2>&1")) | 18 | printversion("Binutils", version("ld -v")) |
19 | printversion("Util-linux", version("mount --version 2>&1")) | 19 | printversion("Util-linux", version("mount --version")) |
20 | printversion("Mount", version("mount --version 2>&1")) | 20 | printversion("Mount", version("mount --version")) |
21 | printversion("Module-init-tools", version("depmod -V 2>&1")) | 21 | printversion("Module-init-tools", version("depmod -V")) |
22 | printversion("E2fsprogs", version("tune2fs 2>&1")) | 22 | printversion("E2fsprogs", version("tune2fs")) |
23 | printversion("Jfsutils", version("fsck.jfs -V 2>&1")) | 23 | printversion("Jfsutils", version("fsck.jfs -V")) |
24 | printversion("Reiserfsprogs", version("reiserfsck -V 2>&1")) | 24 | printversion("Reiserfsprogs", version("reiserfsck -V")) |
25 | printversion("Reiser4fsprogs", version("fsck.reiser4 -V 2>&1")) | 25 | printversion("Reiser4fsprogs", version("fsck.reiser4 -V")) |
26 | printversion("Xfsprogs", version("xfs_db -V 2>&1")) | 26 | printversion("Xfsprogs", version("xfs_db -V")) |
27 | printversion("Pcmciautils", version("pccardctl -V 2>&1")) | 27 | printversion("Pcmciautils", version("pccardctl -V")) |
28 | printversion("Pcmcia-cs", version("cardmgr -V 2>&1")) | 28 | printversion("Pcmcia-cs", version("cardmgr -V")) |
29 | printversion("Quota-tools", version("quota -V 2>&1")) | 29 | printversion("Quota-tools", version("quota -V")) |
30 | printversion("PPP", version("pppd --version 2>&1")) | 30 | printversion("PPP", version("pppd --version")) |
31 | printversion("Isdn4k-utils", version("isdnctrl 2>&1")) | 31 | printversion("Isdn4k-utils", version("isdnctrl")) |
32 | printversion("Nfs-utils", version("showmount --version 2>&1")) | 32 | printversion("Nfs-utils", version("showmount --version")) |
33 | 33 | ||
34 | if (system("test -r /proc/self/maps") == 0) { | 34 | if (system("test -r /proc/self/maps") == 0) { |
35 | while (getline <"/proc/self/maps" > 0) { | 35 | while (getline <"/proc/self/maps" > 0) { |
@@ -42,7 +42,7 @@ BEGIN { | |||
42 | } | 42 | } |
43 | } | 43 | } |
44 | 44 | ||
45 | printversion("Dynamic linker (ldd)", version("ldd --version 2>&1")) | 45 | printversion("Dynamic linker (ldd)", version("ldd --version")) |
46 | 46 | ||
47 | while ("ldconfig -p 2>/dev/null" | getline > 0) { | 47 | while ("ldconfig -p 2>/dev/null" | getline > 0) { |
48 | if (/(libg|stdc)[+]+\.so/) { | 48 | if (/(libg|stdc)[+]+\.so/) { |
@@ -53,14 +53,14 @@ BEGIN { | |||
53 | if (system("test -r " libcpp) == 0) | 53 | if (system("test -r " libcpp) == 0) |
54 | printversion("Linux C++ Library", version("readlink " libcpp)) | 54 | printversion("Linux C++ Library", version("readlink " libcpp)) |
55 | 55 | ||
56 | printversion("Procps", version("ps --version 2>&1")) | 56 | printversion("Procps", version("ps --version")) |
57 | printversion("Net-tools", version("ifconfig --version 2>&1")) | 57 | printversion("Net-tools", version("ifconfig --version")) |
58 | printversion("Kbd", version("loadkeys -V 2>&1")) | 58 | printversion("Kbd", version("loadkeys -V")) |
59 | printversion("Console-tools", version("loadkeys -V 2>&1")) | 59 | printversion("Console-tools", version("loadkeys -V")) |
60 | printversion("Oprofile", version("oprofiled --version 2>&1")) | 60 | printversion("Oprofile", version("oprofiled --version")) |
61 | printversion("Sh-utils", version("expr --v 2>&1")) | 61 | printversion("Sh-utils", version("expr --v")) |
62 | printversion("Udev", version("udevadm --version 2>&1")) | 62 | printversion("Udev", version("udevadm --version")) |
63 | printversion("Wireless-tools", version("iwconfig --version 2>&1")) | 63 | printversion("Wireless-tools", version("iwconfig --version")) |
64 | 64 | ||
65 | if (system("test -r /proc/modules") == 0) { | 65 | if (system("test -r /proc/modules") == 0) { |
66 | while ("sort /proc/modules" | getline > 0) { | 66 | while ("sort /proc/modules" | getline > 0) { |
@@ -72,6 +72,7 @@ BEGIN { | |||
72 | } | 72 | } |
73 | 73 | ||
74 | function version(cmd, ver) { | 74 | function version(cmd, ver) { |
75 | cmd = cmd " 2>&1" | ||
75 | while (cmd | getline > 0) { | 76 | while (cmd | getline > 0) { |
76 | if (!/ver_linux/ && match($0, /[0-9]+([.]?[0-9]+)+/)) { | 77 | if (!/ver_linux/ && match($0, /[0-9]+([.]?[0-9]+)+/)) { |
77 | ver = substr($0, RSTART, RLENGTH) | 78 | ver = substr($0, RSTART, RLENGTH) |