aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--1/test/.gitignore1
-rw-r--r--1/test/main.c18
-rw-r--r--1/test/makefile2
-rwxr-xr-x1/test/test.sh14
4 files changed, 35 insertions, 0 deletions
diff --git a/1/test/.gitignore b/1/test/.gitignore
new file mode 100644
index 0000000..ba2906d
--- /dev/null
+++ b/1/test/.gitignore
@@ -0,0 +1 @@
+main
diff --git a/1/test/main.c b/1/test/main.c
new file mode 100644
index 0000000..7329e16
--- /dev/null
+++ b/1/test/main.c
@@ -0,0 +1,18 @@
+#include <stdio.h>
+#include <unistd.h>
+
+int main(int argc, char** argv) {
+ if (geteuid() != 0) {
+ fprintf(stderr, "run me as root!\n");
+ return 1;
+ }
+
+ argc--; // argv[0] is the program name
+ if (argc == 0) {
+ fprintf(stderr, "usage: %s /dev/lork\n", argv[0]);
+ return 1;
+ }
+
+ return 0;
+}
+
diff --git a/1/test/makefile b/1/test/makefile
new file mode 100644
index 0000000..3491973
--- /dev/null
+++ b/1/test/makefile
@@ -0,0 +1,2 @@
+main: main.o
+
diff --git a/1/test/test.sh b/1/test/test.sh
new file mode 100755
index 0000000..18263e6
--- /dev/null
+++ b/1/test/test.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+if [ $(id -u) -ne 0 ] ; then
+ echo "run me as root!" >&2
+ exit 1
+fi
+
+if [ $# -eq 0 ] ; then
+ echo "usage: $0 /dev/lork" >&2
+ exit 1
+fi
+
+
+exit 0