redundant message on no devices

xkbcommon
Alessandro Mauri 5 years ago
parent 3c9bbe4140
commit cdfed84d5e
  1. 13
      hkd.c

13
hkd.c

@ -71,8 +71,16 @@ int main (void)
struct pollfd *fds = NULL; struct pollfd *fds = NULL;
update_descriptors_list(&fds, &fd_num); update_descriptors_list(&fds, &fd_num);
if (!fd_num) { if (fd_num) {
fputs("Could not open any device, exiting\n", stderr); fprintf(stderr,
ANSI_COLOR_YELLOW
"Monitoring %d devices\n"
ANSI_COLOR_RESET, fd_num);
} else {
fprintf(stderr,
ANSI_COLOR_RED
"Could not open any devices, exiting\n"
ANSI_COLOR_RESET);
exit(-1); exit(-1);
} }
// TODO: watch for events inside /dev/input and reload accordingly // TODO: watch for events inside /dev/input and reload accordingly
@ -328,7 +336,6 @@ void update_descriptors_list (struct pollfd **fds, int *fd_num)
(*fds)[(*fd_num)].fd = tmp_fd; (*fds)[(*fd_num)].fd = tmp_fd;
(*fd_num)++; (*fd_num)++;
} }
fprintf(stderr,ANSI_COLOR_YELLOW "Monitoring %d devices\n" ANSI_COLOR_RESET, (*fd_num));
closedir(ev_dir); closedir(ev_dir);
} }

Loading…
Cancel
Save