Spaces to tabs

This commit is contained in:
Ciro Santilli
2017-06-08 06:26:20 +01:00
parent 41dbf46531
commit 4c1b0e7891
7 changed files with 85 additions and 85 deletions

View File

@@ -6,29 +6,29 @@
#include <unistd.h> /* read */
int main(int argc, char **argv) {
char buf[1024], path[1024];
int fd, i, n;
short revents;
struct pollfd pfd;
char buf[1024], path[1024];
int fd, i, n;
short revents;
struct pollfd pfd;
fd = open(argv[1], O_RDONLY | O_NONBLOCK);
if (fd == -1) {
perror("open");
exit(EXIT_FAILURE);
}
pfd.fd = fd;
pfd.events = POLLIN;
while (1) {
puts("loop");
i = poll(&pfd, 1, -1);
if (i == -1) {
perror("poll");
exit(EXIT_FAILURE);
}
revents = pfd.revents;
if (revents & POLLIN) {
n = read(pfd.fd, buf, sizeof(buf));
printf("POLLIN n=%d buf=%.*s\n", n, n, buf);
}
}
fd = open(argv[1], O_RDONLY | O_NONBLOCK);
if (fd == -1) {
perror("open");
exit(EXIT_FAILURE);
}
pfd.fd = fd;
pfd.events = POLLIN;
while (1) {
puts("loop");
i = poll(&pfd, 1, -1);
if (i == -1) {
perror("poll");
exit(EXIT_FAILURE);
}
revents = pfd.revents;
if (revents & POLLIN) {
n = read(pfd.fd, buf, sizeof(buf));
printf("POLLIN n=%d buf=%.*s\n", n, n, buf);
}
}
}