[wiki] [sites] Fix for barM.c the NULL pointer || levi0x0

From: <git_AT_suckless.org>
Date: Tue, 24 Feb 2015 22:31:27 +0100

commit 9f7b413e3f54a2d1e021459d91cbd68c88cfdff3
Author: levi0x0 <levi0x0x_AT_gmail.com>
Date: Tue Feb 24 23:31:14 2015 +0200

    Fix for barM.c the NULL pointer

diff --git a/dwm.suckless.org/dwmstatus/barM.c b/dwm.suckless.org/dwmstatus/barM.c
index 3ff5f20..6cf1f2e 100644
--- a/dwm.suckless.org/dwmstatus/barM.c
+++ b/dwm.suckless.org/dwmstatus/barM.c
_AT_@ -72,19 +72,9 @@ void XSetRoot(char *name) {
 int main(int argc, char **argv) {
         char status[MAXSTR];
 
- /*append here your commands for the spawn function*/
- char *ram = spawn("free -mh | awk 'NR==2{print $3\"/\"$2}'");
-
- /* Examples:
- char *battery = spawn("/sys/class/power_supply/BAT1/capacity");
- char *uname = spawn("uname");
- char * battery_status= spawn("/sys/class/power_supply/BAT1/status");
-
-
- XXX: DONT! forget to add the varibale to sprintf()
- */
-
- sprintf(status, "(%s) %s", ram, TimeADate());
+ sprintf(status, "(%s) %s", spawn("free -mh | awk 'NR==2{print $3\"/\"$2}'"),
+ TimeADate());
+
         XSetRoot(status);
 
         /*sleep function*/
Received on Tue Feb 24 2015 - 22:31:27 CET

This archive was generated by hypermail 2.3.0 : Thu Jun 18 2015 - 17:40:11 CEST