Merge pull request #35 from freestyl3r/master

Silence the warning about not checking fgets return value
This commit is contained in:
Giuseppe 2014-02-05 12:42:30 +00:00
commit 38183db9a1

24
bar.c
View File

@ -155,41 +155,39 @@ parse (char *text)
xcb_fill_rect (clear_gc, 0, 0, bar_width, BAR_HEIGHT);
for (;;) {
if (*p == '\0')
return;
if (*p == '\n')
if (*p == '\0' || *p == '\n')
return;
if (*p == '\\' && p++ && *p != '\\' && strchr (control_characters, *p)) {
switch (*p++) {
case 'f':
xcb_set_fg (isdigit(*p) ? (*p)-'0' : 11);
xcb_set_fg (isdigit(*p) ? *p-'0' : 11);
p++;
break;
case 'b':
xcb_set_bg (isdigit(*p) ? (*p)-'0' : 10);
xcb_set_bg (isdigit(*p) ? *p-'0' : 10);
p++;
break;
case 'u':
xcb_set_ud (isdigit(*p) ? (*p)-'0' : 10);
xcb_set_ud (isdigit(*p) ? *p-'0' : 10);
p++;
break;
#if XINERAMA
case 's':
if ((*p) == 'r') {
if (*p == 'r') {
screen = &screens[num_screens - 1];
} else if ((*p) == 'l') {
} else if (*p == 'l') {
screen = &screens[0];
} else if ((*p) == 'n') {
} else if (*p == 'n') {
if (screen == &screens[num_screens - 1])
break;
screen++;
} else if ((*p) == 'p') {
} else if (*p == 'p') {
if (screen == screens)
break;
screen--;
} else if (isdigit(*p)) {
int index = (*p)-'0';
int index = *p-'0';
if (index < num_screens) {
screen = &screens[index];
} else {
@ -568,7 +566,9 @@ main (int argc, char **argv)
else break; /* ...bail out */
}
if (pollin[0].revents & POLLIN) { /* New input, process it */
fgets (input, sizeof(input), stdin);
if (fgets (input, sizeof(input), stdin) == NULL)
break; /* EOF received */
parse (input);
redraw = 1;
}