Merge pull request #30 from TheMRod/master Add a "uname -r" feature to see which kernel is running
Aaron Marcher info@nulltime.net
Wed, 16 Nov 2016 21:20:26 +0100
4 files changed,
15 insertions(+),
0 deletions(-)
M
CONTRIBUTORS.md
→
CONTRIBUTORS.md
@@ -8,3 +8,4 @@ - [pfannkuckengesicht](https://github.com/pfannkuchengesicht)
- [sahne](https://github.com/sahne) - [Ali H. Fardan](http://raiz.duckdns.org) - [Quentin Rameau](https://fifth.space) +- [Mike Coddington](https://coddington.us)
M
config.def.h
→
config.def.h
@@ -19,6 +19,7 @@ - entropy (available entropy) [argument: NULL]
- gid (gid of current user) [argument: NULL] - hostname [argument: NULL] - ip (ip address) [argument: interface] +- kernel_release (uname -r) [argument: NULL] - load_avg (load average) [argument: NULL] - ram_free (free ram in GB) [argument: NULL] - ram_perc (ram usage in percent) [argument: NULL]
M
slstatus.c
→
slstatus.c
@@ -20,6 +20,7 @@ #include <sys/statvfs.h>
#include <sys/socket.h> #include <sys/sysinfo.h> #include <sys/types.h> +#include <sys/utsname.h> #include <time.h> #include <unistd.h> #include <X11/Xlib.h>@@ -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);@@ -719,6 +721,16 @@ if (strcmp((char *)wreq.u.essid.pointer, "") == 0)
return smprintf(UNKNOWN_STR); else 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