summaryrefslogtreecommitdiff
path: root/deonebook.c
blob: cd8bb751521545b4f62d65f7bf7c76e5a0249a35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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);
}