~sircmpwn/ctools

ref: d6ae9f8a356d6617aba7f47d6246a74929fc12b7 ctools/src/unlink.c -rw-r--r-- 278 bytes
d6ae9f8aSimon Ser cksum: add error handling for open 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <stdio.h>
#include <unistd.h>

int
main(int argc, char *argv[])
{
	if (getopt(argc, argv, "") != -1 || optind != argc - 1) {
		fprintf(stderr, "usage: unlink <file>\n");
		return 1;
	}

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

	return 0;
}