summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pppctl
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1997-11-11 13:27:47 +0000
committerbrian <brian@FreeBSD.org>1997-11-11 13:27:47 +0000
commit3008d1c558a07eb47df620a3613b63e6477d429e (patch)
tree0bf6134e712836bcc271a4088344e99e936fc07a /usr.sbin/pppctl
parent1777aa3a1039bc07cc750501b65239a6072b5478 (diff)
downloadFreeBSD-src-3008d1c558a07eb47df620a3613b63e6477d429e.zip
FreeBSD-src-3008d1c558a07eb47df620a3613b63e6477d429e.tar.gz
Use select() instead of poll() for portabilities sake.
Diffstat (limited to 'usr.sbin/pppctl')
-rw-r--r--usr.sbin/pppctl/pppctl.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/usr.sbin/pppctl/pppctl.c b/usr.sbin/pppctl/pppctl.c
index e86033c..253983c 100644
--- a/usr.sbin/pppctl/pppctl.c
+++ b/usr.sbin/pppctl/pppctl.c
@@ -6,12 +6,13 @@
#include <sys/un.h>
#include <netdb.h>
+#include <sys/time.h>
#include <histedit.h>
-#include <poll.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <time.h>
#include <unistd.h>
#define LINELEN 2048
@@ -135,13 +136,14 @@ static void
check_fd(int sig)
{
if (data != -1) {
- struct pollfd p;
+ struct timeval t;
+ fd_set f;
static char buf[LINELEN];
- p.fd = data;
- p.events = POLLIN|POLLPRI;
- p.revents = p.events|POLLOUT;
- if (poll(&p, 1, 0) > 0)
+ FD_ZERO(&f);
+ FD_SET(data, &f);
+ t.tv_sec = t.tv_usec = 0;
+ if (select(data+1, &f, NULL, NULL, &t) > 0)
write(1, buf, read(data, buf, sizeof buf));
}
}
OpenPOWER on IntegriCloud