~sircmpwn/ctools

ref: bb5007143abfc22d947c422bfade941e2a741c8c ctools/src/unlink.c -rw-r--r-- 317 bytes
bb500714Drew DeVault link: add conformance test 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <stdio.h>
#include <unistd.h>

static void
usage(void)
{
	fprintf(stderr, "usage: unlink <file>\n");
}

int
main(int argc, char *argv[])
{
	if (getopt(argc, argv, "") != -1 || optind != argc - 1) {
		usage();
		return 1;
	}

	if (unlink(argv[optind]) != 0) {
		perror("unlink");
		return 1;
	}

	return 0;
}