Audit link(1)

This commit is contained in:
FRIGN
2015-02-28 19:42:26 +01:00
parent 804b62f7a2
commit cb610b2c7b
2 changed files with 15 additions and 5 deletions

18
link.c
View File

@@ -3,14 +3,24 @@
#include "util.h"
static void
usage(void)
{
eprintf("usage: %s target name\n", argv0);
}
int
main(int argc, char *argv[])
{
argv0 = argv[0];
ARGBEGIN {
default:
usage();
} ARGEND;
if (argc != 3)
eprintf("usage: %s target name\n", argv0);
if (link(argv[1], argv[2]) < 0)
if (argc != 2)
usage();
if (link(argv[0], argv[1]) < 0)
eprintf("link:");
return 0;
}