From 7aa651a6a4496d848f86de9b1e6b3a003256a01f Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Tue, 13 Nov 2012 17:14:08 -0600 Subject: Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style. The actual code should be the same afterward, this is just cosmetic refactoring. --- toys/posix/ln.c | 86 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 42 insertions(+), 44 deletions(-) (limited to 'toys/posix/ln.c') diff --git a/toys/posix/ln.c b/toys/posix/ln.c index a83df7f6..bde77269 100644 --- a/toys/posix/ln.c +++ b/toys/posix/ln.c @@ -1,6 +1,4 @@ -/* vi: set sw=4 ts=4: - * - * ln.c - Create filesystem links +/* ln.c - Create filesystem links * * Copyright 2012 Andre Renaud * @@ -9,17 +7,17 @@ USE_LN(NEWTOY(ln, "<1nfs", TOYFLAG_BIN)) config LN - bool "ln" - default y - help - usage: ln [-sf] [FROM...] TO + 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. + 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 + -s Create a symbolic link + -f Force the creation of the link, even if TO already exists + -n Symlink at destination treated as file */ #define FOR_ln @@ -27,41 +25,41 @@ config LN void ln_main(void) { - char *dest = toys.optargs[--toys.optc], *new; - struct stat buf; - int i; + 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="."; - } + // 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; - } + // 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