summaryrefslogtreecommitdiff
path: root/tests/ouch.c
diff options
context:
space:
mode:
authorRobert de Bath <rdebath@poboxes.com>1997-02-25 20:42:19 +0100
committerLubomir Rintel <lkundrak@v3.sk>2013-10-23 23:38:07 +0200
commit4c36e9a0c125ccfff37aa440dab2cf58c4152fff (patch)
treea5d9c84ba2661029ddb2223dacd50529a361c3d5 /tests/ouch.c
parentf8de35da65c5d93bb733073cf40da154bc1c0748 (diff)
parent9696d7b0e1f3a1b0f5fd4a0428eb75afe8ad4ed6 (diff)
downloaddev86-4c36e9a0c125ccfff37aa440dab2cf58c4152fff.tar.gz
Import Dev86src-0.0.11.tar.gzv0.0.11
Diffstat (limited to 'tests/ouch.c')
-rw-r--r--tests/ouch.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/ouch.c b/tests/ouch.c
new file mode 100644
index 0000000..c2925c6
--- /dev/null
+++ b/tests/ouch.c
@@ -0,0 +1,27 @@
+
+#include <signal.h>
+#include <stdio.h>
+#include <errno.h>
+
+void trap()
+{
+ write(1, "Ouch!!\n", 7);
+}
+
+main()
+{
+ char buf[2];
+ int cc;
+
+ signal(SIGINT, trap);
+ while( (cc=read(0, buf, 1)) > 0 || (cc == -1 && errno == EINTR) )
+ {
+ if( cc < 0 )
+ fprintf(stderr, "INTR\n");
+ else
+ fprintf(stderr, "%x\n", buf[0]);
+ }
+
+
+ write(1, "\nExit!\n", 7);
+}