pinosaur
/
dwmblocks.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Changed Makefile to use pkg-config to find libraries.
[dwmblocks.git]
/
dwmblocks.c
diff --git
a/dwmblocks.c
b/dwmblocks.c
index
3071243
..
ad8e91c
100644
(file)
--- a/
dwmblocks.c
+++ b/
dwmblocks.c
@@
-5,6
+5,7
@@
#include<signal.h>
#include<X11/Xlib.h>
#define LENGTH(X) (sizeof(X) / sizeof (X[0]))
#include<signal.h>
#include<X11/Xlib.h>
#define LENGTH(X) (sizeof(X) / sizeof (X[0]))
+#define CMDLENGTH 50
typedef struct {
char* icon;
typedef struct {
char* icon;
@@
-20,7
+21,6
@@
void setupsignals();
int getstatus(char *str, char *last);
void setroot();
void statusloop();
int getstatus(char *str, char *last);
void setroot();
void statusloop();
-void statusinit();
void sighandler(int signum);
void termhandler(int signum);
void sighandler(int signum);
void termhandler(int signum);
@@
-30,13
+30,10
@@
void termhandler(int signum);
static Display *dpy;
static int screen;
static Window root;
static Display *dpy;
static int screen;
static Window root;
-static char statusbar[LENGTH(blocks)][
50
] = {0};
+static char statusbar[LENGTH(blocks)][
CMDLENGTH
] = {0};
static char statusstr[2][256];
static int statusContinue = 1;
static char statusstr[2][256];
static int statusContinue = 1;
-<<<<<<< HEAD
static void (*writestatus) () = setroot;
static void (*writestatus) () = setroot;
-=======
->>>>>>> 5ff59d4e8ba9c64963d36c8ea51e7a1d644aef48
void replace(char *str, char old, char new)
{
void replace(char *str, char old, char new)
{
@@
-56,8
+53,8
@@
void getcmd(const Block *block, char *output)
return;
char c;
int i = strlen(block->icon);
return;
char c;
int i = strlen(block->icon);
- while((c = fgetc(cmdf)) != EOF)
-
output[i++] = c
;
+ fgets(output+i, CMDLENGTH-i, cmdf);
+
i = strlen(output)
;
if (delim != '\0' && --i)
output[i++] = delim;
output[i++] = '\0';
if (delim != '\0' && --i)
output[i++] = delim;
output[i++] = '\0';
@@
-99,21
+96,10
@@
void setupsignals()
int getstatus(char *str, char *last)
{
strcpy(last, str);
int getstatus(char *str, char *last)
{
strcpy(last, str);
-<<<<<<< HEAD
str[0] = '\0';
for(int i = 0; i < LENGTH(blocks); i++)
str[0] = '\0';
for(int i = 0; i < LENGTH(blocks); i++)
-=======
- int j = 0;
- for(int i = 0; i < LENGTH(blocks); j+=strlen(statusbar[i++]))
->>>>>>> 5ff59d4e8ba9c64963d36c8ea51e7a1d644aef48
- {
strcat(str, statusbar[i]);
strcat(str, statusbar[i]);
- }
-<<<<<<< HEAD
str[strlen(str)-1] = '\0';
str[strlen(str)-1] = '\0';
-=======
- str[--j] = '\0';
->>>>>>> 5ff59d4e8ba9c64963d36c8ea51e7a1d644aef48
return strcmp(str, last);//0 if they are the same
}
return strcmp(str, last);//0 if they are the same
}
@@
-154,11
+140,6
@@
void statusloop()
}
}
}
}
-void statusinit()
-{
- statusloop();
-}
-
void sighandler(int signum)
{
void sighandler(int signum)
{
@@
-183,5
+164,5
@@
int main(int argc, char** argv)
}
signal(SIGTERM, termhandler);
signal(SIGINT, termhandler);
}
signal(SIGTERM, termhandler);
signal(SIGINT, termhandler);
- status
init
();
+ status
loop
();
}
}