]> git.armaanb.net Git - dwmblocks.git/blobdiff - dwmblocks.c
Merge pull request #15 from tomboehmer/issue9
[dwmblocks.git] / dwmblocks.c
index 7d4616d1d2506f3388091e6adaa6ede473218b8f..21c14825f9ddc595d49481701899a79e1d732b8c 100644 (file)
@@ -6,6 +6,7 @@
 #include<X11/Xlib.h>
 #define LENGTH(X)               (sizeof(X) / sizeof (X[0]))
 #define CMDLENGTH              50
+#define STATUSLENGTH (LENGTH(blocks) * CMDLENGTH + 1)
 
 typedef struct {
        char* icon;
@@ -15,7 +16,6 @@ typedef struct {
 } Block;
 void dummysighandler(int num);
 void sighandler(int num);
-void replace(char *str, char old, char new);
 void getcmds(int time);
 #ifndef __OpenBSD__
 void getsigcmds(int signal);
@@ -34,18 +34,10 @@ static Display *dpy;
 static int screen;
 static Window root;
 static char statusbar[LENGTH(blocks)][CMDLENGTH] = {0};
-static char statusstr[2][256];
+static char statusstr[2][STATUSLENGTH];
 static int statusContinue = 1;
 static void (*writestatus) () = setroot;
 
-void replace(char *str, char old, char new)
-{
-       int N = strlen(str);
-       for(int i = 0; i < N; i++)
-               if(str[i] == old)
-                       str[i] = new;
-}
-
 //opens process *cmd and stores output in *output
 void getcmd(const Block *block, char *output)
 {