From c3eb0c401200320151770680b9291197e759bfc9 Mon Sep 17 00:00:00 2001 From: Mike Coddington Date: Thu, 3 Nov 2016 11:49:09 -0500 Subject: Add "uname -r" functionality --- slstatus.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'slstatus.c') diff --git a/slstatus.c b/slstatus.c index 9559226..2b63be4 100644 --- a/slstatus.c +++ b/slstatus.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -68,6 +69,7 @@ static char *username(void); static char *vol_perc(const char *card); static char *wifi_perc(const char *iface); static char *wifi_essid(const char *iface); +static char *kernel_release(void); static void set_status(const char *str); static void sighandler(const int signo); static void usage(void); @@ -721,6 +723,16 @@ wifi_essid(const char *iface) return smprintf("%s", (char *)wreq.u.essid.pointer); } +static char * +kernel_release(void) +{ + struct utsname udata; + if (uname(&udata) < 0) + return smprintf(UNKNOWN_STR); + + return smprintf("%s", udata.release); +} + static void set_status(const char *str) { -- cgit v1.2.3