From: Alan Cox Date: Sun, 20 Nov 2016 17:49:53 +0000 (+0000) Subject: select test tool X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=f71c2ce0d3e590b207c421a6857be41abe333968;p=FUZIX.git select test tool --- diff --git a/Applications/util/seltest.c b/Applications/util/seltest.c new file mode 100644 index 00000000..1447a578 --- /dev/null +++ b/Applications/util/seltest.c @@ -0,0 +1,34 @@ +#include +#include +#include + + +int main(int argc, char *argv[]) +{ + static uint16_t rwe[8]; + int r; + + r = _select(0, rwe); + if (r != 0) { + perror("test 1 r"); + exit(1); + } + /* Report what stdin shows */ + rwe[0] = 1; + rwe[2] = 1; + rwe[4] = 1; + rwe[6] = 100; + r = _select(1, rwe); + if (r != 0) { + perror("test 2 r"); + exit(1); + } + if (rwe[0] & 1) + write(1, "R", 1); + if (rwe[2] & 1) + write(1, "W", 1); + if (rwe[4] & 1) + write(1, "E", 1); + + exit(0); +} \ No newline at end of file