summaryrefslogtreecommitdiff
path: root/src/link.c
blob: fd00ae0a82cc6f93d7e6757beae1a7e4cbab8175 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>

#define CSTR(s) (s), sizeof(s)-1

int main(int argc, char *argv[])
{
	if (argc != 3) {
		write(2, argv[0], strlen(argv[0]));
		write(2, CSTR(": incorrect usage\n"));
		exit(1);
	}
	if (link(argv[1], argv[2])) {
		write(2, argv[0], strlen(argv[0]));
		write(2, CSTR(": "));
		write(2, strerror(errno), strlen(strerror(errno)));
		write(2, CSTR("\n"));
		exit(1);
	}
	return 0;
}