[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1467109146-20331-31-git-send-email-alexander.kapshuk@gmail.com>
Date: Tue, 28 Jun 2016 13:19:05 +0300
From: Alexander Kapshuk <alexander.kapshuk@...il.com>
To: linux-kernel@...r.kernel.org
Cc: gregkh@...uxfoundation.org,
Alexander Kapshuk <alexander.kapshuk@...il.com>
Subject: [PATCH 31/32] ver_linux: 'version()' function definition
Definition of the 'version()' function. The function encapsulates the
algorithm that extracts the version number of the utility being queried,
and returns it as a value.
Signed-off-by: Alexander Kapshuk <alexander.kapshuk@...il.com>
---
scripts/ver_linux | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/scripts/ver_linux b/scripts/ver_linux
index 3bf72ad..27b43ae 100755
--- a/scripts/ver_linux
+++ b/scripts/ver_linux
@@ -69,3 +69,14 @@ BEGIN {
printversion("Modules Loaded", mods)
}
}
+
+function version(cmd, ver) {
+ while (cmd | getline > 0) {
+ if (!/ver_linux/ && match($0, /[0-9]+([.]?[0-9]+)+/)) {
+ ver = substr($0, RSTART, RLENGTH)
+ break
+ }
+ }
+ close(cmd)
+ return ver
+}
--
2.7.3
Powered by blists - more mailing lists