aboutsummaryrefslogtreecommitdiff
path: root/shiftdown
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2020-10-31 00:06:37 +0100
committerJohn Ankarström <john@ankarstrom.se>2020-11-15 22:00:33 +0100
commit457c2a2018c79da46266ec69469ae8200431941b (patch)
treedb66b00fb9507f77556968f4fef53ca1a4796653 /shiftdown
parentc1acfc730a50fe8049742ac0c2465db631262aac (diff)
downloadalpine-457c2a2018c79da46266ec69469ae8200431941b.tar.gz
Add 'shiftdown' tool
Diffstat (limited to 'shiftdown')
-rw-r--r--shiftdown/Makefile5
-rw-r--r--shiftdown/shiftdownbin0 -> 19952 bytes
-rw-r--r--shiftdown/shiftdown.c12
3 files changed, 17 insertions, 0 deletions
diff --git a/shiftdown/Makefile b/shiftdown/Makefile
new file mode 100644
index 0000000..b5c2f21
--- /dev/null
+++ b/shiftdown/Makefile
@@ -0,0 +1,5 @@
+shiftdown:
+ gcc -o shiftdown shiftdown.c
+
+install:
+ install shiftdown /usr/bin/shiftdown
diff --git a/shiftdown/shiftdown b/shiftdown/shiftdown
new file mode 100644
index 0000000..fde6302
--- /dev/null
+++ b/shiftdown/shiftdown
Binary files differ
diff --git a/shiftdown/shiftdown.c b/shiftdown/shiftdown.c
new file mode 100644
index 0000000..bfd0a02
--- /dev/null
+++ b/shiftdown/shiftdown.c
@@ -0,0 +1,12 @@
+#include <err.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/ioctl.h>
+
+int main() {
+ char shift_state;
+ shift_state = 6;
+ if (ioctl(0, TIOCLINUX, &shift_state) == -1)
+ err(1, "could not get shift state");
+ return !shift_state;
+}