From 9f1904aa426aa3d32df647b8d853e57e587a97ec Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Wed, 13 Mar 2019 21:34:53 -0400 Subject: migrate to gitlab --- link.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 link.c (limited to 'link.c') diff --git a/link.c b/link.c new file mode 100644 index 0000000..defb2ff --- /dev/null +++ b/link.c @@ -0,0 +1,44 @@ +/* + * UNG's Not GNU + * + * Copyright (c) 2011-2017, Jakob Kaivo + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ + +#define _XOPEN_SOURCE 700 +#include +#include +#include +#include + +int main(int argc, char *argv[]) +{ + while (getopt(argc, argv, "") != -1) { + return 1; + } + + if (optind != argc - 2) { + fprintf(stderr, "link: Must specify a source and destination\n"); + return 1; + } + + if (link(argv[optind], argv[optind + 1]) != 0) { + fprintf(stderr, "link: Couldn't link '%s' to '%s': %s\n", + argv[optind], argv[optind + 1], strerror(errno)); + return 1; + } + + return 0; +} -- cgit v1.2.1