summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2020-11-11 10:45:05 -0500
committerJakob Kaivo <jkk@ung.org>2020-11-11 10:45:05 -0500
commit4601fa65349cd7b3f60619842f3585a1336bc183 (patch)
tree1af99de0316359cdc3fb0731a48d57d0351adbe2
initial commit
-rw-r--r--.gitignore2
-rw-r--r--LICENSE21
-rw-r--r--Makefile26
-rw-r--r--deonebook.c35
4 files changed, 84 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..aca991b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+deonebook
+*.o
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..bee0ceb
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2020 Jakob Kaivo <jakob@kaivo.net>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..bf7a297
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,26 @@
+.POSIX:
+
+# This Makefile was generated by maje
+# See https://gitlab.com/jkaivo/maje/ for more information
+# Do not edit this Makefile by hand
+
+CC=c99
+LD=$(CC)
+CFLAGS=-Wall -Wextra -Wpedantic -Werror -g
+LDFLAGS=
+LDLIBS=
+SRCDIR=.
+OBJDIR=.
+BINDIR=$(OBJDIR)
+
+all: $(BINDIR)/deonebook
+
+clean:
+ rm -f $(BINDIR)/deonebook $(OBJDIR)/*.o
+
+$(BINDIR)/deonebook: $(OBJDIR)/deonebook.o
+$(OBJDIR)/deonebook.o: $(SRCDIR)/deonebook.c
+ $(CC) $(CFLAGS) -o $@ -c $(SRCDIR)/deonebook.c
+
+$(BINDIR)/deonebook:
+ $(LD) $(LDFLAGS) -o $@ $(OBJDIR)/*.o $(LDLIBS)
diff --git a/deonebook.c b/deonebook.c
new file mode 100644
index 0000000..cd8bb75
--- /dev/null
+++ b/deonebook.c
@@ -0,0 +1,35 @@
+#define _XOPEN_SOURCE 700
+#include <stdio.h>
+#include <unistd.h>
+
+int main(int argc, char *argv[])
+{
+ char *serial = NULL;
+
+ int c;
+ while ((c = getopt(argc, argv, "s:")) != -1) {
+ switch (c) {
+ case 's':
+ serial = optarg;
+ break;
+
+ default:
+ return 1;
+ }
+ }
+
+ if (serial == NULL) {
+ fprintf(stderr, "%s: missing serial number (provide via -s)\n",
+ argv[0]);
+ return 1;
+ }
+
+ if (optind >= argc) {
+ fprintf(stderr, "%s: missing operands\n", argv[0]);
+ return 1;
+ }
+
+ do {
+ printf("decrypting %s [%s]\n", argv[optind], serial);
+ } while (++optind < argc);
+}