aboutsummaryrefslogtreecommitdiffstats
path: root/key2root.c
blob: 69b7dc6948d6f1c8e8359e85139dc51ecaef4d57 (plain) (blame)
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
36
37
38
39
40
41
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;
}