From 3a9241add947cb6d24b5de7a8927517426a78795 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sat, 25 Aug 2012 14:25:22 -0500 Subject: Move commands into "posix", "lsb", and "other" menus/directories. --- toys/ln.c | 70 --------------------------------------------------------------- 1 file changed, 70 deletions(-) delete mode 100644 toys/ln.c (limited to 'toys/ln.c') diff --git a/toys/ln.c b/toys/ln.c deleted file mode 100644 index 6f55971a..00000000 --- a/toys/ln.c +++ /dev/null @@ -1,70 +0,0 @@ -/* vi: set sw=4 ts=4: - * - * ln.c - Create filesystem links - * - * Copyright 2012 Andre Renaud - * - * See http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ln.html - -USE_LN(NEWTOY(ln, "<1nfs", TOYFLAG_BIN)) - -config LN - bool "ln" - default y - help - usage: ln [-sf] [FROM...] TO - - Create a link between FROM and TO. - With only one argument, create link in current directory. - - -s Create a symbolic link - -f Force the creation of the link, even if TO already exists - -n Symlink at destination treated as file -*/ - -#include "toys.h" - -#define FLAG_s 1 -#define FLAG_f 2 -#define FLAG_n 4 - -void ln_main(void) -{ - char *dest = toys.optargs[--toys.optc], *new; - struct stat buf; - int i; - - // With one argument, create link in current directory. - if (!toys.optc) { - toys.optc++; - dest="."; - } - - // Is destination a directory? - if (((toys.optflags&FLAG_n) ? lstat : stat)(dest, &buf) - || !S_ISDIR(buf.st_mode)) - { - if (toys.optc>1) error_exit("'%s' not a directory"); - buf.st_mode = 0; - } - - for (i=0; i