Reimplement the code that generates an alphabetically sorted list of kernel modules in awk and print the name of this entry and the list of modules via a function call.
Signed-off-by: Alexander Kapshuk <alexander.kaps...@gmail.com> --- scripts/ver_linux | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/scripts/ver_linux b/scripts/ver_linux index 6bba20c..3bf72ad 100755 --- a/scripts/ver_linux +++ b/scripts/ver_linux @@ -61,16 +61,11 @@ BEGIN { printversion("Udev", version("udevadm --version 2>&1")) printversion("Wireless-tools", version("iwconfig --version 2>&1")) -test -e /proc/modules && -sort /proc/modules | -sed ' - s/ .*// - H -${ - g - s/^\n/Modules Loaded\t\t/ - y/\n/ / - q + if (system("test -r /proc/modules") == 0) { + while ("sort /proc/modules" | getline > 0) { + mods = mods sep $1 + sep = " " + } + printversion("Modules Loaded", mods) + } } - d -' -- 2.7.3