aboutsummaryrefslogtreecommitdiff
path: root/core/link.c
blob: 872018e3db36d2f0ab91440b47ccd3c2ade0939b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* SPDX-License-Identifier: BSD-3-Clause */
#include <unistd.h>
#include <stdio.h>
#include <errno.h>

#define REQ_PRINT_USAGE /* Require print_usage() from ../common/common.h */
#define REQ_ERRPRINT /* Require errprint() from ../common/common.h */
#define DESCRIPTION "Call the link() function."
#define OPERANDS    "source dest"
#include "../common/common.h"

int main(int argc, char *const argv[]) {
	if (argc == 1) {
		print_usage(argv[0], DESCRIPTION, OPERANDS, VERSION);
		return 1;
	}
	if (argc >= 2) {
		link(argv[1], argv[2]);
		if (errno) return errprint(argv[0], NULL, errno);
	}
	return 0;
}