aboutsummaryrefslogtreecommitdiffstats
path: root/key2root.c
diff options
context:
space:
mode:
Diffstat (limited to 'key2root.c')
-rw-r--r--key2root.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/key2root.c b/key2root.c
new file mode 100644
index 0000000..69b7dc6
--- /dev/null
+++ b/key2root.c
@@ -0,0 +1,42 @@
+/* See LICENSE file for copyright and license details. */
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "arg.h"
+
+
+char *argv0;
+
+
+static void
+usage(void)
+{
+ fprintf(stderr, "usage: %s [-k key-name] [-e] command [argument] ...\n", argv0);
+ exit(125);
+}
+
+
+int
+main(int argc, char *argv[])
+{
+ int keep_env = 0;
+ const char *key_name = NULL;
+
+ ARGBEGIN {
+ case 'e':
+ keep_env = 1;
+ break;
+ case 'k':
+ if (key_name)
+ usage();
+ key_name = EARGF(usage());
+ break;
+ default:
+ usage();
+ } ARGEND;
+
+ if (!argc)
+ usage();
+
+ return 0;
+}