changeset 694:786841fdb1e0

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.
author Rob Landley <rob@landley.net>
date Tue, 13 Nov 2012 17:14:08 -0600
parents 4a5a250e0633
children d2dde3d0ef05
files lib/args.c lib/bunzip.c lib/dirtree.c lib/getmountlist.c lib/lib.c lib/lib.h lib/llist.c lib/password.c lib/portability.c lib/xregcomp.c main.c scripts/config2help.sh scripts/install.c scripts/test/basename.test scripts/test/cat.test scripts/test/cp.test scripts/test/dirname.test scripts/test/xargs.test toys.h toys/e2fs.h toys/lsb/dmesg.c toys/lsb/hostname.c toys/lsb/killall.c toys/lsb/md5sum.c toys/lsb/mknod.c toys/lsb/mktemp.c toys/lsb/passwd.c toys/lsb/pidof.c toys/lsb/seq.c toys/lsb/sync.c toys/other/bzcat.c toys/other/catv.c toys/other/chroot.c toys/other/chvt.c toys/other/clear.c toys/other/count.c toys/other/dos2unix.c toys/other/free.c toys/other/hello.c toys/other/help.c toys/other/insmod.c toys/other/login.c toys/other/lsmod.c toys/other/mdev.c toys/other/mke2fs.c toys/other/mkswap.c toys/other/modinfo.c toys/other/mountpoint.c toys/other/netcat.c toys/other/oneit.c toys/other/printenv.c toys/other/readlink.c toys/other/realpath.c toys/other/rmmod.c toys/other/setsid.c toys/other/swapoff.c toys/other/swapon.c toys/other/switch_root.c toys/other/tac.c toys/other/taskset.c toys/other/truncate.c toys/other/unshare.c toys/other/uptime.c toys/other/usleep.c toys/other/vconfig.c toys/other/vmstat.c toys/other/w.c toys/other/which.c toys/other/whoami.c toys/other/yes.c toys/posix/basename.c toys/posix/cal.c toys/posix/cat.c toys/posix/chgrp.c toys/posix/chmod.c toys/posix/cksum.c toys/posix/cmp.c toys/posix/comm.c toys/posix/cp.c toys/posix/date.c toys/posix/df.c toys/posix/dirname.c toys/posix/du.c toys/posix/echo.c toys/posix/env.c toys/posix/false.c toys/posix/head.c toys/posix/id.c toys/posix/kill.c toys/posix/link.c toys/posix/ln.c toys/posix/logname.c toys/posix/ls.c toys/posix/mkdir.c toys/posix/mkfifo.c toys/posix/nice.c toys/posix/nohup.c toys/posix/od.c toys/posix/patch.c toys/posix/pwd.c toys/posix/rmdir.c toys/posix/sed.c toys/posix/sh.c toys/posix/sleep.c toys/posix/sort.c toys/posix/tail.c toys/posix/tee.c toys/posix/true.c toys/posix/tty.c toys/posix/uname.c toys/posix/uniq.c toys/posix/unlink.c toys/posix/wc.c toys/posix/who.c toys/posix/xargs.c www/code.html www/design.html
diffstat 117 files changed, 7351 insertions(+), 7600 deletions(-) [+]
line wrap: on
line diff
--- a/lib/args.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/lib/args.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,5 +1,4 @@
-/* vi: set sw=4 ts=4 :
- * args.c - Command line argument parsing.
+/* args.c - Command line argument parsing.
  *
  * Copyright 2006 Rob Landley <rob@landley.net>
  */
@@ -34,6 +33,7 @@
 //       ~X enabling this disables X (switch off)
 //       !X die with error if X already set (x!x die if x supplied twice)
 //       [yz] needs at least one of y or z. TODO
+//
 //   at the beginning:
 //     ^ stop at first nonoption argument
 //     <0 die if less than # leftover arguments (default 0)
@@ -48,19 +48,19 @@
 //     - is a synonym for stdin in file arguments
 //   -abc means -a -b -c
 
-/* This uses a getopt-like option string, but not getopt() itself.  We call
+/* This uses a getopt-like option string, but not getopt() itself. We call
  * it the get_opt string.
  *
  * Each option in the get_opt string corresponds to a bit position in the
- * return value.  The rightmost argument is (1<<0), the next to last is (1<<1)
- * and so on.  If the option isn't seen in argv[], its bit remains 0.
+ * return value. The rightmost argument is (1<<0), the next to last is (1<<1)
+ * and so on. If the option isn't seen in argv[], its bit remains 0.
  *
  * Options which have an argument fill in the corresponding slot in the global
  * union "this" (see generated/globals.h), which it treats as an array of longs
  * (note that sizeof(long)==sizeof(pointer) is guaranteed by LP64).
  *
  * You don't have to free the option strings, which point into the environment
- * space.  List objects should be freed by main() when command_main() returns.
+ * space. List objects should be freed by main() when command_main() returns.
  *
  * Example:
  *   Calling get_optflags() when toys.which->options="ab:c:d" and
@@ -79,343 +79,334 @@
 
 // Linked list of all known options (get_opt string is parsed into this).
 struct opts {
-	struct opts *next;
-	long *arg;         // Pointer into union "this" to store arguments at.
-	uint32_t edx[3];   // Flag mask to enable/disable/exclude.
-	int c;             // Short argument character
-	int flags;         // |=1, ^=2
-	char type;         // Type of arguments to store
-	union {
-		long l;
-		FLOAT f;
-	} val[3];          // low, high, default - range of allowed values
+  struct opts *next;
+  long *arg;         // Pointer into union "this" to store arguments at.
+  uint32_t edx[3];   // Flag mask to enable/disable/exclude.
+  int c;             // Short argument character
+  int flags;         // |=1, ^=2
+  char type;         // Type of arguments to store
+  union {
+    long l;
+    FLOAT f;
+  } val[3];          // low, high, default - range of allowed values
 };
 
 struct longopts {
-	struct longopts *next;
-	struct opts *opt;
-	char *str;
-	int len;
+  struct longopts *next;
+  struct opts *opt;
+  char *str;
+  int len;
 };
 
 // State during argument parsing.
 struct getoptflagstate
 {
-	int argc, minargs, maxargs, nodash;
-	char *arg;
-	struct opts *opts, *this;
-	struct longopts *longopts;
-	int noerror, nodash_now, stopearly;
-	uint32_t excludes;
+  int argc, minargs, maxargs, nodash;
+  char *arg;
+  struct opts *opts, *this;
+  struct longopts *longopts;
+  int noerror, nodash_now, stopearly;
+  uint32_t excludes;
 };
 
 // Parse one command line option.
 static int gotflag(struct getoptflagstate *gof)
 {
-	int type;
-	struct opts *opt = gof->this;
+  int type;
+  struct opts *opt = gof->this;
 
-	// Did we recognize this option?
-	if (!opt) {
-		if (gof->noerror) return 1;
-		error_exit("Unknown option %s", gof->arg);
-	}
+  // Did we recognize this option?
+  if (!opt) {
+    if (gof->noerror) return 1;
+    error_exit("Unknown option %s", gof->arg);
+  }
 
-	// Set flags
-	toys.optflags |= opt->edx[0];
-	toys.optflags &= ~opt->edx[1];
-	gof->excludes = opt->edx[2];
-	if (opt->flags&2) gof->stopearly=2;
+  // Set flags
+  toys.optflags |= opt->edx[0];
+  toys.optflags &= ~opt->edx[1];
+  gof->excludes = opt->edx[2];
+  if (opt->flags&2) gof->stopearly=2;
 
-	// Does this option take an argument?
-	gof->arg++;
-	type = opt->type;
-	if (type) {
-		char *arg = gof->arg;
+  // Does this option take an argument?
+  gof->arg++;
+  type = opt->type;
+  if (type) {
+    char *arg = gof->arg;
 
-		// Handle "-xblah" and "-x blah", but also a third case: "abxc blah"
-		// to make "tar xCjfv blah1 blah2 thingy" work like
-		// "tar -x -C blah1 -j -f blah2 -v thingy"
+    // Handle "-xblah" and "-x blah", but also a third case: "abxc blah"
+    // to make "tar xCjfv blah1 blah2 thingy" work like
+    // "tar -x -C blah1 -j -f blah2 -v thingy"
 
-		if (gof->nodash_now || !arg[0]) arg = toys.argv[++gof->argc];
-		// TODO: The following line doesn't display --longopt correctly
-		if (!arg) error_exit("Missing argument to -%c", opt->c);
+    if (gof->nodash_now || !arg[0]) arg = toys.argv[++gof->argc];
+    // TODO: The following line doesn't display --longopt correctly
+    if (!arg) error_exit("Missing argument to -%c", opt->c);
 
-		if (type == ':') *(opt->arg) = (long)arg;
-		else if (type == '*') {
-			struct arg_list **list;
+    if (type == ':') *(opt->arg) = (long)arg;
+    else if (type == '*') {
+      struct arg_list **list;
 
-			list = (struct arg_list **)opt->arg;
-			while (*list) list=&((*list)->next);
-			*list = xzalloc(sizeof(struct arg_list));
-			(*list)->arg = arg;
-		} else if (type == '#' || type == '-') {
-			long l = atolx(arg);
-			if (type == '-' && !ispunct(*arg)) l*=-1;
-			if (l < opt->val[0].l)
-				error_exit("-%c < %ld", opt->c, opt->val[0].l);
-			if (l > opt->val[1].l)
-				error_exit("-%c > %ld", opt->c, opt->val[1].l);
+      list = (struct arg_list **)opt->arg;
+      while (*list) list=&((*list)->next);
+      *list = xzalloc(sizeof(struct arg_list));
+      (*list)->arg = arg;
+    } else if (type == '#' || type == '-') {
+      long l = atolx(arg);
+      if (type == '-' && !ispunct(*arg)) l*=-1;
+      if (l < opt->val[0].l) error_exit("-%c < %ld", opt->c, opt->val[0].l);
+      if (l > opt->val[1].l) error_exit("-%c > %ld", opt->c, opt->val[1].l);
 
-			*(opt->arg) = l;
-		} else if (CFG_TOYBOX_FLOAT && type == '.') {
-			FLOAT *f = (FLOAT *)(opt->arg);
+      *(opt->arg) = l;
+    } else if (CFG_TOYBOX_FLOAT && type == '.') {
+      FLOAT *f = (FLOAT *)(opt->arg);
 
-			*f = strtod(arg, &arg);
-			if (opt->val[0].l != LONG_MIN && *f < opt->val[0].f)
-				error_exit("-%c < %lf", opt->c, (double)opt->val[0].f);
-			if (opt->val[1].l != LONG_MAX && *f > opt->val[1].f)
-				error_exit("-%c > %lf", opt->c, (double)opt->val[1].f);
-		} else if (type == '@') ++*(opt->arg);
+      *f = strtod(arg, &arg);
+      if (opt->val[0].l != LONG_MIN && *f < opt->val[0].f)
+        error_exit("-%c < %lf", opt->c, (double)opt->val[0].f);
+      if (opt->val[1].l != LONG_MAX && *f > opt->val[1].f)
+        error_exit("-%c > %lf", opt->c, (double)opt->val[1].f);
+    } else if (type == '@') ++*(opt->arg);
 
-		if (!gof->nodash_now) gof->arg = "";
-	}
+    if (!gof->nodash_now) gof->arg = "";
+  }
 
-	gof->this = NULL;
-	return 0;
+  gof->this = NULL;
+  return 0;
 }
 
 // Fill out toys.optflags and toys.optargs.
 
 void parse_optflaglist(struct getoptflagstate *gof)
 {
-	char *options = toys.which->options;
-	long *nextarg = (long *)&this;
-	struct opts *new = 0;
+  char *options = toys.which->options;
+  long *nextarg = (long *)&this;
+  struct opts *new = 0;
 
-	// Parse option format string
-	memset(gof, 0, sizeof(struct getoptflagstate));
-	gof->maxargs = INT_MAX;
-	if (!options) return;
+  // Parse option format string
+  memset(gof, 0, sizeof(struct getoptflagstate));
+  gof->maxargs = INT_MAX;
+  if (!options) return;
 
-	// Parse leading special behavior indicators
-	for (;;) {
-		if (*options == '^') gof->stopearly++;
-		else if (*options == '<') gof->minargs=*(++options)-'0';
-		else if (*options == '>') gof->maxargs=*(++options)-'0';
-		else if (*options == '?') gof->noerror++;
-		else if (*options == '&') gof->nodash++;
-		else break;
-		options++;
-	}
+  // Parse leading special behavior indicators
+  for (;;) {
+    if (*options == '^') gof->stopearly++;
+    else if (*options == '<') gof->minargs=*(++options)-'0';
+    else if (*options == '>') gof->maxargs=*(++options)-'0';
+    else if (*options == '?') gof->noerror++;
+    else if (*options == '&') gof->nodash++;
+    else break;
+    options++;
+  }
 
-	// Parse the rest of the option string into a linked list
-	// of options with attributes.
+  // Parse the rest of the option string into a linked list
+  // of options with attributes.
 
-	if (!*options) gof->stopearly++;
-	while (*options) {
-		char *temp;
-		int idx;
+  if (!*options) gof->stopearly++;
+  while (*options) {
+    char *temp;
+    int idx;
 
-		// Allocate a new list entry when necessary
-		if (!new) {
-			new = xzalloc(sizeof(struct opts));
-			new->next = gof->opts;
-			gof->opts = new;
-			new->val[0].l = LONG_MIN;
-			new->val[1].l = LONG_MAX;
-			++*(new->edx);
-		}
-		// Each option must start with "(" or an option character.  (Bare
-		// longopts only come at the start of the string.)
-		if (*options == '(') {
-			char *end;
-			struct longopts *lo = xmalloc(sizeof(struct longopts));
+    // Allocate a new list entry when necessary
+    if (!new) {
+      new = xzalloc(sizeof(struct opts));
+      new->next = gof->opts;
+      gof->opts = new;
+      new->val[0].l = LONG_MIN;
+      new->val[1].l = LONG_MAX;
+      ++*(new->edx);
+    }
+    // Each option must start with "(" or an option character.  (Bare
+    // longopts only come at the start of the string.)
+    if (*options == '(') {
+      char *end;
+      struct longopts *lo = xmalloc(sizeof(struct longopts));
 
-			// Find the end of the longopt
-			for (end = ++options; *end && *end != ')'; end++);
-			if (CFG_TOYBOX_DEBUG && !*end)
-				error_exit("(longopt) didn't end");
+      // Find the end of the longopt
+      for (end = ++options; *end && *end != ')'; end++);
+      if (CFG_TOYBOX_DEBUG && !*end) error_exit("(longopt) didn't end");
 
-			// init a new struct longopts
-			lo->next = gof->longopts;
-			lo->opt = new;
-			lo->str = options;
-			lo->len = end-options;
-			gof->longopts = lo;
-			options = end;
+      // init a new struct longopts
+      lo->next = gof->longopts;
+      lo->opt = new;
+      lo->str = options;
+      lo->len = end-options;
+      gof->longopts = lo;
+      options = end;
 
-			// Mark this struct opt as used, even when no short opt.
-			if (!new->c) new->c = -1;
+      // Mark this struct opt as used, even when no short opt.
+      if (!new->c) new->c = -1;
 
-		// If this is the start of a new option that wasn't a longopt,
+    // If this is the start of a new option that wasn't a longopt,
 
-		} else if (strchr(":*#@.-", *options)) {
-			if (CFG_TOYBOX_DEBUG && new->type)
-				error_exit("multiple types %c:%c%c", new->c, new->type, *options);
-			new->type = *options;
-		} else if (-1 != (idx = stridx("+~!", *options))) {
-			struct opts *opt;
-			int i;
+    } else if (strchr(":*#@.-", *options)) {
+      if (CFG_TOYBOX_DEBUG && new->type)
+        error_exit("multiple types %c:%c%c", new->c, new->type, *options);
+      new->type = *options;
+    } else if (-1 != (idx = stridx("+~!", *options))) {
+      struct opts *opt;
+      int i;
 
-			if (!*++options && CFG_TOYBOX_DEBUG)
-				error_exit("+~! no target");
-			// Find this option flag (in previously parsed struct opt)
-			for (i=0, opt = new; ; opt = opt->next) {
-				if (CFG_TOYBOX_DEBUG && !opt)
-					error_exit("+~! unknown target");
-				if (opt->c == *options) break;
-				i++;
-			}
-			new->edx[idx] |= 1<<i;
-		} else if (*options == '[') { // TODO
-		} else if (-1 != (idx = stridx("|^ ", *options)))
-			new->flags |= 1<<idx;
-		// bounds checking
-		else if (-1 != (idx = stridx("<>=", *options))) {
-			if (new->type == '#') {
-				long l = strtol(++options, &temp, 10);
-				if (temp != options) new->val[idx].l = l;
-			} else if (CFG_TOYBOX_FLOAT && new->type == '.') {
-				FLOAT f = strtod(++options, &temp);
-				if (temp != options) new->val[idx].f = f;
-			} else if (CFG_TOYBOX_DEBUG) error_exit("<>= only after .#");
-			options = --temp;
-		}
+      if (!*++options && CFG_TOYBOX_DEBUG) error_exit("+~! no target");
+      // Find this option flag (in previously parsed struct opt)
+      for (i=0, opt = new; ; opt = opt->next) {
+        if (CFG_TOYBOX_DEBUG && !opt) error_exit("+~! unknown target");
+        if (opt->c == *options) break;
+        i++;
+      }
+      new->edx[idx] |= 1<<i;
+    } else if (*options == '[') { // TODO
+    } else if (-1 != (idx = stridx("|^ ", *options))) new->flags |= 1<<idx;
+    // bounds checking
+    else if (-1 != (idx = stridx("<>=", *options))) {
+      if (new->type == '#') {
+        long l = strtol(++options, &temp, 10);
+        if (temp != options) new->val[idx].l = l;
+      } else if (CFG_TOYBOX_FLOAT && new->type == '.') {
+        FLOAT f = strtod(++options, &temp);
+        if (temp != options) new->val[idx].f = f;
+      } else if (CFG_TOYBOX_DEBUG) error_exit("<>= only after .#");
+      options = --temp;
+    }
 
-		// At this point, we've hit the end of the previous option.  The
-		// current character is the start of a new option.  If we've already
-		// assigned an option to this struct, loop to allocate a new one.
-		// (It'll get back here afterwards and fall through to next else.)
-		else if (new->c) {
-			new = NULL;
-			continue;
+    // At this point, we've hit the end of the previous option.  The
+    // current character is the start of a new option.  If we've already
+    // assigned an option to this struct, loop to allocate a new one.
+    // (It'll get back here afterwards and fall through to next else.)
+    else if (new->c) {
+      new = NULL;
+      continue;
 
-		// Claim this option, loop to see what's after it.
-		} else new->c = *options;
+    // Claim this option, loop to see what's after it.
+    } else new->c = *options;
 
-		options++;
-	}
+    options++;
+  }
 
-	// Initialize enable/disable/exclude masks and pointers to store arguments.
-	// (We have to calculate all this ahead of time because longopts jump into
-	// the middle of the list.  We have to do this after creating the list
-	// because we reverse direction: last entry created gets first global slot.)
-	int pos = 0;
-	for (new = gof->opts; new; new = new->next) {
-		int i;
+  // Initialize enable/disable/exclude masks and pointers to store arguments.
+  // (We have to calculate all this ahead of time because longopts jump into
+  // the middle of the list.  We have to do this after creating the list
+  // because we reverse direction: last entry created gets first global slot.)
+  int pos = 0;
+  for (new = gof->opts; new; new = new->next) {
+    int i;
 
-		for (i=0;i<3;i++) new->edx[i] <<= pos;
-		pos++;
-		if (new->type) {
-			new->arg = (void *)nextarg;
-			*(nextarg++) = new->val[2].l;
-		}
-	}
+    for (i=0;i<3;i++) new->edx[i] <<= pos;
+    pos++;
+    if (new->type) {
+      new->arg = (void *)nextarg;
+      *(nextarg++) = new->val[2].l;
+    }
+  }
 }
 
 void get_optflags(void)
 {
-	struct getoptflagstate gof;
-	long saveflags;
-	char *letters[]={"s",""};
+  struct getoptflagstate gof;
+  long saveflags;
+  char *letters[]={"s",""};
 
-	// Option parsing is a two stage process: parse the option string into
-	// a struct opts list, then use that list to process argv[];
+  // Option parsing is a two stage process: parse the option string into
+  // a struct opts list, then use that list to process argv[];
 
-	if (CFG_HELP) toys.exithelp++;
-	// Allocate memory for optargs
-	saveflags = 0;
-	while (toys.argv[saveflags++]);
-	toys.optargs = xzalloc(sizeof(char *)*saveflags);
+  if (CFG_HELP) toys.exithelp++;
+  // Allocate memory for optargs
+  saveflags = 0;
+  while (toys.argv[saveflags++]);
+  toys.optargs = xzalloc(sizeof(char *)*saveflags);
 
-	parse_optflaglist(&gof);
+  parse_optflaglist(&gof);
 
-	// Iterate through command line arguments, skipping argv[0]
-	for (gof.argc=1; toys.argv[gof.argc]; gof.argc++) {
-		gof.arg = toys.argv[gof.argc];
-		gof.this = NULL;
+  // Iterate through command line arguments, skipping argv[0]
+  for (gof.argc=1; toys.argv[gof.argc]; gof.argc++) {
+    gof.arg = toys.argv[gof.argc];
+    gof.this = NULL;
 
-		// Parse this argument
-		if (gof.stopearly>1) goto notflag;
+    // Parse this argument
+    if (gof.stopearly>1) goto notflag;
 
-		gof.nodash_now = 0;
+    gof.nodash_now = 0;
 
-		// Various things with dashes
-		if (*gof.arg == '-') {
+    // Various things with dashes
+    if (*gof.arg == '-') {
 
-			// Handle -
-			if (!gof.arg[1]) goto notflag;
-			gof.arg++;
-			if (*gof.arg=='-') {
-				struct longopts *lo;
+      // Handle -
+      if (!gof.arg[1]) goto notflag;
+      gof.arg++;
+      if (*gof.arg=='-') {
+        struct longopts *lo;
 
-				gof.arg++;
-				// Handle --
-				if (!*gof.arg) {
-					gof.stopearly += 2;
-					goto notflag;
-				}
-				// Handle --longopt
+        gof.arg++;
+        // Handle --
+        if (!*gof.arg) {
+          gof.stopearly += 2;
+          goto notflag;
+        }
+        // Handle --longopt
 
-				for (lo = gof.longopts; lo; lo = lo->next) {
-					if (!strncmp(gof.arg, lo->str, lo->len)) {
-						if (gof.arg[lo->len]) {
-							if (gof.arg[lo->len]=='=' && lo->opt->type)
-								gof.arg += lo->len;
-							else continue;
-						}
-						// It's a match.
-						gof.arg = "";
-						gof.this = lo->opt;
-						break;
-					}
-				}
+        for (lo = gof.longopts; lo; lo = lo->next) {
+          if (!strncmp(gof.arg, lo->str, lo->len)) {
+            if (gof.arg[lo->len]) {
+              if (gof.arg[lo->len]=='=' && lo->opt->type) gof.arg += lo->len;
+              else continue;
+            }
+            // It's a match.
+            gof.arg = "";
+            gof.this = lo->opt;
+            break;
+          }
+        }
 
-				// Should we handle this --longopt as a non-option argument?
-				if (!lo && gof.noerror) {
-					gof.arg-=2;
-					goto notflag;
-				}
+        // Should we handle this --longopt as a non-option argument?
+        if (!lo && gof.noerror) {
+          gof.arg-=2;
+          goto notflag;
+        }
 
-				// Long option parsed, handle option.
-				gotflag(&gof);
-				continue;
-			}
+        // Long option parsed, handle option.
+        gotflag(&gof);
+        continue;
+      }
 
-		// Handle things that don't start with a dash.
-		} else {
-			if (gof.nodash && (gof.nodash>1 || gof.argc == 1))
-				gof.nodash_now = 1;
-			else goto notflag;
-		}
+    // Handle things that don't start with a dash.
+    } else {
+      if (gof.nodash && (gof.nodash>1 || gof.argc == 1)) gof.nodash_now = 1;
+      else goto notflag;
+    }
 
-		// At this point, we have the args part of -args.  Loop through
-		// each entry (could be -abc meaning -a -b -c)
-		saveflags = toys.optflags;
-		while (*gof.arg) {
+    // At this point, we have the args part of -args.  Loop through
+    // each entry (could be -abc meaning -a -b -c)
+    saveflags = toys.optflags;
+    while (*gof.arg) {
 
-			// Identify next option char.
-			for (gof.this = gof.opts; gof.this; gof.this = gof.this->next)
-				if (*gof.arg == gof.this->c)
-					if (!((gof.this->flags&4) && gof.arg[1])) break;
+      // Identify next option char.
+      for (gof.this = gof.opts; gof.this; gof.this = gof.this->next)
+        if (*gof.arg == gof.this->c)
+          if (!((gof.this->flags&4) && gof.arg[1])) break;
 
-			// Handle option char (advancing past what was used)
-			if (gotflag(&gof) ) {
-				toys.optflags = saveflags;
-				gof.arg = toys.argv[gof.argc];
-				goto notflag;
-			}
-		}
-		continue;
+      // Handle option char (advancing past what was used)
+      if (gotflag(&gof) ) {
+        toys.optflags = saveflags;
+        gof.arg = toys.argv[gof.argc];
+        goto notflag;
+      }
+    }
+    continue;
 
-		// Not a flag, save value in toys.optargs[]
+    // Not a flag, save value in toys.optargs[]
 notflag:
-		if (gof.stopearly) gof.stopearly++;
-		toys.optargs[toys.optc++] = toys.argv[gof.argc];
-	}
+    if (gof.stopearly) gof.stopearly++;
+    toys.optargs[toys.optc++] = toys.argv[gof.argc];
+  }
 
-	// Sanity check
-	if (toys.optc<gof.minargs) {
-		error_exit("Need%s %d argument%s", letters[!!(gof.minargs-1)],
-				gof.minargs, letters[!(gof.minargs-1)]);
-	}
-	if (toys.optc>gof.maxargs)
-		error_exit("Max %d argument%s", gof.maxargs, letters[!(gof.maxargs-1)]);
-	if (CFG_HELP) toys.exithelp = 0;
+  // Sanity check
+  if (toys.optc<gof.minargs)
+    error_exit("Need%s %d argument%s", letters[!!(gof.minargs-1)],
+      gof.minargs, letters[!(gof.minargs-1)]);
+  if (toys.optc>gof.maxargs)
+    error_exit("Max %d argument%s", gof.maxargs, letters[!(gof.maxargs-1)]);
+  if (CFG_HELP) toys.exithelp = 0;
 
-	if (CFG_TOYBOX_FREE) {
-		llist_traverse(gof.opts, free);
-		llist_traverse(gof.longopts, free);
-	}
+  if (CFG_TOYBOX_FREE) {
+    llist_traverse(gof.opts, free);
+    llist_traverse(gof.longopts, free);
+  }
 }
--- a/lib/bunzip.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/lib/bunzip.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,14 +1,13 @@
-/* vi: set sw=4 ts=4: */
 /* micro-bunzip, a small, simple bzip2 decompression implementation.
-
-   Copyright 2003, 2006 by Rob Landley (rob@landley.net).
-
-   Based on a close reading (but not the actual code) of the original bzip2
-   decompression code by Julian R Seward (jseward@acm.org), which also
-   acknowledges contributions by Mike Burrows, David Wheeler, Peter Fenwick,
-   Alistair Moffat, Radford Neal, Ian H. Witten, Robert Sedgewick, and
-   Jon L. Bentley.
-*/
+ *
+ * Copyright 2003, 2006 by Rob Landley (rob@landley.net).
+ *
+ * Based on a close reading (but not the actual code) of the original bzip2
+ * decompression code by Julian R Seward (jseward@acm.org), which also
+ * acknowledges contributions by Mike Burrows, David Wheeler, Peter Fenwick,
+ * Alistair Moffat, Radford Neal, Ian H. Witten, Robert Sedgewick, and
+ * Jon L. Bentley.
+ */
 
 #include "toys.h"
 
@@ -32,93 +31,92 @@
 #define RETVAL_OBSOLETE_INPUT    (-3)
 
 char *bunzip_errors[]={
-	NULL,
-	"Not bzip data",
-	"Data error",
-	"Obsolete (pre 0.9.5) bzip format not supported."
+  NULL,
+  "Not bzip data",
+  "Data error",
+  "Obsolete (pre 0.9.5) bzip format not supported."
 };
 
 // This is what we know about each huffman coding group
 struct group_data {
-	int limit[MAX_HUFCODE_BITS+1], base[MAX_HUFCODE_BITS], permute[MAX_SYMBOLS];
-	char minLen, maxLen;
+  int limit[MAX_HUFCODE_BITS+1], base[MAX_HUFCODE_BITS], permute[MAX_SYMBOLS];
+  char minLen, maxLen;
 };
 
 // Data for burrows wheeler transform
 
 struct bwdata {
-	unsigned int origPtr;
-	int byteCount[256];
-	// State saved when interrupting output
-	int writePos, writeRun, writeCount, writeCurrent;
-	unsigned int dataCRC, headerCRC;
-	unsigned int *dbuf;
+  unsigned int origPtr;
+  int byteCount[256];
+  // State saved when interrupting output
+  int writePos, writeRun, writeCount, writeCurrent;
+  unsigned int dataCRC, headerCRC;
+  unsigned int *dbuf;
 };
 
 // Structure holding all the housekeeping data, including IO buffers and
 // memory that persists between calls to bunzip
 struct bunzip_data {
+  // Input stream, input buffer, input bit buffer
+  int in_fd, inbufCount, inbufPos;
+  char *inbuf;
+  unsigned int inbufBitCount, inbufBits;
 
-	// Input stream, input buffer, input bit buffer
-	int in_fd, inbufCount, inbufPos;
-	char *inbuf;
-	unsigned int inbufBitCount, inbufBits;
+  // Output buffer
+  char outbuf[IOBUF_SIZE];
+  int outbufPos;
 
-	// Output buffer
-	char outbuf[IOBUF_SIZE];
-	int outbufPos;
+  unsigned int totalCRC;
 
-	unsigned int totalCRC;
+  // First pass decompression data (Huffman and MTF decoding)
+  char selectors[32768];                  // nSelectors=15 bits
+  struct group_data groups[MAX_GROUPS];   // huffman coding tables
+  int symTotal, groupCount, nSelectors;
+  unsigned char symToByte[256], mtfSymbol[256];
 
-	// First pass decompression data (Huffman and MTF decoding)
-	char selectors[32768];                  // nSelectors=15 bits
-	struct group_data groups[MAX_GROUPS];   // huffman coding tables
-	int symTotal, groupCount, nSelectors;
-	unsigned char symToByte[256], mtfSymbol[256];
+  // The CRC values stored in the block header and calculated from the data
+  unsigned int crc32Table[256];
 
-	// The CRC values stored in the block header and calculated from the data
-	unsigned int crc32Table[256];
-
-	// Second pass decompression data (burrows-wheeler transform)
-	unsigned int dbufSize;
-	struct bwdata bwdata[THREADS];
+  // Second pass decompression data (burrows-wheeler transform)
+  unsigned int dbufSize;
+  struct bwdata bwdata[THREADS];
 };
 
 // Return the next nnn bits of input.  All reads from the compressed input
 // are done through this function.  All reads are big endian.
 static unsigned int get_bits(struct bunzip_data *bd, char bits_wanted)
 {
-	unsigned int bits = 0;
+  unsigned int bits = 0;
 
-	// If we need to get more data from the byte buffer, do so.  (Loop getting
-	// one byte at a time to enforce endianness and avoid unaligned access.)
-	while (bd->inbufBitCount < bits_wanted) {
+  // If we need to get more data from the byte buffer, do so.  (Loop getting
+  // one byte at a time to enforce endianness and avoid unaligned access.)
+  while (bd->inbufBitCount < bits_wanted) {
 
-		// If we need to read more data from file into byte buffer, do so
-		if (bd->inbufPos == bd->inbufCount) {
-			if (0 >= (bd->inbufCount = read(bd->in_fd, bd->inbuf, IOBUF_SIZE)))
-				error_exit("Unexpected input EOF");
-			bd->inbufPos = 0;
-		}
+    // If we need to read more data from file into byte buffer, do so
+    if (bd->inbufPos == bd->inbufCount) {
+      if (0 >= (bd->inbufCount = read(bd->in_fd, bd->inbuf, IOBUF_SIZE)))
+        error_exit("Unexpected input EOF");
+      bd->inbufPos = 0;
+    }
 
-		// Avoid 32-bit overflow (dump bit buffer to top of output)
-		if (bd->inbufBitCount>=24) {
-			bits = bd->inbufBits&((1<<bd->inbufBitCount)-1);
-			bits_wanted -= bd->inbufBitCount;
-			bits <<= bits_wanted;
-			bd->inbufBitCount = 0;
-		}
+    // Avoid 32-bit overflow (dump bit buffer to top of output)
+    if (bd->inbufBitCount>=24) {
+      bits = bd->inbufBits&((1<<bd->inbufBitCount)-1);
+      bits_wanted -= bd->inbufBitCount;
+      bits <<= bits_wanted;
+      bd->inbufBitCount = 0;
+    }
 
-		// Grab next 8 bits of input from buffer.
-		bd->inbufBits = (bd->inbufBits<<8) | bd->inbuf[bd->inbufPos++];
-		bd->inbufBitCount += 8;
-	}
+    // Grab next 8 bits of input from buffer.
+    bd->inbufBits = (bd->inbufBits<<8) | bd->inbuf[bd->inbufPos++];
+    bd->inbufBitCount += 8;
+  }
 
-	// Calculate result
-	bd->inbufBitCount -= bits_wanted;
-	bits |= (bd->inbufBits>>bd->inbufBitCount) & ((1<<bits_wanted)-1);
+  // Calculate result
+  bd->inbufBitCount -= bits_wanted;
+  bits |= (bd->inbufBits>>bd->inbufBitCount) & ((1<<bits_wanted)-1);
 
-	return bits;
+  return bits;
 }
 
 /* Read block header at start of a new compressed data block.  Consists of:
@@ -139,156 +137,153 @@
 
 static int read_block_header(struct bunzip_data *bd, struct bwdata *bw)
 {
-	struct group_data *hufGroup;
-	int hh, ii, jj, kk, symCount, *base, *limit;
-	unsigned char uc;
+  struct group_data *hufGroup;
+  int hh, ii, jj, kk, symCount, *base, *limit;
+  unsigned char uc;
 
-	// Read in header signature and CRC (which is stored big endian)
-	ii = get_bits(bd, 24);
-	jj = get_bits(bd, 24);
-	bw->headerCRC = get_bits(bd,32);
+  // Read in header signature and CRC (which is stored big endian)
+  ii = get_bits(bd, 24);
+  jj = get_bits(bd, 24);
+  bw->headerCRC = get_bits(bd,32);
 
-	// Is this the EOF block with CRC for whole file?  (Constant is "e")
-	if (ii==0x177245 && jj==0x385090) return RETVAL_LAST_BLOCK;
+  // Is this the EOF block with CRC for whole file?  (Constant is "e")
+  if (ii==0x177245 && jj==0x385090) return RETVAL_LAST_BLOCK;
 
-	// Is this a valid data block?  (Constant is "pi".)
-	if (ii!=0x314159 || jj!=0x265359) return RETVAL_NOT_BZIP_DATA;
+  // Is this a valid data block?  (Constant is "pi".)
+  if (ii!=0x314159 || jj!=0x265359) return RETVAL_NOT_BZIP_DATA;
 
-	// We can add support for blockRandomised if anybody complains.
-	if (get_bits(bd,1)) return RETVAL_OBSOLETE_INPUT;
-	if ((bw->origPtr = get_bits(bd,24)) > bd->dbufSize)
-		return RETVAL_DATA_ERROR;
+  // We can add support for blockRandomised if anybody complains.
+  if (get_bits(bd,1)) return RETVAL_OBSOLETE_INPUT;
+  if ((bw->origPtr = get_bits(bd,24)) > bd->dbufSize) return RETVAL_DATA_ERROR;
 
-	// mapping table: if some byte values are never used (encoding things
-	// like ascii text), the compression code removes the gaps to have fewer
-	// symbols to deal with, and writes a sparse bitfield indicating which
-	// values were present.  We make a translation table to convert the symbols
-	// back to the corresponding bytes.
-	hh = get_bits(bd, 16);
-	bd->symTotal = 0;
-	for (ii=0; ii<16; ii++) {
-		if (hh & (1 << (15 - ii))) {
-			kk = get_bits(bd, 16);
-			for (jj=0; jj<16; jj++)
-				if (kk & (1 << (15 - jj)))
-					bd->symToByte[bd->symTotal++] = (16 * ii) + jj;
-		}
-	}
+  // mapping table: if some byte values are never used (encoding things
+  // like ascii text), the compression code removes the gaps to have fewer
+  // symbols to deal with, and writes a sparse bitfield indicating which
+  // values were present.  We make a translation table to convert the symbols
+  // back to the corresponding bytes.
+  hh = get_bits(bd, 16);
+  bd->symTotal = 0;
+  for (ii=0; ii<16; ii++) {
+    if (hh & (1 << (15 - ii))) {
+      kk = get_bits(bd, 16);
+      for (jj=0; jj<16; jj++)
+        if (kk & (1 << (15 - jj)))
+          bd->symToByte[bd->symTotal++] = (16 * ii) + jj;
+    }
+  }
 
-	// How many different huffman coding groups does this block use?
-	bd->groupCount = get_bits(bd,3);
-	if (bd->groupCount<2 || bd->groupCount>MAX_GROUPS) return RETVAL_DATA_ERROR;
+  // How many different huffman coding groups does this block use?
+  bd->groupCount = get_bits(bd,3);
+  if (bd->groupCount<2 || bd->groupCount>MAX_GROUPS) return RETVAL_DATA_ERROR;
 
-	// nSelectors: Every GROUP_SIZE many symbols we switch huffman coding
-	// tables.  Each group has a selector, which is an index into the huffman
-	// coding table arrays.
-	//
-	// Read in the group selector array, which is stored as MTF encoded
-	// bit runs.  (MTF = Move To Front.  Every time a symbol occurs it's moved
-	// to the front of the table, so it has a shorter encoding next time.)
-	if (!(bd->nSelectors = get_bits(bd, 15))) return RETVAL_DATA_ERROR;
-	for (ii=0; ii<bd->groupCount; ii++) bd->mtfSymbol[ii] = ii;
-	for (ii=0; ii<bd->nSelectors; ii++) {
+  // nSelectors: Every GROUP_SIZE many symbols we switch huffman coding
+  // tables.  Each group has a selector, which is an index into the huffman
+  // coding table arrays.
+  //
+  // Read in the group selector array, which is stored as MTF encoded
+  // bit runs.  (MTF = Move To Front.  Every time a symbol occurs it's moved
+  // to the front of the table, so it has a shorter encoding next time.)
+  if (!(bd->nSelectors = get_bits(bd, 15))) return RETVAL_DATA_ERROR;
+  for (ii=0; ii<bd->groupCount; ii++) bd->mtfSymbol[ii] = ii;
+  for (ii=0; ii<bd->nSelectors; ii++) {
 
-		// Get next value
-		for(jj=0;get_bits(bd,1);jj++)
-			if (jj>=bd->groupCount) return RETVAL_DATA_ERROR;
+    // Get next value
+    for(jj=0;get_bits(bd,1);jj++)
+      if (jj>=bd->groupCount) return RETVAL_DATA_ERROR;
 
-		// Decode MTF to get the next selector, and move it to the front.
-		uc = bd->mtfSymbol[jj];
-		memmove(bd->mtfSymbol+1, bd->mtfSymbol, jj);
-		bd->mtfSymbol[0] = bd->selectors[ii] = uc;
-	}
+    // Decode MTF to get the next selector, and move it to the front.
+    uc = bd->mtfSymbol[jj];
+    memmove(bd->mtfSymbol+1, bd->mtfSymbol, jj);
+    bd->mtfSymbol[0] = bd->selectors[ii] = uc;
+  }
 
-	// Read the huffman coding tables for each group, which code for symTotal
-	// literal symbols, plus two run symbols (RUNA, RUNB)
-	symCount = bd->symTotal+2;
-	for (jj=0; jj<bd->groupCount; jj++) {
-		unsigned char length[MAX_SYMBOLS];
-		unsigned temp[MAX_HUFCODE_BITS+1];
-		int minLen, maxLen, pp;
+  // Read the huffman coding tables for each group, which code for symTotal
+  // literal symbols, plus two run symbols (RUNA, RUNB)
+  symCount = bd->symTotal+2;
+  for (jj=0; jj<bd->groupCount; jj++) {
+    unsigned char length[MAX_SYMBOLS];
+    unsigned temp[MAX_HUFCODE_BITS+1];
+    int minLen, maxLen, pp;
 
-		// Read lengths
-		hh = get_bits(bd, 5);
-		for (ii = 0; ii < symCount; ii++) {
-			for(;;) {
-				// !hh || hh > MAX_HUFCODE_BITS in one test.
-				if (MAX_HUFCODE_BITS-1 < (unsigned)hh-1)
-					return RETVAL_DATA_ERROR;
-				// Grab 2 bits instead of 1 (slightly smaller/faster).  Stop if
-				// first bit is 0, otherwise second bit says whether to
-				// increment or decrement.
-				kk = get_bits(bd, 2);
-				if (kk & 2) hh += 1 - ((kk&1)<<1);
-				else {
-					bd->inbufBitCount++;
-					break;
-				}
-			}
-			length[ii] = hh;
-		}
+    // Read lengths
+    hh = get_bits(bd, 5);
+    for (ii = 0; ii < symCount; ii++) {
+      for(;;) {
+        // !hh || hh > MAX_HUFCODE_BITS in one test.
+        if (MAX_HUFCODE_BITS-1 < (unsigned)hh-1) return RETVAL_DATA_ERROR;
+        // Grab 2 bits instead of 1 (slightly smaller/faster).  Stop if
+        // first bit is 0, otherwise second bit says whether to
+        // increment or decrement.
+        kk = get_bits(bd, 2);
+        if (kk & 2) hh += 1 - ((kk&1)<<1);
+        else {
+          bd->inbufBitCount++;
+          break;
+        }
+      }
+      length[ii] = hh;
+    }
 
-		// Find largest and smallest lengths in this group
-		minLen = maxLen = length[0];
-		for (ii = 1; ii < symCount; ii++) {
-			if(length[ii] > maxLen) maxLen = length[ii];
-			else if(length[ii] < minLen) minLen = length[ii];
-		}
+    // Find largest and smallest lengths in this group
+    minLen = maxLen = length[0];
+    for (ii = 1; ii < symCount; ii++) {
+      if(length[ii] > maxLen) maxLen = length[ii];
+      else if(length[ii] < minLen) minLen = length[ii];
+    }
 
-		/* Calculate permute[], base[], and limit[] tables from length[].
-		 *
-		 * permute[] is the lookup table for converting huffman coded symbols
-		 * into decoded symbols.  It contains symbol values sorted by length.
-		 *
-		 * base[] is the amount to subtract from the value of a huffman symbol
-		 * of a given length when using permute[].
-		 *
-		 * limit[] indicates the largest numerical value a symbol with a given
-		 * number of bits can have.  It lets us know when to stop reading.
-		 *
-		 * To use these, keep reading bits until value <= limit[bitcount] or
-		 * you've read over 20 bits (error).  Then the decoded symbol
-		 * equals permute[hufcode_value - base[hufcode_bitcount]].
-		 */
-		hufGroup = bd->groups+jj;
-		hufGroup->minLen = minLen;
-		hufGroup->maxLen = maxLen;
+    /* Calculate permute[], base[], and limit[] tables from length[].
+     *
+     * permute[] is the lookup table for converting huffman coded symbols
+     * into decoded symbols.  It contains symbol values sorted by length.
+     *
+     * base[] is the amount to subtract from the value of a huffman symbol
+     * of a given length when using permute[].
+     *
+     * limit[] indicates the largest numerical value a symbol with a given
+     * number of bits can have.  It lets us know when to stop reading.
+     *
+     * To use these, keep reading bits until value <= limit[bitcount] or
+     * you've read over 20 bits (error).  Then the decoded symbol
+     * equals permute[hufcode_value - base[hufcode_bitcount]].
+     */
+    hufGroup = bd->groups+jj;
+    hufGroup->minLen = minLen;
+    hufGroup->maxLen = maxLen;
 
-		// Note that minLen can't be smaller than 1, so we adjust the base
-		// and limit array pointers so we're not always wasting the first
-		// entry.  We do this again when using them (during symbol decoding).
-		base = hufGroup->base-1;
-		limit = hufGroup->limit-1;
+    // Note that minLen can't be smaller than 1, so we adjust the base
+    // and limit array pointers so we're not always wasting the first
+    // entry.  We do this again when using them (during symbol decoding).
+    base = hufGroup->base-1;
+    limit = hufGroup->limit-1;
 
-		// zero temp[] and limit[], and calculate permute[]
-		pp = 0;
-		for (ii = minLen; ii <= maxLen; ii++) {
-			temp[ii] = limit[ii] = 0;
-			for (hh = 0; hh < symCount; hh++)
-				if (length[hh] == ii)
-					hufGroup->permute[pp++] = hh;
-		}
+    // zero temp[] and limit[], and calculate permute[]
+    pp = 0;
+    for (ii = minLen; ii <= maxLen; ii++) {
+      temp[ii] = limit[ii] = 0;
+      for (hh = 0; hh < symCount; hh++)
+        if (length[hh] == ii) hufGroup->permute[pp++] = hh;
+    }
 
-		// Count symbols coded for at each bit length
-		for (ii = 0; ii < symCount; ii++) temp[length[ii]]++;
+    // Count symbols coded for at each bit length
+    for (ii = 0; ii < symCount; ii++) temp[length[ii]]++;
 
-		/* Calculate limit[] (the largest symbol-coding value at each bit
-		 * length, which is (previous limit<<1)+symbols at this level), and
-		 * base[] (number of symbols to ignore at each bit length, which is
-		 * limit minus the cumulative count of symbols coded for already). */
-		pp = hh = 0;
-		for (ii = minLen; ii < maxLen; ii++) {
-			pp += temp[ii];
-			limit[ii] = pp-1;
-			pp <<= 1;
-			base[ii+1] = pp-(hh+=temp[ii]);
-		}
-		limit[maxLen] = pp+temp[maxLen]-1;
-		limit[maxLen+1] = INT_MAX;
-		base[minLen] = 0;
-	}
+    /* Calculate limit[] (the largest symbol-coding value at each bit
+     * length, which is (previous limit<<1)+symbols at this level), and
+     * base[] (number of symbols to ignore at each bit length, which is
+     * limit minus the cumulative count of symbols coded for already). */
+    pp = hh = 0;
+    for (ii = minLen; ii < maxLen; ii++) {
+      pp += temp[ii];
+      limit[ii] = pp-1;
+      pp <<= 1;
+      base[ii+1] = pp-(hh+=temp[ii]);
+    }
+    limit[maxLen] = pp+temp[maxLen]-1;
+    limit[maxLen+1] = INT_MAX;
+    base[minLen] = 0;
+  }
 
-	return 0;
+  return 0;
 }
 
 /* First pass, read block's symbols into dbuf[dbufCount].
@@ -300,191 +295,188 @@
 
 static int read_huffman_data(struct bunzip_data *bd, struct bwdata *bw)
 {
-	struct group_data *hufGroup;
-	int hh, ii, jj, kk, runPos, dbufCount, symCount, selector, nextSym,
-		*byteCount, *base, *limit;
-	unsigned int *dbuf = bw->dbuf;
-	unsigned char uc;
+  struct group_data *hufGroup;
+  int hh, ii, jj, kk, runPos, dbufCount, symCount, selector, nextSym,
+    *byteCount, *base, *limit;
+  unsigned int *dbuf = bw->dbuf;
+  unsigned char uc;
 
-	// We've finished reading and digesting the block header.  Now read this
-	// block's huffman coded symbols from the file and undo the huffman coding
-	// and run length encoding, saving the result into dbuf[dbufCount++] = uc
+  // We've finished reading and digesting the block header.  Now read this
+  // block's huffman coded symbols from the file and undo the huffman coding
+  // and run length encoding, saving the result into dbuf[dbufCount++] = uc
 
-	// Initialize symbol occurrence counters and symbol mtf table
-	byteCount = bw->byteCount;
-	for(ii=0; ii<256; ii++) {
-		byteCount[ii] = 0;
-		bd->mtfSymbol[ii] = ii;
-	}
+  // Initialize symbol occurrence counters and symbol mtf table
+  byteCount = bw->byteCount;
+  for(ii=0; ii<256; ii++) {
+    byteCount[ii] = 0;
+    bd->mtfSymbol[ii] = ii;
+  }
 
-	// Loop through compressed symbols.  This is the first "tight inner loop"
-	// that needs to be micro-optimized for speed.  (This one fills out dbuf[]
-	// linearly, staying in cache more, so isn't as limited by DRAM access.)
-	runPos = dbufCount = symCount = selector = 0;
-	// Some unnecessary initializations to shut gcc up.
-	base = limit = 0;
-	hufGroup = 0;
-	hh = 0;
+  // Loop through compressed symbols.  This is the first "tight inner loop"
+  // that needs to be micro-optimized for speed.  (This one fills out dbuf[]
+  // linearly, staying in cache more, so isn't as limited by DRAM access.)
+  runPos = dbufCount = symCount = selector = 0;
+  // Some unnecessary initializations to shut gcc up.
+  base = limit = 0;
+  hufGroup = 0;
+  hh = 0;
 
-	for (;;) {
+  for (;;) {
+    // Have we reached the end of this huffman group?
+    if (!(symCount--)) {
+      // Determine which huffman coding group to use.
+      symCount = GROUP_SIZE-1;
+      if (selector >= bd->nSelectors) return RETVAL_DATA_ERROR;
+      hufGroup = bd->groups + bd->selectors[selector++];
+      base = hufGroup->base-1;
+      limit = hufGroup->limit-1;
+    }
 
-		// Have we reached the end of this huffman group?
-		if (!(symCount--)) {
-			// Determine which huffman coding group to use.
-			symCount = GROUP_SIZE-1;
-			if (selector >= bd->nSelectors) return RETVAL_DATA_ERROR;
-			hufGroup = bd->groups + bd->selectors[selector++];
-			base = hufGroup->base-1;
-			limit = hufGroup->limit-1;
-		}
+    // Read next huffman-coded symbol (into jj).
+    ii = hufGroup->minLen;
+    jj = get_bits(bd, ii);
+    while (jj > limit[ii]) {
+      // if (ii > hufGroup->maxLen) return RETVAL_DATA_ERROR;
+      ii++;
 
-		// Read next huffman-coded symbol (into jj).
-		ii = hufGroup->minLen;
-		jj = get_bits(bd, ii);
-		while (jj > limit[ii]) {
-			// if (ii > hufGroup->maxLen) return RETVAL_DATA_ERROR;
-			ii++;
+      // Unroll get_bits() to avoid a function call when the data's in
+      // the buffer already.
+      kk = bd->inbufBitCount
+        ? (bd->inbufBits >> --(bd->inbufBitCount)) & 1 : get_bits(bd, 1);
+      jj = (jj << 1) | kk;
+    }
+    // Huffman decode jj into nextSym (with bounds checking)
+    jj-=base[ii];
 
-			// Unroll get_bits() to avoid a function call when the data's in
-			// the buffer already.
-			kk = bd->inbufBitCount
-			   	? (bd->inbufBits >> --(bd->inbufBitCount)) & 1
-				: get_bits(bd, 1);
-			jj = (jj << 1) | kk;
-		}
-		// Huffman decode jj into nextSym (with bounds checking)
-		jj-=base[ii];
+    if (ii > hufGroup->maxLen || (unsigned)jj >= MAX_SYMBOLS)
+      return RETVAL_DATA_ERROR;
+    nextSym = hufGroup->permute[jj];
 
-		if (ii > hufGroup->maxLen || (unsigned)jj >= MAX_SYMBOLS)
-			return RETVAL_DATA_ERROR;
-		nextSym = hufGroup->permute[jj];
+    // If this is a repeated run, loop collecting data
+    if ((unsigned)nextSym <= SYMBOL_RUNB) {
+      // If this is the start of a new run, zero out counter
+      if(!runPos) {
+        runPos = 1;
+        hh = 0;
+      }
 
-		// If this is a repeated run, loop collecting data
-		if ((unsigned)nextSym <= SYMBOL_RUNB) {
+      /* Neat trick that saves 1 symbol: instead of or-ing 0 or 1 at
+         each bit position, add 1 or 2 instead. For example,
+         1011 is 1<<0 + 1<<1 + 2<<2. 1010 is 2<<0 + 2<<1 + 1<<2.
+         You can make any bit pattern that way using 1 less symbol than
+         the basic or 0/1 method (except all bits 0, which would use no
+         symbols, but a run of length 0 doesn't mean anything in this
+         context). Thus space is saved. */
+      hh += (runPos << nextSym); // +runPos if RUNA; +2*runPos if RUNB
+      runPos <<= 1;
+      continue;
+    }
 
-			// If this is the start of a new run, zero out counter
-			if(!runPos) {
-				runPos = 1;
-				hh = 0;
-			}
+    /* When we hit the first non-run symbol after a run, we now know
+       how many times to repeat the last literal, so append that many
+       copies to our buffer of decoded symbols (dbuf) now. (The last
+       literal used is the one at the head of the mtfSymbol array.) */
+    if (runPos) {
+      runPos = 0;
+      if (dbufCount+hh >= bd->dbufSize) return RETVAL_DATA_ERROR;
 
-			/* Neat trick that saves 1 symbol: instead of or-ing 0 or 1 at
-			   each bit position, add 1 or 2 instead.  For example,
-			   1011 is 1<<0 + 1<<1 + 2<<2.  1010 is 2<<0 + 2<<1 + 1<<2.
-			   You can make any bit pattern that way using 1 less symbol than
-			   the basic or 0/1 method (except all bits 0, which would use no
-			   symbols, but a run of length 0 doesn't mean anything in this
-			   context).  Thus space is saved. */
-			hh += (runPos << nextSym); // +runPos if RUNA; +2*runPos if RUNB
-			runPos <<= 1;
-			continue;
-		}
+      uc = bd->symToByte[bd->mtfSymbol[0]];
+      byteCount[uc] += hh;
+      while (hh--) dbuf[dbufCount++] = uc;
+    }
 
-		/* When we hit the first non-run symbol after a run, we now know
-		   how many times to repeat the last literal, so append that many
-		   copies to our buffer of decoded symbols (dbuf) now.  (The last
-		   literal used is the one at the head of the mtfSymbol array.) */
-		if (runPos) {
-			runPos = 0;
-			if (dbufCount+hh >= bd->dbufSize) return RETVAL_DATA_ERROR;
+    // Is this the terminating symbol?
+    if (nextSym>bd->symTotal) break;
 
-			uc = bd->symToByte[bd->mtfSymbol[0]];
-			byteCount[uc] += hh;
-			while (hh--) dbuf[dbufCount++] = uc;
-		}
+    /* At this point, the symbol we just decoded indicates a new literal
+       character. Subtract one to get the position in the MTF array
+       at which this literal is currently to be found. (Note that the
+       result can't be -1 or 0, because 0 and 1 are RUNA and RUNB.
+       Another instance of the first symbol in the mtf array, position 0,
+       would have been handled as part of a run.) */
+    if (dbufCount>=bd->dbufSize) return RETVAL_DATA_ERROR;
+    ii = nextSym - 1;
+    uc = bd->mtfSymbol[ii];
+    // On my laptop, unrolling this memmove() into a loop shaves 3.5% off
+    // the total running time.
+    while(ii--) bd->mtfSymbol[ii+1] = bd->mtfSymbol[ii];
+    bd->mtfSymbol[0] = uc;
+    uc = bd->symToByte[uc];
 
-		// Is this the terminating symbol?
-		if (nextSym>bd->symTotal) break;
+    // We have our literal byte.  Save it into dbuf.
+    byteCount[uc]++;
+    dbuf[dbufCount++] = (unsigned int)uc;
+  }
 
-		/* At this point, the symbol we just decoded indicates a new literal
-		   character.  Subtract one to get the position in the MTF array
-		   at which this literal is currently to be found.  (Note that the
-		   result can't be -1 or 0, because 0 and 1 are RUNA and RUNB.
-		   Another instance of the first symbol in the mtf array, position 0,
-		   would have been handled as part of a run.) */
-		if (dbufCount>=bd->dbufSize) return RETVAL_DATA_ERROR;
-		ii = nextSym - 1;
-		uc = bd->mtfSymbol[ii];
-		// On my laptop, unrolling this memmove() into a loop shaves 3.5% off
-		// the total running time.
-		while(ii--) bd->mtfSymbol[ii+1] = bd->mtfSymbol[ii];
-		bd->mtfSymbol[0] = uc;
-		uc = bd->symToByte[uc];
+  // Now we know what dbufCount is, do a better sanity check on origPtr.
+  if (bw->origPtr >= (bw->writeCount = dbufCount)) return RETVAL_DATA_ERROR;
 
-		// We have our literal byte.  Save it into dbuf.
-		byteCount[uc]++;
-		dbuf[dbufCount++] = (unsigned int)uc;
-	}
-
-	// Now we know what dbufCount is, do a better sanity check on origPtr.
-	if (bw->origPtr >= (bw->writeCount = dbufCount)) return RETVAL_DATA_ERROR;
-
-	return 0;
+  return 0;
 }
 
 // Flush output buffer to disk
 void flush_bunzip_outbuf(struct bunzip_data *bd, int out_fd)
 {
-	if (bd->outbufPos) {
-		if (write(out_fd, bd->outbuf, bd->outbufPos) != bd->outbufPos)
-			error_exit("Unexpected output EOF");
-		bd->outbufPos = 0;
-	}
+  if (bd->outbufPos) {
+    if (write(out_fd, bd->outbuf, bd->outbufPos) != bd->outbufPos)
+      error_exit("Unexpected output EOF");
+    bd->outbufPos = 0;
+  }
 }
 
 void burrows_wheeler_prep(struct bunzip_data *bd, struct bwdata *bw)
 {
-	int ii, jj;
-	unsigned int *dbuf = bw->dbuf;
-	int *byteCount = bw->byteCount;
+  int ii, jj;
+  unsigned int *dbuf = bw->dbuf;
+  int *byteCount = bw->byteCount;
 
-	// Technically this part is preparation for the burrows-wheeler
-	// transform, but it's quick and convenient to do here.
+  // Technically this part is preparation for the burrows-wheeler
+  // transform, but it's quick and convenient to do here.
 
-	// Turn byteCount into cumulative occurrence counts of 0 to n-1.
-	jj = 0;
-	for (ii=0; ii<256; ii++) {
-		int kk = jj + byteCount[ii];
-		byteCount[ii] = jj;
-		jj = kk;
-	}
+  // Turn byteCount into cumulative occurrence counts of 0 to n-1.
+  jj = 0;
+  for (ii=0; ii<256; ii++) {
+    int kk = jj + byteCount[ii];
+    byteCount[ii] = jj;
+    jj = kk;
+  }
 
-	// Use occurrence counts to quickly figure out what order dbuf would be in
-	// if we sorted it.
-	for (ii=0; ii < bw->writeCount; ii++) {
-		unsigned char uc = dbuf[ii];
-		dbuf[byteCount[uc]] |= (ii << 8);
-		byteCount[uc]++;
-	}
+  // Use occurrence counts to quickly figure out what order dbuf would be in
+  // if we sorted it.
+  for (ii=0; ii < bw->writeCount; ii++) {
+    unsigned char uc = dbuf[ii];
+    dbuf[byteCount[uc]] |= (ii << 8);
+    byteCount[uc]++;
+  }
 
-	// blockRandomised support would go here.
+  // blockRandomised support would go here.
 
-	// Using ii as position, jj as previous character, hh as current character,
-	// and uc as run count.
-	bw->dataCRC = 0xffffffffL;
+  // Using ii as position, jj as previous character, hh as current character,
+  // and uc as run count.
+  bw->dataCRC = 0xffffffffL;
 
-	/* Decode first byte by hand to initialize "previous" byte.  Note that it
-	   doesn't get output, and if the first three characters are identical
-	   it doesn't qualify as a run (hence uc=255, which will either wrap
-	   to 1 or get reset). */
-	if (bw->writeCount) {
-		bw->writePos = dbuf[bw->origPtr];
-	    bw->writeCurrent = (unsigned char)bw->writePos;
-		bw->writePos >>= 8;
-		bw->writeRun = -1;
-	}
+  /* Decode first byte by hand to initialize "previous" byte. Note that it
+     doesn't get output, and if the first three characters are identical
+     it doesn't qualify as a run (hence uc=255, which will either wrap
+     to 1 or get reset). */
+  if (bw->writeCount) {
+    bw->writePos = dbuf[bw->origPtr];
+    bw->writeCurrent = (unsigned char)bw->writePos;
+    bw->writePos >>= 8;
+    bw->writeRun = -1;
+  }
 }
 
 // Decompress a block of text to intermediate buffer
 int read_bunzip_data(struct bunzip_data *bd)
 {
-	int rc = read_block_header(bd, bd->bwdata);
-	if (!rc) rc=read_huffman_data(bd, bd->bwdata);
+  int rc = read_block_header(bd, bd->bwdata);
+  if (!rc) rc=read_huffman_data(bd, bd->bwdata);
 
-	// First thing that can be done by a background thread.
-	burrows_wheeler_prep(bd, bd->bwdata);
+  // First thing that can be done by a background thread.
+  burrows_wheeler_prep(bd, bd->bwdata);
 
-	return rc;
+  return rc;
 }
 
 // Undo burrows-wheeler transform on intermediate buffer to produce output.
@@ -497,149 +489,144 @@
 
 int write_bunzip_data(struct bunzip_data *bd, struct bwdata *bw, int out_fd, char *outbuf, int len)
 {
-	unsigned int *dbuf = bw->dbuf;
-	int count, pos, current, run, copies, outbyte, previous, gotcount = 0;
+  unsigned int *dbuf = bw->dbuf;
+  int count, pos, current, run, copies, outbyte, previous, gotcount = 0;
 
-	for (;;) {
+  for (;;) {
+    // If last read was short due to end of file, return last block now
+    if (bw->writeCount < 0) return bw->writeCount;
 
-		// If last read was short due to end of file, return last block now
-		if (bw->writeCount < 0) return bw->writeCount;
+    // If we need to refill dbuf, do it.
+    if (!bw->writeCount) {
+      int i = read_bunzip_data(bd);
+      if (i) {
+        if (i == RETVAL_LAST_BLOCK) {
+          bw->writeCount = i;
+          return gotcount;
+        } else return i;
+      }
+    }
 
-		// If we need to refill dbuf, do it.
-		if (!bw->writeCount) {
-			int i = read_bunzip_data(bd);
-			if (i) {
-				if (i == RETVAL_LAST_BLOCK) {
-					bw->writeCount = i;
-					return gotcount;
-				} else return i;
-			}
-		}
+    // loop generating output
+    count = bw->writeCount;
+    pos = bw->writePos;
+    current = bw->writeCurrent;
+    run = bw->writeRun;
+    while (count) {
 
-		// loop generating output
-		count = bw->writeCount;
-		pos = bw->writePos;
-		current = bw->writeCurrent;
-		run = bw->writeRun;
-		while (count) {
+      // If somebody (like tar) wants a certain number of bytes of
+      // data from memory instead of written to a file, humor them.
+      if (len && bd->outbufPos>=len) goto dataus_interruptus;
+      count--;
 
-			// If somebody (like tar) wants a certain number of bytes of
-			// data from memory instead of written to a file, humor them.
-			if (len && bd->outbufPos>=len) goto dataus_interruptus;
-			count--;
+      // Follow sequence vector to undo Burrows-Wheeler transform.
+      previous = current;
+      pos = dbuf[pos];
+      current = pos&0xff;
+      pos >>= 8;
 
-			// Follow sequence vector to undo Burrows-Wheeler transform.
-			previous = current;
-			pos = dbuf[pos];
-			current = pos&0xff;
-			pos >>= 8;
+      // Whenever we see 3 consecutive copies of the same byte,
+      // the 4th is a repeat count
+      if (run++ == 3) {
+        copies = current;
+        outbyte = previous;
+        current = -1;
+      } else {
+        copies = 1;
+        outbyte = current;
+      }
 
-			// Whenever we see 3 consecutive copies of the same byte,
-			// the 4th is a repeat count
-			if (run++ == 3) {
-				copies = current;
-				outbyte = previous;
-				current = -1;
-			} else {
-				copies = 1;
-				outbyte = current;
-			}
+      // Output bytes to buffer, flushing to file if necessary
+      while (copies--) {
+        if (bd->outbufPos == IOBUF_SIZE) flush_bunzip_outbuf(bd,out_fd);
+        bd->outbuf[bd->outbufPos++] = outbyte;
+        bw->dataCRC = (bw->dataCRC << 8)
+                ^ bd->crc32Table[(bw->dataCRC >> 24) ^ outbyte];
+      }
+      if (current!=previous) run=0;
+    }
 
-			// Output bytes to buffer, flushing to file if necessary
-			while (copies--) {
-				if (bd->outbufPos == IOBUF_SIZE) flush_bunzip_outbuf(bd,out_fd);
-				bd->outbuf[bd->outbufPos++] = outbyte;
-				bw->dataCRC = (bw->dataCRC << 8)
-								^ bd->crc32Table[(bw->dataCRC >> 24) ^ outbyte];
-			}
-			if (current!=previous) run=0;
-		}
+    // decompression of this block completed successfully
+    bw->dataCRC = ~(bw->dataCRC);
+    bd->totalCRC = ((bd->totalCRC << 1) | (bd->totalCRC >> 31)) ^ bw->dataCRC;
 
-		// decompression of this block completed successfully
-		bw->dataCRC = ~(bw->dataCRC);
-		bd->totalCRC = ((bd->totalCRC << 1) | (bd->totalCRC >> 31))
-			^ bw->dataCRC;
+    // if this block had a crc error, force file level crc error.
+    if (bw->dataCRC != bw->headerCRC) {
+      bd->totalCRC = bw->headerCRC+1;
 
-		// if this block had a crc error, force file level crc error.
-		if (bw->dataCRC != bw->headerCRC) {
-			bd->totalCRC = bw->headerCRC+1;
+      return RETVAL_LAST_BLOCK;
+    }
+dataus_interruptus:
+    bw->writeCount = count;
+    if (len) {
+      gotcount += bd->outbufPos;
+      memcpy(outbuf, bd->outbuf, len);
 
-			return RETVAL_LAST_BLOCK;
-		}
-dataus_interruptus:
-		bw->writeCount = count;
-		if (len) {
-			gotcount += bd->outbufPos;
-			memcpy(outbuf, bd->outbuf, len);
+      // If we got enough data, checkpoint loop state and return
+      if ((len-=bd->outbufPos)<1) {
+        bd->outbufPos -= len;
+        if (bd->outbufPos) memmove(bd->outbuf, bd->outbuf+len, bd->outbufPos);
+        bw->writePos = pos;
+        bw->writeCurrent = current;
+        bw->writeRun = run;
 
-			// If we got enough data, checkpoint loop state and return
-			if ((len-=bd->outbufPos)<1) {
-				bd->outbufPos -= len;
-				if (bd->outbufPos)
-					memmove(bd->outbuf, bd->outbuf+len, bd->outbufPos);
-				bw->writePos = pos;
-				bw->writeCurrent = current;
-				bw->writeRun = run;
-
-				return gotcount;
-			}
-		}
-	}
+        return gotcount;
+      }
+    }
+  }
 }
 
-// Allocate the structure, read file header.  If !len, src_fd contains
-// filehandle to read from.  Else inbuf contains data.
+// Allocate the structure, read file header. If !len, src_fd contains
+// filehandle to read from. Else inbuf contains data.
 int start_bunzip(struct bunzip_data **bdp, int src_fd, char *inbuf, int len)
 {
-	struct bunzip_data *bd;
-	unsigned int i;
+  struct bunzip_data *bd;
+  unsigned int i;
 
-	// Figure out how much data to allocate.
-	i = sizeof(struct bunzip_data);
-	if (!len) i += IOBUF_SIZE;
+  // Figure out how much data to allocate.
+  i = sizeof(struct bunzip_data);
+  if (!len) i += IOBUF_SIZE;
 
-	// Allocate bunzip_data.  Most fields initialize to zero.
-	bd = *bdp = xzalloc(i);
-	if (len) {
-		bd->inbuf = inbuf;
-		bd->inbufCount = len;
-		bd->in_fd = -1;
-	} else {
-		bd->inbuf = (char *)(bd+1);
-		bd->in_fd = src_fd;
-	}
+  // Allocate bunzip_data. Most fields initialize to zero.
+  bd = *bdp = xzalloc(i);
+  if (len) {
+    bd->inbuf = inbuf;
+    bd->inbufCount = len;
+    bd->in_fd = -1;
+  } else {
+    bd->inbuf = (char *)(bd+1);
+    bd->in_fd = src_fd;
+  }
 
-	crc_init(bd->crc32Table, 0);
+  crc_init(bd->crc32Table, 0);
 
-	// Ensure that file starts with "BZh".
-    for (i=0;i<3;i++)
-		if (get_bits(bd,8)!="BZh"[i]) return RETVAL_NOT_BZIP_DATA;
+  // Ensure that file starts with "BZh".
+  for (i=0;i<3;i++) if (get_bits(bd,8)!="BZh"[i]) return RETVAL_NOT_BZIP_DATA;
 
-	// Next byte ascii '1'-'9', indicates block size in units of 100k of
-	// uncompressed data.  Allocate intermediate buffer for block.
-	i = get_bits(bd, 8);
-	if (i<'1' || i>'9') return RETVAL_NOT_BZIP_DATA;
-	bd->dbufSize = 100000*(i-'0')*THREADS;
-	for (i=0; i<THREADS; i++)
-		bd->bwdata[i].dbuf = xmalloc(bd->dbufSize * sizeof(int));
+  // Next byte ascii '1'-'9', indicates block size in units of 100k of
+  // uncompressed data. Allocate intermediate buffer for block.
+  i = get_bits(bd, 8);
+  if (i<'1' || i>'9') return RETVAL_NOT_BZIP_DATA;
+  bd->dbufSize = 100000*(i-'0')*THREADS;
+  for (i=0; i<THREADS; i++)
+    bd->bwdata[i].dbuf = xmalloc(bd->dbufSize * sizeof(int));
 
-	return 0;
+  return 0;
 }
 
-// Example usage: decompress src_fd to dst_fd.  (Stops at end of bzip data,
+// Example usage: decompress src_fd to dst_fd. (Stops at end of bzip data,
 // not end of file.)
 void bunzipStream(int src_fd, int dst_fd)
 {
-	struct bunzip_data *bd;
-	int i, j;
+  struct bunzip_data *bd;
+  int i, j;
 
-	if (!(i = start_bunzip(&bd,src_fd,0,0))) {
-		i = write_bunzip_data(bd,bd->bwdata,dst_fd,0,0);
-		if (i==RETVAL_LAST_BLOCK && bd->bwdata[0].headerCRC==bd->totalCRC)
-			i = 0;
-	}
-	flush_bunzip_outbuf(bd,dst_fd);
-	for (j=0; j<THREADS; j++) free(bd->bwdata[j].dbuf);
-	free(bd);
-	if (i) error_exit(bunzip_errors[-i]);
+  if (!(i = start_bunzip(&bd,src_fd,0,0))) {
+    i = write_bunzip_data(bd,bd->bwdata,dst_fd,0,0);
+    if (i==RETVAL_LAST_BLOCK && bd->bwdata[0].headerCRC==bd->totalCRC) i = 0;
+  }
+  flush_bunzip_outbuf(bd,dst_fd);
+  for (j=0; j<THREADS; j++) free(bd->bwdata[j].dbuf);
+  free(bd);
+  if (i) error_exit(bunzip_errors[-i]);
 }
--- a/lib/dirtree.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/lib/dirtree.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,4 +1,3 @@
-/* vi: set sw=4 ts=4 :*/
 /* dirtree.c - Functions for dealing with directory trees.
  *
  * Copyright 2007 Rob Landley <rob@landley.net>
@@ -12,76 +11,75 @@
 
 struct dirtree *dirtree_add_node(int dirfd, char *name, int symfollow)
 {
-	struct dirtree *dt = NULL;
-	struct stat st;
-	char buf[4096];
-	int len = 0, linklen = 0;
+  struct dirtree *dt = NULL;
+  struct stat st;
+  char buf[4096];
+  int len = 0, linklen = 0;
 
-	if (name) {
-		if (fstatat(dirfd, name, &st, symfollow ? 0 : AT_SYMLINK_NOFOLLOW))
-			goto error;
-		if (S_ISLNK(st.st_mode)) {
-			if (0>(linklen = readlinkat(dirfd, name, buf, 4095))) goto error;
-			buf[linklen++]=0;
-		}
-		len = strlen(name);
-	}
-   	dt = xzalloc((len = sizeof(struct dirtree)+len+1)+linklen);
-	if (name) {
-		memcpy(&(dt->st), &st, sizeof(struct stat));
-		strcpy(dt->name, name);
+  if (name) {
+    if (fstatat(dirfd, name, &st, symfollow ? 0 : AT_SYMLINK_NOFOLLOW))
+      goto error;
+    if (S_ISLNK(st.st_mode)) {
+      if (0>(linklen = readlinkat(dirfd, name, buf, 4095))) goto error;
+      buf[linklen++]=0;
+    }
+    len = strlen(name);
+  }
+  dt = xzalloc((len = sizeof(struct dirtree)+len+1)+linklen);
+  if (name) {
+    memcpy(&(dt->st), &st, sizeof(struct stat));
+    strcpy(dt->name, name);
 
-		if (linklen) {
-			dt->symlink = memcpy(len+(char *)dt, buf, linklen);
-			dt->data = --linklen;
-		}
-	}
+    if (linklen) {
+      dt->symlink = memcpy(len+(char *)dt, buf, linklen);
+      dt->data = --linklen;
+    }
+  }
 
-	return dt;
+  return dt;
 
 error:
-	perror_msg("%s",name);
-	free(dt);
-	return 0;
+  perror_msg("%s",name);
+  free(dt);
+  return 0;
 }
 
 // Return path to this node, assembled recursively.
 
 char *dirtree_path(struct dirtree *node, int *plen)
 {
-	char *path;
-	int len;
+  char *path;
+  int len;
 
-	if (!node || !node->name) {
-		path = xmalloc(*plen);
-		*plen = 0;
-		return path;
-	}
+  if (!node || !node->name) {
+    path = xmalloc(*plen);
+    *plen = 0;
+    return path;
+  }
 
-	len = (plen ? *plen : 0)+strlen(node->name)+1;
-	path = dirtree_path(node->parent, &len);
-	if (len && path[len-1] != '/') path[len++]='/';
-	len = (stpcpy(path+len, node->name) - path);
-	if (plen) *plen = len;
+  len = (plen ? *plen : 0)+strlen(node->name)+1;
+  path = dirtree_path(node->parent, &len);
+  if (len && path[len-1] != '/') path[len++]='/';
+  len = (stpcpy(path+len, node->name) - path);
+  if (plen) *plen = len;
 
-	return path;
+  return path;
 }
 
 // Default callback, filters out "." and "..".
 
 int dirtree_notdotdot(struct dirtree *catch)
 {
-	// Should we skip "." and ".."?
-	if (catch->name[0]=='.' && (!catch->name[1] ||
-			(catch->name[1]=='.' && !catch->name[2])))
-				return 0;
+  // Should we skip "." and ".."?
+  if (catch->name[0]=='.' && (!catch->name[1] ||
+      (catch->name[1]=='.' && !catch->name[2]))) return 0;
 
-	return DIRTREE_SAVE|DIRTREE_RECURSE;
+  return DIRTREE_SAVE|DIRTREE_RECURSE;
 }
 
 int dirtree_parentfd(struct dirtree *node)
 {
-	return node->parent ? node->parent->data : AT_FDCWD;
+  return node->parent ? node->parent->data : AT_FDCWD;
 }
 
 // Handle callback for a node in the tree. Returns saved node(s) or NULL.
@@ -93,69 +91,69 @@
 //
 
 struct dirtree *handle_callback(struct dirtree *new,
-					int (*callback)(struct dirtree *node))
+          int (*callback)(struct dirtree *node))
 {
-	int flags, dir = S_ISDIR(new->st.st_mode);
+  int flags, dir = S_ISDIR(new->st.st_mode);
 
-	if (!callback) callback = dirtree_notdotdot;
+  if (!callback) callback = dirtree_notdotdot;
 
-	flags = callback(new);
+  flags = callback(new);
 
-	if (dir) {
-		if (flags & (DIRTREE_RECURSE|DIRTREE_COMEAGAIN)) {
-			new->data = openat(dirtree_parentfd(new), new->name, 0);
-			dirtree_recurse(new, callback, flags & DIRTREE_SYMFOLLOW);
-			if (flags & DIRTREE_COMEAGAIN) flags = callback(new);
-		}
-	}
+  if (dir) {
+    if (flags & (DIRTREE_RECURSE|DIRTREE_COMEAGAIN)) {
+      new->data = openat(dirtree_parentfd(new), new->name, 0);
+      dirtree_recurse(new, callback, flags & DIRTREE_SYMFOLLOW);
+      if (flags & DIRTREE_COMEAGAIN) flags = callback(new);
+    }
+  }
 
-	// If this had children, it was callback's job to free them already.
-	if (!(flags & DIRTREE_SAVE)) {
-		free(new);
-		new = NULL;
-	}
+  // If this had children, it was callback's job to free them already.
+  if (!(flags & DIRTREE_SAVE)) {
+    free(new);
+    new = NULL;
+  }
 
-	return (flags & DIRTREE_ABORT)==DIRTREE_ABORT ? DIRTREE_ABORTVAL : new;
+  return (flags & DIRTREE_ABORT)==DIRTREE_ABORT ? DIRTREE_ABORTVAL : new;
 }
 
 // Recursively read/process children of directory node (with dirfd in data),
 // filtering through callback().
 
 void dirtree_recurse(struct dirtree *node,
-					int (*callback)(struct dirtree *node), int symfollow)
+          int (*callback)(struct dirtree *node), int symfollow)
 {
-	struct dirtree *new, **ddt = &(node->child);
-	struct dirent *entry;
-	DIR *dir;
+  struct dirtree *new, **ddt = &(node->child);
+  struct dirent *entry;
+  DIR *dir;
 
-	if (!(dir = fdopendir(node->data))) {
-		char *path = dirtree_path(node, 0);
-		perror_msg("No %s", path);
-		free(path);
-		close(node->data);
+  if (!(dir = fdopendir(node->data))) {
+    char *path = dirtree_path(node, 0);
+    perror_msg("No %s", path);
+    free(path);
+    close(node->data);
 
-		return;
-	}
+    return;
+  }
 
-	// according to the fddir() man page, the filehandle in the DIR * can still
-	// be externally used by things that don't lseek() it.
+  // according to the fddir() man page, the filehandle in the DIR * can still
+  // be externally used by things that don't lseek() it.
 
-	// The extra parentheses are to shut the stupid compiler up.
-	while ((entry = readdir(dir))) {
-		if (!(new = dirtree_add_node(node->data, entry->d_name, symfollow)))
-			continue;
-		new->parent = node;
-		new = handle_callback(new, callback);
-		if (new == DIRTREE_ABORTVAL) break;
-		if (new) {
-			*ddt = new;
-			ddt = &((*ddt)->next);
-		}
-	}
+  // The extra parentheses are to shut the stupid compiler up.
+  while ((entry = readdir(dir))) {
+    if (!(new = dirtree_add_node(node->data, entry->d_name, symfollow)))
+      continue;
+    new->parent = node;
+    new = handle_callback(new, callback);
+    if (new == DIRTREE_ABORTVAL) break;
+    if (new) {
+      *ddt = new;
+      ddt = &((*ddt)->next);
+    }
+  }
 
-	// This closes filehandle as well, so note it
-	closedir(dir);
-	node->data = -1;
+  // This closes filehandle as well, so note it
+  closedir(dir);
+  node->data = -1;
 }
 
 // Create dirtree from path, using callback to filter nodes.
@@ -165,7 +163,7 @@
 
 struct dirtree *dirtree_read(char *path, int (*callback)(struct dirtree *node))
 {
-	struct dirtree *root = dirtree_add_node(AT_FDCWD, path, 0);
+  struct dirtree *root = dirtree_add_node(AT_FDCWD, path, 0);
 
-	return root ? handle_callback(root, callback) : DIRTREE_ABORTVAL;
+  return root ? handle_callback(root, callback) : DIRTREE_ABORTVAL;
 }
--- a/lib/getmountlist.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/lib/getmountlist.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,4 +1,3 @@
-/* vi: set sw=4 ts=4 : */
 /* getmountlist.c - Get a linked list of mount points, with stat information.
  *
  * Copyright 2006 Rob Landley <rob@landley.net>
@@ -16,28 +15,28 @@
 
 struct mtab_list *getmountlist(int die)
 {
-	FILE *fp;
-	struct mtab_list *mtlist, *mt;
-	struct mntent me;
-	char evilbuf[2*PATH_MAX];
+  FILE *fp;
+  struct mtab_list *mtlist, *mt;
+  struct mntent me;
+  char evilbuf[2*PATH_MAX];
 
-	mtlist = 0;
-	if (!(fp = setmntent(path_mounts, "r"))) {
-		if (die) error_exit("cannot open %s", path_mounts);
-	} else {
-		while (getmntent_r(fp, &me, evilbuf, sizeof(evilbuf))) {
-			mt = xzalloc(sizeof(struct mtab_list) + strlen(me.mnt_fsname) +
-				strlen(me.mnt_dir) + strlen(me.mnt_type) + 3);
-			mt->next = mtlist;
-			// Get information about this filesystem.  Yes, we need both.
-			stat(me.mnt_dir, &(mt->stat));
-			statvfs(me.mnt_dir, &(mt->statvfs));
-			// Remember information from /proc/mounts
-			mt->dir = stpcpy(mt->type, me.mnt_type) + 1;
-			mt->device = stpcpy(mt->dir, me.mnt_dir) + 1;
-			strcpy(mt->device, me.mnt_fsname);
-			mtlist = mt;
-		}
-	}
-	return mtlist;
+  mtlist = 0;
+  if (!(fp = setmntent(path_mounts, "r"))) {
+    if (die) error_exit("cannot open %s", path_mounts);
+  } else {
+    while (getmntent_r(fp, &me, evilbuf, sizeof(evilbuf))) {
+      mt = xzalloc(sizeof(struct mtab_list) + strlen(me.mnt_fsname) +
+        strlen(me.mnt_dir) + strlen(me.mnt_type) + 3);
+      mt->next = mtlist;
+      // Get information about this filesystem.  Yes, we need both.
+      stat(me.mnt_dir, &(mt->stat));
+      statvfs(me.mnt_dir, &(mt->statvfs));
+      // Remember information from /proc/mounts
+      mt->dir = stpcpy(mt->type, me.mnt_type) + 1;
+      mt->device = stpcpy(mt->dir, me.mnt_dir) + 1;
+      strcpy(mt->device, me.mnt_fsname);
+      mtlist = mt;
+    }
+  }
+  return mtlist;
 }
--- a/lib/lib.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/lib/lib.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,4 +1,3 @@
-/* vi: set sw=4 ts=4 :*/
 /* lib.c - reusable stuff.
  *
  * Functions with the x prefix are wrappers for library functions.  They either
@@ -14,257 +13,257 @@
 // Strcpy with size checking: exit if there's not enough space for the string.
 void xstrcpy(char *dest, char *src, size_t size)
 {
-	if (strlen(src)+1 > size) error_exit("xstrcpy");
-	strcpy(dest, src);
+  if (strlen(src)+1 > size) error_exit("xstrcpy");
+  strcpy(dest, src);
 }
 
 void verror_msg(char *msg, int err, va_list va)
 {
-	char *s = ": %s";
+  char *s = ": %s";
 
-	fprintf(stderr, "%s: ", toys.which->name);
-	if (msg) vfprintf(stderr, msg, va);
-	else s+=2;
-	if (err) fprintf(stderr, s, strerror(err));
-	putc('\n', stderr);
+  fprintf(stderr, "%s: ", toys.which->name);
+  if (msg) vfprintf(stderr, msg, va);
+  else s+=2;
+  if (err) fprintf(stderr, s, strerror(err));
+  putc('\n', stderr);
 }
 
 void error_msg(char *msg, ...)
 {
-	va_list va;
+  va_list va;
 
-	va_start(va, msg);
-	verror_msg(msg, 0, va);
-	va_end(va);
+  va_start(va, msg);
+  verror_msg(msg, 0, va);
+  va_end(va);
 }
 
 void perror_msg(char *msg, ...)
 {
-	va_list va;
+  va_list va;
 
-	va_start(va, msg);
-	verror_msg(msg, errno, va);
-	va_end(va);
+  va_start(va, msg);
+  verror_msg(msg, errno, va);
+  va_end(va);
 }
 
 // Die with an error message.
 void error_exit(char *msg, ...)
 {
-	va_list va;
+  va_list va;
 
-	if (CFG_HELP && toys.exithelp) {
-		*toys.optargs=*toys.argv;
-		USE_HELP(help_main();)  // dear gcc: shut up.
-		fprintf(stderr,"\n");
-	}
+  if (CFG_HELP && toys.exithelp) {
+    *toys.optargs=*toys.argv;
+    USE_HELP(help_main();)  // dear gcc: shut up.
+    fprintf(stderr,"\n");
+  }
 
-	va_start(va, msg);
-	verror_msg(msg, 0, va);
-	va_end(va);
+  va_start(va, msg);
+  verror_msg(msg, 0, va);
+  va_end(va);
 
-	exit(!toys.exitval ? 1 : toys.exitval);
+  exit(!toys.exitval ? 1 : toys.exitval);
 }
 
 
 // Die with an error message and strerror(errno)
 void perror_exit(char *msg, ...)
 {
-	va_list va;
+  va_list va;
 
-	va_start(va, msg);
-	verror_msg(msg, errno, va);
-	va_end(va);
+  va_start(va, msg);
+  verror_msg(msg, errno, va);
+  va_end(va);
 
-	exit(!toys.exitval ? 1 : toys.exitval);
+  exit(!toys.exitval ? 1 : toys.exitval);
 }
 
 // Die unless we can allocate memory.
 void *xmalloc(size_t size)
 {
-	void *ret = malloc(size);
-	if (!ret) error_exit("xmalloc");
+  void *ret = malloc(size);
+  if (!ret) error_exit("xmalloc");
 
-	return ret;
+  return ret;
 }
 
 // Die unless we can allocate prezeroed memory.
 void *xzalloc(size_t size)
 {
-	void *ret = xmalloc(size);
-	memset(ret, 0, size);
-	return ret;
+  void *ret = xmalloc(size);
+  memset(ret, 0, size);
+  return ret;
 }
 
 // Die unless we can change the size of an existing allocation, possibly
 // moving it.  (Notice different arguments from libc function.)
 void *xrealloc(void *ptr, size_t size)
 {
-	ptr = realloc(ptr, size);
-	if (!ptr) error_exit("xrealloc");
+  ptr = realloc(ptr, size);
+  if (!ptr) error_exit("xrealloc");
 
-	return ptr;
+  return ptr;
 }
 
 // Die unless we can allocate a copy of this many bytes of string.
 char *xstrndup(char *s, size_t n)
 {
-	char *ret = xmalloc(++n);
-	strncpy(ret, s, n);
-	ret[--n]=0;
+  char *ret = xmalloc(++n);
+  strncpy(ret, s, n);
+  ret[--n]=0;
 
-	return ret;
+  return ret;
 }
 
 // Die unless we can allocate a copy of this string.
 char *xstrdup(char *s)
 {
-	return xstrndup(s, strlen(s));
+  return xstrndup(s, strlen(s));
 }
 
 // Die unless we can allocate enough space to sprintf() into.
 char *xmsprintf(char *format, ...)
 {
-	va_list va, va2;
-	int len;
-	char *ret;
+  va_list va, va2;
+  int len;
+  char *ret;
 
-	va_start(va, format);
-	va_copy(va2, va);
+  va_start(va, format);
+  va_copy(va2, va);
 
-	// How long is it?
-	len = vsnprintf(0, 0, format, va);
-	len++;
-	va_end(va);
+  // How long is it?
+  len = vsnprintf(0, 0, format, va);
+  len++;
+  va_end(va);
 
-	// Allocate and do the sprintf()
-	ret = xmalloc(len);
-	vsnprintf(ret, len, format, va2);
-	va_end(va2);
+  // Allocate and do the sprintf()
+  ret = xmalloc(len);
+  vsnprintf(ret, len, format, va2);
+  va_end(va2);
 
-	return ret;
+  return ret;
 }
 
 void xprintf(char *format, ...)
 {
-	va_list va;
-	va_start(va, format);
+  va_list va;
+  va_start(va, format);
 
-	vprintf(format, va);
-	if (ferror(stdout)) perror_exit("write");
+  vprintf(format, va);
+  if (ferror(stdout)) perror_exit("write");
 }
 
 void xputs(char *s)
 {
-	if (EOF == puts(s)) perror_exit("write");
+  if (EOF == puts(s)) perror_exit("write");
 }
 
 void xputc(char c)
 {
-	if (EOF == fputc(c, stdout) || fflush(stdout)) perror_exit("write");
+  if (EOF == fputc(c, stdout) || fflush(stdout)) perror_exit("write");
 }
 
 void xflush(void)
 {
-	if (fflush(stdout)) perror_exit("write");;
+  if (fflush(stdout)) perror_exit("write");;
 }
 
 // Die unless we can exec argv[] (or run builtin command).  Note that anything
 // with a path isn't a builtin, so /bin/sh won't match the builtin sh.
 void xexec(char **argv)
 {
-	toy_exec(argv);
-	execvp(argv[0], argv);
+  toy_exec(argv);
+  execvp(argv[0], argv);
 
-	perror_exit("exec %s", argv[0]);
+  perror_exit("exec %s", argv[0]);
 }
 
 void xaccess(char *path, int flags)
 {
-	if (access(path, flags)) perror_exit("Can't access '%s'", path);
+  if (access(path, flags)) perror_exit("Can't access '%s'", path);
 }
 
 // Die unless we can delete a file.  (File must exist to be deleted.)
 void xunlink(char *path)
 {
-	if (unlink(path)) perror_exit("unlink '%s'", path);
+  if (unlink(path)) perror_exit("unlink '%s'", path);
 }
 
 // Die unless we can open/create a file, returning file descriptor.
 int xcreate(char *path, int flags, int mode)
 {
-	int fd = open(path, flags, mode);
-	if (fd == -1) perror_exit("%s", path);
-	return fd;
+  int fd = open(path, flags, mode);
+  if (fd == -1) perror_exit("%s", path);
+  return fd;
 }
 
 // Die unless we can open a file, returning file descriptor.
 int xopen(char *path, int flags)
 {
-	return xcreate(path, flags, 0);
+  return xcreate(path, flags, 0);
 }
 
 void xclose(int fd)
 {
-	if (close(fd)) perror_exit("xclose");
+  if (close(fd)) perror_exit("xclose");
 }
 
 int xdup(int fd)
 {
-	if (fd != -1) {
-		fd = dup(fd);
-		if (fd == -1) perror_exit("xdup");
-	}
-	return fd;
+  if (fd != -1) {
+    fd = dup(fd);
+    if (fd == -1) perror_exit("xdup");
+  }
+  return fd;
 }
 
 // Die unless we can open/create a file, returning FILE *.
 FILE *xfopen(char *path, char *mode)
 {
-	FILE *f = fopen(path, mode);
-	if (!f) perror_exit("No file %s", path);
-	return f;
+  FILE *f = fopen(path, mode);
+  if (!f) perror_exit("No file %s", path);
+  return f;
 }
 
 // Keep reading until full or EOF
 ssize_t readall(int fd, void *buf, size_t len)
 {
-	size_t count = 0;
+  size_t count = 0;
 
-	while (count<len) {
-		int i = read(fd, buf+count, len-count);
-		if (!i) break;
-		if (i<0) return i;
-		count += i;
-	}
+  while (count<len) {
+    int i = read(fd, buf+count, len-count);
+    if (!i) break;
+    if (i<0) return i;
+    count += i;
+  }
 
-	return count;
+  return count;
 }
 
 // Keep writing until done or EOF
 ssize_t writeall(int fd, void *buf, size_t len)
 {
-	size_t count = 0;
-	while (count<len) {
-		int i = write(fd, buf+count, len-count);
-		if (i<1) return i;
-		count += i;
-	}
+  size_t count = 0;
+  while (count<len) {
+    int i = write(fd, buf+count, len-count);
+    if (i<1) return i;
+    count += i;
+  }
 
-	return count;
+  return count;
 }
 
 // Die if there's an error other than EOF.
 size_t xread(int fd, void *buf, size_t len)
 {
-	ssize_t ret = read(fd, buf, len);
-	if (ret < 0) perror_exit("xread");
+  ssize_t ret = read(fd, buf, len);
+  if (ret < 0) perror_exit("xread");
 
-	return ret;
+  return ret;
 }
 
 void xreadall(int fd, void *buf, size_t len)
 {
-	if (len != readall(fd, buf, len)) perror_exit("xreadall");
+  if (len != readall(fd, buf, len)) perror_exit("xreadall");
 }
 
 // There's no xwriteall(), just xwrite().  When we read, there may or may not
@@ -273,51 +272,51 @@
 
 void xwrite(int fd, void *buf, size_t len)
 {
-	if (len != writeall(fd, buf, len)) perror_exit("xwrite");
+  if (len != writeall(fd, buf, len)) perror_exit("xwrite");
 }
 
 // Die if lseek fails, probably due to being called on a pipe.
 
 off_t xlseek(int fd, off_t offset, int whence)
 {
-	offset = lseek(fd, offset, whence);
-	if (offset<0) perror_exit("lseek");
+  offset = lseek(fd, offset, whence);
+  if (offset<0) perror_exit("lseek");
 
-	return offset;
+  return offset;
 }
 
 off_t lskip(int fd, off_t offset)
 {
-	off_t and = lseek(fd, offset, SEEK_CUR);
+  off_t and = lseek(fd, offset, SEEK_CUR);
 
-	if (and != -1 && offset >= lseek(fd, offset, SEEK_END)
-		&& offset+and == lseek(fd, offset+and, SEEK_SET)) return 0;
-	else {
-		char buf[4096];
-		while (offset>0) {
-			int try = offset>sizeof(buf) ? sizeof(buf) : offset, or;
+  if (and != -1 && offset >= lseek(fd, offset, SEEK_END)
+    && offset+and == lseek(fd, offset+and, SEEK_SET)) return 0;
+  else {
+    char buf[4096];
+    while (offset>0) {
+      int try = offset>sizeof(buf) ? sizeof(buf) : offset, or;
 
-			or = readall(fd, buf, try);
-			if (or < 0) perror_msg("lskip to %lld", (long long)offset);
-			else offset -= try;
-			if (or < try) break;
-		}
+      or = readall(fd, buf, try);
+      if (or < 0) perror_msg("lskip to %lld", (long long)offset);
+      else offset -= try;
+      if (or < try) break;
+    }
 
-		return offset;
-	}
+    return offset;
+  }
 }
 
 char *xgetcwd(void)
 {
-	char *buf = getcwd(NULL, 0);
-	if (!buf) perror_exit("xgetcwd");
+  char *buf = getcwd(NULL, 0);
+  if (!buf) perror_exit("xgetcwd");
 
-	return buf;
+  return buf;
 }
 
 void xstat(char *path, struct stat *st)
 {
-	if(stat(path, st)) perror_exit("Can't stat %s", path);
+  if(stat(path, st)) perror_exit("Can't stat %s", path);
 }
 
 // Cannonicalizes path by removing ".", "..", and "//" elements.  This is not
@@ -325,60 +324,60 @@
 // following symlinks.
 char *xabspath(char *path)
 {
-	char *from, *to;
+  char *from, *to;
 
-	// If this isn't an absolute path, make it one with cwd.
-	if (path[0]!='/') {
-		char *cwd=xgetcwd();
-		path = xmsprintf("%s/%s", cwd, path);
-		free(cwd);
-	} else path = xstrdup(path);
+  // If this isn't an absolute path, make it one with cwd.
+  if (path[0]!='/') {
+    char *cwd=xgetcwd();
+    path = xmsprintf("%s/%s", cwd, path);
+    free(cwd);
+  } else path = xstrdup(path);
 
-	// Loop through path elements
-	from = to = path;
-	while (*from) {
+  // Loop through path elements
+  from = to = path;
+  while (*from) {
 
-		// Continue any current path component.
-		if (*from!='/') {
-			*(to++) = *(from++);
-			continue;
-		}
+    // Continue any current path component.
+    if (*from!='/') {
+      *(to++) = *(from++);
+      continue;
+    }
 
-		// Skip duplicate slashes.
-		while (*from=='/') from++;
+    // Skip duplicate slashes.
+    while (*from=='/') from++;
 
-		// Start of a new filename.  Handle . and ..
-		while (*from=='.') {
-			// Skip .
-			if (from[1]=='/') from += 2;
-			else if (!from[1]) from++;
-			// Back up for ..
-			else if (from[1]=='.') {
-				if (from[2]=='/') from +=3;
-				else if(!from[2]) from+=2;
-				else break;
-				while (to>path && *(--to)!='/');
-			} else break;
-		}
-		// Add directory separator slash.
-		*(to++) = '/';
-	}
-	*to = 0;
+    // Start of a new filename.  Handle . and ..
+    while (*from=='.') {
+      // Skip .
+      if (from[1]=='/') from += 2;
+      else if (!from[1]) from++;
+      // Back up for ..
+      else if (from[1]=='.') {
+        if (from[2]=='/') from +=3;
+        else if(!from[2]) from+=2;
+        else break;
+        while (to>path && *(--to)!='/');
+      } else break;
+    }
+    // Add directory separator slash.
+    *(to++) = '/';
+  }
+  *to = 0;
 
-	return path;
+  return path;
 }
 
 // Resolve all symlinks, returning malloc() memory.
 char *xrealpath(char *path)
 {
-	char *new = realpath(path, NULL);
-	if (!new) perror_exit("realpath '%s'", path);
-	return new;
+  char *new = realpath(path, NULL);
+  if (!new) perror_exit("realpath '%s'", path);
+  return new;
 }
 
 void xchdir(char *path)
 {
-	if (chdir(path)) error_exit("chdir '%s'", path);
+  if (chdir(path)) error_exit("chdir '%s'", path);
 }
 
 // Ensure entire path exists.
@@ -386,27 +385,27 @@
 // Requires that path string be writable (for temporary null terminators).
 void xmkpath(char *path, int mode)
 {
-	char *p, old;
-	mode_t mask;
-	int rc;
-	struct stat st;
+  char *p, old;
+  mode_t mask;
+  int rc;
+  struct stat st;
 
-	for (p = path; ; p++) {
-		if (!*p || *p == '/') {
-			old = *p;
-			*p = rc = 0;
-			if (stat(path, &st) || !S_ISDIR(st.st_mode)) {
-				if (mode != -1) {
-					mask=umask(0);
-					rc = mkdir(path, mode);
-					umask(mask);
-				} else rc = mkdir(path, 0777);
-			}
-			*p = old;
-			if(rc) perror_exit("mkpath '%s'", path);
-		}
-		if (!*p) break;
-	}
+  for (p = path; ; p++) {
+    if (!*p || *p == '/') {
+      old = *p;
+      *p = rc = 0;
+      if (stat(path, &st) || !S_ISDIR(st.st_mode)) {
+        if (mode != -1) {
+          mask=umask(0);
+          rc = mkdir(path, mode);
+          umask(mask);
+        } else rc = mkdir(path, 0777);
+      }
+      *p = old;
+      if(rc) perror_exit("mkpath '%s'", path);
+    }
+    if (!*p) break;
+  }
 }
 
 // setuid() can fail (for example, too many processes belonging to that user),
@@ -414,7 +413,7 @@
 
 void xsetuid(uid_t uid)
 {
-	if (setuid(uid)) perror_exit("xsetuid");
+  if (setuid(uid)) perror_exit("xsetuid");
 }
 
 
@@ -424,40 +423,40 @@
 
 struct string_list *find_in_path(char *path, char *filename)
 {
-	struct string_list *rlist = NULL, **prlist=&rlist;
-	char *cwd = xgetcwd();
+  struct string_list *rlist = NULL, **prlist=&rlist;
+  char *cwd = xgetcwd();
 
-	for (;;) {
-		char *next = path ? strchr(path, ':') : NULL;
-		int len = next ? next-path : strlen(path);
-		struct string_list *rnext;
-		struct stat st;
+  for (;;) {
+    char *next = path ? strchr(path, ':') : NULL;
+    int len = next ? next-path : strlen(path);
+    struct string_list *rnext;
+    struct stat st;
 
-		rnext = xmalloc(sizeof(void *) + strlen(filename)
-			+ (len ? len : strlen(cwd)) + 2);
-		if (!len) sprintf(rnext->str, "%s/%s", cwd, filename);
-		else {
-			char *res = rnext->str;
-			strncpy(res, path, len);
-			res += len;
-			*(res++) = '/';
-			strcpy(res, filename);
-		}
+    rnext = xmalloc(sizeof(void *) + strlen(filename)
+      + (len ? len : strlen(cwd)) + 2);
+    if (!len) sprintf(rnext->str, "%s/%s", cwd, filename);
+    else {
+      char *res = rnext->str;
+      strncpy(res, path, len);
+      res += len;
+      *(res++) = '/';
+      strcpy(res, filename);
+    }
 
-		// Confirm it's not a directory.
-		if (!stat(rnext->str, &st) && S_ISREG(st.st_mode)) {
-			*prlist = rnext;
-			rnext->next = NULL;
-			prlist = &(rnext->next);
-		} else free(rnext);
+    // Confirm it's not a directory.
+    if (!stat(rnext->str, &st) && S_ISREG(st.st_mode)) {
+      *prlist = rnext;
+      rnext->next = NULL;
+      prlist = &(rnext->next);
+    } else free(rnext);
 
-		if (!next) break;
-		path += len;
-		path++;
-	}
-	free(cwd);
+    if (!next) break;
+    path += len;
+    path++;
+  }
+  free(cwd);
 
-	return rlist;
+  return rlist;
 }
 
 // Convert unsigned int to ascii, writing into supplied buffer.  A truncated
@@ -465,31 +464,31 @@
 // always null terminated (unless buflen is 0).
 void utoa_to_buf(unsigned n, char *buf, unsigned buflen)
 {
-	int i, out = 0;
+  int i, out = 0;
 
-	if (buflen) {
-		for (i=1000000000; i; i/=10) {
-			int res = n/i;
+  if (buflen) {
+    for (i=1000000000; i; i/=10) {
+      int res = n/i;
 
-			if ((res || out || i == 1) && --buflen>0) {
-				out++;
-				n -= res*i;
-				*buf++ = '0' + res;
-			}
-		}
-		*buf = 0;
-	}
+      if ((res || out || i == 1) && --buflen>0) {
+        out++;
+        n -= res*i;
+        *buf++ = '0' + res;
+      }
+    }
+    *buf = 0;
+  }
 }
 
 // Convert signed integer to ascii, using utoa_to_buf()
 void itoa_to_buf(int n, char *buf, unsigned buflen)
 {
-	if (buflen && n<0) {
-		n = -n;
-		*buf++ = '-';
-		buflen--;
-	}
-	utoa_to_buf((unsigned)n, buf, buflen);
+  if (buflen && n<0) {
+    n = -n;
+    *buf++ = '-';
+    buflen--;
+  }
+  utoa_to_buf((unsigned)n, buf, buflen);
 }
 
 // This static buffer is used by both utoa() and itoa(), calling either one a
@@ -504,122 +503,122 @@
 // Convert unsigned integer to ascii, returning a static buffer.
 char *utoa(unsigned n)
 {
-	utoa_to_buf(n, itoa_buf, sizeof(itoa_buf));
+  utoa_to_buf(n, itoa_buf, sizeof(itoa_buf));
 
-	return itoa_buf;
+  return itoa_buf;
 }
 
 char *itoa(int n)
 {
-	itoa_to_buf(n, itoa_buf, sizeof(itoa_buf));
+  itoa_to_buf(n, itoa_buf, sizeof(itoa_buf));
 
-	return itoa_buf;
+  return itoa_buf;
 }
 
 // atol() with the kilo/mega/giga/tera/peta/exa extensions.
 // (zetta and yotta don't fit in 64 bits.)
 long atolx(char *numstr)
 {
-	char *c, *suffixes="bkmgtpe", *end;
-	long val = strtol(numstr, &c, 0);
+  char *c, *suffixes="bkmgtpe", *end;
+  long val = strtol(numstr, &c, 0);
 
-	if (*c) {
-		if (c != numstr && (end = strchr(suffixes, tolower(*c)))) {
-			int shift = end-suffixes;
-			if (shift--) val *= 1024L<<(shift*10);
-		} else {
-			while (isspace(*c)) c++;
-			if (*c) error_exit("not integer: %s", numstr);
-		}
-	}
+  if (*c) {
+    if (c != numstr && (end = strchr(suffixes, tolower(*c)))) {
+      int shift = end-suffixes;
+      if (shift--) val *= 1024L<<(shift*10);
+    } else {
+      while (isspace(*c)) c++;
+      if (*c) error_exit("not integer: %s", numstr);
+    }
+  }
 
-	return val;
+  return val;
 }
 
 int numlen(long l)
 {
-    int len = 0;
-    while (l) {
-       l /= 10;
-       len++;
-    }
-    return len;
+  int len = 0;
+  while (l) {
+     l /= 10;
+     len++;
+  }
+  return len;
 }
 
 int stridx(char *haystack, char needle)
 {
-	char *off;
+  char *off;
 
-	if (!needle) return -1;
-	off = strchr(haystack, needle);
-	if (!off) return -1;
+  if (!needle) return -1;
+  off = strchr(haystack, needle);
+  if (!off) return -1;
 
-	return off-haystack;
+  return off-haystack;
 }
 
 // Return how long the file at fd is, if there's any way to determine it.
 off_t fdlength(int fd)
 {
-	off_t bottom = 0, top = 0, pos, old;
-	int size;
+  off_t bottom = 0, top = 0, pos, old;
+  int size;
 
-	// If the ioctl works for this, return it.
+  // If the ioctl works for this, return it.
 
-	if (ioctl(fd, BLKGETSIZE, &size) >= 0) return size*512L;
+  if (ioctl(fd, BLKGETSIZE, &size) >= 0) return size*512L;
 
-	// If not, do a binary search for the last location we can read.  (Some
-	// block devices don't do BLKGETSIZE right.)  This should probably have
-	// a CONFIG option...
+  // If not, do a binary search for the last location we can read.  (Some
+  // block devices don't do BLKGETSIZE right.)  This should probably have
+  // a CONFIG option...
 
-	old = lseek(fd, 0, SEEK_CUR);
-	do {
-		char temp;
+  old = lseek(fd, 0, SEEK_CUR);
+  do {
+    char temp;
 
-		pos = bottom + (top - bottom) / 2;
+    pos = bottom + (top - bottom) / 2;
 
-		// If we can read from the current location, it's bigger.
+    // If we can read from the current location, it's bigger.
 
-		if (lseek(fd, pos, 0)>=0 && read(fd, &temp, 1)==1) {
-			if (bottom == top) bottom = top = (top+1) * 2;
-			else bottom = pos;
+    if (lseek(fd, pos, 0)>=0 && read(fd, &temp, 1)==1) {
+      if (bottom == top) bottom = top = (top+1) * 2;
+      else bottom = pos;
 
-			// If we can't, it's smaller.
+      // If we can't, it's smaller.
 
-		} else {
-			if (bottom == top) {
-				if (!top) return 0;
-				bottom = top/2;
-			} else top = pos;
-		}
-	} while (bottom + 1 != top);
+    } else {
+      if (bottom == top) {
+        if (!top) return 0;
+        bottom = top/2;
+      } else top = pos;
+    }
+  } while (bottom + 1 != top);
 
-	lseek(fd, old, SEEK_SET);
+  lseek(fd, old, SEEK_SET);
 
-	return pos + 1;
+  return pos + 1;
 }
 
 // This can return null (meaning file not found).  It just won't return null
 // for memory allocation reasons.
 char *xreadlink(char *name)
 {
-	int len, size = 0;
-	char *buf = 0;
+  int len, size = 0;
+  char *buf = 0;
 
-	// Grow by 64 byte chunks until it's big enough.
-	for(;;) {
-		size +=64;
-		buf = xrealloc(buf, size);
-		len = readlink(name, buf, size);
+  // Grow by 64 byte chunks until it's big enough.
+  for(;;) {
+    size +=64;
+    buf = xrealloc(buf, size);
+    len = readlink(name, buf, size);
 
-		if (len<0) {
-			free(buf);
-			return 0;
-		}
-		if (len<size) {
-			buf[len]=0;
-			return buf;
-		}
-	}
+    if (len<0) {
+      free(buf);
+      return 0;
+    }
+    if (len<size) {
+      buf[len]=0;
+      return buf;
+    }
+  }
 }
 
 /*
@@ -628,24 +627,24 @@
 // Read contents of file as a single freshly allocated nul-terminated string.
 char *readfile(char *name)
 {
-	off_t len;
-	int fd;
-	char *buf;
+  off_t len;
+  int fd;
+  char *buf;
 
-	fd = open(name, O_RDONLY);
-	if (fd == -1) return 0;
-	len = fdlength(fd);
-	buf = xmalloc(len+1);
-	buf[readall(fd, buf, len)] = 0;
+  fd = open(name, O_RDONLY);
+  if (fd == -1) return 0;
+  len = fdlength(fd);
+  buf = xmalloc(len+1);
+  buf[readall(fd, buf, len)] = 0;
 
-	return buf;
+  return buf;
 }
 
 char *xreadfile(char *name)
 {
-	char *buf = readfile(name);
-	if (!buf) perror_exit("xreadfile %s", name);
-	return buf;
+  char *buf = readfile(name);
+  if (!buf) perror_exit("xreadfile %s", name);
+  return buf;
 }
 
 */
@@ -654,33 +653,33 @@
 // exists and is this executable.
 void xpidfile(char *name)
 {
-	char pidfile[256], spid[32];
-	int i, fd;
-	pid_t pid;
-	
-	sprintf(pidfile, "/var/run/%s.pid", name);
-	// Try three times to open the sucker.
-	for (i=0; i<3; i++) {
-		fd = open(pidfile, O_CREAT|O_EXCL, 0644);
-		if (fd != -1) break;
+  char pidfile[256], spid[32];
+  int i, fd;
+  pid_t pid;
 
-		// If it already existed, read it.  Loop for race condition.
-		fd = open(pidfile, O_RDONLY);
-		if (fd == -1) continue;
+  sprintf(pidfile, "/var/run/%s.pid", name);
+  // Try three times to open the sucker.
+  for (i=0; i<3; i++) {
+    fd = open(pidfile, O_CREAT|O_EXCL, 0644);
+    if (fd != -1) break;
 
-		// Is the old program still there?
-		spid[xread(fd, spid, sizeof(spid)-1)] = 0;
-		close(fd);
-		pid = atoi(spid);
-		if (pid < 1 || kill(pid, 0) == ESRCH) unlink(pidfile);
+    // If it already existed, read it.  Loop for race condition.
+    fd = open(pidfile, O_RDONLY);
+    if (fd == -1) continue;
 
-		// An else with more sanity checking might be nice here.
-	}
+    // Is the old program still there?
+    spid[xread(fd, spid, sizeof(spid)-1)] = 0;
+    close(fd);
+    pid = atoi(spid);
+    if (pid < 1 || kill(pid, 0) == ESRCH) unlink(pidfile);
 
-	if (i == 3) error_exit("xpidfile %s", name);
+    // An else with more sanity checking might be nice here.
+  }
 
-	xwrite(fd, spid, sprintf(spid, "%ld\n", (long)getpid()));
-	close(fd);
+  if (i == 3) error_exit("xpidfile %s", name);
+
+  xwrite(fd, spid, sprintf(spid, "%ld\n", (long)getpid()));
+  close(fd);
 }
 
 // Iterate through an array of files, opening each one and calling a function
@@ -691,157 +690,157 @@
 // Note: read only filehandles are automatically closed when function()
 // returns, but writeable filehandles must be close by function()
 void loopfiles_rw(char **argv, int flags, int permissions, int failok,
-	void (*function)(int fd, char *name))
+  void (*function)(int fd, char *name))
 {
-	int fd;
+  int fd;
 
-	// If no arguments, read from stdin.
-	if (!*argv) function(flags ? 1 : 0, "-");
-	else do {
-		// Filename "-" means read from stdin.
-		// Inability to open a file prints a warning, but doesn't exit.
+  // If no arguments, read from stdin.
+  if (!*argv) function(flags ? 1 : 0, "-");
+  else do {
+    // Filename "-" means read from stdin.
+    // Inability to open a file prints a warning, but doesn't exit.
 
-		if (!strcmp(*argv,"-")) fd=0;
-		else if (0>(fd = open(*argv, flags, permissions)) && !failok) {
-			perror_msg("%s", *argv);
-			toys.exitval = 1;
-			continue;
-		}
-		function(fd, *argv);
-		if (flags == O_RDONLY) close(fd);
-	} while (*++argv);
+    if (!strcmp(*argv,"-")) fd=0;
+    else if (0>(fd = open(*argv, flags, permissions)) && !failok) {
+      perror_msg("%s", *argv);
+      toys.exitval = 1;
+      continue;
+    }
+    function(fd, *argv);
+    if (flags == O_RDONLY) close(fd);
+  } while (*++argv);
 }
 
 // Call loopfiles_rw with O_RDONLY and !failok (common case).
 void loopfiles(char **argv, void (*function)(int fd, char *name))
 {
-	loopfiles_rw(argv, O_RDONLY, 0, 0, function);
+  loopfiles_rw(argv, O_RDONLY, 0, 0, function);
 }
 
 // Slow, but small.
 
 char *get_rawline(int fd, long *plen, char end)
 {
-	char c, *buf = NULL;
-	long len = 0;
+  char c, *buf = NULL;
+  long len = 0;
 
-	for (;;) {
-		if (1>read(fd, &c, 1)) break;
-		if (!(len & 63)) buf=xrealloc(buf, len+65);
-		if ((buf[len++]=c) == end) break;
-	}
-	if (buf) buf[len]=0;
-	if (plen) *plen = len;
+  for (;;) {
+    if (1>read(fd, &c, 1)) break;
+    if (!(len & 63)) buf=xrealloc(buf, len+65);
+    if ((buf[len++]=c) == end) break;
+  }
+  if (buf) buf[len]=0;
+  if (plen) *plen = len;
 
-	return buf;
+  return buf;
 }
 
 char *get_line(int fd)
 {
-	long len;
-	char *buf = get_rawline(fd, &len, '\n');
+  long len;
+  char *buf = get_rawline(fd, &len, '\n');
 
-	if (buf && buf[--len]=='\n') buf[len]=0;
+  if (buf && buf[--len]=='\n') buf[len]=0;
 
-	return buf;
+  return buf;
 }
 
 // Copy the rest of in to out and close both files.
 
 void xsendfile(int in, int out)
 {
-	long len;
-	char buf[4096];
+  long len;
+  char buf[4096];
 
-	if (in<0) return;
-	for (;;) {
-		len = xread(in, buf, 4096);
-		if (len<1) break;
-		xwrite(out, buf, len);
-	}
+  if (in<0) return;
+  for (;;) {
+    len = xread(in, buf, 4096);
+    if (len<1) break;
+    xwrite(out, buf, len);
+  }
 }
 
 int wfchmodat(int fd, char *name, mode_t mode)
 {
-	int rc = fchmodat(fd, name, mode, 0);
+  int rc = fchmodat(fd, name, mode, 0);
 
-	if (rc) {
-		perror_msg("chmod '%s' to %04o", name, mode);
-		toys.exitval=1;
-	}
-	return rc;
+  if (rc) {
+    perror_msg("chmod '%s' to %04o", name, mode);
+    toys.exitval=1;
+  }
+  return rc;
 }
 
 static char *tempfile2zap;
 static void tempfile_handler(int i)
 {
-	if (1 < (long)tempfile2zap) unlink(tempfile2zap);
-	_exit(1);
+  if (1 < (long)tempfile2zap) unlink(tempfile2zap);
+  _exit(1);
 }
 
 // Open a temporary file to copy an existing file into.
 int copy_tempfile(int fdin, char *name, char **tempname)
 {
-	struct stat statbuf;
-	int fd;
+  struct stat statbuf;
+  int fd;
 
-	*tempname = xstrndup(name, strlen(name)+6);
-	strcat(*tempname,"XXXXXX");
-	if(-1 == (fd = mkstemp(*tempname))) error_exit("no temp file");
-	if (!tempfile2zap) sigatexit(tempfile_handler);
-	tempfile2zap = *tempname;
+  *tempname = xstrndup(name, strlen(name)+6);
+  strcat(*tempname,"XXXXXX");
+  if(-1 == (fd = mkstemp(*tempname))) error_exit("no temp file");
+  if (!tempfile2zap) sigatexit(tempfile_handler);
+  tempfile2zap = *tempname;
 
-	// Set permissions of output file
+  // Set permissions of output file
 
-	fstat(fdin, &statbuf);
-	fchmod(fd, statbuf.st_mode);
+  fstat(fdin, &statbuf);
+  fchmod(fd, statbuf.st_mode);
 
-	return fd;
+  return fd;
 }
 
 // Abort the copy and delete the temporary file.
 void delete_tempfile(int fdin, int fdout, char **tempname)
 {
-	close(fdin);
-	close(fdout);
-	unlink(*tempname);
-	tempfile2zap = (char *)1;
-	free(*tempname);
-	*tempname = NULL;
+  close(fdin);
+  close(fdout);
+  unlink(*tempname);
+  tempfile2zap = (char *)1;
+  free(*tempname);
+  *tempname = NULL;
 }
 
 // Copy the rest of the data and replace the original with the copy.
 void replace_tempfile(int fdin, int fdout, char **tempname)
 {
-	char *temp = xstrdup(*tempname);
+  char *temp = xstrdup(*tempname);
 
-	temp[strlen(temp)-6]=0;
-	if (fdin != -1) {
-		xsendfile(fdin, fdout);
-		xclose(fdin);
-	}
-	xclose(fdout);
-	rename(*tempname, temp);
-	tempfile2zap = (char *)1;
-	free(*tempname);
-	free(temp);
-	*tempname = NULL;
+  temp[strlen(temp)-6]=0;
+  if (fdin != -1) {
+    xsendfile(fdin, fdout);
+    xclose(fdin);
+  }
+  xclose(fdout);
+  rename(*tempname, temp);
+  tempfile2zap = (char *)1;
+  free(*tempname);
+  free(temp);
+  *tempname = NULL;
 }
 
 // Create a 256 entry CRC32 lookup table.
 
 void crc_init(unsigned int *crc_table, int little_endian)
 {
-	unsigned int i;
+  unsigned int i;
 
-	// Init the CRC32 table (big endian)
-	for (i=0; i<256; i++) {
-		unsigned int j, c = little_endian ? i : i<<24;
-		for (j=8; j; j--)
-			if (little_endian) c = (c&1) ? (c>>1)^0xEDB88320 : c>>1;
-			else c=c&0x80000000 ? (c<<1)^0x04c11db7 : (c<<1);
-		crc_table[i] = c;
-	}
+  // Init the CRC32 table (big endian)
+  for (i=0; i<256; i++) {
+    unsigned int j, c = little_endian ? i : i<<24;
+    for (j=8; j; j--)
+      if (little_endian) c = (c&1) ? (c>>1)^0xEDB88320 : c>>1;
+      else c=c&0x80000000 ? (c<<1)^0x04c11db7 : (c<<1);
+    crc_table[i] = c;
+  }
 }
 
 // Quick and dirty query size of terminal, doesn't do ANSI probe fallback.
@@ -850,86 +849,85 @@
 
 void terminal_size(unsigned *x, unsigned *y)
 {
-	struct winsize ws;
-	int i;
+  struct winsize ws;
+  int i;
 
-	//memset(&ws, 0, sizeof(ws));
-	for (i=0; i<3; i++) {
-		if (ioctl(i, TIOCGWINSZ, &ws)) continue;
-		if (x) *x = ws.ws_col;
-		if (y) *y = ws.ws_row;
-	}
-	if (x) {
-		char *s = getenv("COLUMNS");
+  //memset(&ws, 0, sizeof(ws));
+  for (i=0; i<3; i++) {
+    if (ioctl(i, TIOCGWINSZ, &ws)) continue;
+    if (x) *x = ws.ws_col;
+    if (y) *y = ws.ws_row;
+  }
+  if (x) {
+    char *s = getenv("COLUMNS");
 
-		i = s ? atoi(s) : 0;
-		if (i>0) *x = i;
-	}
-	if (y) {
-		char *s = getenv("ROWS");
+    i = s ? atoi(s) : 0;
+    if (i>0) *x = i;
+  }
+  if (y) {
+    char *s = getenv("ROWS");
 
-		i = s ? atoi(s) : 0;
-		if (i>0) *y = i;
-	}
+    i = s ? atoi(s) : 0;
+    if (i>0) *y = i;
+  }
 }
 
 // This should use a raw tty, fixit later.
 int yesno(char *prompt, int def)
 {
-	FILE *fps[] = {stdin, stdout, stderr};
-	int i;
-	char buf;
+  FILE *fps[] = {stdin, stdout, stderr};
+  int i;
+  char buf;
 
-	for (i=0; i<3; i++) if (isatty(i)) break;
-	if (i == 3) return 1;
+  for (i=0; i<3; i++) if (isatty(i)) break;
+  if (i == 3) return 1;
 
-	fprintf(fps[i], "%s (%c/%c):", prompt, def ? 'Y' : 'y', def ? 'n' : 'N');
-	fflush(fps[i]);
-	while (fread(&buf, 1, 1, fps[i])) {
-		if (tolower(buf) == 'y') def = 1;
-		if (tolower(buf) == 'n') def = 0;
-		else if (!isspace(buf)) continue;
+  fprintf(fps[i], "%s (%c/%c):", prompt, def ? 'Y' : 'y', def ? 'n' : 'N');
+  fflush(fps[i]);
+  while (fread(&buf, 1, 1, fps[i])) {
+    if (tolower(buf) == 'y') def = 1;
+    if (tolower(buf) == 'n') def = 0;
+    else if (!isspace(buf)) continue;
 
-		break;
-	}
+    break;
+  }
 
-	return def;
+  return def;
 }
 
 // Execute a callback for each PID that matches a process name from a list.
 void for_each_pid_with_name_in(char **names, void (*callback)(pid_t pid))
 {
-    DIR *dp;
-    struct dirent *entry;
-    char cmd[sizeof(toybuf)], path[64];
-    char **curname;
+  DIR *dp;
+  struct dirent *entry;
+  char cmd[sizeof(toybuf)], path[64];
+  char **curname;
 
-    if (!(dp = opendir("/proc"))) perror_exit("opendir");
+  if (!(dp = opendir("/proc"))) perror_exit("opendir");
 
-    while ((entry = readdir(dp))) {
-        int fd, n;
+  while ((entry = readdir(dp))) {
+    int fd, n;
 
-        if (!isdigit(*entry->d_name)) continue;
+    if (!isdigit(*entry->d_name)) continue;
 
-        if (sizeof(path) <= snprintf(path, sizeof(path), "/proc/%s/cmdline", 
-            entry->d_name)) continue;
+    if (sizeof(path) <= snprintf(path, sizeof(path), "/proc/%s/cmdline",
+      entry->d_name)) continue;
 
-        if (-1 == (fd=open(path, O_RDONLY))) continue;
-        n = read(fd, cmd, sizeof(cmd));
-        close(fd);
-        if (n<1) continue;
+    if (-1 == (fd=open(path, O_RDONLY))) continue;
+    n = read(fd, cmd, sizeof(cmd));
+    close(fd);
+    if (n<1) continue;
 
-        for (curname = names; *curname; curname++)
-            if (!strcmp(basename(cmd), *curname))
-                callback(atol(entry->d_name));
-    }
+    for (curname = names; *curname; curname++)
+      if (!strcmp(basename(cmd), *curname)) callback(atol(entry->d_name));
+  }
 
-    closedir(dp);
+  closedir(dp);
 }
 
 struct signame {
-	int num;
-	char *name;
+  int num;
+  char *name;
 };
 
 // Signals required by POSIX 2008:
@@ -938,16 +936,16 @@
 #define SIGNIFY(x) {SIG##x, #x}
 
 static struct signame signames[] = {
-	SIGNIFY(ABRT), SIGNIFY(ALRM), SIGNIFY(BUS),
-	SIGNIFY(FPE), SIGNIFY(HUP), SIGNIFY(ILL), SIGNIFY(INT), SIGNIFY(KILL),
-	SIGNIFY(PIPE), SIGNIFY(QUIT), SIGNIFY(SEGV), SIGNIFY(TERM),
-	SIGNIFY(USR1), SIGNIFY(USR2), SIGNIFY(SYS), SIGNIFY(TRAP),
-	SIGNIFY(VTALRM), SIGNIFY(XCPU), SIGNIFY(XFSZ),
+  SIGNIFY(ABRT), SIGNIFY(ALRM), SIGNIFY(BUS),
+  SIGNIFY(FPE), SIGNIFY(HUP), SIGNIFY(ILL), SIGNIFY(INT), SIGNIFY(KILL),
+  SIGNIFY(PIPE), SIGNIFY(QUIT), SIGNIFY(SEGV), SIGNIFY(TERM),
+  SIGNIFY(USR1), SIGNIFY(USR2), SIGNIFY(SYS), SIGNIFY(TRAP),
+  SIGNIFY(VTALRM), SIGNIFY(XCPU), SIGNIFY(XFSZ),
 
-	// Start of non-terminal signals
+  // Start of non-terminal signals
 
-	SIGNIFY(CHLD), SIGNIFY(CONT), SIGNIFY(STOP), SIGNIFY(TSTP),
-	SIGNIFY(TTIN), SIGNIFY(TTOU), SIGNIFY(URG)
+  SIGNIFY(CHLD), SIGNIFY(CONT), SIGNIFY(STOP), SIGNIFY(TSTP),
+  SIGNIFY(TTIN), SIGNIFY(TTOU), SIGNIFY(URG)
 };
 
 // not in posix: SIGNIFY(STKFLT), SIGNIFY(WINCH), SIGNIFY(IO), SIGNIFY(PWR)
@@ -956,147 +954,144 @@
 // Install the same handler on every signal that defaults to killing the process
 void sigatexit(void *handler)
 {
-	int i;
-	for (i=0; signames[i].num != SIGCHLD; i++)
-		signal(signames[i].num, handler);
+  int i;
+  for (i=0; signames[i].num != SIGCHLD; i++) signal(signames[i].num, handler);
 }
 // Convert name to signal number.  If name == NULL print names.
 int sig_to_num(char *pidstr)
 {
-	int i;
+  int i;
 
-	if (pidstr) {
-		char *s;
-		i = strtol(pidstr, &s, 10);
-		if (!*s) return i;
+  if (pidstr) {
+    char *s;
+    i = strtol(pidstr, &s, 10);
+    if (!*s) return i;
 
-		if (!strncasecmp(pidstr, "sig", 3)) pidstr+=3;
-	}
-	for (i = 0; i < sizeof(signames)/sizeof(struct signame); i++)
-		if (!pidstr) xputs(signames[i].name);
-		else if (!strcasecmp(pidstr, signames[i].name))
-			return signames[i].num;
+    if (!strncasecmp(pidstr, "sig", 3)) pidstr+=3;
+  }
+  for (i = 0; i < sizeof(signames)/sizeof(struct signame); i++)
+    if (!pidstr) xputs(signames[i].name);
+    else if (!strcasecmp(pidstr, signames[i].name)) return signames[i].num;
 
-	return -1;
+  return -1;
 }
 
 char *num_to_sig(int sig)
 {
-	int i;
+  int i;
 
-	for (i=0; i<sizeof(signames)/sizeof(struct signame); i++)
-		if (signames[i].num == sig) return signames[i].name;
-	return NULL;
+  for (i=0; i<sizeof(signames)/sizeof(struct signame); i++)
+    if (signames[i].num == sig) return signames[i].name;
+  return NULL;
 }
 
 // premute mode bits based on posix mode strings.
 mode_t string_to_mode(char *modestr, mode_t mode)
 {
-	char *whos = "ogua", *hows = "=+-", *whats = "xwrstX", *whys = "ogu";
-	char *s, *str = modestr;
+  char *whos = "ogua", *hows = "=+-", *whats = "xwrstX", *whys = "ogu";
+  char *s, *str = modestr;
 
-	// Handle octal mode
-	if (isdigit(*str)) {
-		mode = strtol(str, &s, 8);
-		if (*s || (mode & ~(07777))) goto barf;
+  // Handle octal mode
+  if (isdigit(*str)) {
+    mode = strtol(str, &s, 8);
+    if (*s || (mode & ~(07777))) goto barf;
 
-		return mode;
-	}
+    return mode;
+  }
 
-	// Gaze into the bin of permission...
-	for (;;) {
-		int i, j, dowho, dohow, dowhat, amask;
+  // Gaze into the bin of permission...
+  for (;;) {
+    int i, j, dowho, dohow, dowhat, amask;
 
-		dowho = dohow = dowhat = amask = 0;
+    dowho = dohow = dowhat = amask = 0;
 
-		// Find the who, how, and what stanzas, in that order
-		while (*str && (s = strchr(whos, *str))) {
-			dowho |= 1<<(s-whos);
-			str++;
-		}
-		// If who isn't specified, like "a" but honoring umask.
-		if (!dowho) {
-			dowho = 8;
-			umask(amask=umask(0));
-		}
-		if (!*str || !(s = strchr(hows, *str))) goto barf;
-		dohow = *(str++);
+    // Find the who, how, and what stanzas, in that order
+    while (*str && (s = strchr(whos, *str))) {
+      dowho |= 1<<(s-whos);
+      str++;
+    }
+    // If who isn't specified, like "a" but honoring umask.
+    if (!dowho) {
+      dowho = 8;
+      umask(amask=umask(0));
+    }
+    if (!*str || !(s = strchr(hows, *str))) goto barf;
+    dohow = *(str++);
 
-		if (!dohow) goto barf;
-		while (*str && (s = strchr(whats, *str))) {
-			dowhat |= 1<<(s-whats);
-			str++;
-		}
+    if (!dohow) goto barf;
+    while (*str && (s = strchr(whats, *str))) {
+      dowhat |= 1<<(s-whats);
+      str++;
+    }
 
-		// Convert X to x for directory or if already executable somewhere
-		if ((dowhat&32) &&  (S_ISDIR(mode) || (mode&0111))) dowhat |= 1;
+    // Convert X to x for directory or if already executable somewhere
+    if ((dowhat&32) &&  (S_ISDIR(mode) || (mode&0111))) dowhat |= 1;
 
-		// Copy mode from another category?
-		if (!dowhat && *str && (s = strchr(whys, *str))) {
-			dowhat = (mode>>(3*(s-whys)))&7;
-			str++;
-		}
+    // Copy mode from another category?
+    if (!dowhat && *str && (s = strchr(whys, *str))) {
+      dowhat = (mode>>(3*(s-whys)))&7;
+      str++;
+    }
 
-		// Are we ready to do a thing yet?
-		if (*str && *(str++) != ',') goto barf;
+    // Are we ready to do a thing yet?
+    if (*str && *(str++) != ',') goto barf;
 
-		// Ok, apply the bits to the mode.
-		for (i=0; i<4; i++) {
-			for (j=0; j<3; j++) {
-				mode_t bit = 0;
-				int where = 1<<((3*i)+j);
+    // Ok, apply the bits to the mode.
+    for (i=0; i<4; i++) {
+      for (j=0; j<3; j++) {
+        mode_t bit = 0;
+        int where = 1<<((3*i)+j);
 
-				if (amask & where) continue;
+        if (amask & where) continue;
 
-				// Figure out new value at this location
-				if (i == 3) {
-					// suid/sticky bit.
-					if (j) {
-						if ((dowhat & 8) && (dowho&(8|(1<<i)))) bit++;
-					} else if (dowhat & 16) bit++;
-				} else {
-					if (!(dowho&(8|(1<<i)))) continue;
-					if (dowhat&(1<<j)) bit++;
-				}
+        // Figure out new value at this location
+        if (i == 3) {
+          // suid/sticky bit.
+          if (j) {
+            if ((dowhat & 8) && (dowho&(8|(1<<i)))) bit++;
+          } else if (dowhat & 16) bit++;
+        } else {
+          if (!(dowho&(8|(1<<i)))) continue;
+          if (dowhat&(1<<j)) bit++;
+        }
 
-				// When selection active, modify bit
+        // When selection active, modify bit
 
-				if (dohow == '=' || (bit && dohow == '-'))
-					mode &= ~where;
-				if (bit && dohow != '-') mode |= where;
-			}
-		}
+        if (dohow == '=' || (bit && dohow == '-')) mode &= ~where;
+        if (bit && dohow != '-') mode |= where;
+      }
+    }
 
-		if (!*str) break;
-	}
-	return mode;
+    if (!*str) break;
+  }
+  return mode;
 barf:
-	error_exit("bad mode '%s'", modestr);
+  error_exit("bad mode '%s'", modestr);
 }
 
 
 char* make_human_readable(unsigned long long size, unsigned long unit)
 {
-    unsigned int frac = 0;
-    if(unit) {
-        size = (size/(unit)) + (size%(unit)?1:0);
-        return xmsprintf("%llu", size);
+  unsigned int frac = 0;
+  if(unit) {
+    size = (size/(unit)) + (size%(unit)?1:0);
+    return xmsprintf("%llu", size);
+  }
+  else {
+    static char units[] = {'\0', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'};
+    int index = 0;
+    while(size >= 1024) {
+      frac = size%1024;
+      size /= 1024;
+      index++;
     }
-    else {
-        static char units[] = {'\0', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'};
-        int index = 0;
-        while(size >= 1024) {
-            frac = size%1024;
-            size /= 1024;
-            index++;
-        }
-        frac = (frac/102) + ((frac%102)?1:0);
-        if(frac >= 10) {
-            size += 1;
-            frac = 0;
-        }
-        if(frac) return xmsprintf("%llu.%u%c", size, frac, units[index]);
-        else return xmsprintf("%llu%c", size, units[index]);
+    frac = (frac/102) + ((frac%102)?1:0);
+    if(frac >= 10) {
+      size += 1;
+      frac = 0;
     }
-    return NULL; //not reached
+    if(frac) return xmsprintf("%llu.%u%c", size, frac, units[index]);
+    else return xmsprintf("%llu%c", size, units[index]);
+  }
+  return NULL; //not reached
 }
--- a/lib/lib.h	Tue Nov 13 16:13:45 2012 -0600
+++ b/lib/lib.h	Tue Nov 13 17:14:08 2012 -0600
@@ -1,4 +1,3 @@
-/* vi: set ts=4 :*/
 /* lib.h - header file for lib directory
  *
  * Copyright 2006 Rob Landley <rob@landley.net>
@@ -21,18 +20,18 @@
 // is always next pointer, so next = (mytype *)&struct.
 
 struct string_list {
-	struct string_list *next;
-	char str[0];
+  struct string_list *next;
+  char str[0];
 };
 
 struct arg_list {
-	struct arg_list *next;
-	char *arg;
+  struct arg_list *next;
+  char *arg;
 };
 
 struct double_list {
-	struct double_list *next, *prev;
-	char *data;
+  struct double_list *next, *prev;
+  char *data;
 };
 
 void llist_traverse(void *list, void (*using)(void *data));
@@ -63,12 +62,12 @@
 #define DIRTREE_ABORTVAL ((struct dirtree *)1)
 
 struct dirtree {
-	struct dirtree *next, *parent, *child;
-	long extra; // place for user to store their stuff (can be pointer)
-	struct stat st;
-	char *symlink;
-	int data;  // dirfd for directory, linklen for symlink, -1 = comeagain
-	char name[];
+  struct dirtree *next, *parent, *child;
+  long extra; // place for user to store their stuff (can be pointer)
+  struct stat st;
+  char *symlink;
+  int data;  // dirfd for directory, linklen for symlink, -1 = comeagain
+  char name[];
 };
 
 struct dirtree *dirtree_add_node(int dirfd, char *name, int symfollow);
@@ -76,9 +75,9 @@
 int dirtree_notdotdot(struct dirtree *catch);
 int dirtree_parentfd(struct dirtree *node);
 struct dirtree *handle_callback(struct dirtree *new,
-	int (*callback)(struct dirtree *node));
+  int (*callback)(struct dirtree *node));
 void dirtree_recurse(struct dirtree *node,
-	int (*callback)(struct dirtree *node), int symfollow);
+  int (*callback)(struct dirtree *node), int symfollow);
 struct dirtree *dirtree_read(char *path, int (*callback)(struct dirtree *node));
 
 // lib.c
@@ -133,7 +132,7 @@
 off_t fdlength(int fd);
 char *xreadlink(char *name);
 void loopfiles_rw(char **argv, int flags, int permissions, int failok,
-	void (*function)(int fd, char *name));
+  void (*function)(int fd, char *name));
 void loopfiles(char **argv, void (*function)(int fd, char *name));
 char *get_rawline(int fd, long *plen, char end);
 char *get_line(int fd);
@@ -150,12 +149,12 @@
 
 // getmountlist.c
 struct mtab_list {
-	struct mtab_list *next;
-	struct stat stat;
-	struct statvfs statvfs;
-	char *dir;
-	char *device;
-	char type[0];
+  struct mtab_list *next;
+  struct stat stat;
+  struct statvfs statvfs;
+  char *dir;
+  char *device;
+  char type[0];
 };
 
 struct mtab_list *getmountlist(int die);
--- a/lib/llist.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/lib/llist.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,5 +1,4 @@
-/* vi: set sw=4 ts=4 :
- * llist.c - Linked list functions
+/* llist.c - Linked list functions
  *
  * Linked list structures have a next pointer as their first element.
  */
@@ -9,47 +8,47 @@
 // Call a function (such as free()) on each element of a linked list.
 void llist_traverse(void *list, void (*using)(void *data))
 {
-	while (list) {
-		void *pop = llist_pop(&list);
-		using(pop);
+  while (list) {
+    void *pop = llist_pop(&list);
+    using(pop);
 
-		// End doubly linked list too.
-		if (list==pop) break;
-	}
+    // End doubly linked list too.
+    if (list==pop) break;
+  }
 }
 
 // Return the first item from the list, advancing the list (which must be called
 // as &list)
 void *llist_pop(void *list)
 {
-	// I'd use a void ** for the argument, and even accept the typecast in all
-	// callers as documentation you need the &, except the stupid compiler
-	// would then scream about type-punned pointers.  Screw it.
-	void **llist = (void **)list;
-	void **next = (void **)*llist;
-	*llist = *next;
+  // I'd use a void ** for the argument, and even accept the typecast in all
+  // callers as documentation you need the &, except the stupid compiler
+  // would then scream about type-punned pointers.  Screw it.
+  void **llist = (void **)list;
+  void **next = (void **)*llist;
+  *llist = *next;
 
-	return (void *)next;
+  return (void *)next;
 }
 
 void dlist_add_nomalloc(struct double_list **list, struct double_list *new)
 {
-	if (*list) {
-		new->next = *list;
-		new->prev = (*list)->prev;
-		(*list)->prev->next = new;
-		(*list)->prev = new;
-	} else *list = new->next = new->prev = new;
+  if (*list) {
+    new->next = *list;
+    new->prev = (*list)->prev;
+    (*list)->prev->next = new;
+    (*list)->prev = new;
+  } else *list = new->next = new->prev = new;
 }
 
 
 // Add an entry to the end of a doubly linked list
 struct double_list *dlist_add(struct double_list **list, char *data)
 {
-	struct double_list *new = xmalloc(sizeof(struct double_list));
+  struct double_list *new = xmalloc(sizeof(struct double_list));
 
-	new->data = data;
-	dlist_add_nomalloc(list, new);
+  new->data = data;
+  dlist_add_nomalloc(list, new);
 
-	return new;
+  return new;
 }
--- a/lib/password.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/lib/password.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,5 +1,4 @@
-/* vi: set sw=4 ts=4 :                                                                                                                                                          
- * pwdutils.c - password read/update helper functions.
+/* pwdutils.c - password read/update helper functions.
  *
  * Copyright 2012 Ashwini Kumar <ak.ashwini@gmail.com>
  */
@@ -7,136 +6,131 @@
 #include "toys.h"
 #include <time.h>
 
+int read_password(char * buff, int buflen, char* mesg)
+{
+  int i = 0;
+  struct termios termio, oldtermio;
+  tcgetattr(0, &oldtermio);
+  tcflush(0, TCIFLUSH);
+  termio = oldtermio;
 
-int read_password(char * buff, int buflen, char* mesg)
-{           
-    int i = 0;
-    struct termios termio, oldtermio;
-    tcgetattr(0, &oldtermio);
-    tcflush(0, TCIFLUSH);
-    termio = oldtermio;
+  termio.c_iflag &= ~(IUCLC|IXON|IXOFF|IXANY);
+  termio.c_lflag &= ~(ECHO|ECHOE|ECHOK|ECHONL|TOSTOP);
+  tcsetattr(0, TCSANOW, &termio);
 
-    termio.c_iflag &= ~(IUCLC|IXON|IXOFF|IXANY);
-    termio.c_lflag &= ~(ECHO|ECHOE|ECHOK|ECHONL|TOSTOP);
-    tcsetattr(0, TCSANOW, &termio);
+  fputs(mesg, stdout);
+  fflush(stdout);
 
-    fputs(mesg, stdout);
-    fflush(stdout);
+  while (1) {
+    int ret = read(0, &buff[i], 1);
+    if ( ret < 0 ) {
+      buff[0] = 0;
+      tcsetattr(0, TCSANOW, &oldtermio);
+      return 1;
+    } else if (ret == 0 || buff[i] == '\n' || buff[i] == '\r' || buflen == i+1)
+    {
+      buff[i] = '\0';
+      break;
+    }
+    i++;
+  }
 
-    while (1) {
-        int ret = read(0, &buff[i], 1);
-        if ( ret < 0 ) {   
-            buff[0] = 0;
-            tcsetattr(0, TCSANOW, &oldtermio);
-            return 1;
-        }   
-        else if ( ret == 0 || buff[i] == '\n' ||
-                buff[i] == '\r' || buflen == i+1) {   
-            buff[i] = '\0';
-            break;
-        }   
-        i++;
-    }       
-
-    tcsetattr(0, TCSANOW, &oldtermio);
-    puts("");
-    fflush(stdout);
-    return 0;
+  tcsetattr(0, TCSANOW, &oldtermio);
+  puts("");
+  fflush(stdout);
+  return 0;
 }
 
 static char *get_nextcolon(const char *line, char delim)
 {
-    char *current_ptr = NULL;
-    if((current_ptr = strchr(line, ':')) == NULL) 
-        error_exit("Invalid Entry\n");      
-    return current_ptr;
+  char *current_ptr = NULL;
+  if((current_ptr = strchr(line, ':')) == NULL) error_exit("Invalid Entry\n");
+  return current_ptr;
 }
 
 int update_password(char *filename, char* username, char* encrypted)
 {
-    char *filenamesfx = NULL, *namesfx = NULL;
-    char *shadow = NULL, *sfx = NULL;
-    FILE *exfp, *newfp;
-    int ret = -1; //fail
-    struct flock lock;
-    char *line = NULL;
+  char *filenamesfx = NULL, *namesfx = NULL;
+  char *shadow = NULL, *sfx = NULL;
+  FILE *exfp, *newfp;
+  int ret = -1; //fail
+  struct flock lock;
+  char *line = NULL;
 
-    shadow = strstr(filename, "shadow");
-    filenamesfx = xmsprintf("%s+", filename);
-    sfx = strchr(filenamesfx, '+');
+  shadow = strstr(filename, "shadow");
+  filenamesfx = xmsprintf("%s+", filename);
+  sfx = strchr(filenamesfx, '+');
 
-    exfp = fopen(filename, "r+");
-    if(!exfp) {      
-        perror_msg("Couldn't open file %s",filename);
-        goto free_storage;
+  exfp = fopen(filename, "r+");
+  if(!exfp) {
+    perror_msg("Couldn't open file %s",filename);
+    goto free_storage;
+  }
+
+  *sfx = '-';
+  ret = unlink(filenamesfx);
+  ret = link(filename, filenamesfx);
+  if(ret < 0) error_msg("can't create backup file");
+
+  *sfx = '+';
+  lock.l_type = F_WRLCK;
+  lock.l_whence = SEEK_SET;
+  lock.l_start = 0;
+  lock.l_len = 0;
+
+  ret = fcntl(fileno(exfp), F_SETLK, &lock);
+  if(ret < 0) perror_msg("Couldn't lock file %s",filename);
+
+  lock.l_type = F_UNLCK; //unlocking at a later stage
+
+  newfp = fopen(filenamesfx, "w+");
+  if(!newfp) {
+    error_msg("couldn't open file for writing");
+    ret = -1;
+    fclose(exfp);
+    goto free_storage;
+  }
+
+  ret = 0;
+  namesfx = xmsprintf("%s:",username);
+  while((line = get_line(fileno(exfp))) != NULL)
+  {
+    if(strncmp(line, namesfx, strlen(namesfx)) != 0)
+      fprintf(newfp, "%s\n", line);
+    else {
+      char *current_ptr = NULL;
+      fprintf(newfp, "%s%s:",namesfx,encrypted);
+      current_ptr = get_nextcolon(line, ':'); //past username
+      current_ptr++; //past colon ':' after username
+      current_ptr = get_nextcolon(current_ptr, ':'); //past passwd
+      current_ptr++; //past colon ':' after passwd
+      if(shadow) {
+        fprintf(newfp, "%u:",(unsigned)(time(NULL))/(24*60*60));
+        current_ptr = get_nextcolon(current_ptr, ':');
+        current_ptr++; //past time stamp colon.
+        fprintf(newfp, "%s\n",current_ptr);
+      }
+      else fprintf(newfp, "%s\n",current_ptr);
     }
 
-    *sfx = '-';
-    ret = unlink(filenamesfx);
-    ret = link(filename, filenamesfx);
-    if(ret < 0) error_msg("can't create backup file");
+    free(line);
+  }
+  free(namesfx);
+  fcntl(fileno(exfp), F_SETLK, &lock);
+  fclose(exfp);
 
-    *sfx = '+';
-    lock.l_type = F_WRLCK;
-    lock.l_whence = SEEK_SET;
-    lock.l_start = 0;
-    lock.l_len = 0;
-
-    ret = fcntl(fileno(exfp), F_SETLK, &lock);
-    if(ret < 0) perror_msg("Couldn't lock file %s",filename);
-
-    lock.l_type = F_UNLCK; //unlocking at a later stage                                                                                                                         
-
-    newfp = fopen(filenamesfx, "w+");
-    if(!newfp) {       
-        error_msg("couldn't open file for writing");
-        ret = -1;
-        fclose(exfp);
-        goto free_storage;
-    }       
-
-    ret = 0;
-    namesfx = xmsprintf("%s:",username);
-    while((line = get_line(fileno(exfp))) != NULL)
-    {
-        if(strncmp(line, namesfx, strlen(namesfx)) != 0)
-            fprintf(newfp, "%s\n", line);
-        else {
-            char *current_ptr = NULL;
-            fprintf(newfp, "%s%s:",namesfx,encrypted);
-            current_ptr = get_nextcolon(line, ':'); //past username
-            current_ptr++; //past colon ':' after username
-            current_ptr = get_nextcolon(current_ptr, ':'); //past passwd
-            current_ptr++; //past colon ':' after passwd
-            if(shadow) {
-                fprintf(newfp, "%u:",(unsigned)(time(NULL))/(24*60*60));
-                current_ptr = get_nextcolon(current_ptr, ':'); 
-                current_ptr++; //past time stamp colon.
-                fprintf(newfp, "%s\n",current_ptr);
-            }
-            else {
-                fprintf(newfp, "%s\n",current_ptr);
-            }
-        }
-
-        free(line);
-    }
-    free(namesfx);
-    fcntl(fileno(exfp), F_SETLK, &lock);
-    fclose(exfp);
-    
-    errno = 0;
-    fflush(newfp);
-    fsync(fileno(newfp));
-    fclose(newfp);
-    rename(filenamesfx, filename);
-    if(errno) {
-        perror_msg("File Writing/Saving failed: ");
-        unlink(filenamesfx);
-        ret = -1;
-    }      
+  errno = 0;
+  fflush(newfp);
+  fsync(fileno(newfp));
+  fclose(newfp);
+  rename(filenamesfx, filename);
+  if(errno) {
+    perror_msg("File Writing/Saving failed: ");
+    unlink(filenamesfx);
+    ret = -1;
+  }
 
 free_storage:
-    free(filenamesfx);
-    return ret;
-} 
+  free(filenamesfx);
+  return ret;
+}
--- a/lib/portability.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/lib/portability.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,4 +1,3 @@
-/* vi: set sw=4 ts=4 :*/
 /* portability.c - code to workaround the deficiencies of various platforms.
  *
  * Copyright 2012 Rob Landley <rob@landley.net>
@@ -10,66 +9,64 @@
 #if defined(__APPLE__) || defined(__ANDROID__)
 ssize_t getdelim(char **linep, size_t *np, int delim, FILE *stream)
 {
-	int ch;
-	size_t new_len;
-	ssize_t i = 0;
-	char *line, *new_line;
+  int ch;
+  size_t new_len;
+  ssize_t i = 0;
+  char *line, *new_line;
 
-	// Invalid input
-	if (!linep || !np) {
-		errno = EINVAL;
-		return -1;
-	}
+  // Invalid input
+  if (!linep || !np) {
+    errno = EINVAL;
+    return -1;
+  }
 
-	if (*linep == NULL || *np == 0) {
-		*np = 1024;
-		*linep = calloc(1, *np);
-		if (*linep == NULL)
-			return -1;
-	}
-	line = *linep;
+  if (*linep == NULL || *np == 0) {
+    *np = 1024;
+    *linep = calloc(1, *np);
+    if (*linep == NULL) return -1;
+  }
+  line = *linep;
 
-	while ((ch = getc(stream)) != EOF) {
-		if (i > *np) {
-			// Need more space
-			new_len  = *np + 1024;
-			new_line = realloc(*linep, new_len);
-			if (!new_line)
-				return -1;
-			*np    = new_len;
-			*linep = new_line;
-		}
+  while ((ch = getc(stream)) != EOF) {
+    if (i > *np) {
+      // Need more space
+      new_len = *np + 1024;
+      new_line = realloc(*linep, new_len);
+      if (!new_line) return -1;
+      *np = new_len;
+      *linep = new_line;
+    }
 
-		line[i] = ch;
-		if (ch == delim)
-			break;
-		i += 1;
-	}
+    line[i] = ch;
+    if (ch == delim) break;
+    i += 1;
+  }
 
-	if (i > *np) {
-		// Need more space
-		new_len  = i + 2;
-		new_line = realloc(*linep, new_len);
-		if (!new_line)
-			return -1;
-		*np    = new_len;
-		*linep = new_line;
-	}
-	line[i + 1] = '\0';
+  if (i > *np) {
+    // Need more space
+    new_len  = i + 2;
+    new_line = realloc(*linep, new_len);
+    if (!new_line) return -1;
+    *np = new_len;
+    *linep = new_line;
+  }
+  line[i + 1] = '\0';
 
-	return i > 0 ? i : -1;
+  return i > 0 ? i : -1;
 }
 
-ssize_t getline(char **linep, size_t *np, FILE *stream) {
-	return getdelim(linep, np, '\n', stream);
+ssize_t getline(char **linep, size_t *np, FILE *stream)
+{
+  return getdelim(linep, np, '\n', stream);
 }
 #endif
 
 #if defined(__APPLE__)
 extern char **environ;
 
-int clearenv(void) {
-	*environ = NULL;
-	return 0;
+int clearenv(void)
+{
+  *environ = NULL;
+  return 0;
 }
 #endif
--- a/lib/xregcomp.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/lib/xregcomp.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,5 +1,4 @@
-/* vi: set ts=4:
- *  Call regcomp() and handle errors.
+/* Call regcomp() and handle errors.
  *
  * Copyright 2007 Rob Landley <rob@landley.net>
  *
@@ -12,12 +11,12 @@
 
 void xregcomp(regex_t *preg, char *regex, int cflags)
 {
-	int rc = regcomp(preg, regex, cflags);
+  int rc = regcomp(preg, regex, cflags);
 
-	if (rc) {
-		char msg[256];
-		regerror(rc, preg, msg, 255);
-		msg[255]=0;
-		error_exit("xregcomp: %s", msg);
-	}
+  if (rc) {
+    char msg[256];
+    regerror(rc, preg, msg, 255);
+    msg[255]=0;
+    error_exit("xregcomp: %s", msg);
+  }
 }
--- a/main.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/main.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,4 +1,3 @@
-/* vi: set ts=4 :*/
 /* Toybox infrastructure.
  *
  * Copyright 2006 Rob Landley <rob@landley.net>
@@ -25,27 +24,27 @@
 
 struct toy_list *toy_find(char *name)
 {
-	int top, bottom, middle;
+  int top, bottom, middle;
 
-	// If the name starts with "toybox" accept that as a match.  Otherwise
-	// skip the first entry, which is out of order.
+  // If the name starts with "toybox" accept that as a match.  Otherwise
+  // skip the first entry, which is out of order.
 
-	if (!strncmp(name,"toybox",6)) return toy_list;
-	bottom = 1;
+  if (!strncmp(name,"toybox",6)) return toy_list;
+  bottom = 1;
 
-	// Binary search to find this applet.
+  // Binary search to find this applet.
 
-	top = ARRAY_LEN(toy_list)-1;
-	for (;;) {
-		int result;
+  top = ARRAY_LEN(toy_list)-1;
+  for (;;) {
+    int result;
 
-		middle = (top+bottom)/2;
-		if (middle<bottom || middle>top) return NULL;
-		result = strcmp(name,toy_list[middle].name);
-		if (!result) return toy_list+middle;
-		if (result<0) top=--middle;
-		else bottom = ++middle;
-	}
+    middle = (top+bottom)/2;
+    if (middle<bottom || middle>top) return NULL;
+    result = strcmp(name,toy_list[middle].name);
+    if (!result) return toy_list+middle;
+    if (result<0) top=--middle;
+    else bottom = ++middle;
+  }
 }
 
 // Figure out whether or not anything is using the option parsing logic,
@@ -65,44 +64,42 @@
 
 void toy_init(struct toy_list *which, char *argv[])
 {
-	// Drop permissions for non-suid commands.
+  // Drop permissions for non-suid commands.
 
-	if (CFG_TOYBOX_SUID) {
-		uid_t uid = getuid(), euid = geteuid();
+  if (CFG_TOYBOX_SUID) {
+    uid_t uid = getuid(), euid = geteuid();
 
-		if (!(which->flags & TOYFLAG_STAYROOT)) {
-			if (uid != euid) xsetuid(euid=uid);
-		} else if (CFG_TOYBOX_DEBUG && uid)
-			error_exit("Not installed suid root");
+    if (!(which->flags & TOYFLAG_STAYROOT)) {
+      if (uid != euid) xsetuid(euid=uid);
+    } else if (CFG_TOYBOX_DEBUG && uid) error_exit("Not installed suid root");
 
-		if ((which->flags & TOYFLAG_NEEDROOT) && euid)
-			error_exit("Not root");
-	}
+    if ((which->flags & TOYFLAG_NEEDROOT) && euid) error_exit("Not root");
+  }
 
-	// Free old toys contents (to be reentrant)
+  // Free old toys contents (to be reentrant)
 
-	if (toys.optargs != toys.argv+1) free(toys.optargs);
-	memset(&toys, 0, sizeof(struct toy_context));
+  if (toys.optargs != toys.argv+1) free(toys.optargs);
+  memset(&toys, 0, sizeof(struct toy_context));
 
-	toys.which = which;
-	toys.argv = argv;
-	if (NEED_OPTIONS && which->options) get_optflags();
-	else toys.optargs = argv+1;
-	toys.old_umask = umask(0);
-	if (!(which->flags & TOYFLAG_UMASK)) umask(toys.old_umask);
+  toys.which = which;
+  toys.argv = argv;
+  if (NEED_OPTIONS && which->options) get_optflags();
+  else toys.optargs = argv+1;
+  toys.old_umask = umask(0);
+  if (!(which->flags & TOYFLAG_UMASK)) umask(toys.old_umask);
 }
 
 // Like exec() but runs an internal toybox command instead of another file.
 // Only returns if it can't find the command, otherwise exit() when done.
 void toy_exec(char *argv[])
 {
-	struct toy_list *which;
+  struct toy_list *which;
 
-	which = toy_find(argv[0]);
-	if (!which) return;
-	toy_init(which, argv);
-	toys.which->toy_main();
-	exit(toys.exitval);
+  which = toy_find(argv[0]);
+  if (!which) return;
+  toy_init(which, argv);
+  toys.which->toy_main();
+  exit(toys.exitval);
 }
 
 // Multiplexer command, first argument is command to run, rest are args to that.
@@ -110,52 +107,52 @@
 
 void toybox_main(void)
 {
-	static char *toy_paths[]={"usr/","bin/","sbin/",0};
-	int i, len = 0;
+  static char *toy_paths[]={"usr/","bin/","sbin/",0};
+  int i, len = 0;
 
-	if (toys.argv[1]) {
-		if (toys.argv[1][0]!='-') {
-			toy_exec(toys.argv+1);
-			toys.which = toy_list;
-			error_exit("Unknown command %s",toys.argv[1]);
-		}
-	}
+  if (toys.argv[1]) {
+    if (toys.argv[1][0]!='-') {
+      toy_exec(toys.argv+1);
+      toys.which = toy_list;
+      error_exit("Unknown command %s",toys.argv[1]);
+    }
+  }
 
-	// Output list of applets.
-	for (i=1; i<ARRAY_LEN(toy_list); i++) {
-		int fl = toy_list[i].flags;
-		if (fl & TOYMASK_LOCATION) {
-			if (toys.argv[1]) {
-				int j;
-				for (j=0; toy_paths[j]; j++)
-					if (fl & (1<<j)) len += printf("%s", toy_paths[j]);
-			}
-			len += printf("%s ",toy_list[i].name);
-			if (len>65) {
-				xputc('\n');
-				len=0;
-			}
-		}
-	}
-	xputc('\n');
+  // Output list of applets.
+  for (i=1; i<ARRAY_LEN(toy_list); i++) {
+    int fl = toy_list[i].flags;
+    if (fl & TOYMASK_LOCATION) {
+      if (toys.argv[1]) {
+        int j;
+        for (j=0; toy_paths[j]; j++)
+          if (fl & (1<<j)) len += printf("%s", toy_paths[j]);
+      }
+      len += printf("%s ",toy_list[i].name);
+      if (len>65) {
+        xputc('\n');
+        len=0;
+      }
+    }
+  }
+  xputc('\n');
 }
 
 int main(int argc, char *argv[])
 {
-	// Artificial scope to eat less stack for things we call
-	{
-		char *name;
+  // Artificial scope to eat less stack for things we call
+  {
+    char *name;
 
-		// Trim path off of command name
-		name = strrchr(argv[0], '/');
-		if (!name) name=argv[0];
-		else name++;
-		argv[0] = name;
-	}
+    // Trim path off of command name
+    name = strrchr(argv[0], '/');
+    if (!name) name=argv[0];
+    else name++;
+    argv[0] = name;
+  }
 
-	// Call the multiplexer, adjusting this argv[] to be its' argv[1].
-	// (It will adjust it back before calling toy_exec().)
-	toys.argv = argv-1;
-	toybox_main();
-	return 0;
+  // Call the multiplexer, adjusting this argv[] to be its' argv[1].
+  // (It will adjust it back before calling toy_exec().)
+  toys.argv = argv-1;
+  toybox_main();
+  return 0;
 }
--- a/scripts/config2help.sh	Tue Nov 13 16:13:45 2012 -0600
+++ b/scripts/config2help.sh	Tue Nov 13 17:14:08 2012 -0600
@@ -29,7 +29,7 @@
 		configs=$(echo "$filetxt" | egrep -ne "^config *" | cut -d\:  -f1)
 		endmenus=$(echo "$filetxt" | egrep -ne "^endmenu *" | cut -d\:  -f1)
 		let last=$(echo "$filetxt" | wc -l)+2
-		
+
 		declare -i i c s e
 		for i in $configs; do
 #			echo -n "c:$i" >&2
@@ -40,7 +40,7 @@
 			test $e -ge $s
 #			echo " s:$s e:$e" >&2
 			print_h "$filetxt" $i $s $e
-		done 
+		done
 		for fle in $(cat "$file" | egrep -e "^[ \t]*source " | sed -e "s,^[ \t]*source *\(.*\),\\1,"); do
 			$0 $fle
 		done
--- a/scripts/install.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/scripts/install.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,4 +1,3 @@
-/* vi: set ts=4 :*/
 /* Wrapper to make installation easier with cross-compiling.
  *
  * Copyright 2006 Rob Landley <rob@landley.net>
@@ -21,20 +20,20 @@
 
 int main(int argc, char *argv[])
 {
-	static char *toy_paths[]={"usr/","bin/","sbin/",0};
-	int i, len = 0;
+  static char *toy_paths[]={"usr/","bin/","sbin/",0};
+  int i, len = 0;
 
-	// Output list of applets.
-	for (i=1; i<TOY_LIST_LEN; i++) {
-		int fl = toy_list[i].flags;
-		if (fl & TOYMASK_LOCATION) {
-			if (argc>1) {
-				int j;
-				for (j=0; toy_paths[j]; j++)
-					if (fl & (1<<j)) len += printf("%s", toy_paths[j]);
-			}
-			len += printf("%s\n",toy_list[i].name);
-		}
-	}
-	return 0;
+  // Output list of applets.
+  for (i=1; i<TOY_LIST_LEN; i++) {
+    int fl = toy_list[i].flags;
+    if (fl & TOYMASK_LOCATION) {
+      if (argc>1) {
+        int j;
+        for (j=0; toy_paths[j]; j++)
+          if (fl & (1<<j)) len += printf("%s", toy_paths[j]);
+      }
+      len += printf("%s\n",toy_list[i].name);
+    }
+  }
+  return 0;
 }
--- a/scripts/test/basename.test	Tue Nov 13 16:13:45 2012 -0600
+++ b/scripts/test/basename.test	Tue Nov 13 17:14:08 2012 -0600
@@ -7,7 +7,7 @@
 # Removal of extra /'s
 testing "basename /-only" "basename ///////" "/\n" "" ""
 testing "basename trailing /" "basename a//////" "a\n" "" ""
-testing "basename combined" "basename /////a///b///c///d/////" "d\n" "" "" 
+testing "basename combined" "basename /////a///b///c///d/////" "d\n" "" ""
 
 # Standard suffix behavior.
 testing "basename suffix" "basename a/b/c/d.suffix .suffix" "d\n" "" ""
--- a/scripts/test/cat.test	Tue Nov 13 16:13:45 2012 -0600
+++ b/scripts/test/cat.test	Tue Nov 13 17:14:08 2012 -0600
@@ -6,7 +6,7 @@
 
 testing "cat" "cat && echo yes" "oneyes\n" "" "one"
 testing "cat file1" \
-	"cat /bin/cat > file1 && diff -u /bin/cat file1 && echo yes" \
+	"cat /proc/self/exe > file1 && diff -u /proc/self/exe file1 && echo yes" \
 	"yes\n" "" ""
 #testing "cat file1 file2" "cat /bin/cat file1 > file2 && diff -u -
 
--- a/scripts/test/cp.test	Tue Nov 13 16:13:45 2012 -0600
+++ b/scripts/test/cp.test	Tue Nov 13 17:14:08 2012 -0600
@@ -24,7 +24,7 @@
 	"yes\n" "" ""
 testing "cp -r dir->missing" \
 	"cp -r two three && cmp random three/random && echo yes" \
-	"yes\n" "" "" 
+	"yes\n" "" ""
 touch walrus
 testing "cp -r dir->file [fail]" \
 	"cp -r two walrus 2>/dev/null || echo yes" "yes\n" "" ""
--- a/scripts/test/dirname.test	Tue Nov 13 16:13:45 2012 -0600
+++ b/scripts/test/dirname.test	Tue Nov 13 17:14:08 2012 -0600
@@ -6,5 +6,5 @@
 
 testing "dirname /-only" "dirname ///////" "/\n" "" ""
 testing "dirname trailing /" "dirname a//////" ".\n" "" ""
-testing "dirname combined" "dirname /////a///b///c///d/////" "/////a///b///c\n" "" "" 
+testing "dirname combined" "dirname /////a///b///c///d/////" "/////a///b///c\n" "" ""
 testing "dirname /a/" "dirname /////a///" "/\n" "" ""
--- a/scripts/test/xargs.test	Tue Nov 13 16:13:45 2012 -0600
+++ b/scripts/test/xargs.test	Tue Nov 13 17:14:08 2012 -0600
@@ -26,7 +26,7 @@
 
 exit
 
-testing "xargs -n exact match" 
+testing "xargs -n exact match"
 testing "xargs -s exact match"
 testing "xargs -s 0"
 testing "xargs -s impossible"
--- a/toys.h	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys.h	Tue Nov 13 17:14:08 2012 -0600
@@ -1,4 +1,3 @@
-/* vi: set ts=4 :*/
 /* Toybox infrastructure.
  *
  * Copyright 2006 Rob Landley <rob@landley.net>
@@ -87,23 +86,23 @@
 // Array of available applets
 
 extern struct toy_list {
-	char *name;
-	void (*toy_main)(void);
-	char *options;
-	int flags;
+  char *name;
+  void (*toy_main)(void);
+  char *options;
+  int flags;
 } toy_list[];
 
 // Global context shared by all commands.
 
 extern struct toy_context {
-	struct toy_list *which;  // Which entry in toy_list is this one?
-	int exitval;             // Value error_exit feeds to exit()
-	char **argv;             // Original command line arguments
-	unsigned optflags;       // Command line option flags from get_optflags()
-	char **optargs;          // Arguments left over from get_optflags()
-	int optc;                // Count of optargs
-	int exithelp;            // Should error_exit print a usage message first?
-	int old_umask;           // Old umask preserved by TOYFLAG_UMASK
+  struct toy_list *which;  // Which entry in toy_list is this one?
+  int exitval;             // Value error_exit feeds to exit()
+  char **argv;             // Original command line arguments
+  unsigned optflags;       // Command line option flags from get_optflags()
+  char **optargs;          // Arguments left over from get_optflags()
+  int optc;                // Count of optargs
+  int exithelp;            // Should error_exit print a usage message first?
+  int old_umask;           // Old umask preserved by TOYFLAG_UMASK
 } toys;
 
 // One big temporary buffer, for use by commands (not library functions).
--- a/toys/e2fs.h	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/e2fs.h	Tue Nov 13 17:14:08 2012 -0600
@@ -1,6 +1,4 @@
-/* vi: set ts=4:
- *
- * mke2fs.h - Headers for ext2
+/* mke2fs.h - Headers for ext2
  *
  * Copyright 2006 Rob Landley <rob@landley.net>
  */
@@ -10,103 +8,103 @@
 #define EXT2_SUPER_MAGIC  0xEF53
 
 struct ext2_superblock {
-	uint32_t inodes_count;      // Inodes count
-	uint32_t blocks_count;      // Blocks count
-	uint32_t r_blocks_count;    // Reserved blocks count
-	uint32_t free_blocks_count; // Free blocks count
-	uint32_t free_inodes_count; // Free inodes count
-	uint32_t first_data_block;  // First Data Block
-	uint32_t log_block_size;    // Block size
-	uint32_t log_frag_size;     // Fragment size
-	uint32_t blocks_per_group;  // Blocks per group
-	uint32_t frags_per_group;   // Fragments per group
-	uint32_t inodes_per_group;  // Inodes per group
-	uint32_t mtime;             // Mount time
-	uint32_t wtime;             // Write time
-	uint16_t mnt_count;         // Mount count
-	uint16_t max_mnt_count;     // Maximal mount count
-	uint16_t magic;             // Magic signature
-	uint16_t state;             // File system state
-	uint16_t errors;            // Behaviour when detecting errors
-	uint16_t minor_rev_level;   // minor revision level
-	uint32_t lastcheck;         // time of last check
-	uint32_t checkinterval;     // max. time between checks
-	uint32_t creator_os;        // OS
-	uint32_t rev_level;         // Revision level
-	uint16_t def_resuid;        // Default uid for reserved blocks
-	uint16_t def_resgid;        // Default gid for reserved blocks
-	uint32_t first_ino;         // First non-reserved inode
-	uint16_t inode_size;        // size of inode structure
-	uint16_t block_group_nr;    // block group # of this superblock
-	uint32_t feature_compat;    // compatible feature set
-	uint32_t feature_incompat;  // incompatible feature set
-	uint32_t feature_ro_compat; // readonly-compatible feature set
-	char     uuid[16];          // 128-bit uuid for volume
-	char     volume_name[16];   // volume name
-	char     last_mounted[64];  // directory where last mounted
-	uint32_t alg_usage_bitmap;  // For compression
-	// For EXT2_COMPAT_PREALLOC
-	uint8_t  prealloc_blocks;   // Nr of blocks to try to preallocate
-	uint8_t  prealloc_dir_blocks; //Nr to preallocate for dirs
-	uint16_t padding1;
-	// For EXT3_FEATURE_COMPAT_HAS_JOURNAL
-	uint8_t  journal_uuid[16];   // uuid of journal superblock
-	uint32_t journal_inum;       // inode number of journal file
-	uint32_t journal_dev;        // device number of journal file
-	uint32_t last_orphan;        // start of list of inodes to delete
-	uint32_t hash_seed[4];       // HTREE hash seed
-	uint8_t  def_hash_version;   // Default hash version to use
-	uint8_t  padding2[3];
-	uint32_t default_mount_opts;
- 	uint32_t first_meta_bg;      // First metablock block group
-	uint32_t mkfs_time;          // Creation timestamp
-	uint32_t jnl_blocks[17];     // Backup of journal inode
-	// uint32_t reserved[172];      // Padding to the end of the block
+  uint32_t inodes_count;      // Inodes count
+  uint32_t blocks_count;      // Blocks count
+  uint32_t r_blocks_count;    // Reserved blocks count
+  uint32_t free_blocks_count; // Free blocks count
+  uint32_t free_inodes_count; // Free inodes count
+  uint32_t first_data_block;  // First Data Block
+  uint32_t log_block_size;    // Block size
+  uint32_t log_frag_size;     // Fragment size
+  uint32_t blocks_per_group;  // Blocks per group
+  uint32_t frags_per_group;   // Fragments per group
+  uint32_t inodes_per_group;  // Inodes per group
+  uint32_t mtime;             // Mount time
+  uint32_t wtime;             // Write time
+  uint16_t mnt_count;         // Mount count
+  uint16_t max_mnt_count;     // Maximal mount count
+  uint16_t magic;             // Magic signature
+  uint16_t state;             // File system state
+  uint16_t errors;            // Behaviour when detecting errors
+  uint16_t minor_rev_level;   // minor revision level
+  uint32_t lastcheck;         // time of last check
+  uint32_t checkinterval;     // max. time between checks
+  uint32_t creator_os;        // OS
+  uint32_t rev_level;         // Revision level
+  uint16_t def_resuid;        // Default uid for reserved blocks
+  uint16_t def_resgid;        // Default gid for reserved blocks
+  uint32_t first_ino;         // First non-reserved inode
+  uint16_t inode_size;        // size of inode structure
+  uint16_t block_group_nr;    // block group # of this superblock
+  uint32_t feature_compat;    // compatible feature set
+  uint32_t feature_incompat;  // incompatible feature set
+  uint32_t feature_ro_compat; // readonly-compatible feature set
+  char     uuid[16];          // 128-bit uuid for volume
+  char     volume_name[16];   // volume name
+  char     last_mounted[64];  // directory where last mounted
+  uint32_t alg_usage_bitmap;  // For compression
+  // For EXT2_COMPAT_PREALLOC
+  uint8_t  prealloc_blocks;   // Nr of blocks to try to preallocate
+  uint8_t  prealloc_dir_blocks; //Nr to preallocate for dirs
+  uint16_t padding1;
+  // For EXT3_FEATURE_COMPAT_HAS_JOURNAL
+  uint8_t  journal_uuid[16];   // uuid of journal superblock
+  uint32_t journal_inum;       // inode number of journal file
+  uint32_t journal_dev;        // device number of journal file
+  uint32_t last_orphan;        // start of list of inodes to delete
+  uint32_t hash_seed[4];       // HTREE hash seed
+  uint8_t  def_hash_version;   // Default hash version to use
+  uint8_t  padding2[3];
+  uint32_t default_mount_opts;
+  uint32_t first_meta_bg;      // First metablock block group
+  uint32_t mkfs_time;          // Creation timestamp
+  uint32_t jnl_blocks[17];     // Backup of journal inode
+  // uint32_t reserved[172];      // Padding to the end of the block
 };
 
 struct ext2_group
 {
-	uint32_t block_bitmap;       // Block number of block bitmap
-	uint32_t inode_bitmap;       // Block number of inode bitmap
-	uint32_t inode_table;        // Block number of inode table
-	uint16_t free_blocks_count;  // How many free blocks in this group?
-	uint16_t free_inodes_count;  // How many free inodes in this group?
-	uint16_t used_dirs_count;    // How many directories?
-	uint16_t reserved[7];        // pad to 32 bytes
+  uint32_t block_bitmap;       // Block number of block bitmap
+  uint32_t inode_bitmap;       // Block number of inode bitmap
+  uint32_t inode_table;        // Block number of inode table
+  uint16_t free_blocks_count;  // How many free blocks in this group?
+  uint16_t free_inodes_count;  // How many free inodes in this group?
+  uint16_t used_dirs_count;    // How many directories?
+  uint16_t reserved[7];        // pad to 32 bytes
 };
 
 struct ext2_dentry {
-	uint32_t inode;         // Inode number
-    uint16_t rec_len;       // Directory entry length
-    uint8_t  name_len;      // Name length
-    uint8_t  file_type;
-	char     name[0];     // File name
+  uint32_t inode;         // Inode number
+  uint16_t rec_len;       // Directory entry length
+  uint8_t  name_len;      // Name length
+  uint8_t  file_type;
+  char     name[0];     // File name
 };
 
 struct ext2_inode {
-	uint16_t mode;        // File mode
-	uint16_t uid;         // Low 16 bits of Owner Uid
-	uint32_t size;        // Size in bytes
-	uint32_t atime;       // Access time
-	uint32_t ctime;       // Creation time
-	uint32_t mtime;       // Modification time
-	uint32_t dtime;       // Deletion Time
-	uint16_t gid;         // Low 16 bits of Group Id
-	uint16_t links_count; // Links count
-	uint32_t blocks;      // Blocks count
-	uint32_t flags;       // File flags
-	uint32_t reserved1;
-	uint32_t block[15];   // Pointers to blocks
-	uint32_t generation;  // File version (for NFS)
-	uint32_t file_acl;    // File ACL
-	uint32_t dir_acl;     // Directory ACL (or top bits of file length)
-	uint32_t faddr;       // Last block in file
-	uint8_t  frag;        // Fragment number
-	uint8_t  fsize;       // Fragment size
-	uint16_t pad1;
-	uint16_t uid_high;    // High bits of uid
-	uint16_t gid_high;    // High bits of gid
-	uint32_t reserved2;
+  uint16_t mode;        // File mode
+  uint16_t uid;         // Low 16 bits of Owner Uid
+  uint32_t size;        // Size in bytes
+  uint32_t atime;       // Access time
+  uint32_t ctime;       // Creation time
+  uint32_t mtime;       // Modification time
+  uint32_t dtime;       // Deletion Time
+  uint16_t gid;         // Low 16 bits of Group Id
+  uint16_t links_count; // Links count
+  uint32_t blocks;      // Blocks count
+  uint32_t flags;       // File flags
+  uint32_t reserved1;
+  uint32_t block[15];   // Pointers to blocks
+  uint32_t generation;  // File version (for NFS)
+  uint32_t file_acl;    // File ACL
+  uint32_t dir_acl;     // Directory ACL (or top bits of file length)
+  uint32_t faddr;       // Last block in file
+  uint8_t  frag;        // Fragment number
+  uint8_t  fsize;       // Fragment size
+  uint16_t pad1;
+  uint16_t uid_high;    // High bits of uid
+  uint16_t gid_high;    // High bits of gid
+  uint32_t reserved2;
 };
 
 #define EXT2_FEATURE_COMPAT_DIR_PREALLOC	0x0001
@@ -132,13 +130,13 @@
 // other bits are reserved for now.
 
 enum {
-	EXT2_FT_UNKNOWN,
-	EXT2_FT_REG_FILE,
-	EXT2_FT_DIR,
-	EXT2_FT_CHRDEV,
-	EXT2_FT_BLKDEV,
-	EXT2_FT_FIFO,
-	EXT2_FT_SOCK,
-	EXT2_FT_SYMLINK,
-	EXT2_FT_MAX
+  EXT2_FT_UNKNOWN,
+  EXT2_FT_REG_FILE,
+  EXT2_FT_DIR,
+  EXT2_FT_CHRDEV,
+  EXT2_FT_BLKDEV,
+  EXT2_FT_FIFO,
+  EXT2_FT_SOCK,
+  EXT2_FT_SYMLINK,
+  EXT2_FT_MAX
 };
--- a/toys/lsb/dmesg.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/lsb/dmesg.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,6 +1,4 @@
-/* vi: set sw=4 ts=4:
- *
- * dmesg.c - display/control kernel ring buffer.
+/* dmesg.c - display/control kernel ring buffer.
  *
  * Copyright 2006, 2007 Rob Landley <rob@landley.net>
  *
@@ -9,16 +7,16 @@
 USE_DMESG(NEWTOY(dmesg, "s#n#c", TOYFLAG_BIN))
 
 config DMESG
-	bool "dmesg"
-	default y
-	help
-	  usage: dmesg [-n level] [-s bufsize] | -c
+  bool "dmesg"
+  default y
+  help
+    usage: dmesg [-n level] [-s bufsize] | -c
 
-	  Print or control the kernel ring buffer.
+    Print or control the kernel ring buffer.
 
-	  -n	Set kernel logging level (1-9).
-	  -s	Size of buffer to read (in bytes), default 16384.
-	  -c	Clear the ring buffer after printing.
+    -n	Set kernel logging level (1-9).
+    -s	Size of buffer to read (in bytes), default 16384.
+    -c	Clear the ring buffer after printing.
 */
 
 #define FOR_dmesg
@@ -26,33 +24,32 @@
 #include <sys/klog.h>
 
 GLOBALS(
-	long level;
-	long size;
+  long level;
+  long size;
 )
 
 void dmesg_main(void)
 {
-	// For -n just tell kernel to which messages to keep.
-	if (toys.optflags & 2) {
-		if (klogctl(8, NULL, TT.level))
-			error_exit("klogctl");
-	} else {
-		int size, i, last = '\n';
-		char *data;
+  // For -n just tell kernel to which messages to keep.
+  if (toys.optflags & 2) {
+    if (klogctl(8, NULL, TT.level)) error_exit("klogctl");
+  } else {
+    int size, i, last = '\n';
+    char *data;
 
-		// Figure out how much data we need, and fetch it.
-		size = TT.size;
-		if (size<2) size = 16384;
-		data = xmalloc(size);
-		size = klogctl(3 + (toys.optflags&1), data, size);
-		if (size < 0) error_exit("klogctl");
+    // Figure out how much data we need, and fetch it.
+    size = TT.size;
+    if (size<2) size = 16384;
+    data = xmalloc(size);
+    size = klogctl(3 + (toys.optflags&1), data, size);
+    if (size < 0) error_exit("klogctl");
 
-		// Display data, filtering out level markers.
-		for (i=0; i<size; ) {
-			if (last=='\n' && data[i]=='<') i += 3;
-			else xputc(last = data[i++]);
-		}
-		if (last!='\n') xputc('\n');
-		if (CFG_TOYBOX_FREE) free(data);
-	}
+    // Display data, filtering out level markers.
+    for (i=0; i<size; ) {
+      if (last=='\n' && data[i]=='<') i += 3;
+      else xputc(last = data[i++]);
+    }
+    if (last!='\n') xputc('\n');
+    if (CFG_TOYBOX_FREE) free(data);
+  }
 }
--- a/toys/lsb/hostname.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/lsb/hostname.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,6 +1,4 @@
-/* vi: set sw=4 ts=4:
- *
- * hostname.c - Get/Set the hostname
+/* hostname.c - Get/Set the hostname
  *
  * Copyright 2012 Andre Renaud <andre@bluewatersys.com>
  *
@@ -9,12 +7,12 @@
 USE_HOSTNAME(NEWTOY(hostname, NULL, TOYFLAG_BIN))
 
 config HOSTNAME
-	bool "hostname"
-	default y
-	help
-	  usage: hostname [newname]
+  bool "hostname"
+  default y
+  help
+    usage: hostname [newname]
 
-	  Get/Set the current hostname
+    Get/Set the current hostname
 */
 
 #define FOR_hostname
@@ -22,13 +20,12 @@
 
 void hostname_main(void)
 {
-	const char *hostname = toys.optargs[0];
-        if (hostname) {
-            if (sethostname(hostname, strlen(hostname)))
-                perror_exit("set failed '%s'", hostname);
-        } else {
-            if (gethostname(toybuf, sizeof(toybuf)))
-                perror_exit("get failed");
-            xputs(toybuf);
-        }
+  const char *hostname = toys.optargs[0];
+  if (hostname) {
+    if (sethostname(hostname, strlen(hostname)))
+      perror_exit("set failed '%s'", hostname);
+  } else {
+    if (gethostname(toybuf, sizeof(toybuf))) perror_exit("get failed");
+    xputs(toybuf);
+  }
 }
--- a/toys/lsb/killall.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/lsb/killall.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,6 +1,4 @@
-/* vi: set sw=4 ts=4:
- *
- * killall.c - Send signal (default: TERM) to all processes with given names.
+/* killall.c - Send signal (default: TERM) to all processes with given names.
  *
  * Copyright 2012 Andreas Heck <aheck@gmx.de>
  *
@@ -9,68 +7,67 @@
 USE_KILLALL(NEWTOY(killall, "<1?lq", TOYFLAG_USR|TOYFLAG_BIN))
 
 config KILLALL
-	bool "killall"
-	default y
-	help
-	  usage: killall [-l] [-q] [-SIG] PROCESS_NAME...
+  bool "killall"
+  default y
+  help
+    usage: killall [-l] [-q] [-SIG] PROCESS_NAME...
 
-	  Send a signal (default: TERM) to all processes with the given names.
+    Send a signal (default: TERM) to all processes with the given names.
 
-		-l	print list of all available signals
-		-q	don't print any warnings or error messages
+    -l	print list of all available signals
+    -q	don't print any warnings or error messages
 */
 
 #define FOR_killall
 #include "toys.h"
 
 GLOBALS(
-	int signum;
+  int signum;
 )
 
 static void kill_process(pid_t pid)
 {
-	int ret;
+  int ret;
 
-	toys.exitval = 0;
-	ret = kill(pid, TT.signum);
+  toys.exitval = 0;
+  ret = kill(pid, TT.signum);
 
-	if (ret == -1 && !(toys.optflags & FLAG_q)) perror("kill");
+  if (ret == -1 && !(toys.optflags & FLAG_q)) perror("kill");
 }
 
 void killall_main(void)
 {
-	char **names;
+  char **names;
 
-	if (toys.optflags & FLAG_l) {
-		sig_to_num(NULL);
-		return;
-	}
+  if (toys.optflags & FLAG_l) {
+    sig_to_num(NULL);
+    return;
+  }
 
-	TT.signum = SIGTERM;
-	toys.exitval++;
+  TT.signum = SIGTERM;
+  toys.exitval++;
 
-	if (!*toys.optargs) {
-		toys.exithelp = 1;
-		error_exit("Process name missing!");
-	}
+  if (!*toys.optargs) {
+    toys.exithelp = 1;
+    error_exit("Process name missing!");
+  }
 
-	names = toys.optargs;
+  names = toys.optargs;
 
-	if (**names == '-') {
-		if (0 > (TT.signum = sig_to_num((*names)+1))) {
-			if (toys.optflags & FLAG_q) exit(1);
-			error_exit("Invalid signal");
-		}
-		names++;
+  if (**names == '-') {
+    if (0 > (TT.signum = sig_to_num((*names)+1))) {
+      if (toys.optflags & FLAG_q) exit(1);
+      error_exit("Invalid signal");
+    }
+    names++;
 
-		if (!*names) {
-			toys.exithelp++;
-			error_exit("Process name missing!");
-		}
-	}
+    if (!*names) {
+      toys.exithelp++;
+      error_exit("Process name missing!");
+    }
+  }
 
-	for_each_pid_with_name_in(names, kill_process);
+  for_each_pid_with_name_in(names, kill_process);
 
-	if (toys.exitval && !(toys.optflags & FLAG_q))
-		error_exit("No such process");
+  if (toys.exitval && !(toys.optflags & FLAG_q)) error_exit("No such process");
 }
--- a/toys/lsb/md5sum.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/lsb/md5sum.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,6 +1,4 @@
-/* vi: set sw=4 ts=4:
- *
- * md5sum.c - Calculate RFC 1321 md5 hash and sha1 hash.
+/* md5sum.c - Calculate RFC 1321 md5 hash and sha1 hash.
  *
  * Copyright 2012 Rob Landley <rob@landley.net>
  *
@@ -219,8 +217,7 @@
     buf = 0;
   } while ((TT.count & 63) != 56);
   if (sha1) count=bswap_64(count);
-  for (i = 0; i < 8; i++)
-    TT.buffer.c[56+i] = count >> (8*i);
+  for (i = 0; i < 8; i++) TT.buffer.c[56+i] = count >> (8*i);
   transform();
 
   if (sha1)
--- a/toys/lsb/mknod.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/lsb/mknod.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,6 +1,4 @@
-/* vi: set sw=4 ts=4:
- *
- * mknod.c - make block or character special file
+/* mknod.c - make block or character special file
  *
  * Copyright 2012 Elie De Brauwer <eliedebrauwer@gmail.com>
  *
@@ -9,15 +7,15 @@
 USE_MKNOD(NEWTOY(mknod, "<2>4", TOYFLAG_BIN))
 
 config MKNOD
-	bool "mknod"
-	default y
-	help
-	  usage: mknod NAME TYPE [MAJOR MINOR]
+  bool "mknod"
+  default y
+  help
+    usage: mknod NAME TYPE [MAJOR MINOR]
 
-	  Create a special file NAME with a given type, possible types are
-	  b	block device
-	  c or u	character device
-	  p	named pipe (ignores MAJOR/MINOR)
+    Create a special file NAME with a given type, possible types are
+    b	block device
+    c or u	character device
+    p	named pipe (ignores MAJOR/MINOR)
 */
 
 #define FOR_mknod
@@ -25,20 +23,19 @@
 
 void mknod_main(void)
 {
-	mode_t modes[] = {S_IFIFO, S_IFCHR, S_IFCHR, S_IFBLK};
-	int major=0, minor=0, type;
-	int mode = 0660;
+  mode_t modes[] = {S_IFIFO, S_IFCHR, S_IFCHR, S_IFBLK};
+  int major=0, minor=0, type;
+  int mode = 0660;
 
-	type = stridx("pcub", *toys.optargs[1]);
-	if (type == -1) perror_exit("bad type '%c'", *toys.optargs[1]);
-	if (type) {
-                if (toys.optc != 4) perror_exit("need major/minor");
+  type = stridx("pcub", *toys.optargs[1]);
+  if (type == -1) perror_exit("bad type '%c'", *toys.optargs[1]);
+  if (type) {
+    if (toys.optc != 4) perror_exit("need major/minor");
 
-		major = atoi(toys.optargs[2]);
-		minor = atoi(toys.optargs[3]);
-	}
+    major = atoi(toys.optargs[2]);
+    minor = atoi(toys.optargs[3]);
+  }
 
-	if (mknod(toys.optargs[0], mode | modes[type], makedev(major, minor)))
-		perror_exit("mknod %s failed", toys.optargs[0]);
-
+  if (mknod(toys.optargs[0], mode | modes[type], makedev(major, minor)))
+    perror_exit("mknod %s failed", toys.optargs[0]);
 }
--- a/toys/lsb/mktemp.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/lsb/mktemp.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,6 +1,4 @@
-/* vi: set sw=4 ts=4:
- *
- * mktemp.c - Create a temporary file or directory.
+/* mktemp.c - Create a temporary file or directory.
  *
  * Copyright 2012 Elie De Brauwer <eliedebrauwer@gmail.com>
  *
@@ -9,46 +7,46 @@
 USE_MKTEMP(NEWTOY(mktemp, ">1q(directory)d(tmpdir)p:", TOYFLAG_BIN))
 
 config MKTEMP
-	bool "mktemp"
-	default y
-	help
-	  usage: mktemp [-dq] [-p DIR] [TEMPLATE]
+  bool "mktemp"
+  default y
+  help
+    usage: mktemp [-dq] [-p DIR] [TEMPLATE]
 
-	  Safely create new file and print its name. Default TEMPLATE is
-	  /tmp/tmp.XXXXXX and each trailing X is replaced with random char.
+    Safely create new file and print its name. Default TEMPLATE is
+    /tmp/tmp.XXXXXX and each trailing X is replaced with random char.
 
-	  -d, --directory        Create directory instead of file
-	  -p DIR, --tmpdir=DIR   Put new file in DIR
-	  -q                     Quiet
+    -d, --directory        Create directory instead of file
+    -p DIR, --tmpdir=DIR   Put new file in DIR
+    -q                     Quiet
 */
 
 #define FOR_mktemp
 #include "toys.h"
 
 GLOBALS(
-	char * tmpdir;
+  char * tmpdir;
 )
 
 void mktemp_main(void)
 {
-	int  d_flag = toys.optflags & FLAG_d;
-	char *tmp;
+  int  d_flag = toys.optflags & FLAG_d;
+  char *tmp;
 
-	tmp = *toys.optargs;
+  tmp = *toys.optargs;
 
-	if (!tmp) {
-		if (!TT.tmpdir) TT.tmpdir = "/tmp";
-		tmp = "tmp.xxxxxx";
-	}
-	if (TT.tmpdir) tmp = xmsprintf("%s/%s", TT.tmpdir ? TT.tmpdir : "/tmp",
-		*toys.optargs ? *toys.optargs : "tmp.XXXXXX");
+  if (!tmp) {
+    if (!TT.tmpdir) TT.tmpdir = "/tmp";
+    tmp = "tmp.xxxxxx";
+  }
+  if (TT.tmpdir) tmp = xmsprintf("%s/%s", TT.tmpdir ? TT.tmpdir : "/tmp",
+    *toys.optargs ? *toys.optargs : "tmp.XXXXXX");
 
-	if (d_flag ? mkdtemp(tmp) == NULL : mkstemp(tmp) == -1)
-		if (toys.optflags & FLAG_q)
-			perror_exit("Failed to create temporary %s",
-				d_flag ? "directory" : "file");
+  if (d_flag ? mkdtemp(tmp) == NULL : mkstemp(tmp) == -1)
+    if (toys.optflags & FLAG_q)
+      perror_exit("Failed to create temporary %s",
+        d_flag ? "directory" : "file");
 
-	xputs(tmp);
+  xputs(tmp);
 
-	if (CFG_TOYBOX_FREE && TT.tmpdir) free(tmp);
+  if (CFG_TOYBOX_FREE && TT.tmpdir) free(tmp);
 }
--- a/toys/lsb/passwd.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/lsb/passwd.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,6 +1,4 @@
-/* vi: set sw=4 ts=4:
- *
- * passwd.c - Program to upadte user password.
+/* passwd.c - Program to update user password.
  *
  * Copyright 2012 Ashwini Kumar <ak.ashwini@gmail.com>
  * Modified 2012 Jason Kyungwan Han <asura321@gmail.com>
@@ -10,18 +8,17 @@
 USE_PASSWD(NEWTOY(passwd, ">1a:dlu", TOYFLAG_STAYROOT|TOYFLAG_USR|TOYFLAG_BIN))
 
 config PASSWD
-	bool "passwd"
-	default y
-	help
-	  usage: passwd [-a ALGO] [-d] [-l] [-u] <account name>
+  bool "passwd"
+  default y
+  help
+    usage: passwd [-a ALGO] [-d] [-l] [-u] <account name>
 
-	  update user’s authentication tokens. Default : current user
+    update user’s authentication tokens. Default : current user
 
-	  -a ALGO	Encryption method (des, md5, sha256, sha512) default: des
-	  -d		Set password to ''
-	  -l		Lock (disable) account
-	  -u 		Unlock (enable) account
-
+    -a ALGO	Encryption method (des, md5, sha256, sha512) default: des
+    -d		Set password to ''
+    -l		Lock (disable) account
+    -u		Unlock (enable) account
 */
 
 #define FOR_passwd
@@ -29,7 +26,7 @@
 #include <time.h>
 
 GLOBALS(
-	char *algo;
+  char *algo;
 )
 
 #define MAX_SALT_LEN  20 //3 for id, 16 for key, 1 for '\0'
@@ -41,227 +38,225 @@
 
 unsigned int random_number_generator(int fd)
 {
-    unsigned int randnum;
-    xreadall(fd, &randnum, sizeof(randnum));
-	return randnum;
+  unsigned int randnum;
+  xreadall(fd, &randnum, sizeof(randnum));
+  return randnum;
 }
 
-
-
 char inttoc(int i)
 {
-	// salt value uses 64 chracters in "./0-9a-zA-Z"
-	const char character_set[]="./0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
-    i &= 0x3f; // masking for using 10 bits only
-	return character_set[i];
+  // salt value uses 64 chracters in "./0-9a-zA-Z"
+  const char character_set[]="./0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
+  i &= 0x3f; // masking for using 10 bits only
+  return character_set[i];
 }
 
 int get_salt(char *salt)
-{                     
-	int i, salt_length = 0;
-    int randfd;
-	if(!strncmp(TT.algo,"des",3)){
-		// 2 bytes salt value is used in des
-		salt_length = 2;
-	} else {
-		*salt++ = '$';
-		if(!strncmp(TT.algo,"md5",3)){
-			*salt++ = '1';
-			// 8 bytes salt value is used in md5
-			salt_length = 8;
-		} else if(!strncmp(TT.algo,"sha256",6)){
-			*salt++ = '5';
-			// 16 bytes salt value is used in sha256
-			salt_length = 16;
-		} else if(!strncmp(TT.algo,"sha512",6)){
-			*salt++ = '6';
-			// 16 bytes salt value is used in sha512
-			salt_length = 16;
-		} else return 1;
+{
+  int i, salt_length = 0;
+  int randfd;
+  if(!strncmp(TT.algo,"des",3)){
+    // 2 bytes salt value is used in des
+    salt_length = 2;
+  } else {
+    *salt++ = '$';
+    if(!strncmp(TT.algo,"md5",3)){
+      *salt++ = '1';
+      // 8 bytes salt value is used in md5
+      salt_length = 8;
+    } else if(!strncmp(TT.algo,"sha256",6)){
+      *salt++ = '5';
+      // 16 bytes salt value is used in sha256
+      salt_length = 16;
+    } else if(!strncmp(TT.algo,"sha512",6)){
+      *salt++ = '6';
+      // 16 bytes salt value is used in sha512
+      salt_length = 16;
+    } else return 1;
 
-		*salt++ = '$';
-	}
+    *salt++ = '$';
+  }
 
-    randfd = xopen(URANDOM_PATH, O_RDONLY);
-	for(i=0; i<salt_length; i++)
-		salt[i] = inttoc(random_number_generator(randfd));
-	salt[salt_length+1] = '\0';
-    xclose(randfd);
+  randfd = xopen(URANDOM_PATH, O_RDONLY);
+  for(i=0; i<salt_length; i++)
+    salt[i] = inttoc(random_number_generator(randfd));
+  salt[salt_length+1] = '\0';
+  xclose(randfd);
 
-	return 0;
+  return 0;
 }
 
 static int str_check(char *s, char *p)
 {
-    if((strcasestr(s, p) != NULL) || (strcasestr(p, s) != NULL))
-        return 1;
-    return 0;
+  if((strcasestr(s, p) != NULL) || (strcasestr(p, s) != NULL))
+    return 1;
+  return 0;
 }
 
 static void strength_check(char *newp, char *oldp, char *user)
 {
-    char *msg = NULL;
-    if(strlen(newp) < 6) { //Min passwd len
-        msg = "too short";
-        xprintf("BAD PASSWORD: %s\n",msg);
-    }
-    if(!newp[0])
-        return; //passwd is empty
+  char *msg = NULL;
+  if(strlen(newp) < 6) { //Min passwd len
+    msg = "too short";
+    xprintf("BAD PASSWORD: %s\n",msg);
+  }
+  if(!newp[0])
+    return; //passwd is empty
 
-    if(str_check(newp, user)) {
-        msg = "user based password";
-        xprintf("BAD PASSWORD: %s\n",msg);
-    }
+  if(str_check(newp, user)) {
+    msg = "user based password";
+    xprintf("BAD PASSWORD: %s\n",msg);
+  }
 
-    if(oldp[0] && str_check(newp, oldp)) {
-        msg = "based on old passwd";
-        xprintf("BAD PASSWORD: %s\n",msg);
-    }
+  if(oldp[0] && str_check(newp, oldp)) {
+    msg = "based on old passwd";
+    xprintf("BAD PASSWORD: %s\n",msg);
+  }
 }
 
 static int verify_passwd(char * pwd)
-{    
-    char * pass;
+{
+  char * pass;
 
-    if (!pwd) return 1;
-    if (pwd[0] == '!' || pwd[0] == '*') return 1;
+  if (!pwd) return 1;
+  if (pwd[0] == '!' || pwd[0] == '*') return 1;
 
-    pass = crypt(toybuf, pwd);
-    if (pass != NULL && strcmp(pass, pwd)==0)
-        return 0;
+  pass = crypt(toybuf, pwd);
+  if (pass != NULL && strcmp(pass, pwd)==0)
+    return 0;
 
-    return 1;
+  return 1;
 }
 
 static char *new_password(char *oldp, char *user)
 {
-    char *newp = NULL;
+  char *newp = NULL;
 
-    if(read_password(toybuf, sizeof(toybuf), "New password:"))
-        return NULL; //may be due to Ctrl-C
+  if(read_password(toybuf, sizeof(toybuf), "New password:"))
+    return NULL; //may be due to Ctrl-C
 
-    newp = xstrdup(toybuf);
-    strength_check(newp, oldp, user);
-    if(read_password(toybuf, sizeof(toybuf), "Retype password:")) {
-        free(newp);
-        return NULL; //may be due to Ctrl-C
-    }
+  newp = xstrdup(toybuf);
+  strength_check(newp, oldp, user);
+  if(read_password(toybuf, sizeof(toybuf), "Retype password:")) {
+    free(newp);
+    return NULL; //may be due to Ctrl-C
+  }
 
-    if(strcmp(newp, toybuf) == 0)
-        return newp;
-    else error_msg("Passwords do not match.\n");
-    /*Failure Case */
-    free(newp);
-    return NULL;
+  if(strcmp(newp, toybuf) == 0)
+    return newp;
+  else error_msg("Passwords do not match.\n");
+  /*Failure Case */
+  free(newp);
+  return NULL;
 }
 
 
 void passwd_main(void)
 {
-    uid_t myuid;
-    struct passwd *pw;
-    struct spwd *sp;
-    char *name = NULL;
-    char *pass = NULL, *encrypted = NULL, *newp = NULL;
-    char *orig = (char *)"";
-    char salt[MAX_SALT_LEN];
-    int ret = -1;
+  uid_t myuid;
+  struct passwd *pw;
+  struct spwd *sp;
+  char *name = NULL;
+  char *pass = NULL, *encrypted = NULL, *newp = NULL;
+  char *orig = (char *)"";
+  char salt[MAX_SALT_LEN];
+  int ret = -1;
 
-    myuid = getuid();
-    if((myuid != 0) && (toys.optflags & (FLAG_l | FLAG_u | FLAG_d)))
-        error_exit("You need to be root to do these actions\n");
+  myuid = getuid();
+  if((myuid != 0) && (toys.optflags & (FLAG_l | FLAG_u | FLAG_d)))
+    error_exit("You need to be root to do these actions\n");
 
-    pw = getpwuid(myuid);
+  pw = getpwuid(myuid);
 
-    if(!pw)
-        error_exit("Unknown uid '%u'",myuid);
+  if(!pw)
+    error_exit("Unknown uid '%u'",myuid);
 
-    if(toys.optargs[0])
-        name = toys.optargs[0];
-    else
-        name = xstrdup(pw->pw_name);
+  if(toys.optargs[0])
+    name = toys.optargs[0];
+  else
+    name = xstrdup(pw->pw_name);
 
-    pw = getpwnam(name);
-    if(!pw) error_exit("Unknown user '%s'",name);
+  pw = getpwnam(name);
+  if(!pw) error_exit("Unknown user '%s'",name);
 
-    if(myuid != 0 && (myuid != pw->pw_uid))
-        error_exit("You need to be root to change '%s' password\n", name);
+  if(myuid != 0 && (myuid != pw->pw_uid))
+    error_exit("You need to be root to change '%s' password\n", name);
 
-    pass = pw->pw_passwd;
-    if(pw->pw_passwd[0] == 'x') {
-        /*get shadow passwd */
-        sp = getspnam(name);
-        if(sp)
-            pass = sp->sp_pwdp;
+  pass = pw->pw_passwd;
+  if(pw->pw_passwd[0] == 'x') {
+    /*get shadow passwd */
+    sp = getspnam(name);
+    if(sp)
+      pass = sp->sp_pwdp;
+  }
+
+
+  if(!(toys.optflags & (FLAG_l | FLAG_u | FLAG_d))) {
+    printf("Changing password for %s\n",name);
+    if(pass[0] == '!')
+      error_exit("Can't change, password is locked for %s",name);
+    if(myuid != 0) {
+      /*Validate user */
+
+      if(read_password(toybuf, sizeof(toybuf), "Origial password:")) {
+        if(!toys.optargs[0]) free(name);
+        return;
+      }
+      orig = toybuf;
+      if(verify_passwd(pass))
+        error_exit("Authentication failed\n");
     }
 
+    orig = xstrdup(orig);
 
-    if(!(toys.optflags & (FLAG_l | FLAG_u | FLAG_d))) {
-        printf("Changing password for %s\n",name);
-        if(pass[0] == '!') 
-            error_exit("Can't change, password is locked for %s",name);
-        if(myuid != 0) {
-            /*Validate user */
-
-            if(read_password(toybuf, sizeof(toybuf), "Origial password:")) {
-                if(!toys.optargs[0]) free(name);
-                return;
-            }
-            orig = toybuf;
-            if(verify_passwd(pass))
-                error_exit("Authentication failed\n");
-        }
-
-        orig = xstrdup(orig);
-
-        /*Get new password */
-        newp = new_password(orig, name);
-        if(!newp) {
-            free(orig);
-            if(!toys.optargs[0]) free(name);
-            return; //new password is not set well.
-        }
-
-        /*Encrypt the passwd */
-        if(!(toys.optflags & FLAG_a)) TT.algo = "des";
-
-		if(get_salt(salt))
-			error_exit("Error: Unkown encryption algorithm\n");
-		
-        encrypted = crypt(newp, salt);
-        free(newp);
-        free(orig);
-    }
-    else if(toys.optflags & FLAG_l) {
-        if(pass[0] == '!')
-            error_exit("password is already locked for %s",name);
-        printf("Locking password for %s\n",name);
-        encrypted = xmsprintf("!%s",pass);
-    }
-    else if(toys.optflags & FLAG_u) {
-        if(pass[0] != '!')         
-            error_exit("password is already unlocked for %s",name);
-
-        printf("Unlocking password for %s\n",name);
-        encrypted = xstrdup(&pass[1]);
-    }
-    else if(toys.optflags & FLAG_d) {
-        printf("Deleting password for %s\n",name);
-        encrypted = (char*)xzalloc(sizeof(char)*2); //1 = "", 2 = '\0'
+    /*Get new password */
+    newp = new_password(orig, name);
+    if(!newp) {
+      free(orig);
+      if(!toys.optargs[0]) free(name);
+      return; //new password is not set well.
     }
 
-    /*Update the passwd */
-    if(pw->pw_passwd[0] == 'x')
-        ret = update_password("/etc/shadow", name, encrypted);
-    else
-        ret = update_password("/etc/passwd", name, encrypted);
+    /*Encrypt the passwd */
+    if(!(toys.optflags & FLAG_a)) TT.algo = "des";
 
-    if((toys.optflags & (FLAG_l | FLAG_u | FLAG_d))) 
-        free(encrypted);
+    if(get_salt(salt))
+      error_exit("Error: Unkown encryption algorithm\n");
 
-    if(!toys.optargs[0]) free(name);
-    if(!ret)
-        error_msg("Success");
-    else
-        error_msg("Failure");
+    encrypted = crypt(newp, salt);
+    free(newp);
+    free(orig);
+  }
+  else if(toys.optflags & FLAG_l) {
+    if(pass[0] == '!')
+      error_exit("password is already locked for %s",name);
+    printf("Locking password for %s\n",name);
+    encrypted = xmsprintf("!%s",pass);
+  }
+  else if(toys.optflags & FLAG_u) {
+    if(pass[0] != '!')
+      error_exit("password is already unlocked for %s",name);
+
+    printf("Unlocking password for %s\n",name);
+    encrypted = xstrdup(&pass[1]);
+  }
+  else if(toys.optflags & FLAG_d) {
+    printf("Deleting password for %s\n",name);
+    encrypted = (char*)xzalloc(sizeof(char)*2); //1 = "", 2 = '\0'
+  }
+
+  /*Update the passwd */
+  if(pw->pw_passwd[0] == 'x')
+    ret = update_password("/etc/shadow", name, encrypted);
+  else
+    ret = update_password("/etc/passwd", name, encrypted);
+
+  if((toys.optflags & (FLAG_l | FLAG_u | FLAG_d)))
+    free(encrypted);
+
+  if(!toys.optargs[0]) free(name);
+  if(!ret)
+    error_msg("Success");
+  else
+    error_msg("Failure");
 }
--- a/toys/lsb/pidof.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/lsb/pidof.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,6 +1,4 @@
-/* vi: set sw=4 ts=4:
- *
- * pidof.c - Print the PIDs of all processes with the given names.
+/* pidof.c - Print the Process IDs of all processes with the given names.
  *
  * Copyright 2012 Andreas Heck <aheck@gmx.de>
  *
@@ -9,24 +7,25 @@
 USE_PIDOF(NEWTOY(pidof, "<1", TOYFLAG_USR|TOYFLAG_BIN))
 
 config PIDOF
-	bool "pidof"
-	default y
-	help
-	  usage: pidof [NAME]...
+  bool "pidof"
+  default y
+  help
+    usage: pidof [NAME]...
 
-	  Print the PIDs of all processes with the given names.
+    Print the PIDs of all processes with the given names.
 */
 
 #include "toys.h"
 
-static void print_pid(pid_t pid) {
-    xprintf("%s%ld", toys.exitval ? "" : " ", (long)pid);
-    toys.exitval = 0;
+static void print_pid(pid_t pid)
+{
+  xprintf("%s%ld", toys.exitval ? "" : " ", (long)pid);
+  toys.exitval = 0;
 }
 
 void pidof_main(void)
 {
-    toys.exitval = 1;
-    for_each_pid_with_name_in(toys.optargs, print_pid);
-    if (!toys.exitval) xputc('\n');
+  toys.exitval = 1;
+  for_each_pid_with_name_in(toys.optargs, print_pid);
+  if (!toys.exitval) xputc('\n');
 }
--- a/toys/lsb/seq.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/lsb/seq.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,6 +1,4 @@
-/* vi: set sw=4 ts=4:
- *
- * seq.c - Count from first to last, by increment.
+/* seq.c - Count from first to last, by increment.
  *
  * Copyright 2006 Rob Landley <rob@landley.net>
  *
@@ -9,40 +7,40 @@
 USE_SEQ(NEWTOY(seq, "<1>3?", TOYFLAG_USR|TOYFLAG_BIN))
 
 config SEQ
-	bool "seq"
-	depends on TOYBOX_FLOAT
-	default y
-	help
-	  usage: seq [first] [increment] last
+  bool "seq"
+  depends on TOYBOX_FLOAT
+  default y
+  help
+    usage: seq [first] [increment] last
 
-	  Count from first to last, by increment.  Omitted arguments default
-	  to 1.  Two arguments are used as first and last.  Arguments can be
-	  negative or floating point.
+    Count from first to last, by increment. Omitted arguments default
+    to 1. Two arguments are used as first and last. Arguments can be
+    negative or floating point.
 */
 
 #include "toys.h"
 
 void seq_main(void)
 {
-	double first, increment, last, dd;
+  double first, increment, last, dd;
 
-	// Parse command line arguments, with appropriate defaults.
-	// Note that any non-numeric arguments are treated as zero.
-	first = increment = 1;
-	switch (toys.optc) {
-		case 3:
-			increment = atof(toys.optargs[1]);
-		case 2:
-			first = atof(*toys.optargs);
-		default:
-			last = atof(toys.optargs[toys.optc-1]);
-	}
+  // Parse command line arguments, with appropriate defaults.
+  // Note that any non-numeric arguments are treated as zero.
+  first = increment = 1;
+  switch (toys.optc) {
+    case 3:
+      increment = atof(toys.optargs[1]);
+    case 2:
+      first = atof(*toys.optargs);
+    default:
+      last = atof(toys.optargs[toys.optc-1]);
+  }
 
-	// Yes, we're looping on a double.  Yes rounding errors can accumulate if
-	// you use a non-integer increment.  Deal with it.
-	for (dd=first; (increment>0 && dd<=last) || (increment <0 && dd>=last);
-		dd+=increment)
-	{
-		printf("%g\n", dd);
-	}
+  // Yes, we're looping on a double.  Yes rounding errors can accumulate if
+  // you use a non-integer increment.  Deal with it.
+  for (dd=first; (increment>0 && dd<=last) || (increment<0 && dd>=last);
+    dd+=increment)
+  {
+    printf("%g\n", dd);
+  }
 }
--- a/toys/lsb/sync.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/lsb/sync.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,6 +1,4 @@
-/* vi: set sw=4 ts=4:
- *
- * sync.c - Write all pending data to disk.
+/* sync.c - Write all pending data to disk.
  *
  * Copyright 2007 Rob Landley <rob@landley.net>
  *
@@ -9,17 +7,17 @@
 USE_SYNC(NEWTOY(sync, NULL, TOYFLAG_BIN))
 
 config SYNC
-	bool "sync"
-	default y
-	help
-	  usage: sync
+  bool "sync"
+  default y
+  help
+    usage: sync
 
-	  Write pending cached data to disk (synchronize), blocking until done.
+    Write pending cached data to disk (synchronize), blocking until done.
 */
 
 #include "toys.h"
 
 void sync_main(void)
 {
-	sync();
+  sync();
 }
--- a/toys/other/bzcat.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/other/bzcat.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,28 +1,26 @@
-/* vi: set sw=4 ts=4:
- *
- * bzcat.c - decompress stdin to stdout using bunzip2.
+/* bzcat.c - decompress stdin to stdout using bunzip2.
  *
  * Copyright 2007 Rob Landley <rob@landley.net>
 
 USE_BZCAT(NEWTOY(bzcat, NULL, TOYFLAG_USR|TOYFLAG_BIN))
 
 config BZCAT
-	bool "bzcat"
-	default y
-	help
-	  usage: bzcat [filename...]
+  bool "bzcat"
+  default y
+  help
+    usage: bzcat [filename...]
 
-	  Decompress listed files to stdout.  Use stdin if no files listed.
+    Decompress listed files to stdout. Use stdin if no files listed.
 */
 
 #include "toys.h"
 
 static void do_bzcat(int fd, char *name)
 {
-    bunzipStream(fd, 1);
+  bunzipStream(fd, 1);
 }
 
 void bzcat_main(void)
 {
-    loopfiles(toys.optargs, do_bzcat);
+  loopfiles(toys.optargs, do_bzcat);
 }
--- a/toys/other/catv.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/other/catv.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,6 +1,4 @@
-/* vi: set sw=4 ts=4:
- *
- * cat -v implementation for toybox
+/* cat -v implementation for toybox
  *
  * Copyright (C) 2006, 2007 Rob Landley <rob@landley.net>
  *
@@ -10,17 +8,17 @@
 USE_CATV(NEWTOY(catv, "vte", TOYFLAG_USR|TOYFLAG_BIN))
 
 config CATV
-	bool "catv"
-	default y
-	help
-	  usage: catv [-evt] [filename...]
+  bool "catv"
+  default y
+  help
+    usage: catv [-evt] [filename...]
 
-	  Display nonprinting characters as escape sequences.  Use M-x for
-	  high ascii characters (>127), and ^x for other nonprinting chars.
+    Display nonprinting characters as escape sequences. Use M-x for
+    high ascii characters (>127), and ^x for other nonprinting chars.
 
-	  -e	Mark each newline with $
-	  -t	Show tabs as ^I
-	  -v	Don't use ^x or M-x escapes.
+    -e	Mark each newline with $
+    -t	Show tabs as ^I
+    -v	Don't use ^x or M-x escapes.
 */
 
 #define FOR_catv
@@ -30,40 +28,40 @@
 
 static void do_catv(int fd, char *name)
 {
-	for(;;) {
-		int i, len;
+  for(;;) {
+    int i, len;
 
-		len = read(fd, toybuf, sizeof(toybuf));
-		if (len < 0) toys.exitval = EXIT_FAILURE;
-		if (len < 1) break;
-		for (i=0; i<len; i++) {
-			char c=toybuf[i];
+    len = read(fd, toybuf, sizeof(toybuf));
+    if (len < 0) toys.exitval = EXIT_FAILURE;
+    if (len < 1) break;
+    for (i=0; i<len; i++) {
+      char c=toybuf[i];
 
-			if (c > 126 && (toys.optflags & FLAG_v)) {
-				if (c > 127) {
-					printf("M-");
-					c -= 128;
-				}
-				if (c == 127) {
-					printf("^?");
-					continue;
-				}
-			}
-			if (c < 32) {
-				if (c == 10) {
-					if (toys.optflags & FLAG_e) xputc('$');
-				} else if (toys.optflags & (c==9 ? FLAG_t : FLAG_v)) {
-					printf("^%c", c+'@');
-					continue;
-				}
-			}
-			xputc(c);
-		}
-	}
+      if (c > 126 && (toys.optflags & FLAG_v)) {
+        if (c > 127) {
+          printf("M-");
+          c -= 128;
+        }
+        if (c == 127) {
+          printf("^?");
+          continue;
+        }
+      }
+      if (c < 32) {
+        if (c == 10) {
+          if (toys.optflags & FLAG_e) xputc('$');
+        } else if (toys.optflags & (c==9 ? FLAG_t : FLAG_v)) {
+          printf("^%c", c+'@');
+          continue;
+        }
+      }
+      xputc(c);
+    }
+  }
 }
 
 void catv_main(void)
 {
-	toys.optflags ^= FLAG_v;
-	loopfiles(toys.optargs, do_catv);
+  toys.optflags ^= FLAG_v;
+  loopfiles(toys.optargs, do_catv);
 }
--- a/toys/other/chroot.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/other/chroot.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,26 +1,23 @@
-/* vi: set sw=4 ts=4:
- *
- * chroot.c - Run command in new root directory.
+/* chroot.c - Run command in new root directory.
  *
  * Copyright 2007 Rob Landley <rob@landley.net>
 
 USE_CHROOT(NEWTOY(chroot, "^<1", TOYFLAG_USR|TOYFLAG_SBIN))
 
 config CHROOT
-	bool "chroot"
-	default y
-	help
-	  usage: chroot NEWPATH [commandline...]
+  bool "chroot"
+  default y
+  help
+    usage: chroot NEWPATH [commandline...]
 
-	  Run command within a new root directory.  If no command, run /bin/sh.
+    Run command within a new root directory. If no command, run /bin/sh.
 */
 
 #include "toys.h"
 
 void chroot_main(void)
 {
-	char *binsh[] = {"/bin/sh", "-i", 0};
-	if (chdir(*toys.optargs) || chroot("."))
-		perror_exit("%s", *toys.optargs);
-	xexec(toys.optargs[1] ? toys.optargs+1 : binsh);
+  char *binsh[] = {"/bin/sh", "-i", 0};
+  if (chdir(*toys.optargs) || chroot(".")) perror_exit("%s", *toys.optargs);
+  xexec(toys.optargs[1] ? toys.optargs+1 : binsh);
 }
--- a/toys/other/chvt.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/other/chvt.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,22 +1,20 @@
-/* vi: set sw=4 ts=4:
- *
- * chvt.c - switch virtual terminals
+/* chvt.c - switch virtual terminals
  *
  * Copyright (C) 2008 David Anders <danders@amltd.com>
 
 USE_CHVT(NEWTOY(chvt, "<1", TOYFLAG_USR|TOYFLAG_SBIN))
 
 config CHVT
-	bool "chvt"
-	default y
-	help
-	  usage: chvt N
+  bool "chvt"
+  default y
+  help
+    usage: chvt N
 
-	  Change to virtual terminal number N.  (This only works in text mode.)
+    Change to virtual terminal number N. (This only works in text mode.)
 
-	  Virtual terminals are the Linux VGA text mode displays, ordinarily
-	  switched between via alt-F1, alt-F2, etc.  Use ctrl-alt-F1 to switch
-	  from X to a virtual terminal, and alt-F6 (or F7, or F8) to get back.
+    Virtual terminals are the Linux VGA text mode displays, ordinarily
+    switched between via alt-F1, alt-F2, etc. Use ctrl-alt-F1 to switch
+    from X to a virtual terminal, and alt-F6 (or F7, or F8) to get back.
 */
 
 #include "toys.h"
@@ -24,26 +22,26 @@
 /* Note: get_console_fb() will need to be moved into a seperate lib section */
 int get_console_fd()
 {
-	int fd;
-	char *consoles[]={"/dev/console", "/dev/vc/0", "/dev/tty", NULL}, **cc;
+  int fd;
+  char *consoles[]={"/dev/console", "/dev/vc/0", "/dev/tty", NULL}, **cc;
 
-	cc = consoles;
-	while (*cc) {
-		fd = open(*cc++, O_RDWR);
-		if (fd >= 0) return fd;
-	}
+  cc = consoles;
+  while (*cc) {
+    fd = open(*cc++, O_RDWR);
+    if (fd >= 0) return fd;
+  }
 
-	return -1;
+  return -1;
 }
 
 void chvt_main(void)
 {
-	int vtnum, fd;
+  int vtnum, fd;
 
-	vtnum=atoi(*toys.optargs);
+  vtnum=atoi(*toys.optargs);
 
-	fd=get_console_fd();
-	// These numbers are VT_ACTIVATE and VT_WAITACTIVE from linux/vt.h
-	if (fd < 0 || ioctl(fd, 0x5606, vtnum) || ioctl(fd, 0x5607, vtnum))
-		perror_exit(NULL);
+  fd=get_console_fd();
+  // These numbers are VT_ACTIVATE and VT_WAITACTIVE from linux/vt.h
+  if (fd < 0 || ioctl(fd, 0x5606, vtnum) || ioctl(fd, 0x5607, vtnum))
+    perror_exit(NULL);
 }
--- a/toys/other/clear.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/other/clear.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,21 +1,19 @@
-/* vi: set sw=4 ts=4:
- *
- * clear.c - clear the screen
+/* clear.c - clear the screen
  *
  * Copyright 2012 Rob Landley <rob@landley.net>
 
 USE_CLEAR(NEWTOY(clear, NULL, TOYFLAG_USR|TOYFLAG_BIN))
 
 config CLEAR
-	bool "clear"
-	default y
-	help
-	  Clear the screen.
+  bool "clear"
+  default y
+  help
+    Clear the screen.
 */
 
 #include "toys.h"
 
 void clear_main(void)
 {
-	write(1, "\e[2J\e[H", 7);
+  write(1, "\e[2J\e[H", 7);
 }
--- a/toys/other/count.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/other/count.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,34 +1,32 @@
-/* vi: set sw=4 ts=4:
- *
- * count.c - Progress indicator from stdin to stdout
+/* count.c - Progress indicator from stdin to stdout
  *
  * Copyright 2002 Rob Landley <rob@landley.net>
 
 USE_COUNT(NEWTOY(count, NULL, TOYFLAG_USR|TOYFLAG_BIN))
 
 config COUNT
-	bool "count"
-	default y
-	help
-	  usage: count
+  bool "count"
+  default y
+  help
+    usage: count
 
-	  Copy stdin to stdout, displaying simple progress indicator to stderr.
+    Copy stdin to stdout, displaying simple progress indicator to stderr.
 */
 
 #include "toys.h"
 
 void count_main(void)
 {
-	uint64_t size = 0;
-	int len;
-	char buf[32];
+  uint64_t size = 0;
+  int len;
+  char buf[32];
 
-	for (;;) {
-		len = xread(0, toybuf, sizeof(toybuf));
-		if (!len) break;
-		size += len;
-		xwrite(1, toybuf, len);
-		xwrite(2, buf, sprintf(buf, "%"PRIu64" bytes\r", size));
-	}
-	xwrite(2, "\n", 1);
+  for (;;) {
+    len = xread(0, toybuf, sizeof(toybuf));
+    if (!len) break;
+    size += len;
+    xwrite(1, toybuf, len);
+    xwrite(2, buf, sprintf(buf, "%"PRIu64" bytes\r", size));
+  }
+  xwrite(2, "\n", 1);
 }
--- a/toys/other/dos2unix.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/other/dos2unix.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,6 +1,4 @@
-/* vi: set sw=4 ts=4:
- *
- * dos2unix.c - convert newline format
+/* dos2unix.c - convert newline format
  *
  * Copyright 2012 Rob Landley <rob@landley.net>
 
@@ -8,60 +6,60 @@
 USE_DOS2UNIX(OLDTOY(unix2dos, dos2unix, NULL, TOYFLAG_BIN))
 
 config DOS2UNIX
-	bool "dos2unix/unix2dos"
-	default y
-	help
-	  usage: dos2unix/unix2dos [file...]
+  bool "dos2unix/unix2dos"
+  default y
+  help
+    usage: dos2unix/unix2dos [file...]
 
-	  Convert newline format between dos (\r\n) and unix (just \n)
-	  If no files listed copy from stdin, "-" is a synonym for stdin.
+    Convert newline format between dos (\r\n) and unix (just \n)
+    If no files listed copy from stdin, "-" is a synonym for stdin.
 */
 
 #define FOR_dos2unix
 #include "toys.h"
 
 GLOBALS(
-	char *tempfile;
+  char *tempfile;
 )
 
 static void do_dos2unix(int fd, char *name)
 {
-	char c = toys.which->name[0];
-	int outfd = 1, catch = 0;
+  char c = toys.which->name[0];
+  int outfd = 1, catch = 0;
 
-	if (fd) outfd = copy_tempfile(fd, name, &TT.tempfile);
+  if (fd) outfd = copy_tempfile(fd, name, &TT.tempfile);
 
-	for (;;) {
-		int len, in, out;
+  for (;;) {
+    int len, in, out;
 
-		len = read(fd, toybuf+(sizeof(toybuf)/2), sizeof(toybuf)/2);
-		if (len<0) {
-			perror_msg("%s",name);
-			toys.exitval = 1;
-		}
-		if (len<1) break;
+    len = read(fd, toybuf+(sizeof(toybuf)/2), sizeof(toybuf)/2);
+    if (len<0) {
+      perror_msg("%s",name);
+      toys.exitval = 1;
+    }
+    if (len<1) break;
 
-		for (in = out = 0; in < len; in++) {
-			char x = toybuf[in+sizeof(toybuf)/2];
+    for (in = out = 0; in < len; in++) {
+      char x = toybuf[in+sizeof(toybuf)/2];
 
-			// Drop \r only if followed by \n in dos2unix mode
-			if (catch) {
-				if (c == 'u' || x != '\n') toybuf[out++] = '\r';
-				catch = 0;
-			// Add \r only if \n not after \r in unix2dos mode
-			} else if (c == 'u' && x == '\n') toybuf[out++] = '\r';
+      // Drop \r only if followed by \n in dos2unix mode
+      if (catch) {
+        if (c == 'u' || x != '\n') toybuf[out++] = '\r';
+        catch = 0;
+      // Add \r only if \n not after \r in unix2dos mode
+      } else if (c == 'u' && x == '\n') toybuf[out++] = '\r';
 
-			if (x == '\r') catch++;
-			else toybuf[out++] = x;
-		}
-		xwrite(outfd, toybuf, out);
-	}
-	if (catch) xwrite(outfd, "\r", 1);
+      if (x == '\r') catch++;
+      else toybuf[out++] = x;
+    }
+    xwrite(outfd, toybuf, out);
+  }
+  if (catch) xwrite(outfd, "\r", 1);
 
-	if (fd) replace_tempfile(-1, outfd, &TT.tempfile);
+  if (fd) replace_tempfile(-1, outfd, &TT.tempfile);
 }
 
 void dos2unix_main(void)
 {
-	loopfiles(toys.optargs, do_dos2unix);
+  loopfiles(toys.optargs, do_dos2unix);
 }
--- a/toys/other/free.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/other/free.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,59 +1,57 @@
-/* vi: set sw=4 ts=4:
- *
- * free.c - Display amount of free and used memory in the system.
+/* free.c - Display amount of free and used memory in the system.
  *
  * Copyright 2012 Elie De Brauwer <eliedebrauwer@gmail.com>
 
 USE_FREE(NEWTOY(free, "gmkb", TOYFLAG_USR|TOYFLAG_BIN))
 
 config FREE
-	bool "free"
-	default y
-	help
-	  usage: free [-bkmg]
+  bool "free"
+  default y
+  help
+    usage: free [-bkmg]
 
-	  Display the total, free and used amount of physical memory and
-	  swap space.
+    Display the total, free and used amount of physical memory and
+    swap space.
 
-	  -bkmg    Output in bytes (default), KB, MB or GB
+    -bkmg	Output in bytes (default), KB, MB or GB
 */
 
 #define FOR_free
 #include "toys.h"
 
 static unsigned long long convert(unsigned long d, unsigned int iscale,
-				unsigned int oscale)
+        unsigned int oscale)
 {
-	return ((unsigned long long)d*iscale)>>oscale;
+  return ((unsigned long long)d*iscale)>>oscale;
 }
 
 void free_main(void)
 {
-	struct sysinfo info;
-	unsigned int iscale = 1;
-	unsigned int oscale = 0;
+  struct sysinfo info;
+  unsigned int iscale = 1;
+  unsigned int oscale = 0;
 
-	sysinfo(&info);
-	if (info.mem_unit) iscale = info.mem_unit;
-	if (toys.optflags & FLAG_b) oscale = 0;
-	if (toys.optflags & FLAG_k) oscale = 10;
-	if (toys.optflags & FLAG_m) oscale = 20;
-	if (toys.optflags & FLAG_g) oscale = 30;
+  sysinfo(&info);
+  if (info.mem_unit) iscale = info.mem_unit;
+  if (toys.optflags & FLAG_b) oscale = 0;
+  if (toys.optflags & FLAG_k) oscale = 10;
+  if (toys.optflags & FLAG_m) oscale = 20;
+  if (toys.optflags & FLAG_g) oscale = 30;
 
-	xprintf("\t\ttotal        used        free      shared     buffers\n");
-	xprintf("Mem:%17llu%12llu%12llu%12llu%12llu\n",
-		convert(info.totalram, iscale, oscale),
-		convert(info.totalram-info.freeram, iscale, oscale),
-		convert(info.freeram, iscale, oscale),
-		convert(info.sharedram, iscale, oscale),
-		convert(info.bufferram, iscale, oscale));
+  xprintf("\t\ttotal        used        free      shared     buffers\n");
+  xprintf("Mem:%17llu%12llu%12llu%12llu%12llu\n",
+    convert(info.totalram, iscale, oscale),
+    convert(info.totalram-info.freeram, iscale, oscale),
+    convert(info.freeram, iscale, oscale),
+    convert(info.sharedram, iscale, oscale),
+    convert(info.bufferram, iscale, oscale));
 
-	xprintf("-/+ buffers/cache:%15llu%12llu\n",
-		convert(info.totalram - info.freeram - info.bufferram, iscale, oscale),
-		convert(info.freeram + info.bufferram, iscale, oscale));
+  xprintf("-/+ buffers/cache:%15llu%12llu\n",
+    convert(info.totalram - info.freeram - info.bufferram, iscale, oscale),
+    convert(info.freeram + info.bufferram, iscale, oscale));
 
-	xprintf("Swap:%16llu%12llu%12llu\n",
-		convert(info.totalswap, iscale, oscale),
-		convert(info.totalswap - info.freeswap, iscale, oscale),
-		convert(info.freeswap, iscale, oscale));
+  xprintf("Swap:%16llu%12llu%12llu\n",
+    convert(info.totalswap, iscale, oscale),
+    convert(info.totalswap - info.freeswap, iscale, oscale),
+    convert(info.freeswap, iscale, oscale));
 }
--- a/toys/other/hello.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/other/hello.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,6 +1,4 @@
-/* vi: set sw=4 ts=4:
- *
- * hello.c - A hello world program. (Template for new commands.)
+/* hello.c - A hello world program. (Template for new commands.)
  *
  * Copyright 2012 Rob Landley <rob@landley.net>
  *
@@ -10,15 +8,15 @@
 USE_HELLO(NEWTOY(hello, "e@d*c#b:a", TOYFLAG_USR|TOYFLAG_BIN))
 
 config HELLO
-	bool "hello"
-	default n
-	help
-	  usage: hello [-a] [-b string] [-c number] [-d list] [-e count] [...]
+  bool "hello"
+  default n
+  help
+    usage: hello [-a] [-b string] [-c number] [-d list] [-e count] [...]
 
-	  A hello world program.  You don't need this.
+    A hello world program.  You don't need this.
 
-	  Mostly used as an example/skeleton file for adding new commands,
-	  occasionally nice to test kernel booting via "init=/bin/hello".
+    Mostly used as an example/skeleton file for adding new commands,
+    occasionally nice to test kernel booting via "init=/bin/hello".
 */
 
 #define FOR_hello
@@ -27,26 +25,26 @@
 // Hello doesn't use these globals, they're here for example/skeleton purposes.
 
 GLOBALS(
-	char *b_string;
-	long c_number;
-	struct arg_list *d_list;
-	long e_count;
+  char *b_string;
+  long c_number;
+  struct arg_list *d_list;
+  long e_count;
 
-	int more_globals;
+  int more_globals;
 )
 
 void hello_main(void)
 {
-	printf("Hello world\n");
+  printf("Hello world\n");
 
-	if (toys.optflags & FLAG_a) printf("Saw a\n");
-	if (toys.optflags & FLAG_b) printf("b=%s\n", TT.b_string);
-	if (toys.optflags & FLAG_c) printf("c=%ld\n", TT.c_number);
-	while (TT.d_list) {
-		printf("d=%s\n", TT.d_list->arg);
-		TT.d_list = TT.d_list->next;
-	}
-	if (TT.e_count) printf("e was seen %ld times", TT.e_count);
+  if (toys.optflags & FLAG_a) printf("Saw a\n");
+  if (toys.optflags & FLAG_b) printf("b=%s\n", TT.b_string);
+  if (toys.optflags & FLAG_c) printf("c=%ld\n", TT.c_number);
+  while (TT.d_list) {
+    printf("d=%s\n", TT.d_list->arg);
+    TT.d_list = TT.d_list->next;
+  }
+  if (TT.e_count) printf("e was seen %ld times", TT.e_count);
 
-	while (*toys.optargs) printf("optarg=%s\n", *(toys.optargs++));
+  while (*toys.optargs) printf("optarg=%s\n", *(toys.optargs++));
 }
--- a/toys/other/help.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/other/help.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,6 +1,4 @@
-/* vi: set sw=4 ts=4:
- *
- * help.c - Show help for toybox commands
+/* help.c - Show help for toybox commands
  *
  * Copyright 2007 Rob Landley <rob@landley.net>
  *
@@ -9,15 +7,15 @@
 USE_HELP(NEWTOY(help, "<1", TOYFLAG_BIN))
 
 config HELP
-	bool "help"
-	default y
-	help
-	  usage: help [command]
+  bool "help"
+  default y
+  help
+    usage: help [command]
 
-	  Show usage information for toybox commands.
-	  Run "toybox" with no arguments for a list of available commands.
+    Show usage information for toybox commands.
+    Run "toybox" with no arguments for a list of available commands.
 */
- 
+
 
 #include "toys.h"
 #include "generated/help.h"
@@ -32,17 +30,17 @@
 
 void help_main(void)
 {
-	struct toy_list *t = toy_find(*toys.optargs);
-	int i = t-toy_list;
-	char *s = help_data;
+  struct toy_list *t = toy_find(*toys.optargs);
+  int i = t-toy_list;
+  char *s = help_data;
 
-	if (!t) error_exit("Unknown command '%s'", *toys.optargs);
-	for (;;) {
-		while (i--) s += strlen(s) + 1;
-		if (*s != 255) break;
-		i = toy_find(++s)-toy_list;
-		s = help_data;
-	}
+  if (!t) error_exit("Unknown command '%s'", *toys.optargs);
+  for (;;) {
+    while (i--) s += strlen(s) + 1;
+    if (*s != 255) break;
+    i = toy_find(++s)-toy_list;
+    s = help_data;
+  }
 
-	fprintf(toys.exithelp ? stderr : stdout, "%s", s);
+  fprintf(toys.exithelp ? stderr : stdout, "%s", s);
 }
--- a/toys/other/insmod.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/other/insmod.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,18 +1,16 @@
-/* vi: set sw=4 ts=4:
- *
- * insmod.c - Load a module into the Linux kernel.
+/* insmod.c - Load a module into the Linux kernel.
  *
  * Copyright 2012 Elie De Brauwer <eliedebrauwer@gmail.com>
 
 USE_INSMOD(NEWTOY(insmod, "<1", TOYFLAG_BIN|TOYFLAG_NEEDROOT))
 
 config INSMOD
-	bool "insmod"
-	default y
-	help
-	  usage: insmod MODULE [MODULE_OPTIONS]
+  bool "insmod"
+  default y
+  help
+    usage: insmod MODULE [MODULE_OPTIONS]
 
-	  Load the module named MODULE passing options if given.
+    Load the module named MODULE passing options if given.
 */
 
 #include "toys.h"
@@ -22,24 +20,23 @@
 
 void insmod_main(void)
 {
-	char * buf = NULL;
-	int len, res, i;
-	int fd = xopen(toys.optargs[0], O_RDONLY);
+  char * buf = NULL;
+  int len, res, i;
+  int fd = xopen(toys.optargs[0], O_RDONLY);
 
-	len = fdlength(fd);
-	buf = xmalloc(len);
-	xreadall(fd, buf, len);
+  len = fdlength(fd);
+  buf = xmalloc(len);
+  xreadall(fd, buf, len);
 
-	i = 1;
-	while(toys.optargs[i] &&
-		strlen(toybuf) + strlen(toys.optargs[i]) + 2 < sizeof(toybuf)) {
-		strcat(toybuf, toys.optargs[i++]);
-		strcat(toybuf, " ");
-	}
+  i = 1;
+  while(toys.optargs[i] &&
+    strlen(toybuf) + strlen(toys.optargs[i]) + 2 < sizeof(toybuf)) {
+    strcat(toybuf, toys.optargs[i++]);
+    strcat(toybuf, " ");
+  }
 
-	res = init_module(buf, len, toybuf);
-	if (CFG_TOYBOX_FREE && buf != toybuf) free(buf);
+  res = init_module(buf, len, toybuf);
+  if (CFG_TOYBOX_FREE && buf != toybuf) free(buf);
 
-	if (res)
-		perror_exit("failed to load %s", toys.optargs[0]);
+  if (res) perror_exit("failed to load %s", toys.optargs[0]);
 }
--- a/toys/other/login.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/other/login.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,6 +1,4 @@
-/* vi: set sw=4 ts=4:
- *
- * login.c - Start a session on the system.
+/* login.c - Start a session on the system.
  *
  * Copyright 2012 Elie De Brauwer <eliedebrauwer@gmail.com>
  *
@@ -10,15 +8,15 @@
 USE_LOGIN(NEWTOY(login, ">1fph:", TOYFLAG_BIN))
 
 config LOGIN
-	bool "login"
-	default y
-	help
-	  usage: login [-p] [-h host] [[-f] username]
+  bool "login"
+  default y
+  help
+    usage: login [-p] [-h host] [[-f] username]
 
-	  Establish a new session with the system.
-	  -p    Preserve environment
-	  -h    The name of the remote host for this login
-	  -f    Do not perform authentication
+    Establish a new session with the system.
+    -p	Preserve environment
+    -h	The name of the remote host for this login
+    -f	Do not perform authentication
 */
 
 #define FOR_login
@@ -30,215 +28,199 @@
 #define HOSTNAME_SIZE 32
 
 GLOBALS(
-	char *hostname;
+  char *hostname;
 )
 
 static void login_timeout_handler(int sig __attribute__((unused)))
 {
-	printf("\nLogin timed out after %d seconds.\n", LOGIN_TIMEOUT);
-	exit(0);
+  printf("\nLogin timed out after %d seconds.\n", LOGIN_TIMEOUT);
+  exit(0);
 }
 
 static char *forbid[] = {
-	"BASH_ENV",
-	"ENV",
-	"HOME",
-	"IFS",
-	"LD_LIBRARY_PATH",
-	"LD_PRELOAD",
-	"LD_TRACE_LOADED_OBJECTS",
-	"LD_BIND_NOW",
-	"LD_AOUT_LIBRARY_PATH",
-	"LD_AOUT_PRELOAD",
-	"LD_NOWARN",
-	"LD_KEEPDIR",
-	"SHELL",
-	NULL
+  "BASH_ENV", "ENV", "HOME", "IFS", "LD_LIBRARY_PATH", "LD_PRELOAD",
+  "LD_TRACE_LOADED_OBJECTS", "LD_BIND_NOW", "LD_AOUT_LIBRARY_PATH",
+  "LD_AOUT_PRELOAD", "LD_NOWARN", "LD_KEEPDIR", "SHELL", NULL
 };
 
 int verify_password(char * pwd)
 {
-	char *pass;
+  char *pass;
 
-	if (read_password(toybuf, sizeof(toybuf), "Password: ")) return 1;
-	if (!pwd) return 1;
-	if (pwd[0] == '!' || pwd[0] == '*') return 1;
+  if (read_password(toybuf, sizeof(toybuf), "Password: ")) return 1;
+  if (!pwd) return 1;
+  if (pwd[0] == '!' || pwd[0] == '*') return 1;
 
-	pass = crypt(toybuf, pwd);
-	if (pass && !strcmp(pass, pwd)) return 0;
+  pass = crypt(toybuf, pwd);
+  if (pass && !strcmp(pass, pwd)) return 0;
 
-	return 1;
+  return 1;
 }
 
 void read_user(char * buff, int size)
 {
-	char hostname[HOSTNAME_SIZE+1];
-	int i = 0;
-	hostname[HOSTNAME_SIZE] = 0;
-	if(!gethostname(hostname, HOSTNAME_SIZE)) fputs(hostname, stdout);
+  char hostname[HOSTNAME_SIZE+1];
+  int i = 0;
+  hostname[HOSTNAME_SIZE] = 0;
+  if(!gethostname(hostname, HOSTNAME_SIZE)) fputs(hostname, stdout);
 
-	fputs(" login: ", stdout);
-	fflush(stdout);
+  fputs(" login: ", stdout);
+  fflush(stdout);
 
-	do {
-		buff[0] = getchar();
-		if (buff[0] == EOF)
-			exit(EXIT_FAILURE);
-	} while (isblank(buff[0]));
+  do {
+    buff[0] = getchar();
+    if (buff[0] == EOF) exit(EXIT_FAILURE);
+  } while (isblank(buff[0]));
 
-	if (buff[0] != '\n')
-		if(!fgets(&buff[1], HOSTNAME_SIZE-1, stdin))
-			_exit(1);
+  if (buff[0] != '\n') if(!fgets(&buff[1], HOSTNAME_SIZE-1, stdin)) _exit(1);
 
-	while(i<HOSTNAME_SIZE-1 && isgraph(buff[i])) i++;
-	buff[i] = 0;
+  while(i<HOSTNAME_SIZE-1 && isgraph(buff[i])) i++;
+  buff[i] = 0;
 }
 
 void handle_nologin(void)
 {
-	int fd = open("/etc/nologin", O_RDONLY);
-	int size;
-	if (fd == -1) return;
+  int fd = open("/etc/nologin", O_RDONLY);
+  int size;
+  if (fd == -1) return;
 
-	size = readall(fd, toybuf,sizeof(toybuf)-1);
-	toybuf[size] = 0;
-	if (!size) puts("System closed for routine maintenance\n");
-	else puts(toybuf);
+  size = readall(fd, toybuf,sizeof(toybuf)-1);
+  toybuf[size] = 0;
+  if (!size) puts("System closed for routine maintenance\n");
+  else puts(toybuf);
 
-	close(fd);
-	fflush(stdout);
-	exit(EXIT_FAILURE);
+  close(fd);
+  fflush(stdout);
+  exit(EXIT_FAILURE);
 }
 
 void handle_motd(void)
 {
-	int fd = open("/etc/motd", O_RDONLY);
-	int size;
-	if (fd == -1) return;
+  int fd = open("/etc/motd", O_RDONLY);
+  int size;
+  if (fd == -1) return;
 
-	size = readall(fd, toybuf,sizeof(toybuf)-1);
-	toybuf[size] = 0;
-	puts(toybuf);
+  size = readall(fd, toybuf,sizeof(toybuf)-1);
+  toybuf[size] = 0;
+  puts(toybuf);
 
-	close(fd);
-	fflush(stdout);
+  close(fd);
+  fflush(stdout);
 }
 
 int change_identity(const struct passwd *pwd)
 {
-	if (initgroups(pwd->pw_name,pwd->pw_gid)) return 1;
-	if (setgid(pwd->pw_uid)) return 1;
-	if (setuid(pwd->pw_uid)) return 1;
+  if (initgroups(pwd->pw_name,pwd->pw_gid)) return 1;
+  if (setgid(pwd->pw_uid)) return 1;
+  if (setuid(pwd->pw_uid)) return 1;
 
-	return 0;
+  return 0;
 }
 
 void spawn_shell(const char *shell)
 {
-	const char * exec_name = strrchr(shell,'/');
-	if (exec_name) exec_name++;
-	else exec_name = shell;
+  const char * exec_name = strrchr(shell,'/');
+  if (exec_name) exec_name++;
+  else exec_name = shell;
 
-	snprintf(toybuf,sizeof(toybuf)-1, "-%s", shell);
-	execl(shell, toybuf, NULL);
-	error_exit("Failed to spawn shell");
+  snprintf(toybuf,sizeof(toybuf)-1, "-%s", shell);
+  execl(shell, toybuf, NULL);
+  error_exit("Failed to spawn shell");
 }
 
 void setup_environment(const struct passwd *pwd, int clear_env)
 {
-	if (chdir(pwd->pw_dir)) printf("bad home dir: %s\n", pwd->pw_dir);
+  if (chdir(pwd->pw_dir)) printf("bad home dir: %s\n", pwd->pw_dir);
 
-	if (clear_env) {
-		const char * term = getenv("TERM");
-		clearenv();
-		if (term) setenv("TERM", term, 1);
-	}
+  if (clear_env) {
+    const char * term = getenv("TERM");
+    clearenv();
+    if (term) setenv("TERM", term, 1);
+  }
 
-	setenv("USER", pwd->pw_name, 1);
-	setenv("LOGNAME", pwd->pw_name, 1);
-	setenv("HOME", pwd->pw_dir, 1);
-	setenv("SHELL", pwd->pw_shell, 1);
+  setenv("USER", pwd->pw_name, 1);
+  setenv("LOGNAME", pwd->pw_name, 1);
+  setenv("HOME", pwd->pw_dir, 1);
+  setenv("SHELL", pwd->pw_shell, 1);
 }
 
 void login_main(void)
 {
-	int f_flag = toys.optflags & FLAG_f;
-	int h_flag = toys.optflags & FLAG_h;
-	char username[USER_NAME_MAX_SIZE+1], *pass = NULL, **ss;
-	struct passwd * pwd = NULL;
-	struct spwd * spwd = NULL;
-	int auth_fail_cnt = 0;
+  int f_flag = toys.optflags & FLAG_f;
+  int h_flag = toys.optflags & FLAG_h;
+  char username[USER_NAME_MAX_SIZE+1], *pass = NULL, **ss;
+  struct passwd * pwd = NULL;
+  struct spwd * spwd = NULL;
+  int auth_fail_cnt = 0;
 
-	if (f_flag && toys.optc != 1)
-		error_exit("-f requires username");
+  if (f_flag && toys.optc != 1) error_exit("-f requires username");
 
-	if (geteuid()) error_exit("not root");
+  if (geteuid()) error_exit("not root");
 
-	if (!isatty(0) || !isatty(1) || !isatty(2)) error_exit("no tty");
+  if (!isatty(0) || !isatty(1) || !isatty(2)) error_exit("no tty");
 
-	openlog("login", LOG_PID | LOG_CONS, LOG_AUTH);
-	signal(SIGALRM, login_timeout_handler);
-	alarm(LOGIN_TIMEOUT);
+  openlog("login", LOG_PID | LOG_CONS, LOG_AUTH);
+  signal(SIGALRM, login_timeout_handler);
+  alarm(LOGIN_TIMEOUT);
 
-	for (ss = forbid; *ss; ss++) unsetenv(*ss);
+  for (ss = forbid; *ss; ss++) unsetenv(*ss);
 
-	while (1) {
-		tcflush(0, TCIFLUSH);
+  while (1) {
+    tcflush(0, TCIFLUSH);
 
-		username[USER_NAME_MAX_SIZE] = 0;
-		if (toys.optargs[0])
-			strncpy(username, toys.optargs[0], USER_NAME_MAX_SIZE);
-		else {
-			read_user(username, USER_NAME_MAX_SIZE+1);
-			if (username[0] == 0) continue;
-		}
+    username[USER_NAME_MAX_SIZE] = 0;
+    if (toys.optargs[0]) strncpy(username, toys.optargs[0], USER_NAME_MAX_SIZE);
+    else {
+      read_user(username, USER_NAME_MAX_SIZE+1);
+      if (username[0] == 0) continue;
+    }
 
-		pwd = getpwnam(username);
-		if (!pwd) goto query_pass; // Non-existing user
+    pwd = getpwnam(username);
+    if (!pwd) goto query_pass; // Non-existing user
 
-		if (pwd->pw_passwd[0] == '!' || pwd->pw_passwd[0] == '*')
-			goto query_pass;  // Locked account
+    if (pwd->pw_passwd[0] == '!' || pwd->pw_passwd[0] == '*')
+      goto query_pass;  // Locked account
 
-		if (f_flag) break; // Pre-authenticated
+    if (f_flag) break; // Pre-authenticated
 
-		if (!pwd->pw_passwd[0]) break; // Password-less account
+    if (!pwd->pw_passwd[0]) break; // Password-less account
 
-		pass = pwd->pw_passwd;
-		if (pwd->pw_passwd[0] == 'x') {
-			spwd = getspnam (username);
-			if (spwd) pass = spwd->sp_pwdp;
-		}
+    pass = pwd->pw_passwd;
+    if (pwd->pw_passwd[0] == 'x') {
+      spwd = getspnam (username);
+      if (spwd) pass = spwd->sp_pwdp;
+    }
 
 query_pass:
-		if (!verify_password(pass)) break;
+    if (!verify_password(pass)) break;
 
-		f_flag = 0;
-		syslog(LOG_WARNING, "invalid password for '%s' on %s %s %s", username,
-			ttyname(0), h_flag?"from":"", h_flag?TT.hostname:"");
+    f_flag = 0;
+    syslog(LOG_WARNING, "invalid password for '%s' on %s %s %s", username,
+      ttyname(0), h_flag?"from":"", h_flag?TT.hostname:"");
 
-		sleep(LOGIN_FAIL_TIMEOUT);
-		puts("Login incorrect");
+    sleep(LOGIN_FAIL_TIMEOUT);
+    puts("Login incorrect");
 
-		if (++auth_fail_cnt == 3)
-			error_exit("Maximum number of tries exceeded (%d)\n", auth_fail_cnt);
+    if (++auth_fail_cnt == 3)
+      error_exit("Maximum number of tries exceeded (%d)\n", auth_fail_cnt);
 
-		username[0] = 0;
-		pwd = NULL;
-		spwd = NULL;
-	}
+    username[0] = 0;
+    pwd = NULL;
+    spwd = NULL;
+  }
 
-	alarm(0);
+  alarm(0);
 
-	if (pwd->pw_uid) handle_nologin();
+  if (pwd->pw_uid) handle_nologin();
 
-	if (change_identity(pwd)) error_exit("Failed to change identity");
+  if (change_identity(pwd)) error_exit("Failed to change identity");
 
-	setup_environment(pwd, !(toys.optflags & FLAG_p));
+  setup_environment(pwd, !(toys.optflags & FLAG_p));
 
-	handle_motd();
+  handle_motd();
 
-	syslog(LOG_INFO, "%s logged in on %s %s %s", pwd->pw_name,
-		ttyname(0), h_flag?"from":"", h_flag?TT.hostname:"");
+  syslog(LOG_INFO, "%s logged in on %s %s %s", pwd->pw_name,
+    ttyname(0), h_flag?"from":"", h_flag?TT.hostname:"");
 
-	spawn_shell(pwd->pw_shell);
+  spawn_shell(pwd->pw_shell);
 }
--- a/toys/other/lsmod.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/other/lsmod.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,40 +1,36 @@
-/* vi: set sw=4 ts=4:
- *
- * lsmod.c - Show the status of modules in the kernel
+/* lsmod.c - Show the status of modules in the kernel
  *
  * Copyright 2012 Elie De Brauwer <eliedebrauwer@gmail.com>
 
 USE_LSMOD(NEWTOY(lsmod, NULL, TOYFLAG_BIN))
 
 config LSMOD
-	bool "lsmod"
-	default y
-	help
-	  usage: lsmod
+  bool "lsmod"
+  default y
+  help
+    usage: lsmod
 
-	  Display the currently loaded modules, their sizes and their
-	  dependencies.
+    Display the currently loaded modules, their sizes and their dependencies.
 */
 
 #include "toys.h"
 
 void lsmod_main(void)
 {
-	char *modfile = "/proc/modules";
-	FILE * file = xfopen(modfile, "r");
+  char *modfile = "/proc/modules";
+  FILE * file = xfopen(modfile, "r");
 
-	xprintf("%-23s Size  Used by\n", "Module");
+  xprintf("%-23s Size  Used by\n", "Module");
 
-	while (fgets(toybuf, sizeof(toybuf), file)) {
-		char *name = strtok(toybuf, " "), *size = strtok(NULL, " "),
-			*refcnt = strtok(NULL, " "), *users = strtok(NULL, " ");
+  while (fgets(toybuf, sizeof(toybuf), file)) {
+    char *name = strtok(toybuf, " "), *size = strtok(NULL, " "),
+         *refcnt = strtok(NULL, " "), *users = strtok(NULL, " ");
 
-		if(users) {
-			int len = strlen(users)-1;
-			if (users[len] == ',' || users[len] == '-')
-				users[len] = 0;
-			xprintf("%-19s %8s  %s %s\n", name, size, refcnt, users);
-		} else perror_exit("bad %s", modfile);
-	}
-	fclose(file);
+    if(users) {
+      int len = strlen(users)-1;
+      if (users[len] == ',' || users[len] == '-') users[len] = 0;
+      xprintf("%-19s %8s  %s %s\n", name, size, refcnt, users);
+    } else perror_exit("bad %s", modfile);
+  }
+  fclose(file);
 }
--- a/toys/other/mdev.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/other/mdev.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,6 +1,4 @@
-/* vi:set ts=4:
- *
- * mdev.c - Populate /dev directory and handle hotplug events
+/* mdev.c - Populate /dev directory and handle hotplug events
  *
  * Copyright 2005, 2008 Rob Landley <rob@landley.net>
  * Copyright 2005 Frank Sorenson <frank@tuxrocks.com>
@@ -8,27 +6,27 @@
 USE_MDEV(NEWTOY(mdev, "s", TOYFLAG_USR|TOYFLAG_BIN|TOYFLAG_UMASK))
 
 config MDEV
-	bool "mdev"
-	default n
-	help
-	  usage: mdev [-s]
+  bool "mdev"
+  default n
+  help
+    usage: mdev [-s]
 
-	  Create devices in /dev using information from /sys.
+    Create devices in /dev using information from /sys.
 
-	  -s	Scan all entries in /sys to populate /dev.
+    -s	Scan all entries in /sys to populate /dev.
 
 config MDEV_CONF
-	bool "Configuration file for mdev"
-	default y
-	depends on MDEV
-	help
-	  The mdev config file (/etc/mdev.conf) contains lines that look like:
-		hd[a-z][0-9]* 0:3 660
+  bool "Configuration file for mdev"
+  default y
+  depends on MDEV
+  help
+    The mdev config file (/etc/mdev.conf) contains lines that look like:
+    hd[a-z][0-9]* 0:3 660
 
-	  Each line must contain three whitespace separated fields.  The first
-	  field is a regular expression matching one or more device names, and
-	  the second and third fields are uid:gid and file permissions for
-	  matching devies.
+    Each line must contain three whitespace separated fields. The first
+    field is a regular expression matching one or more device names, and
+    the second and third fields are uid:gid and file permissions for
+    matching devies.
 */
 
 #include "toys.h"
@@ -39,173 +37,173 @@
 // mknod in /dev based on a path like "/sys/block/hda/hda1"
 static void make_device(char *path)
 {
-	char *device_name, *s, *temp;
-	int major, minor, type, len, fd;
-	int mode = 0660;
-	uid_t uid = 0;
-	gid_t gid = 0;
+  char *device_name, *s, *temp;
+  int major, minor, type, len, fd;
+  int mode = 0660;
+  uid_t uid = 0;
+  gid_t gid = 0;
 
-	// Try to read major/minor string
+  // Try to read major/minor string
 
-	temp = strrchr(path, '/');
-	fd = open(path, O_RDONLY);
-	*temp=0;
-	temp = toybuf;
-	len = read(fd, temp, 64);
-	close(fd);
-	if (len<1) return;
-	temp[len] = 0;
+  temp = strrchr(path, '/');
+  fd = open(path, O_RDONLY);
+  *temp=0;
+  temp = toybuf;
+  len = read(fd, temp, 64);
+  close(fd);
+  if (len<1) return;
+  temp[len] = 0;
 
-	// Determine device name, type, major and minor
+  // Determine device name, type, major and minor
 
-	device_name = strrchr(path, '/') + 1;
-	type = path[5]=='c' ? S_IFCHR : S_IFBLK;
-	major = minor = 0;
-	sscanf(temp, "%u:%u", &major, &minor);
+  device_name = strrchr(path, '/') + 1;
+  type = path[5]=='c' ? S_IFCHR : S_IFBLK;
+  major = minor = 0;
+  sscanf(temp, "%u:%u", &major, &minor);
 
-	// If we have a config file, look up permissions for this device
+  // If we have a config file, look up permissions for this device
 
-	if (CFG_MDEV_CONF) {
-		char *conf, *pos, *end;
+  if (CFG_MDEV_CONF) {
+    char *conf, *pos, *end;
 
-		// mmap the config file
-		if (-1!=(fd = open("/etc/mdev.conf", O_RDONLY))) {
-			len = fdlength(fd);
-			conf = mmap(NULL, len, PROT_READ, MAP_PRIVATE, fd, 0);
-			if (conf) {
-				int line = 0;
+    // mmap the config file
+    if (-1!=(fd = open("/etc/mdev.conf", O_RDONLY))) {
+      len = fdlength(fd);
+      conf = mmap(NULL, len, PROT_READ, MAP_PRIVATE, fd, 0);
+      if (conf) {
+        int line = 0;
 
-				// Loop through lines in mmaped file
-				for (pos = conf; pos-conf<len;) {
-					int field;
-					char *end2;
+        // Loop through lines in mmaped file
+        for (pos = conf; pos-conf<len;) {
+          int field;
+          char *end2;
 
-					line++;
-					// find end of this line
-					for(end = pos; end-conf<len && *end!='\n'; end++);
+          line++;
+          // find end of this line
+          for(end = pos; end-conf<len && *end!='\n'; end++);
 
-					// Three fields: regex, uid:gid, mode
-					for (field = 3; field; field--) {
-						// Skip whitespace
-						while (pos<end && isspace(*pos)) pos++;
-						if (pos==end || *pos=='#') break;
-						for (end2 = pos;
-							end2<end && !isspace(*end2) && *end2!='#'; end2++);
-						switch(field) {
-							// Regex to match this device
-							case 3:
-							{
-								char *regex = strndup(pos, end2-pos);
-								regex_t match;
-								regmatch_t off;
-								int result;
+          // Three fields: regex, uid:gid, mode
+          for (field = 3; field; field--) {
+            // Skip whitespace
+            while (pos<end && isspace(*pos)) pos++;
+            if (pos==end || *pos=='#') break;
+            for (end2 = pos;
+              end2<end && !isspace(*end2) && *end2!='#'; end2++);
+            switch(field) {
+              // Regex to match this device
+              case 3:
+              {
+                char *regex = strndup(pos, end2-pos);
+                regex_t match;
+                regmatch_t off;
+                int result;
 
-								// Is this it?
-								xregcomp(&match, regex, REG_EXTENDED);
-								result=regexec(&match, device_name, 1, &off, 0);
-								regfree(&match);
-								free(regex);
+                // Is this it?
+                xregcomp(&match, regex, REG_EXTENDED);
+                result=regexec(&match, device_name, 1, &off, 0);
+                regfree(&match);
+                free(regex);
 
-								// If not this device, skip rest of line
-								if (result || off.rm_so
-									|| off.rm_eo!=strlen(device_name))
-										goto end_line;
+                // If not this device, skip rest of line
+                if (result || off.rm_so
+                  || off.rm_eo!=strlen(device_name))
+                    goto end_line;
 
-								break;
-							}
-							// uid:gid
-							case 2:
-							{
-								char *s2;
+                break;
+              }
+              // uid:gid
+              case 2:
+              {
+                char *s2;
 
-								// Find :
-								for(s = pos; s<end2 && *s!=':'; s++);
-								if (s==end2) goto end_line;
+                // Find :
+                for(s = pos; s<end2 && *s!=':'; s++);
+                if (s==end2) goto end_line;
 
-								// Parse UID
-								uid = strtoul(pos,&s2,10);
-								if (s!=s2) {
-									struct passwd *pass;
-									char *str = strndup(pos, s-pos);
-									pass = getpwnam(str);
-									free(str);
-									if (!pass) goto end_line;
-									uid = pass->pw_uid;
-								}
-								s++;
-								// parse GID
-								gid = strtoul(s,&s2,10);
-								if (end2!=s2) {
-									struct group *grp;
-									char *str = strndup(s, end2-s);
-									grp = getgrnam(str);
-									free(str);
-									if (!grp) goto end_line;
-									gid = grp->gr_gid;
-								}
-								break;
-							}
-							// mode
-							case 1:
-							{
-								mode = strtoul(pos, &pos, 8);
-								if (pos!=end2) goto end_line;
-								goto found_device;
-							}
-						}
-						pos=end2;
-					}
+                // Parse UID
+                uid = strtoul(pos,&s2,10);
+                if (s!=s2) {
+                  struct passwd *pass;
+                  char *str = strndup(pos, s-pos);
+                  pass = getpwnam(str);
+                  free(str);
+                  if (!pass) goto end_line;
+                  uid = pass->pw_uid;
+                }
+                s++;
+                // parse GID
+                gid = strtoul(s,&s2,10);
+                if (end2!=s2) {
+                  struct group *grp;
+                  char *str = strndup(s, end2-s);
+                  grp = getgrnam(str);
+                  free(str);
+                  if (!grp) goto end_line;
+                  gid = grp->gr_gid;
+                }
+                break;
+              }
+              // mode
+              case 1:
+              {
+                mode = strtoul(pos, &pos, 8);
+                if (pos!=end2) goto end_line;
+                goto found_device;
+              }
+            }
+            pos=end2;
+          }
 end_line:
-					// Did everything parse happily?
-					if (field && field!=3) error_exit("Bad line %d", line);
+          // Did everything parse happily?
+          if (field && field!=3) error_exit("Bad line %d", line);
 
-					// Next line
-					pos = ++end;
-				}
+          // Next line
+          pos = ++end;
+        }
 found_device:
-				munmap(conf, len);
-			}
-			close(fd);
-		}
-	}
+        munmap(conf, len);
+      }
+      close(fd);
+    }
+  }
 
-	sprintf(temp, "/dev/%s", device_name);
-	if (mknod(temp, mode | type, makedev(major, minor)) && errno != EEXIST)
-		perror_exit("mknod %s failed", temp);
+  sprintf(temp, "/dev/%s", device_name);
+  if (mknod(temp, mode | type, makedev(major, minor)) && errno != EEXIST)
+    perror_exit("mknod %s failed", temp);
 
-	if (CFG_MDEV_CONF) mode=chown(temp, uid, gid);
+  if (CFG_MDEV_CONF) mode=chown(temp, uid, gid);
 }
 
 static int callback(struct dirtree *node)
 {
-	// Entries in /sys/class/block aren't char devices, so skip 'em.  (We'll
-	// get block devices out of /sys/block.)
-	if(!strcmp(node->name, "block")) return 0;
+  // Entries in /sys/class/block aren't char devices, so skip 'em.  (We'll
+  // get block devices out of /sys/block.)
+  if(!strcmp(node->name, "block")) return 0;
 
-	// Does this directory have a "dev" entry in it?
-	// This is path based because the hotplug callbacks are
-	if (S_ISDIR(node->st.st_mode) || S_ISLNK(node->st.st_mode)) {
-		int len=4;
-		char *dev = dirtree_path(node, &len);
-		strcpy(dev+len, "/dev");
-		if (!access(dev, R_OK)) make_device(dev);
-		free(dev);
-	}
+  // Does this directory have a "dev" entry in it?
+  // This is path based because the hotplug callbacks are
+  if (S_ISDIR(node->st.st_mode) || S_ISLNK(node->st.st_mode)) {
+    int len=4;
+    char *dev = dirtree_path(node, &len);
+    strcpy(dev+len, "/dev");
+    if (!access(dev, R_OK)) make_device(dev);
+    free(dev);
+  }
 
-	// Circa 2.6.25 the entries more than 2 deep are all either redundant
-	// (mouse#, event#) or unnamed (every usb_* entry is called "device").
+  // Circa 2.6.25 the entries more than 2 deep are all either redundant
+  // (mouse#, event#) or unnamed (every usb_* entry is called "device").
 
-	return (node->parent && node->parent->parent) ? 0 : DIRTREE_RECURSE;
+  return (node->parent && node->parent->parent) ? 0 : DIRTREE_RECURSE;
 }
 
 void mdev_main(void)
 {
-	// Handle -s
+  // Handle -s
 
-	if (toys.optflags) {
-		dirtree_read("/sys/class", callback);
-		dirtree_read("/sys/block", callback);
-	}
+  if (toys.optflags) {
+    dirtree_read("/sys/class", callback);
+    dirtree_read("/sys/block", callback);
+  }
 
-	// hotplug support goes here
+  // hotplug support goes here
 }
--- a/toys/other/mke2fs.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/other/mke2fs.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,6 +1,4 @@
-/* vi: set ts=4:
- *
- * mke2fs.c - Create an ext2 filesystem image.
+/* mke2fs.c - Create an ext2 filesystem image.
  *
  * Copyright 2006, 2007 Rob Landley <rob@landley.net>
 
@@ -8,155 +6,155 @@
 USE_MKE2FS(NEWTOY(mke2fs, "<1>2g:Fnqm#N#i#b#", TOYFLAG_SBIN))
 
 config MKE2FS
-	bool "mke2fs (unfinished and broken by dirtree changes)"
-	default n
-	help
-	  usage: mke2fs [-Fnq] [-b ###] [-N|i ###] [-m ###] device
+  bool "mke2fs (unfinished and broken by dirtree changes)"
+  default n
+  help
+    usage: mke2fs [-Fnq] [-b ###] [-N|i ###] [-m ###] device
 
-	  Create an ext2 filesystem on a block device or filesystem image.
+    Create an ext2 filesystem on a block device or filesystem image.
 
-	  -F         Force to run on a mounted device
-	  -n         Don't write to device
-	  -q         Quiet (no output)
-	  -b size    Block size (1024, 2048, or 4096)
-	  -N inodes  Allocate this many inodes
-	  -i bytes   Allocate one inode for every XXX bytes of device
-	  -m percent Reserve this percent of filesystem space for root user
+    -F         Force to run on a mounted device
+    -n         Don't write to device
+    -q         Quiet (no output)
+    -b size    Block size (1024, 2048, or 4096)
+    -N inodes  Allocate this many inodes
+    -i bytes   Allocate one inode for every XXX bytes of device
+    -m percent Reserve this percent of filesystem space for root user
 
 config MKE2FS_JOURNAL
-	bool "Journaling support (ext3)"
-	default n
-	depends on MKE2FS
-	help
-	  usage: [-j] [-J size=###,device=XXX]
+  bool "Journaling support (ext3)"
+  default n
+  depends on MKE2FS
+  help
+    usage: [-j] [-J size=###,device=XXX]
 
-	  -j         Create journal (ext3)
-	  -J         Journal options
-	             size: Number of blocks (1024-102400)
-	             device: Specify an external journal
+    -j         Create journal (ext3)
+    -J         Journal options
+               size: Number of blocks (1024-102400)
+               device: Specify an external journal
 
 config MKE2FS_GEN
-	bool "Generate (gene2fs)"
-	default n
-	depends on MKE2FS
-	help
-	  usage: gene2fs [options] device filename
+  bool "Generate (gene2fs)"
+  default n
+  depends on MKE2FS
+  help
+    usage: gene2fs [options] device filename
 
-	  The [options] are the same as mke2fs.
+    The [options] are the same as mke2fs.
 
 config MKE2FS_LABEL
-	bool "Label support"
-	default n
-	depends on MKE2FS
-	help
-	  usage: mke2fs [-L label] [-M path] [-o string]
+  bool "Label support"
+  default n
+  depends on MKE2FS
+  help
+    usage: mke2fs [-L label] [-M path] [-o string]
 
-	  -L         Volume label
-	  -M         Path to mount point
-	  -o         Created by
+    -L         Volume label
+    -M         Path to mount point
+    -o         Created by
 
 config MKE2FS_EXTENDED
-	bool "Extended options"
-	default n
-	depends on MKE2FS
-	help
-	  usage: mke2fs [-E stride=###] [-O option[,option]]
+  bool "Extended options"
+  default n
+  depends on MKE2FS
+  help
+    usage: mke2fs [-E stride=###] [-O option[,option]]
 
-	  -E stride= Set RAID stripe size (in blocks)
-	  -O [opts]  Specify fewer ext2 option flags (for old kernels)
-	             All of these are on by default (as appropriate)
-	     none         Clear default options (all but journaling)
-	     dir_index    Use htree indexes for large directories
-	     filetype     Store file type info in directory entry
-	     has_journal  Set by -j
-	     journal_dev  Set by -J device=XXX
-	     sparse_super Don't allocate huge numbers of redundant superblocks
+    -E stride= Set RAID stripe size (in blocks)
+    -O [opts]  Specify fewer ext2 option flags (for old kernels)
+               All of these are on by default (as appropriate)
+       none         Clear default options (all but journaling)
+       dir_index    Use htree indexes for large directories
+       filetype     Store file type info in directory entry
+       has_journal  Set by -j
+       journal_dev  Set by -J device=XXX
+       sparse_super Don't allocate huge numbers of redundant superblocks
 */
 
 #define FOR_mke2fs
 #include "toys.h"
 
 GLOBALS(
-	// Command line arguments.
-	long blocksize;
-	long bytes_per_inode;
-	long inodes;           // Total inodes in filesystem.
-	long reserved_percent; // Integer precent of space to reserve for root.
-	char *gendir;          // Where to read dirtree from.
+  // Command line arguments.
+  long blocksize;
+  long bytes_per_inode;
+  long inodes;           // Total inodes in filesystem.
+  long reserved_percent; // Integer precent of space to reserve for root.
+  char *gendir;          // Where to read dirtree from.
 
-	// Internal data.
-	struct dirtree *dt;    // Tree of files to copy into the new filesystem.
-	unsigned treeblocks;   // Blocks used by dt
-	unsigned treeinodes;   // Inodes used by dt
+  // Internal data.
+  struct dirtree *dt;    // Tree of files to copy into the new filesystem.
+  unsigned treeblocks;   // Blocks used by dt
+  unsigned treeinodes;   // Inodes used by dt
 
-	unsigned blocks;       // Total blocks in the filesystem.
-	unsigned freeblocks;   // Free blocks in the filesystem.
-	unsigned inodespg;     // Inodes per group
-	unsigned groups;       // Total number of block groups.
-	unsigned blockbits;    // Bits per block.  (Also blocks per group.)
+  unsigned blocks;       // Total blocks in the filesystem.
+  unsigned freeblocks;   // Free blocks in the filesystem.
+  unsigned inodespg;     // Inodes per group
+  unsigned groups;       // Total number of block groups.
+  unsigned blockbits;    // Bits per block.  (Also blocks per group.)
 
-	// For gene2fs
-	unsigned nextblock;    // Next data block to allocate
-	unsigned nextgroup;    // Next group we'll be allocating from
-	int fsfd;              // File descriptor of filesystem (to output to).
+  // For gene2fs
+  unsigned nextblock;    // Next data block to allocate
+  unsigned nextgroup;    // Next group we'll be allocating from
+  int fsfd;              // File descriptor of filesystem (to output to).
 
-	struct ext2_superblock sb;
+  struct ext2_superblock sb;
 )
 
 #define INODES_RESERVED 10
 
 static uint32_t div_round_up(uint32_t a, uint32_t b)
 {
-	uint32_t c = a/b;
+  uint32_t c = a/b;
 
-	if (a%b) c++;
-	return c;
+  if (a%b) c++;
+  return c;
 }
 
 // Calculate data blocks plus index blocks needed to hold a file.
 
 static uint32_t file_blocks_used(uint64_t size, uint32_t *blocklist)
 {
-	uint32_t dblocks = (uint32_t)((size+(TT.blocksize-1))/TT.blocksize);
-	uint32_t idx=TT.blocksize/4, iblocks=0, diblocks=0, tiblocks=0;
+  uint32_t dblocks = (uint32_t)((size+(TT.blocksize-1))/TT.blocksize);
+  uint32_t idx=TT.blocksize/4, iblocks=0, diblocks=0, tiblocks=0;
 
-	// Fill out index blocks in inode.
+  // Fill out index blocks in inode.
 
-	if (blocklist) {
-		int i;
+  if (blocklist) {
+    int i;
 
-		// Direct index blocks
-		for (i=0; i<13 && i<dblocks; i++) blocklist[i] = i;
-		// Singly indirect index blocks
-		if (dblocks > 13+idx) blocklist[13] = 13+idx;
-		// Doubly indirect index blocks
-		idx = 13 + idx + (idx*idx);
-		if (dblocks > idx) blocklist[14] = idx;
+    // Direct index blocks
+    for (i=0; i<13 && i<dblocks; i++) blocklist[i] = i;
+    // Singly indirect index blocks
+    if (dblocks > 13+idx) blocklist[13] = 13+idx;
+    // Doubly indirect index blocks
+    idx = 13 + idx + (idx*idx);
+    if (dblocks > idx) blocklist[14] = idx;
 
-		return 0;
-	}
+    return 0;
+  }
 
-	// Account for direct, singly, doubly, and triply indirect index blocks
+  // Account for direct, singly, doubly, and triply indirect index blocks
 
-	if (dblocks > 12) {
-		iblocks = ((dblocks-13)/idx)+1;
-		if (iblocks > 1) {
-			diblocks = ((iblocks-2)/idx)+1;
-			if (diblocks > 1)
-				tiblocks = ((diblocks-2)/idx)+1;
-		}
-	}
+  if (dblocks > 12) {
+    iblocks = ((dblocks-13)/idx)+1;
+    if (iblocks > 1) {
+      diblocks = ((iblocks-2)/idx)+1;
+      if (diblocks > 1)
+        tiblocks = ((diblocks-2)/idx)+1;
+    }
+  }
 
-	return dblocks + iblocks + diblocks + tiblocks;
+  return dblocks + iblocks + diblocks + tiblocks;
 }
 
 // Use the parent pointer to iterate through the tree non-recursively.
 static struct dirtree *treenext(struct dirtree *this)
 {
-	while (this && !this->next) this = this->parent;
-	if (this) this = this->next;
+  while (this && !this->next) this = this->parent;
+  if (this) this = this->next;
 
-	return this;
+  return this;
 }
 
 // Recursively calculate the number of blocks used by each inode in the tree.
@@ -165,27 +163,27 @@
 
 static long check_treesize(struct dirtree *that, off_t *size)
 {
-	long blocks;
+  long blocks;
 
-	while (that) {
-		*size += sizeof(struct ext2_dentry) + strlen(that->name);
+  while (that) {
+    *size += sizeof(struct ext2_dentry) + strlen(that->name);
 
-		if (that->child)
-			that->st.st_blocks = check_treesize(that->child, &that->st.st_size);
-		else if (S_ISREG(that->st.st_mode)) {
-			 that->st.st_blocks = file_blocks_used(that->st.st_size, 0);
-			 TT.treeblocks += that->st.st_blocks;
-		}
-		that = that->next;
-	}
-	TT.treeblocks += blocks = file_blocks_used(*size, 0);
-	TT.treeinodes++;
+    if (that->child)
+      that->st.st_blocks = check_treesize(that->child, &that->st.st_size);
+    else if (S_ISREG(that->st.st_mode)) {
+       that->st.st_blocks = file_blocks_used(that->st.st_size, 0);
+       TT.treeblocks += that->st.st_blocks;
+    }
+    that = that->next;
+  }
+  TT.treeblocks += blocks = file_blocks_used(*size, 0);
+  TT.treeinodes++;
 
-	return blocks;
+  return blocks;
 }
 
 // Calculate inode numbers and link counts.
-// 
+//
 // To do this right I need to copy the tree and sort it, but here's a really
 // ugly n^2 way of dealing with the problem that doesn't scale well to large
 // numbers of files (> 100,000) but can be done in very little code.
@@ -193,32 +191,32 @@
 
 static void check_treelinks(struct dirtree *tree)
 {
-	struct dirtree *current=tree, *that;
-	long inode = INODES_RESERVED;
+  struct dirtree *current=tree, *that;
+  long inode = INODES_RESERVED;
 
-	while (current) {
-		++inode;
-		// Since we can't hardlink to directories, we know their link count.
-		if (S_ISDIR(current->st.st_mode)) current->st.st_nlink = 2;
-		else {
-			dev_t new = current->st.st_dev;
+  while (current) {
+    ++inode;
+    // Since we can't hardlink to directories, we know their link count.
+    if (S_ISDIR(current->st.st_mode)) current->st.st_nlink = 2;
+    else {
+      dev_t new = current->st.st_dev;
 
-			if (!new) continue;
+      if (!new) continue;
 
-			// Look for other copies of current node
-			current->st.st_nlink = 0;
-			for (that = tree; that; that = treenext(that)) {
-				if (current->st.st_ino == that->st.st_ino &&
-					current->st.st_dev == that->st.st_dev)
-				{
-					current->st.st_nlink++;
-					current->st.st_ino = inode;
-				}
-			}
-		}
-		current->st.st_ino = inode;
-		current = treenext(current);
-	}
+      // Look for other copies of current node
+      current->st.st_nlink = 0;
+      for (that = tree; that; that = treenext(that)) {
+        if (current->st.st_ino == that->st.st_ino &&
+          current->st.st_dev == that->st.st_dev)
+        {
+          current->st.st_nlink++;
+          current->st.st_ino = inode;
+        }
+      }
+    }
+    current->st.st_ino = inode;
+    current = treenext(current);
+  }
 }
 
 // According to http://www.opengroup.org/onlinepubs/9629399/apdxa.htm
@@ -231,202 +229,202 @@
 
 static void create_uuid(char *uuid)
 {
-	// Read 128 random bits
-	int fd = xopen("/dev/urandom", O_RDONLY);
-	xreadall(fd, uuid, 16);
-	close(fd);
+  // Read 128 random bits
+  int fd = xopen("/dev/urandom", O_RDONLY);
+  xreadall(fd, uuid, 16);
+  close(fd);
 
-	// Claim to be a DCE format UUID.
-	uuid[6] = (uuid[6] & 0x0F) | 0x40;
-	uuid[8] = (uuid[8] & 0x3F) | 0x80;
+  // Claim to be a DCE format UUID.
+  uuid[6] = (uuid[6] & 0x0F) | 0x40;
+  uuid[8] = (uuid[8] & 0x3F) | 0x80;
 
-    // rfc2518 section 6.4.1 suggests if we're not using a macaddr, we should
-	// set bit 1 of the node ID, which is the mac multicast bit.  This means we
-	// should never collide with anybody actually using a macaddr.
-	uuid[11] = uuid[11] | 128;
+  // rfc2518 section 6.4.1 suggests if we're not using a macaddr, we should
+  // set bit 1 of the node ID, which is the mac multicast bit.  This means we
+  // should never collide with anybody actually using a macaddr.
+  uuid[11] = uuid[11] | 128;
 }
 
 // Calculate inodes per group from total inodes.
 static uint32_t get_inodespg(uint32_t inodes)
 {
-	uint32_t temp;
+  uint32_t temp;
 
-	// Round up to fill complete inode blocks.
-	temp = (inodes + TT.groups - 1) / TT.groups;
-	inodes = TT.blocksize/sizeof(struct ext2_inode);
-	return ((temp + inodes - 1)/inodes)*inodes;
+  // Round up to fill complete inode blocks.
+  temp = (inodes + TT.groups - 1) / TT.groups;
+  inodes = TT.blocksize/sizeof(struct ext2_inode);
+  return ((temp + inodes - 1)/inodes)*inodes;
 }
 
 // Fill out superblock and TT structures.
 
 static void init_superblock(struct ext2_superblock *sb)
 {
-	uint32_t temp;
+  uint32_t temp;
 
-	// Set log_block_size and log_frag_size.
+  // Set log_block_size and log_frag_size.
 
-	for (temp = 0; temp < 4; temp++) if (TT.blocksize == 1024<<temp) break;
-	if (temp==4) error_exit("bad blocksize");
-	sb->log_block_size = sb->log_frag_size = SWAP_LE32(temp);
+  for (temp = 0; temp < 4; temp++) if (TT.blocksize == 1024<<temp) break;
+  if (temp==4) error_exit("bad blocksize");
+  sb->log_block_size = sb->log_frag_size = SWAP_LE32(temp);
 
-	// Fill out blocks_count, r_blocks_count, first_data_block
+  // Fill out blocks_count, r_blocks_count, first_data_block
 
-	sb->blocks_count = SWAP_LE32(TT.blocks);
-	sb->free_blocks_count = SWAP_LE32(TT.freeblocks);
-	temp = (TT.blocks * (uint64_t)TT.reserved_percent) / 100;
-	sb->r_blocks_count = SWAP_LE32(temp);
+  sb->blocks_count = SWAP_LE32(TT.blocks);
+  sb->free_blocks_count = SWAP_LE32(TT.freeblocks);
+  temp = (TT.blocks * (uint64_t)TT.reserved_percent) / 100;
+  sb->r_blocks_count = SWAP_LE32(temp);
 
-	sb->first_data_block = SWAP_LE32(TT.blocksize == 1024 ? 1 : 0);
+  sb->first_data_block = SWAP_LE32(TT.blocksize == 1024 ? 1 : 0);
 
-	// Set blocks_per_group and frags_per_group, which is the size of an
-	// allocation bitmap that fits in one block (I.E. how many bits per block)?
+  // Set blocks_per_group and frags_per_group, which is the size of an
+  // allocation bitmap that fits in one block (I.E. how many bits per block)?
 
-	sb->blocks_per_group = sb->frags_per_group = SWAP_LE32(TT.blockbits);
+  sb->blocks_per_group = sb->frags_per_group = SWAP_LE32(TT.blockbits);
 
-	// Set inodes_per_group and total inodes_count
-	sb->inodes_per_group = SWAP_LE32(TT.inodespg);
-	sb->inodes_count = SWAP_LE32(TT.inodespg * TT.groups);
+  // Set inodes_per_group and total inodes_count
+  sb->inodes_per_group = SWAP_LE32(TT.inodespg);
+  sb->inodes_count = SWAP_LE32(TT.inodespg * TT.groups);
 
-	// Determine free inodes.
-	temp = TT.inodespg*TT.groups - INODES_RESERVED;
-	if (temp < TT.treeinodes) error_exit("Not enough inodes.\n");
-	sb->free_inodes_count = SWAP_LE32(temp - TT.treeinodes);
+  // Determine free inodes.
+  temp = TT.inodespg*TT.groups - INODES_RESERVED;
+  if (temp < TT.treeinodes) error_exit("Not enough inodes.\n");
+  sb->free_inodes_count = SWAP_LE32(temp - TT.treeinodes);
 
-	// Fill out the rest of the superblock.
-	sb->max_mnt_count=0xFFFF;
-	sb->wtime = sb->lastcheck = sb->mkfs_time = SWAP_LE32(time(NULL));
-	sb->magic = SWAP_LE32(0xEF53);
-	sb->state = sb->errors = SWAP_LE16(1);
+  // Fill out the rest of the superblock.
+  sb->max_mnt_count=0xFFFF;
+  sb->wtime = sb->lastcheck = sb->mkfs_time = SWAP_LE32(time(NULL));
+  sb->magic = SWAP_LE32(0xEF53);
+  sb->state = sb->errors = SWAP_LE16(1);
 
-	sb->rev_level = SWAP_LE32(1);
-	sb->first_ino = SWAP_LE32(INODES_RESERVED+1);
-	sb->inode_size = SWAP_LE16(sizeof(struct ext2_inode));
-	sb->feature_incompat = SWAP_LE32(EXT2_FEATURE_INCOMPAT_FILETYPE);
-	sb->feature_ro_compat = SWAP_LE32(EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER);
+  sb->rev_level = SWAP_LE32(1);
+  sb->first_ino = SWAP_LE32(INODES_RESERVED+1);
+  sb->inode_size = SWAP_LE16(sizeof(struct ext2_inode));
+  sb->feature_incompat = SWAP_LE32(EXT2_FEATURE_INCOMPAT_FILETYPE);
+  sb->feature_ro_compat = SWAP_LE32(EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER);
 
-	create_uuid(sb->uuid);
-	
-	// TODO If we're called as mke3fs or mkfs.ext3, do a journal.
+  create_uuid(sb->uuid);
 
-	//if (strchr(toys.which->name,'3'))
-	//	sb->feature_compat |= SWAP_LE32(EXT3_FEATURE_COMPAT_HAS_JOURNAL);
+  // TODO If we're called as mke3fs or mkfs.ext3, do a journal.
+
+  //if (strchr(toys.which->name,'3'))
+  //	sb->feature_compat |= SWAP_LE32(EXT3_FEATURE_COMPAT_HAS_JOURNAL);
 }
 
 // Does this group contain a superblock backup (and group descriptor table)?
 static int is_sb_group(uint32_t group)
 {
-	int i;
+  int i;
 
-	// Superblock backups are on groups 0, 1, and powers of 3, 5, and 7.
-	if(!group || group==1) return 1;
-	for (i=3; i<9; i+=2) {
-		int j = i;
-		while (j<group) j*=i;
-		if (j==group) return 1;
-	}
-	return 0;
+  // Superblock backups are on groups 0, 1, and powers of 3, 5, and 7.
+  if(!group || group==1) return 1;
+  for (i=3; i<9; i+=2) {
+    int j = i;
+    while (j<group) j*=i;
+    if (j==group) return 1;
+  }
+  return 0;
 }
 
-	
+
 // Number of blocks used in group by optional superblock/group list backup.
 static int group_superblock_overhead(uint32_t group)
 {
-	int used;
+  int used;
 
-	if (!is_sb_group(group)) return 0;
+  if (!is_sb_group(group)) return 0;
 
-	// How many blocks does the group descriptor table take up?
-	used = TT.groups * sizeof(struct ext2_group);
-	used += TT.blocksize - 1;
-	used /= TT.blocksize;
-	// Plus the superblock itself.
-	used++;
-	// And a corner case.
-	if (!group && TT.blocksize == 1024) used++;
+  // How many blocks does the group descriptor table take up?
+  used = TT.groups * sizeof(struct ext2_group);
+  used += TT.blocksize - 1;
+  used /= TT.blocksize;
+  // Plus the superblock itself.
+  used++;
+  // And a corner case.
+  if (!group && TT.blocksize == 1024) used++;
 
-	return used;
+  return used;
 }
 
 // Number of blocks used in group to store superblock/group/inode list
 static int group_overhead(uint32_t group)
 {
-	// Return superblock backup overhead (if any), plus block/inode
-	// allocation bitmaps, plus inode tables.
-	return group_superblock_overhead(group) + 2 + get_inodespg(TT.inodespg)
-				/ (TT.blocksize/sizeof(struct ext2_inode));
+  // Return superblock backup overhead (if any), plus block/inode
+  // allocation bitmaps, plus inode tables.
+  return group_superblock_overhead(group) + 2 + get_inodespg(TT.inodespg)
+        / (TT.blocksize/sizeof(struct ext2_inode));
 }
 
 // In bitmap "array" set "len" bits starting at position "start" (from 0).
 static void bits_set(char *array, int start, int len)
 {
-	while(len) {
-		if ((start&7) || len<8) {
-			array[start/8]|=(1<<(start&7));
-			start++;
-			len--;
-		} else {
-			array[start/8]=255;
-			start+=8;
-			len-=8;
-		}
-	}
+  while(len) {
+    if ((start&7) || len<8) {
+      array[start/8]|=(1<<(start&7));
+      start++;
+      len--;
+    } else {
+      array[start/8]=255;
+      start+=8;
+      len-=8;
+    }
+  }
 }
 
 // Seek past len bytes (to maintain sparse file), or write zeroes if output
 // not seekable
 static void put_zeroes(int len)
 {
-	if(-1 == lseek(TT.fsfd, len, SEEK_SET)) {
-		memset(toybuf, 0, sizeof(toybuf));
-		while (len) {
-			int out = len > sizeof(toybuf) ? sizeof(toybuf) : len;
-			xwrite(TT.fsfd, toybuf, out);
-			len -= out;
-		}
-	}
+  if(-1 == lseek(TT.fsfd, len, SEEK_SET)) {
+    memset(toybuf, 0, sizeof(toybuf));
+    while (len) {
+      int out = len > sizeof(toybuf) ? sizeof(toybuf) : len;
+      xwrite(TT.fsfd, toybuf, out);
+      len -= out;
+    }
+  }
 }
 
 // Fill out an inode structure from struct stat info in dirtree.
 static void fill_inode(struct ext2_inode *in, struct dirtree *that)
 {
-	uint32_t fbu[15];
-	int temp;
+  uint32_t fbu[15];
+  int temp;
 
-	file_blocks_used(that->st.st_size, fbu);
+  file_blocks_used(that->st.st_size, fbu);
 
-	// If that inode needs data blocks allocated to it.
-	if (that->st.st_size) {
-		int i, group = TT.nextblock/TT.blockbits;
+  // If that inode needs data blocks allocated to it.
+  if (that->st.st_size) {
+    int i, group = TT.nextblock/TT.blockbits;
 
-		// TODO: teach this about indirect blocks.
-		for (i=0; i<15; i++) {
-			// If we just jumped into a new group, skip group overhead blocks.
-			while (group >= TT.nextgroup)
-				TT.nextblock += group_overhead(TT.nextgroup++);
-		}
-	}
-	// TODO :  S_ISREG/DIR/CHR/BLK/FIFO/LNK/SOCK(m)
-	in->mode = SWAP_LE32(that->st.st_mode);
+    // TODO: teach this about indirect blocks.
+    for (i=0; i<15; i++) {
+      // If we just jumped into a new group, skip group overhead blocks.
+      while (group >= TT.nextgroup)
+        TT.nextblock += group_overhead(TT.nextgroup++);
+    }
+  }
+  // TODO :  S_ISREG/DIR/CHR/BLK/FIFO/LNK/SOCK(m)
+  in->mode = SWAP_LE32(that->st.st_mode);
 
-	in->uid = SWAP_LE16(that->st.st_uid & 0xFFFF);
-	in->uid_high = SWAP_LE16(that->st.st_uid >> 16);
-	in->gid = SWAP_LE16(that->st.st_gid & 0xFFFF);
-	in->gid_high = SWAP_LE16(that->st.st_gid >> 16);
-	in->size = SWAP_LE32(that->st.st_size & 0xFFFFFFFF);
+  in->uid = SWAP_LE16(that->st.st_uid & 0xFFFF);
+  in->uid_high = SWAP_LE16(that->st.st_uid >> 16);
+  in->gid = SWAP_LE16(that->st.st_gid & 0xFFFF);
+  in->gid_high = SWAP_LE16(that->st.st_gid >> 16);
+  in->size = SWAP_LE32(that->st.st_size & 0xFFFFFFFF);
 
-	// Contortions to make the compiler not generate a warning for x>>32
-	// when x is 32 bits.  The optimizer should clean this up.
-	if (sizeof(that->st.st_size) > 4) temp = 32;
-	else temp = 0;
-	if (temp) in->dir_acl = SWAP_LE32(that->st.st_size >> temp);
-	
-	in->atime = SWAP_LE32(that->st.st_atime);
-	in->ctime = SWAP_LE32(that->st.st_ctime);
-	in->mtime = SWAP_LE32(that->st.st_mtime);
+  // Contortions to make the compiler not generate a warning for x>>32
+  // when x is 32 bits.  The optimizer should clean this up.
+  if (sizeof(that->st.st_size) > 4) temp = 32;
+  else temp = 0;
+  if (temp) in->dir_acl = SWAP_LE32(that->st.st_size >> temp);
 
-	in->links_count = SWAP_LE16(that->st.st_nlink);
-	in->blocks = SWAP_LE32(that->st.st_blocks);
-	// in->faddr
+  in->atime = SWAP_LE32(that->st.st_atime);
+  in->ctime = SWAP_LE32(that->st.st_ctime);
+  in->mtime = SWAP_LE32(that->st.st_mtime);
+
+  in->links_count = SWAP_LE16(that->st.st_nlink);
+  in->blocks = SWAP_LE32(that->st.st_blocks);
+  // in->faddr
 }
 
 // Works like an archiver.
@@ -435,224 +433,224 @@
 
 void mke2fs_main(void)
 {
-	int i, temp;
-	off_t length;
-	uint32_t usedblocks, usedinodes, dtiblk, dtbblk;
-	struct dirtree *dti, *dtb;
+  int i, temp;
+  off_t length;
+  uint32_t usedblocks, usedinodes, dtiblk, dtbblk;
+  struct dirtree *dti, *dtb;
 
-	// Handle command line arguments.
+  // Handle command line arguments.
 
-	if (toys.optargs[1]) {
-		sscanf(toys.optargs[1], "%u", &TT.blocks);
-		temp = O_RDWR|O_CREAT;
-	} else temp = O_RDWR;
-	if (!TT.reserved_percent) TT.reserved_percent = 5;
+  if (toys.optargs[1]) {
+    sscanf(toys.optargs[1], "%u", &TT.blocks);
+    temp = O_RDWR|O_CREAT;
+  } else temp = O_RDWR;
+  if (!TT.reserved_percent) TT.reserved_percent = 5;
 
-	// TODO: Check if filesystem is mounted here
+  // TODO: Check if filesystem is mounted here
 
-	// For mke?fs, open file.  For gene?fs, create file.
-	TT.fsfd = xcreate(*toys.optargs, temp, 0777);
-	
-	// Determine appropriate block size and block count from file length.
-	// (If no length, default to 4k.  They can override it on the cmdline.)
+  // For mke?fs, open file.  For gene?fs, create file.
+  TT.fsfd = xcreate(*toys.optargs, temp, 0777);
 
-	length = fdlength(TT.fsfd);
-	if (!TT.blocksize) TT.blocksize = (length && length < 1<<29) ? 1024 : 4096;
-	TT.blockbits = 8*TT.blocksize;
-	if (!TT.blocks) TT.blocks = length/TT.blocksize;
+  // Determine appropriate block size and block count from file length.
+  // (If no length, default to 4k.  They can override it on the cmdline.)
 
-	// Collect gene2fs list or lost+found, calculate requirements.
+  length = fdlength(TT.fsfd);
+  if (!TT.blocksize) TT.blocksize = (length && length < 1<<29) ? 1024 : 4096;
+  TT.blockbits = 8*TT.blocksize;
+  if (!TT.blocks) TT.blocks = length/TT.blocksize;
 
-	if (TT.gendir) {
-		strncpy(toybuf, TT.gendir, sizeof(toybuf));
-		dti = dirtree_read(toybuf, NULL, NULL);
-	} else {
-		dti = xzalloc(sizeof(struct dirtree)+11);
-		strcpy(dti->name, "lost+found");
-		dti->st.st_mode = S_IFDIR|0755;
-		dti->st.st_ctime = dti->st.st_mtime = time(NULL);
-	}
+  // Collect gene2fs list or lost+found, calculate requirements.
 
-	// Add root directory inode.  This is iterated through for when finding
-	// blocks, but not when finding inodes.  The tree's parent pointers don't
-	// point back into this.
+  if (TT.gendir) {
+    strncpy(toybuf, TT.gendir, sizeof(toybuf));
+    dti = dirtree_read(toybuf, NULL, NULL);
+  } else {
+    dti = xzalloc(sizeof(struct dirtree)+11);
+    strcpy(dti->name, "lost+found");
+    dti->st.st_mode = S_IFDIR|0755;
+    dti->st.st_ctime = dti->st.st_mtime = time(NULL);
+  }
 
-	dtb = xzalloc(sizeof(struct dirtree)+1);
-	dtb->st.st_mode = S_IFDIR|0755;
-	dtb->st.st_ctime = dtb->st.st_mtime = time(NULL);
-	dtb->child = dti;
-	
-	// Figure out how much space is used by preset files
-	length = check_treesize(dtb, &(dtb->st.st_size));
-	check_treelinks(dtb);
+  // Add root directory inode.  This is iterated through for when finding
+  // blocks, but not when finding inodes.  The tree's parent pointers don't
+  // point back into this.
 
-	// Figure out how many total inodes we need.
+  dtb = xzalloc(sizeof(struct dirtree)+1);
+  dtb->st.st_mode = S_IFDIR|0755;
+  dtb->st.st_ctime = dtb->st.st_mtime = time(NULL);
+  dtb->child = dti;
 
-	if (!TT.inodes) {
-		if (!TT.bytes_per_inode) TT.bytes_per_inode = 8192;
-		TT.inodes = (TT.blocks * (uint64_t)TT.blocksize) / TT.bytes_per_inode;
-	}
+  // Figure out how much space is used by preset files
+  length = check_treesize(dtb, &(dtb->st.st_size));
+  check_treelinks(dtb);
 
-	// If we're generating a filesystem and have no idea how many blocks it
-	// needs, start with a minimal guess, find the overhead of that many
-	// groups, and loop until this is enough groups to store this many blocks.
-	if (!TT.blocks) TT.groups = (TT.treeblocks/TT.blockbits)+1;
-	else TT.groups = div_round_up(TT.blocks, TT.blockbits);
+  // Figure out how many total inodes we need.
 
-	for (;;) {
-		temp = TT.treeblocks;
+  if (!TT.inodes) {
+    if (!TT.bytes_per_inode) TT.bytes_per_inode = 8192;
+    TT.inodes = (TT.blocks * (uint64_t)TT.blocksize) / TT.bytes_per_inode;
+  }
 
-		for (i = 0; i<TT.groups; i++) temp += group_overhead(i);
+  // If we're generating a filesystem and have no idea how many blocks it
+  // needs, start with a minimal guess, find the overhead of that many
+  // groups, and loop until this is enough groups to store this many blocks.
+  if (!TT.blocks) TT.groups = (TT.treeblocks/TT.blockbits)+1;
+  else TT.groups = div_round_up(TT.blocks, TT.blockbits);
 
-		if (TT.blocks) {
-			if (TT.blocks < temp) error_exit("Not enough space.\n");
-			break;
-		}
-		if (temp <= TT.groups * TT.blockbits) {
-			TT.blocks = temp;
-			break;
-		}
-		TT.groups++;
-	}
-	TT.freeblocks = TT.blocks - temp;
+  for (;;) {
+    temp = TT.treeblocks;
 
-	// Now we know all the TT data, initialize superblock structure.
+    for (i = 0; i<TT.groups; i++) temp += group_overhead(i);
 
-	init_superblock(&TT.sb);
+    if (TT.blocks) {
+      if (TT.blocks < temp) error_exit("Not enough space.\n");
+      break;
+    }
+    if (temp <= TT.groups * TT.blockbits) {
+      TT.blocks = temp;
+      break;
+    }
+    TT.groups++;
+  }
+  TT.freeblocks = TT.blocks - temp;
 
-	// Start writing.  Skip the first 1k to avoid the boot sector (if any).
-	put_zeroes(1024);
+  // Now we know all the TT data, initialize superblock structure.
 
-	// Loop through block groups, write out each one.
-	dtiblk = dtbblk = usedblocks = usedinodes = 0;
-	for (i=0; i<TT.groups; i++) {
-		struct ext2_inode *in = (struct ext2_inode *)toybuf;
-		uint32_t start, itable, used, end;
-		int j, slot;
+  init_superblock(&TT.sb);
 
-		// Where does this group end?
-		end = TT.blockbits;
-		if ((i+1)*TT.blockbits > TT.blocks) end = TT.blocks & (TT.blockbits-1);
+  // Start writing.  Skip the first 1k to avoid the boot sector (if any).
+  put_zeroes(1024);
 
-		// Blocks used by inode table
-		itable = (TT.inodespg*sizeof(struct ext2_inode))/TT.blocksize;
+  // Loop through block groups, write out each one.
+  dtiblk = dtbblk = usedblocks = usedinodes = 0;
+  for (i=0; i<TT.groups; i++) {
+    struct ext2_inode *in = (struct ext2_inode *)toybuf;
+    uint32_t start, itable, used, end;
+    int j, slot;
 
-		// If a superblock goes here, write it out.
-		start = group_superblock_overhead(i);
-		if (start) {
-			struct ext2_group *bg = (struct ext2_group *)toybuf;
-			int treeblocks = TT.treeblocks, treeinodes = TT.treeinodes;
+    // Where does this group end?
+    end = TT.blockbits;
+    if ((i+1)*TT.blockbits > TT.blocks) end = TT.blocks & (TT.blockbits-1);
 
-			TT.sb.block_group_nr = SWAP_LE16(i);
+    // Blocks used by inode table
+    itable = (TT.inodespg*sizeof(struct ext2_inode))/TT.blocksize;
 
-			// Write superblock and pad it up to block size
-			xwrite(TT.fsfd, &TT.sb, sizeof(struct ext2_superblock));
-			temp = TT.blocksize - sizeof(struct ext2_superblock);
-			if (!i && TT.blocksize > 1024) temp -= 1024;
-			memset(toybuf, 0, TT.blocksize);
-			xwrite(TT.fsfd, toybuf, temp);
+    // If a superblock goes here, write it out.
+    start = group_superblock_overhead(i);
+    if (start) {
+      struct ext2_group *bg = (struct ext2_group *)toybuf;
+      int treeblocks = TT.treeblocks, treeinodes = TT.treeinodes;
 
-			// Loop through groups to write group descriptor table.
-			for(j=0; j<TT.groups; j++) {
+      TT.sb.block_group_nr = SWAP_LE16(i);
 
-				// Figure out what sector this group starts in.
-				used = group_superblock_overhead(j);
+      // Write superblock and pad it up to block size
+      xwrite(TT.fsfd, &TT.sb, sizeof(struct ext2_superblock));
+      temp = TT.blocksize - sizeof(struct ext2_superblock);
+      if (!i && TT.blocksize > 1024) temp -= 1024;
+      memset(toybuf, 0, TT.blocksize);
+      xwrite(TT.fsfd, toybuf, temp);
 
-				// Find next array slot in this block (flush block if full).
-				slot = j % (TT.blocksize/sizeof(struct ext2_group));
-				if (!slot) {
-					if (j) xwrite(TT.fsfd, bg, TT.blocksize);
-					memset(bg, 0, TT.blocksize);
-				}
+      // Loop through groups to write group descriptor table.
+      for(j=0; j<TT.groups; j++) {
 
-				// How many free inodes in this group?
-				temp = TT.inodespg;
-				if (!i) temp -= INODES_RESERVED;
-				if (temp > treeinodes) {
-					treeinodes -= temp;
-					temp = 0;
-				} else {
-					temp -= treeinodes;
-					treeinodes = 0;
-				}
-				bg[slot].free_inodes_count = SWAP_LE16(temp);
+        // Figure out what sector this group starts in.
+        used = group_superblock_overhead(j);
 
-				// How many free blocks in this group?
-				temp = TT.inodespg/(TT.blocksize/sizeof(struct ext2_inode)) + 2;
-				temp = end-used-temp;
-				if (temp > treeblocks) {
-					treeblocks -= temp;
-					temp = 0;
-				} else {
-					temp -= treeblocks;
-					treeblocks = 0;
-				}
-				bg[slot].free_blocks_count = SWAP_LE32(temp);
+        // Find next array slot in this block (flush block if full).
+        slot = j % (TT.blocksize/sizeof(struct ext2_group));
+        if (!slot) {
+          if (j) xwrite(TT.fsfd, bg, TT.blocksize);
+          memset(bg, 0, TT.blocksize);
+        }
 
-				// Fill out rest of group structure
-				used += j*TT.blockbits;
-				bg[slot].block_bitmap = SWAP_LE32(used++);
-				bg[slot].inode_bitmap = SWAP_LE32(used++);
-				bg[slot].inode_table = SWAP_LE32(used);
-				bg[slot].used_dirs_count = 0;  // (TODO)
-			}
-			xwrite(TT.fsfd, bg, TT.blocksize);
-		}
+        // How many free inodes in this group?
+        temp = TT.inodespg;
+        if (!i) temp -= INODES_RESERVED;
+        if (temp > treeinodes) {
+          treeinodes -= temp;
+          temp = 0;
+        } else {
+          temp -= treeinodes;
+          treeinodes = 0;
+        }
+        bg[slot].free_inodes_count = SWAP_LE16(temp);
 
-		// Now write out stuff that every block group has.
+        // How many free blocks in this group?
+        temp = TT.inodespg/(TT.blocksize/sizeof(struct ext2_inode)) + 2;
+        temp = end-used-temp;
+        if (temp > treeblocks) {
+          treeblocks -= temp;
+          temp = 0;
+        } else {
+          temp -= treeblocks;
+          treeblocks = 0;
+        }
+        bg[slot].free_blocks_count = SWAP_LE32(temp);
 
-		// Write block usage bitmap
+        // Fill out rest of group structure
+        used += j*TT.blockbits;
+        bg[slot].block_bitmap = SWAP_LE32(used++);
+        bg[slot].inode_bitmap = SWAP_LE32(used++);
+        bg[slot].inode_table = SWAP_LE32(used);
+        bg[slot].used_dirs_count = 0;  // (TODO)
+      }
+      xwrite(TT.fsfd, bg, TT.blocksize);
+    }
 
-		start += 2 + itable;
-		memset(toybuf, 0, TT.blocksize);
-		bits_set(toybuf, 0, start);
-		bits_set(toybuf, end, TT.blockbits-end);
-		temp = TT.treeblocks - usedblocks;
-		if (temp) {
-			if (end-start > temp) temp = end-start;
-			bits_set(toybuf, start, temp);
-		}
-		xwrite(TT.fsfd, toybuf, TT.blocksize);
+    // Now write out stuff that every block group has.
 
-		// Write inode bitmap
-		memset(toybuf, 0, TT.blocksize);
-		j = 0;
-		if (!i) bits_set(toybuf, 0, j = INODES_RESERVED);
-		bits_set(toybuf, TT.inodespg, slot = TT.blockbits-TT.inodespg);
-		temp = TT.treeinodes - usedinodes;
-		if (temp) {
-			if (slot-j > temp) temp = slot-j;
-			bits_set(toybuf, j, temp);
-		}
-		xwrite(TT.fsfd, toybuf, TT.blocksize);
+    // Write block usage bitmap
 
-		// Write inode table for this group (TODO)
-		for (j = 0; j<TT.inodespg; j++) {
-			slot = j % (TT.blocksize/sizeof(struct ext2_inode));
-			if (!slot) {
-				if (j) xwrite(TT.fsfd, in, TT.blocksize);
-				memset(in, 0, TT.blocksize);
-			}
-			if (!i && j<INODES_RESERVED) {
-				// Write root inode
-				if (j == 2) fill_inode(in+slot, dtb);
-			} else if (dti) {
-				fill_inode(in+slot, dti);
-				dti = treenext(dti);
-			}
-		}
-		xwrite(TT.fsfd, in, TT.blocksize);
+    start += 2 + itable;
+    memset(toybuf, 0, TT.blocksize);
+    bits_set(toybuf, 0, start);
+    bits_set(toybuf, end, TT.blockbits-end);
+    temp = TT.treeblocks - usedblocks;
+    if (temp) {
+      if (end-start > temp) temp = end-start;
+      bits_set(toybuf, start, temp);
+    }
+    xwrite(TT.fsfd, toybuf, TT.blocksize);
 
-		while (dtb) {
-			// TODO write index data block
-			// TODO write root directory data block
-			// TODO write directory data block
-			// TODO write file data block
-			put_zeroes(TT.blocksize);
-			start++;
-			if (start == end) break;
-		}
-		// Write data blocks (TODO)
-		put_zeroes((end-start) * TT.blocksize);
-	}
+    // Write inode bitmap
+    memset(toybuf, 0, TT.blocksize);
+    j = 0;
+    if (!i) bits_set(toybuf, 0, j = INODES_RESERVED);
+    bits_set(toybuf, TT.inodespg, slot = TT.blockbits-TT.inodespg);
+    temp = TT.treeinodes - usedinodes;
+    if (temp) {
+      if (slot-j > temp) temp = slot-j;
+      bits_set(toybuf, j, temp);
+    }
+    xwrite(TT.fsfd, toybuf, TT.blocksize);
+
+    // Write inode table for this group (TODO)
+    for (j = 0; j<TT.inodespg; j++) {
+      slot = j % (TT.blocksize/sizeof(struct ext2_inode));
+      if (!slot) {
+        if (j) xwrite(TT.fsfd, in, TT.blocksize);
+        memset(in, 0, TT.blocksize);
+      }
+      if (!i && j<INODES_RESERVED) {
+        // Write root inode
+        if (j == 2) fill_inode(in+slot, dtb);
+      } else if (dti) {
+        fill_inode(in+slot, dti);
+        dti = treenext(dti);
+      }
+    }
+    xwrite(TT.fsfd, in, TT.blocksize);
+
+    while (dtb) {
+      // TODO write index data block
+      // TODO write root directory data block
+      // TODO write directory data block
+      // TODO write file data block
+      put_zeroes(TT.blocksize);
+      start++;
+      if (start == end) break;
+    }
+    // Write data blocks (TODO)
+    put_zeroes((end-start) * TT.blocksize);
+  }
 }
--- a/toys/other/mkswap.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/other/mkswap.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,40 +1,38 @@
-/* vi: set sw=4 ts=4:
- *
- * mkswap.c - Format swap device.
+/* mkswap.c - Format swap device.
  *
  * Copyright 2009 Rob Landley <rob@landley.net>
 
 USE_MKSWAP(NEWTOY(mkswap, "<1>1", TOYFLAG_SBIN))
 
 config MKSWAP
-	bool "mkswap"
-	default y
-	help
-	  usage: mkswap DEVICE
+  bool "mkswap"
+  default y
+  help
+    usage: mkswap DEVICE
 
-	  Sets up a Linux swap area on a device or file.
+    Sets up a Linux swap area on a device or file.
 */
 
 #include "toys.h"
 
 void mkswap_main(void)
 {
-	int fd = xopen(*toys.optargs, O_RDWR), pagesize = sysconf(_SC_PAGE_SIZE);
-	off_t len = fdlength(fd);
-	unsigned int pages = (len/pagesize)-1, *swap = (unsigned int *)toybuf;
+  int fd = xopen(*toys.optargs, O_RDWR), pagesize = sysconf(_SC_PAGE_SIZE);
+  off_t len = fdlength(fd);
+  unsigned int pages = (len/pagesize)-1, *swap = (unsigned int *)toybuf;
 
-	// Write header.  Note that older kernel versions checked signature
-	// on disk (not in cache) during swapon, so sync after writing.
+  // Write header. Note that older kernel versions checked signature
+  // on disk (not in cache) during swapon, so sync after writing.
 
-	swap[0] = 1;
-	swap[1] = pages;
-	xlseek(fd, 1024, SEEK_SET);
-	xwrite(fd, swap, 129*sizeof(unsigned int));
-	xlseek(fd, pagesize-10, SEEK_SET);
-	xwrite(fd, "SWAPSPACE2", 10);
-	fsync(fd);
+  swap[0] = 1;
+  swap[1] = pages;
+  xlseek(fd, 1024, SEEK_SET);
+  xwrite(fd, swap, 129*sizeof(unsigned int));
+  xlseek(fd, pagesize-10, SEEK_SET);
+  xwrite(fd, "SWAPSPACE2", 10);
+  fsync(fd);
 
-	if (CFG_TOYBOX_FREE) close(fd);
+  if (CFG_TOYBOX_FREE) close(fd);
 
-	printf("Swapspace size: %luk\n", pages*(unsigned long)(pagesize/1024));
+  printf("Swapspace size: %luk\n", pages*(unsigned long)(pagesize/1024));
 }
--- a/toys/other/modinfo.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/other/modinfo.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,101 +1,92 @@
-/* vi: set sw=4 ts=4:
- *
- * modinfo.c - Display module info
+/* modinfo.c - Display module info
  *
  * Copyright 2012 Andre Renaud <andre@bluewatersys.com>
- *
 
 USE_MODINFO(NEWTOY(modinfo, "<1F:0", TOYFLAG_BIN))
 
 config MODINFO
-	bool "modinfo"
-	default y
-	help
-	  usage: modinfo [-0] [-F field] [modulename...]
+  bool "modinfo"
+  default y
+  help
+    usage: modinfo [-0] [-F field] [modulename...]
 */
 
 #define FOR_modinfo
 #include "toys.h"
 
 GLOBALS(
-    char *field;
+  char *field;
 )
 
 static const char *modinfo_tags[] = {
-    "alias", "license", "description", "author", "vermagic",
-    "srcversion", "intree", "parm", "depends",
+  "alias", "license", "description", "author", "vermagic",
+  "srcversion", "intree", "parm", "depends",
 };
 
 static void output_field(const char *field, const char *value)
 {
-    int len;
+  int len;
 
-    if (TT.field && strcmp(TT.field, field) != 0)
-        return;
+  if (TT.field && strcmp(TT.field, field) != 0) return;
 
-    len = strlen(field);
+  len = strlen(field);
 
-    if (TT.field)
-        xprintf("%s", value);
-    else
-        xprintf("%s:%*s%s",
-                field, 15 - len, "", value);
-    if (toys.optflags & FLAG_0)
-        xwrite(fileno(stdout), "\0", 1);
-    else
-        xputs("");
+  if (TT.field) xprintf("%s", value);
+  else xprintf("%s:%*s%s", field, 15 - len, "", value);
+  if (toys.optflags & FLAG_0) xwrite(fileno(stdout), "\0", 1);
+  else xputs("");
 }
 
 
 static void modinfo_file(struct dirtree *dir)
 {
-    int fd, len, i;
-    char *buf, *pos;
-    char *full_name;
+  int fd, len, i;
+  char *buf, *pos;
+  char *full_name;
 
-    full_name = dirtree_path(dir, NULL);
+  full_name = dirtree_path(dir, NULL);
 
-    output_field("filename", full_name);
-    fd = xopen(full_name, O_RDONLY);
-    len = fdlength(fd);
-    buf = xmalloc(len);
-    xreadall(fd, buf, len);
+  output_field("filename", full_name);
+  fd = xopen(full_name, O_RDONLY);
+  len = fdlength(fd);
+  buf = xmalloc(len);
+  xreadall(fd, buf, len);
 
-    for (pos = buf; pos < buf + len + 10; pos++) {
-        if (*pos)
-            continue;
+  for (pos = buf; pos < buf + len + 10; pos++) {
+    if (*pos) continue;
 
-        for (i = 0; i < sizeof(modinfo_tags) / sizeof(modinfo_tags[0]); i++) {
-            const char *str = modinfo_tags[i];
-            int len = strlen(str); 
-            if (strncmp(pos + 1, str, len) == 0 && pos[len + 1] == '=')
-                output_field(str, &pos[len + 2]);
-        }
+    for (i = 0; i < sizeof(modinfo_tags) / sizeof(modinfo_tags[0]); i++) {
+      const char *str = modinfo_tags[i];
+      int len = strlen(str);
+      if (strncmp(pos + 1, str, len) == 0 && pos[len + 1] == '=')
+        output_field(str, &pos[len + 2]);
     }
+  }
 
-    free(full_name);
-    free(buf);
-    close(fd);
+  free(full_name);
+  free(buf);
+  close(fd);
 }
 
 static int check_module(struct dirtree *new)
 {
-    if (S_ISREG(new->st.st_mode)) {
-        char **s;
-        for (s = toys.optargs; *s; s++) {
-            int len = strlen(*s);
-            if (!strncmp(*s, new->name, len) && !strcmp(new->name+len, ".ko"))
-                modinfo_file(new);
-        }
+  if (S_ISREG(new->st.st_mode)) {
+    char **s;
+    for (s = toys.optargs; *s; s++) {
+      int len = strlen(*s);
+      if (!strncmp(*s, new->name, len) && !strcmp(new->name+len, ".ko"))
+        modinfo_file(new);
     }
+  }
 
-    return dirtree_notdotdot(new);
+  return dirtree_notdotdot(new);
 }
 
 void modinfo_main(void)
 {
-    struct utsname uts;
-    if (uname(&uts) < 0) perror_exit("bad uname");
-    sprintf(toybuf, "/lib/modules/%s", uts.release);
-    dirtree_read(toybuf, check_module);
+  struct utsname uts;
+
+  if (uname(&uts) < 0) perror_exit("bad uname");
+  sprintf(toybuf, "/lib/modules/%s", uts.release);
+  dirtree_read(toybuf, check_module);
 }
--- a/toys/other/mountpoint.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/other/mountpoint.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,20 +1,19 @@
-/* vi: set sw=4 ts=4:
- *
- * mountpoint.c - Check if a directory is a mountpoint.
+/* mountpoint.c - Check if a directory is a mountpoint.
  *
  * Copyright 2012 Elie De Brauwer <eliedebrauwer@gmail.com>
 
 USE_MOUNTPOINT(NEWTOY(mountpoint, "<1qdx", TOYFLAG_BIN))
 
 config MOUNTPOINT
-	bool "mountpoint"
-	default y
-	help
-	  usage: mountpoint [-q] [-d] directory
-			 mountpoint [-q] [-x] device 
-	  -q Be quiet, return zero if directory is a mountpoint
-	  -d Print major/minor device number of the directory
-	  -x Print major/minor device number of the block device
+  bool "mountpoint"
+  default y
+  help
+    usage: mountpoint [-q] [-d] directory
+           mountpoint [-q] [-x] device
+
+    -q	Be quiet, return zero if directory is a mountpoint
+    -d	Print major/minor device number of the directory
+    -x	Print major/minor device number of the block device
 */
 
 #define FOR_mountpoint
@@ -22,34 +21,34 @@
 
 void mountpoint_main(void)
 {
-	struct stat st1, st2;
-	int res = 0;
-	int quiet = toys.optflags & FLAG_q;
-	toys.exitval = 1; // be pessimistic
-	strncpy(toybuf, toys.optargs[0], sizeof(toybuf));
-	if (((toys.optflags & FLAG_x) && lstat(toybuf, &st1)) || stat(toybuf, &st1))
-		perror_exit("%s", toybuf);
+  struct stat st1, st2;
+  int res = 0;
+  int quiet = toys.optflags & FLAG_q;
+  toys.exitval = 1; // be pessimistic
+  strncpy(toybuf, toys.optargs[0], sizeof(toybuf));
+  if (((toys.optflags & FLAG_x) && lstat(toybuf, &st1)) || stat(toybuf, &st1))
+    perror_exit("%s", toybuf);
 
-	if (toys.optflags & FLAG_x){
-		if (S_ISBLK(st1.st_mode)) {
-			if (!quiet) printf("%u:%u\n", major(st1.st_rdev), minor(st1.st_rdev));
-			toys.exitval = 0;
-			return;
-		}
-		if (!quiet) printf("%s: not a block device\n", toybuf);
-		return;
-	}
+  if (toys.optflags & FLAG_x){
+    if (S_ISBLK(st1.st_mode)) {
+      if (!quiet) printf("%u:%u\n", major(st1.st_rdev), minor(st1.st_rdev));
+      toys.exitval = 0;
+      return;
+    }
+    if (!quiet) printf("%s: not a block device\n", toybuf);
+    return;
+  }
 
-	if(!S_ISDIR(st1.st_mode)){
-		if (!quiet) printf("%s: not a directory\n", toybuf);
-		return;
-	}
-	strncat(toybuf, "/..", sizeof(toybuf));
-	stat(toybuf, &st2);
-	res = (st1.st_dev != st2.st_dev) ||
-		(st1.st_dev == st2.st_dev && st1.st_ino == st2.st_ino);
-	if (!quiet) printf("%s is %sa mountpoint\n", toys.optargs[0], res ? "" : "not ");
-	if (toys.optflags & FLAG_d)
-		printf("%u:%u\n", major(st1.st_dev), minor(st1.st_dev));
-	toys.exitval = res ? 0 : 1;
+  if(!S_ISDIR(st1.st_mode)){
+    if (!quiet) printf("%s: not a directory\n", toybuf);
+    return;
+  }
+  strncat(toybuf, "/..", sizeof(toybuf));
+  stat(toybuf, &st2);
+  res = (st1.st_dev != st2.st_dev) ||
+    (st1.st_dev == st2.st_dev && st1.st_ino == st2.st_ino);
+  if (!quiet) printf("%s is %sa mountpoint\n", toys.optargs[0], res ? "" : "not ");
+  if (toys.optflags & FLAG_d)
+    printf("%u:%u\n", major(st1.st_dev), minor(st1.st_dev));
+  toys.exitval = res ? 0 : 1;
 }
--- a/toys/other/netcat.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/other/netcat.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,46 +1,42 @@
-/* vi: set sw=4 ts=4:
- *
- * netcat.c - Forward stdin/stdout to a file or network connection.
+/* netcat.c - Forward stdin/stdout to a file or network connection.
  *
  * Copyright 2007 Rob Landley <rob@landley.net>
  *
  * TODO: udp, ipv6, genericize for telnet/microcom/tail-f
 
-
 USE_NETCAT(OLDTOY(nc, netcat, USE_NETCAT_LISTEN("tl^L^")"w#p#s:q#f:", TOYFLAG_BIN))
 USE_NETCAT(NEWTOY(netcat, USE_NETCAT_LISTEN("tl^L^")"w#p#s:q#f:", TOYFLAG_BIN))
 
 config NETCAT
-	bool "netcat"
-	default y
-	help
-	  usage: netcat [-wpq #] [-s addr] {IPADDR PORTNUM|-f FILENAME|-let} [-e COMMAND]
+  bool "netcat"
+  default y
+  help
+    usage: netcat [-wpq #] [-s addr] {IPADDR PORTNUM|-f FILENAME|-let} [-e COMMAND]
 
-	  -w	SECONDS timeout for connection
-	  -p	local port number
-	  -s	local ipv4 address
-	  -q	SECONDS quit this many seconds after EOF on stdin.
-	  -f	use FILENAME (ala /dev/ttyS0) instead of network
+    -w	SECONDS timeout for connection
+    -p	local port number
+    -s	local ipv4 address
+    -q	SECONDS quit this many seconds after EOF on stdin.
+    -f	use FILENAME (ala /dev/ttyS0) instead of network
 
-	  Use "stty 115200 -F /dev/ttyS0 && stty raw -echo -ctlecho" with
-	  netcat -f to connect to a serial port.
-
+    Use "stty 115200 -F /dev/ttyS0 && stty raw -echo -ctlecho" with
+    netcat -f to connect to a serial port.
 
 config NETCAT_LISTEN
-	bool "netcat server options (-let)"
-	default y
-	depends on NETCAT
-	help
-	  -t    allocate tty (must come before -l or -L)
-	  -l	listen for one incoming connection.
-	  -L	listen for multiple incoming connections (server mode).
+  bool "netcat server options (-let)"
+  default y
+  depends on NETCAT
+  help
+    -t	allocate tty (must come before -l or -L)
+    -l	listen for one incoming connection.
+    -L	listen for multiple incoming connections (server mode).
 
-	  Any additional command line arguments after -l or -L are executed
-	  to handle each incoming connection.  If none, the connection is
-	  forwarded to stdin/stdout.
+    Any additional command line arguments after -l or -L are executed
+    to handle each incoming connection. If none, the connection is
+    forwarded to stdin/stdout.
 
-	  For a quick-and-dirty server, try something like:
-		netcat -s 127.0.0.1 -p 1234 -tL /bin/bash -l
+    For a quick-and-dirty server, try something like:
+    netcat -s 127.0.0.1 -p 1234 -tL /bin/bash -l
 */
 
 #define FOR_netcat
@@ -48,33 +44,33 @@
 #include "toynet.h"
 
 GLOBALS(
-	char *filename;        // -f read from filename instead of network
-	long quit_delay;       // -q Exit after EOF from stdin after # seconds.
-	char *source_address;  // -s Bind to a specific source address.
-	long port;             // -p Bind to a specific source port.
-	long wait;             // -w Wait # seconds for a connection.
+  char *filename;        // -f read from filename instead of network
+  long quit_delay;       // -q Exit after EOF from stdin after # seconds.
+  char *source_address;  // -s Bind to a specific source address.
+  long port;             // -p Bind to a specific source port.
+  long wait;             // -w Wait # seconds for a connection.
 )
 
 static void timeout(int signum)
 {
-	if (TT.wait) error_exit("Timeout");
-	exit(0);
+  if (TT.wait) error_exit("Timeout");
+  exit(0);
 }
 
 static void set_alarm(int seconds)
 {
-	signal(SIGALRM, seconds ? timeout : SIG_DFL);
-	alarm(seconds);
+  signal(SIGALRM, seconds ? timeout : SIG_DFL);
+  alarm(seconds);
 }
 
 // Translate x.x.x.x numeric IPv4 address, or else DNS lookup an IPv4 name.
 static void lookup_name(char *name, uint32_t *result)
 {
-	struct hostent *hostbyname;
+  struct hostent *hostbyname;
 
-	hostbyname = gethostbyname(name);
-	if (!hostbyname) error_exit("no host '%s'", name);
-	*result = *(uint32_t *)*hostbyname->h_addr_list;
+  hostbyname = gethostbyname(name);
+  if (!hostbyname) error_exit("no host '%s'", name);
+  *result = *(uint32_t *)*hostbyname->h_addr_list;
 }
 
 // Worry about a fancy lookup later.
@@ -85,143 +81,142 @@
 
 void netcat_main(void)
 {
-	int sockfd=-1, pollcount=2;
-	struct pollfd pollfds[2];
+  int sockfd=-1, pollcount=2;
+  struct pollfd pollfds[2];
 
-	memset(pollfds, 0, 2*sizeof(struct pollfd));
-	pollfds[0].events = pollfds[1].events = POLLIN;
-	set_alarm(TT.wait);
+  memset(pollfds, 0, 2*sizeof(struct pollfd));
+  pollfds[0].events = pollfds[1].events = POLLIN;
+  set_alarm(TT.wait);
 
-	// The argument parsing logic can't make "<2" conditional on other
-	// arguments like -f and -l, so we do it by hand here.
-	if (toys.optflags&FLAG_f) {
-		if (toys.optc) toys.exithelp++;
-	} else if (!(toys.optflags&(FLAG_l|FLAG_L)) && toys.optc!=2) toys.exithelp++;
+  // The argument parsing logic can't make "<2" conditional on other
+  // arguments like -f and -l, so we do it by hand here.
+  if (toys.optflags&FLAG_f) {
+    if (toys.optc) toys.exithelp++;
+  } else if (!(toys.optflags&(FLAG_l|FLAG_L)) && toys.optc!=2) toys.exithelp++;
 
-	if (toys.exithelp) error_exit("Argument count wrong");
+  if (toys.exithelp) error_exit("Argument count wrong");
 
-	if (TT.filename) pollfds[0].fd = xopen(TT.filename, O_RDWR);
-	else {
-		int temp;
-		struct sockaddr_in address;
+  if (TT.filename) pollfds[0].fd = xopen(TT.filename, O_RDWR);
+  else {
+    int temp;
+    struct sockaddr_in address;
 
-		// Setup socket
-		sockfd = socket(AF_INET, SOCK_STREAM, 0);
-		if (-1 == sockfd) perror_exit("socket");
-		fcntl(sockfd, F_SETFD, FD_CLOEXEC);
-		temp = 1;
-		setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &temp, sizeof(temp));
-		memset(&address, 0, sizeof(address));
-		address.sin_family = AF_INET;
-		if (TT.source_address || TT.port) {
-			address.sin_port = SWAP_BE16(TT.port);
-			if (TT.source_address) 
-				lookup_name(TT.source_address, (uint32_t *)&address.sin_addr);
-			if (bind(sockfd, (struct sockaddr *)&address, sizeof(address)))
-				perror_exit("bind");
-		}
+    // Setup socket
+    sockfd = socket(AF_INET, SOCK_STREAM, 0);
+    if (-1 == sockfd) perror_exit("socket");
+    fcntl(sockfd, F_SETFD, FD_CLOEXEC);
+    temp = 1;
+    setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &temp, sizeof(temp));
+    memset(&address, 0, sizeof(address));
+    address.sin_family = AF_INET;
+    if (TT.source_address || TT.port) {
+      address.sin_port = SWAP_BE16(TT.port);
+      if (TT.source_address)
+        lookup_name(TT.source_address, (uint32_t *)&address.sin_addr);
+      if (bind(sockfd, (struct sockaddr *)&address, sizeof(address)))
+        perror_exit("bind");
+    }
 
-		// Dial out
+    // Dial out
 
-		if (!CFG_NETCAT_LISTEN || !(toys.optflags&(FLAG_L|FLAG_l))) {
-			// Figure out where to dial out to.
-			lookup_name(*toys.optargs, (uint32_t *)&address.sin_addr);
-			lookup_port(toys.optargs[1], &address.sin_port);
-			temp = connect(sockfd, (struct sockaddr *)&address, sizeof(address));
-			if (temp<0) perror_exit("connect");
-			pollfds[0].fd = sockfd;
+    if (!CFG_NETCAT_LISTEN || !(toys.optflags&(FLAG_L|FLAG_l))) {
+      // Figure out where to dial out to.
+      lookup_name(*toys.optargs, (uint32_t *)&address.sin_addr);
+      lookup_port(toys.optargs[1], &address.sin_port);
+      temp = connect(sockfd, (struct sockaddr *)&address, sizeof(address));
+      if (temp<0) perror_exit("connect");
+      pollfds[0].fd = sockfd;
 
-		// Listen for incoming connections
+    // Listen for incoming connections
 
-		} else {
-			socklen_t len = sizeof(address);
+    } else {
+      socklen_t len = sizeof(address);
 
-			if (listen(sockfd, 5)) error_exit("listen");
-			if (!TT.port) {
-				getsockname(sockfd, (struct sockaddr *)&address, &len);
-				printf("%d\n", SWAP_BE16(address.sin_port));
-				fflush(stdout);
-			}
-			// Do we need to return immediately because -l has arguments?
+      if (listen(sockfd, 5)) error_exit("listen");
+      if (!TT.port) {
+        getsockname(sockfd, (struct sockaddr *)&address, &len);
+        printf("%d\n", SWAP_BE16(address.sin_port));
+        fflush(stdout);
+      }
+      // Do we need to return immediately because -l has arguments?
 
-			if ((toys.optflags&FLAG_l) && toys.optc) {
-				if (fork()) goto cleanup;
-				close(0);
-				close(1);
-				close(2);
-			}
+      if ((toys.optflags&FLAG_l) && toys.optc) {
+        if (fork()) goto cleanup;
+        close(0);
+        close(1);
+        close(2);
+      }
 
-			for (;;) {
-				pid_t child = 0;
+      for (;;) {
+        pid_t child = 0;
 
-				// For -l, call accept from the _new_ thread.
+        // For -l, call accept from the _new_ thread.
 
-				pollfds[0].fd = accept(sockfd, (struct sockaddr *)&address,
-					&len);
-				if (pollfds[0].fd<0) perror_exit("accept");
+        pollfds[0].fd = accept(sockfd, (struct sockaddr *)&address, &len);
+        if (pollfds[0].fd<0) perror_exit("accept");
 
-				// Do we need a tty?
+        // Do we need a tty?
 
-				if (toys.optflags&FLAG_t)
-					child = forkpty(&(pollfds[1].fd), NULL, NULL, NULL);
+        if (toys.optflags&FLAG_t)
+          child = forkpty(&(pollfds[1].fd), NULL, NULL, NULL);
 
-				// Do we need to fork and/or redirect for exec?
+        // Do we need to fork and/or redirect for exec?
 
-				else {
-					if (toys.optflags&FLAG_L) child = fork();
-					if (!child && toys.optc) {
-						int fd = pollfds[0].fd;
+        else {
+          if (toys.optflags&FLAG_L) child = fork();
+          if (!child && toys.optc) {
+            int fd = pollfds[0].fd;
 
-						if (!temp) close(sockfd);
-						dup2(fd, 0);
-						dup2(fd, 1);
-						dup2(fd, 2);
-						if (fd>2) close(fd);
-					}
-				}
+            if (!temp) close(sockfd);
+            dup2(fd, 0);
+            dup2(fd, 1);
+            dup2(fd, 2);
+            if (fd>2) close(fd);
+          }
+        }
 
-				if (child<0) error_msg("Fork failed\n");
-				if (child<1) break;
-				close(pollfds[0].fd);
-			}
-		}
-	}
+        if (child<0) error_msg("Fork failed\n");
+        if (child<1) break;
+        close(pollfds[0].fd);
+      }
+    }
+  }
 
-	// We have a connection.  Disarm timeout.
-	// (Does not play well with -L, but what _should_ that do?)
-	set_alarm(0);
+  // We have a connection.  Disarm timeout.
+  // (Does not play well with -L, but what _should_ that do?)
+  set_alarm(0);
 
-	if (CFG_NETCAT_LISTEN && (toys.optflags&(FLAG_L|FLAG_l) && toys.optc)) {
-		execvp(*toys.optargs, toys.optargs);
-		error_exit("Exec failed");
-	}
+  if (CFG_NETCAT_LISTEN && (toys.optflags&(FLAG_L|FLAG_l) && toys.optc)) {
+    execvp(*toys.optargs, toys.optargs);
+    error_exit("Exec failed");
+  }
 
-	// Poll loop copying stdin->socket and socket->stdout.
-	for (;;) {
-		int i;
+  // Poll loop copying stdin->socket and socket->stdout.
+  for (;;) {
+    int i;
 
-		if (0>poll(pollfds, pollcount, -1)) perror_exit("poll");
+    if (0>poll(pollfds, pollcount, -1)) perror_exit("poll");
 
-		for (i=0; i<pollcount; i++) {
-			if (pollfds[i].revents & POLLIN) {
-				int len = read(pollfds[i].fd, toybuf, sizeof(toybuf));
-				if (len<1) goto dohupnow;
-				xwrite(i ? pollfds[0].fd : 1, toybuf, len);
-			} else if (pollfds[i].revents & POLLHUP) {
+    for (i=0; i<pollcount; i++) {
+      if (pollfds[i].revents & POLLIN) {
+        int len = read(pollfds[i].fd, toybuf, sizeof(toybuf));
+        if (len<1) goto dohupnow;
+        xwrite(i ? pollfds[0].fd : 1, toybuf, len);
+      } else if (pollfds[i].revents & POLLHUP) {
 dohupnow:
-				// Close half-connection.  This is needed for things like
-				// "echo GET / | netcat landley.net 80"
-				if (i) {
-					shutdown(pollfds[0].fd, SHUT_WR);
-					pollcount--;
-					set_alarm(TT.quit_delay);
-				} else goto cleanup;
-			}
-		}
-	}
+        // Close half-connection.  This is needed for things like
+        // "echo GET / | netcat landley.net 80"
+        if (i) {
+          shutdown(pollfds[0].fd, SHUT_WR);
+          pollcount--;
+          set_alarm(TT.quit_delay);
+        } else goto cleanup;
+      }
+    }
+  }
 cleanup:
-	if (CFG_TOYBOX_FREE) {
-		close(pollfds[0].fd);
-		close(sockfd);
-	}
+  if (CFG_TOYBOX_FREE) {
+    close(pollfds[0].fd);
+    close(sockfd);
+  }
 }
--- a/toys/other/oneit.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/other/oneit.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,27 +1,25 @@
-/* vi: set sw=4 ts=4:
- *
- * oneit.c - tiny init replacement to launch a single child process.
+/* oneit.c - tiny init replacement to launch a single child process.
  *
  * Copyright 2005, 2007 by Rob Landley <rob@landley.net>.
 
 USE_ONEIT(NEWTOY(oneit, "^<1c:p", TOYFLAG_SBIN))
 
 config ONEIT
-	bool "oneit"
-	default y
-	help
-	  usage: oneit [-p] [-c /dev/tty0] command [...]
+  bool "oneit"
+  default y
+  help
+    usage: oneit [-p] [-c /dev/tty0] command [...]
 
-	  A simple init program that runs a single supplied command line with a
-	  controlling tty (so CTRL-C can kill it).
+    A simple init program that runs a single supplied command line with a
+    controlling tty (so CTRL-C can kill it).
 
-	  -p	Power off instead of rebooting when command exits.
-	  -c	Which console device to use.
+    -p	Power off instead of rebooting when command exits.
+    -c	Which console device to use.
 
-	  The oneit command runs the supplied command line as a child process
-	  (because PID 1 has signals blocked), attached to /dev/tty0, in its
-	  own session.  Then oneit reaps zombies until the child exits, at
-	  which point it reboots (or with -p, powers off) the system.
+    The oneit command runs the supplied command line as a child process
+    (because PID 1 has signals blocked), attached to /dev/tty0, in its
+    own session. Then oneit reaps zombies until the child exits, at
+    which point it reboots (or with -p, powers off) the system.
 */
 
 #define FOR_oneit
@@ -29,7 +27,7 @@
 #include <sys/reboot.h>
 
 GLOBALS(
-	char *console;
+  char *console;
 )
 
 // The minimum amount of work necessary to get ctrl-c and such to work is:
@@ -53,22 +51,21 @@
   if (pid) {
 
     // pid 1 just reaps zombies until it gets its child, then halts the system.
-    while (pid!=wait(&i));
+    while (pid != wait(&i));
     sync();
 
-	// PID 1 can't call reboot() because it kills the task that calls it,
-	// which causes the kernel to panic before the actual reboot happens.
-	if (!vfork())
-            reboot((toys.optflags & FLAG_p) ? RB_POWER_OFF : RB_AUTOBOOT);
-	sleep(5);
-	_exit(1);
+    // PID 1 can't call reboot() because it kills the task that calls it,
+    // which causes the kernel to panic before the actual reboot happens.
+    if (!vfork()) reboot((toys.optflags & FLAG_p) ? RB_POWER_OFF : RB_AUTOBOOT);
+    sleep(5);
+    _exit(1);
   }
 
   // Redirect stdio to /dev/tty0, with new session ID, so ctrl-c works.
   setsid();
   for (i=0; i<3; i++) {
     close(i);
-    xopen(TT.console ? TT.console : "/dev/tty0",O_RDWR);
+    xopen(TT.console ? TT.console : "/dev/tty0", O_RDWR);
   }
 
   // Can't xexec() here, because we vforked so we don't want to error_exit().
--- a/toys/other/printenv.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/other/printenv.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,20 +1,18 @@
-/* vi: set sw=4 ts=4:
- *
- * printenv.c - Print environment variables.
+/* printenv.c - Print environment variables.
  *
  * Copyright 2012 Georgi Chorbadzhiyski <georgi@unixsol.org>
 
 USE_PRINTENV(NEWTOY(printenv, "0(null)", TOYFLAG_USR|TOYFLAG_BIN))
 
 config PRINTENV
-	bool "printenv"
-	default y
-	help
-	  usage: printenv [-0] [env_var...]
+  bool "printenv"
+  default y
+  help
+    usage: printenv [-0] [env_var...]
 
-	  Print environment variables.
+    Print environment variables.
 
-	  -0	Use \0 as delimiter instead of \n
+    -0	Use \0 as delimiter instead of \n
 */
 
 #include "toys.h"
@@ -23,24 +21,23 @@
 
 void printenv_main(void)
 {
-	char **env, **var = toys.optargs;
-	char delim = '\n';
+  char **env, **var = toys.optargs;
+  char delim = '\n';
 
-	if (toys.optflags) delim = 0;
+  if (toys.optflags) delim = 0;
 
-	do {
-		int catch = 0, len = *var ? strlen(*var) : 0;
+  do {
+    int catch = 0, len = *var ? strlen(*var) : 0;
 
-		for (env = environ; *env; env++) {
-			char *out = *env;
-			if (*var) {
-				if (!strncmp(out, *var, len) && out[len] == '=')
-					out += len +1;
-				else continue;
-			}
-			xprintf("%s%c", out, delim);
-			catch++;
-		}
-		if (*var && !catch) toys.exitval = 1;
-	} while (*var && *(++var));
+    for (env = environ; *env; env++) {
+      char *out = *env;
+      if (*var) {
+        if (!strncmp(out, *var, len) && out[len] == '=') out += len +1;
+        else continue;
+      }
+      xprintf("%s%c", out, delim);
+      catch++;
+    }
+    if (*var && !catch) toys.exitval = 1;
+  } while (*var && *(++var));
 }
--- a/toys/other/readlink.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/other/readlink.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,43 +1,41 @@
-/* vi: set sw=4 ts=4:
- *
- * readlink.c - Return string representation of a symbolic link.
+/* readlink.c - Return string representation of a symbolic link.
  *
  * Copyright 2007 Rob Landley <rob@landley.net>
 
 USE_READLINK(NEWTOY(readlink, "<1f", TOYFLAG_BIN))
 
 config READLINK
-	bool "readlink"
-	default n
-	help
-	  usage: readlink
+  bool "readlink"
+  default n
+  help
+    usage: readlink
 
-	  Show what a symbolic link points to.
+    Show what a symbolic link points to.
 
 config READLINK_F
-	bool "readlink -f"
-	default n
-	depends on READLINK
-	help
-	  usage: readlink [-f]
+  bool "readlink -f"
+  default n
+  depends on READLINK
+  help
+    usage: readlink [-f]
 
-	  -f	Show full cannonical path, with no symlinks in it.  Returns
-		nonzero if nothing could currently exist at this location.
+    -f	Show full cannonical path, with no symlinks in it.  Returns
+    	nonzero if nothing could currently exist at this location.
 */
 
 #include "toys.h"
 
 void readlink_main(void)
 {
-	char *s;
+  char *s;
 
-	// Calculating full cannonical path?
+  // Calculating full cannonical path?
 
-	if (CFG_READLINK_F && toys.optflags) s = xrealpath(*toys.optargs);
-	else s = xreadlink(*toys.optargs);
+  if (CFG_READLINK_F && toys.optflags) s = xrealpath(*toys.optargs);
+  else s = xreadlink(*toys.optargs);
 
-	if (s) {
-		xputs(s);
-		if (CFG_TOYBOX_FREE) free(s);
-	} else toys.exitval = 1;
+  if (s) {
+    xputs(s);
+    if (CFG_TOYBOX_FREE) free(s);
+  } else toys.exitval = 1;
 }
--- a/toys/other/realpath.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/other/realpath.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,29 +1,28 @@
-/* vi: set sw=4 ts=4:
- *
- * realpath.c - Return the canonical version of a pathname
+/* realpath.c - Return the canonical version of a pathname
  *
  * Copyright 2012 Andre Renaud <andre@bluewatersys.com>
 
 USE_REALPATH(NEWTOY(realpath, "<1", TOYFLAG_USR|TOYFLAG_BIN))
 
 config REALPATH
-	bool "realpath"
-	default y
-	help
-	  usage: realpath FILE...
+  bool "realpath"
+  default y
+  help
+    usage: realpath FILE...
 
-	  Display the canonical absolute pathname
+    Display the canonical absolute pathname
 */
 
 #include "toys.h"
 
 void realpath_main(void)
 {
-    char **s = toys.optargs;
-    for (s = toys.optargs; *s; s++) {
-        if (!realpath(*s, toybuf)) {
-            perror_msg("cannot access '%s'", *s);
-            toys.exitval = 1;
-        } else xputs(toybuf);
-    }
+  char **s = toys.optargs;
+
+  for (s = toys.optargs; *s; s++) {
+    if (!realpath(*s, toybuf)) {
+      perror_msg("cannot access '%s'", *s);
+      toys.exitval = 1;
+    } else xputs(toybuf);
+  }
 }
--- a/toys/other/rmmod.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/other/rmmod.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,20 +1,18 @@
-/* vi: set sw=4 ts=4:
- *
- * rmmod.c - Remove a module from the Linux kernel.
+/* rmmod.c - Remove a module from the Linux kernel.
  *
  * Copyright 2012 Elie De Brauwer <eliedebrauwer@gmail.com>
 
 USE_RMMOD(NEWTOY(rmmod, "<1wf", TOYFLAG_BIN|TOYFLAG_NEEDROOT))
 
 config RMMOD
-	bool "rmmod"
-	default y
-	help
-	  usage: rmmod [-wf] [MODULE]
+  bool "rmmod"
+  default y
+  help
+    usage: rmmod [-wf] [MODULE]
 
-	  Unload the module named MODULE from the Linux kernel.
-	  -f   Force unload of a module
-	  -w   Wait until the module is no longer used.
+    Unload the module named MODULE from the Linux kernel.
+    -f	Force unload of a module
+    -w	Wait until the module is no longer used.
 
 */
 
@@ -26,25 +24,22 @@
 
 void rmmod_main(void)
 {
-	unsigned int flags = O_NONBLOCK|O_EXCL;
-	char * mod_name;
-	int len;
+  unsigned int flags = O_NONBLOCK|O_EXCL;
+  char * mod_name;
+  int len;
 
-	// Basename
-	mod_name = strrchr(toys.optargs[0],'/');
-	if (mod_name)
-		mod_name++;
-	else
-		mod_name = toys.optargs[0];
+  // Basename
+  mod_name = strrchr(toys.optargs[0],'/');
+  if (mod_name) mod_name++;
+  else mod_name = toys.optargs[0];
 
-	// Remove .ko if present
-	len = strlen(mod_name);
-	if (len > 3 && !strcmp(&mod_name[len-3], ".ko" ))
-		mod_name[len-3] = 0;
+  // Remove .ko if present
+  len = strlen(mod_name);
+  if (len > 3 && !strcmp(&mod_name[len-3], ".ko" )) mod_name[len-3] = 0;
 
-	if (toys.optflags & FLAG_f) flags |= O_TRUNC;
-	if (toys.optflags & FLAG_w) flags &= ~O_NONBLOCK;
+  if (toys.optflags & FLAG_f) flags |= O_TRUNC;
+  if (toys.optflags & FLAG_w) flags &= ~O_NONBLOCK;
 
-	if (delete_module(mod_name, flags))
-		perror_exit("failed to unload %s", mod_name);
+  if (delete_module(mod_name, flags))
+    perror_exit("failed to unload %s", mod_name);
 }
--- a/toys/other/setsid.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/other/setsid.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,31 +1,28 @@
-/* vi: set sw=4 ts=4:
- *
- * setsid.c - Run program in a new session ID.
+/* setsid.c - Run program in a new session ID.
  *
  * Copyright 2006 Rob Landley <rob@landley.net>
 
 USE_SETSID(NEWTOY(setsid, "^<1t", TOYFLAG_USR|TOYFLAG_BIN))
 
 config SETSID
-	bool "setsid"
-	default y
-	help
-	  usage: setsid [-t] command [args...]
+  bool "setsid"
+  default y
+  help
+    usage: setsid [-t] command [args...]
 
-	  Run process in a new session.
+    Run process in a new session.
 
-	  -t	Grab tty (become foreground process, receiving keyboard signals)
+    -t	Grab tty (become foreground process, receiving keyboard signals)
 */
 
 #include "toys.h"
 
 void setsid_main(void)
 {
-	while (setsid()<0)
-		if (vfork()) _exit(0);
-	if (toys.optflags) {
-		setpgid(0,0);
-		tcsetpgrp(0, getpid());
-	}
-	xexec(toys.optargs);
+  while (setsid()<0) if (vfork()) _exit(0);
+  if (toys.optflags) {
+    setpgid(0,0);
+    tcsetpgrp(0, getpid());
+  }
+  xexec(toys.optargs);
 }
--- a/toys/other/swapoff.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/other/swapoff.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,24 +1,21 @@
-/* vi: set sw=4 ts=4:
- *
- * swapoff.c - Disable region for swapping
+/* swapoff.c - Disable region for swapping
  *
  * Copyright 2012 Elie De Brauwer <eliedebrauwer@gmail.com>
 
 USE_SWAPOFF(NEWTOY(swapoff, "<1>1", TOYFLAG_BIN|TOYFLAG_NEEDROOT))
 
 config SWAPOFF
-	bool "swapoff"
-	default y
-	help
-	  usage: swapoff swapregion
+  bool "swapoff"
+  default y
+  help
+    usage: swapoff swapregion
 
-	  Disable swapping on a given swapregion.
+    Disable swapping on a given swapregion.
 */
 
 #include "toys.h"
 
 void swapoff_main(void)
 {
-	if (swapoff(toys.optargs[0]))
-		perror_exit("failed to remove swaparea");
+  if (swapoff(toys.optargs[0])) perror_exit("failed to remove swaparea");
 }
--- a/toys/other/swapon.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/other/swapon.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,34 +1,32 @@
-/* vi: set sw=4 ts=4:
- *
- * swapon.c - Enable region for swapping
+/* swapon.c - Enable region for swapping
  *
  * Copyright 2012 Elie De Brauwer <eliedebrauwer@gmail.com>
 
 USE_SWAPON(NEWTOY(swapon, "<1>1p#<0>32767", TOYFLAG_BIN|TOYFLAG_NEEDROOT))
 
 config SWAPON
-	bool "swapon"
-	default y
-	help
-	  usage: swapon [-p priority] filename
+  bool "swapon"
+  default y
+  help
+    usage: swapon [-p priority] filename
 
-	  Enable swapping on a given device/file.
+    Enable swapping on a given device/file.
 */
 
 #define FOR_swapon
 #include "toys.h"
 
 GLOBALS(
-	long priority;
+  long priority;
 )
 
 void swapon_main(void)
 {
-	int flags = 0;
+  int flags = 0;
 
-	if (toys.optflags)
-		flags = SWAP_FLAG_PREFER | (TT.priority << SWAP_FLAG_PRIO_SHIFT);
+  if (toys.optflags)
+    flags = SWAP_FLAG_PREFER | (TT.priority << SWAP_FLAG_PRIO_SHIFT);
 
-	if (swapon(*toys.optargs, flags))
-		perror_exit("Couldn't swapon '%s'", *toys.optargs);
+  if (swapon(*toys.optargs, flags))
+    perror_exit("Couldn't swapon '%s'", *toys.optargs);
 }
--- a/toys/other/switch_root.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/other/switch_root.c	Tue Nov 13 17:14:08 2012 -0600
@@ -5,16 +5,16 @@
 USE_SWITCH_ROOT(NEWTOY(switch_root, "<2c:h", TOYFLAG_SBIN))
 
 config SWITCH_ROOT
-	bool "switch_root"
-	default y
-	help
-	  usage: switch_root [-c /dev/console] NEW_ROOT NEW_INIT...
+  bool "switch_root"
+  default y
+  help
+    usage: switch_root [-c /dev/console] NEW_ROOT NEW_INIT...
 
-	  Use from PID 1 under initramfs to free initramfs, chroot to NEW_ROOT,
-	  and exec NEW_INIT.
+    Use from PID 1 under initramfs to free initramfs, chroot to NEW_ROOT,
+    and exec NEW_INIT.
 
-	  -c	Redirect console to device in NEW_ROOT
-	  -h	Hang instead of exiting on failure (avoids kernel panic)
+    -c	Redirect console to device in NEW_ROOT
+    -h	Hang instead of exiting on failure (avoids kernel panic)
 */
 
 #define FOR_switch_root
@@ -22,72 +22,72 @@
 #include <sys/vfs.h>
 
 GLOBALS(
-   char *console;
+  char *console;
 
-   dev_t rootdev;
+  dev_t rootdev;
 )
 
 static int del_node(struct dirtree *node)
 {
-   if (node->st.st_dev == TT.rootdev && dirtree_notdotdot(node)) {
-      int flag = 0;
-      if (S_ISDIR(node->st.st_mode)) {
-         if (node->data != -1) return DIRTREE_COMEAGAIN;
-         flag = AT_REMOVEDIR;
-      }
-      unlinkat(dirtree_parentfd(node), node->name, flag);
-   }
+  if (node->st.st_dev == TT.rootdev && dirtree_notdotdot(node)) {
+    int flag = 0;
+    if (S_ISDIR(node->st.st_mode)) {
+      if (node->data != -1) return DIRTREE_COMEAGAIN;
+      flag = AT_REMOVEDIR;
+    }
+    unlinkat(dirtree_parentfd(node), node->name, flag);
+  }
 
-   return 0;
+  return 0;
 }
 
 void switch_root_main(void)
 {
-   char *newroot = *toys.optargs, **cmdline = toys.optargs+1;
-   struct stat st1, st2;
-   struct statfs stfs;
-   int console = console; // gcc's "may be used" warnings are broken.
+  char *newroot = *toys.optargs, **cmdline = toys.optargs+1;
+  struct stat st1, st2;
+  struct statfs stfs;
+  int console = console; // gcc's "may be used" warnings are broken.
 
-   if (getpid() != 1) error_exit("not pid 1");
+  if (getpid() != 1) error_exit("not pid 1");
 
-   // Root filesystem we're leaving must be ramfs or tmpfs
-   if (statfs("/", &stfs) ||
-      (stfs.f_type != 0x858458f6 && stfs.f_type != 0x01021994))
-   {
-      error_msg("not ramfs");
-      goto panic;
-   }
+  // Root filesystem we're leaving must be ramfs or tmpfs
+  if (statfs("/", &stfs) ||
+    (stfs.f_type != 0x858458f6 && stfs.f_type != 0x01021994))
+  {
+    error_msg("not ramfs");
+    goto panic;
+  }
 
-   // New directory must be different filesystem instance
-   if (chdir(newroot) || stat(".", &st1) || stat("/", &st2) ||
-      st1.st_dev == st2.st_dev)
-   {
-      error_msg("bad newroot '%s'", newroot);
-      goto panic;
-   }
-   TT.rootdev=st2.st_dev;
+  // New directory must be different filesystem instance
+  if (chdir(newroot) || stat(".", &st1) || stat("/", &st2) ||
+    st1.st_dev == st2.st_dev)
+  {
+    error_msg("bad newroot '%s'", newroot);
+    goto panic;
+  }
+  TT.rootdev=st2.st_dev;
 
-   // init program must exist and be an executable file
-   if (stat("init", &st1) || !S_ISREG(st1.st_mode) || !(st1.st_mode&0100)) {
-      error_msg("bad init");
-      goto panic;
-   }
+  // init program must exist and be an executable file
+  if (stat("init", &st1) || !S_ISREG(st1.st_mode) || !(st1.st_mode&0100)) {
+    error_msg("bad init");
+    goto panic;
+  }
 
-   if (TT.console && -1 == (console = open(TT.console, O_RDWR))) {
-      perror_msg("bad console '%s'", TT.console);
-      goto panic;
-   }
+  if (TT.console && -1 == (console = open(TT.console, O_RDWR))) {
+    perror_msg("bad console '%s'", TT.console);
+    goto panic;
+  }
  
-   // Ok, enough safety checks: wipe root partition.
-   dirtree_read("/", del_node);
+  // Ok, enough safety checks: wipe root partition.
+  dirtree_read("/", del_node);
 
-   if (TT.console) {
-      int i;
-      for (i=0; i<3; i++) if (console != i) dup2(console, i);
-      if (console>2) close(console);
-   }
-   execv(*cmdline, cmdline);
-   perror_msg("Failed to exec '%s'", *cmdline);
+  if (TT.console) {
+    int i;
+    for (i=0; i<3; i++) if (console != i) dup2(console, i);
+    if (console>2) close(console);
+  }
+  execv(*cmdline, cmdline);
+  perror_msg("Failed to exec '%s'", *cmdline);
 panic:
-   if (toys.optflags & FLAG_h) for (;;) wait(NULL);
+  if (toys.optflags & FLAG_h) for (;;) wait(NULL);
 }
--- a/toys/other/tac.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/other/tac.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,53 +1,51 @@
-/* vi: set sw=4 ts=4:
- *
- * tac.c - output lines in reverse order
+/* tac.c - output lines in reverse order
  *
  * Copyright 2012 Rob Landley <rob@landley.net>
 
 USE_TAC(NEWTOY(tac, NULL, TOYFLAG_USR|TOYFLAG_BIN))
 
 config TAC
-	bool "tac"
-	default y
-	help
-	  usage: tac [FILE...]
+  bool "tac"
+  default y
+  help
+    usage: tac [FILE...]
 
-	  Output lines in reverse order.
+    Output lines in reverse order.
 */
 
 #include "toys.h"
 
 void do_tac(int fd, char *name)
 {
-	struct arg_list *list = NULL;
-	char *c;
+  struct arg_list *list = NULL;
+  char *c;
 
-	// Read in lines
-	for (;;) {
-		struct arg_list *temp;
-		int len;
+  // Read in lines
+  for (;;) {
+    struct arg_list *temp;
+    int len;
 
-		if (!(c = get_line(fd))) break;
+    if (!(c = get_line(fd))) break;
 
-		len = strlen(c);
-		if (len && c[len-1]=='\n') c[len-1] = 0;
-		temp = xmalloc(sizeof(struct arg_list));
-		temp->next = list;
-		temp->arg = c;
-		list = temp;
-	}
+    len = strlen(c);
+    if (len && c[len-1]=='\n') c[len-1] = 0;
+    temp = xmalloc(sizeof(struct arg_list));
+    temp->next = list;
+    temp->arg = c;
+    list = temp;
+  }
 
-	// Play them back.
-	while (list) {
-		struct arg_list *temp = list->next;
-		xputs(list->arg);
-		free(list->arg);
-		free(list);
-		list = temp;
-	}
+  // Play them back.
+  while (list) {
+    struct arg_list *temp = list->next;
+    xputs(list->arg);
+    free(list->arg);
+    free(list);
+    list = temp;
+  }
 }
 
 void tac_main(void)
 {
-	loopfiles(toys.optargs, do_tac);
+  loopfiles(toys.optargs, do_tac);
 }
--- a/toys/other/taskset.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/other/taskset.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,25 +1,23 @@
-/* vi: set sw=4 ts=4:
- *
- * taskset.c - Retrieve or set the CPU affinity of a process.
+/* taskset.c - Retrieve or set the CPU affinity of a process.
  *
  * Copyright 2012 Elie De Brauwer <eliedebrauwer@gmail.com>
 
 USE_TASKSET(NEWTOY(taskset, "<1^pa", TOYFLAG_BIN|TOYFLAG_STAYROOT))
 
 config TASKSET
-	bool "taskset"
-	default y
-	help
-	  usage: taskset [-ap] [mask] [PID | cmd [args...]]
+  bool "taskset"
+  default y
+  help
+    usage: taskset [-ap] [mask] [PID | cmd [args...]]
 
-	  Launch a new task which may only run on certain processors, or change
-	  the processor affinity of an exisitng PID.
+    Launch a new task which may only run on certain processors, or change
+    the processor affinity of an exisitng PID.
 
-	  Mask is a hex string where each bit represents a processor the process
-	  is allowed to run on. PID without a mask displays existing affinity.
+    Mask is a hex string where each bit represents a processor the process
+    is allowed to run on. PID without a mask displays existing affinity.
 
-	  -p	Set/get the affinity of given PID instead of a new command.
-	  -a	Set/get the affinity of all threads of the PID.
+    -p	Set/get the affinity of given PID instead of a new command.
+    -a	Set/get the affinity of all threads of the PID.
 */
 
 #define FOR_taskset
@@ -34,73 +32,73 @@
 
 static void do_taskset(pid_t pid, int quiet)
 {
-	unsigned long *mask = (unsigned long *)toybuf;
-	char *s = *toys.optargs, *failed = "failed to %s %d's affinity";
-	int i, j, k;
+  unsigned long *mask = (unsigned long *)toybuf;
+  char *s = *toys.optargs, *failed = "failed to %s %d's affinity";
+  int i, j, k;
 
-	for (i=0; ; i++) {
-		if (!quiet) {
-			int j = sizeof(toybuf), flag = 0;
+  for (i=0; ; i++) {
+    if (!quiet) {
+      int j = sizeof(toybuf), flag = 0;
 
-			if (sched_getaffinity(pid, sizeof(toybuf), (void *)mask))
-				perror_exit(failed, "get", pid);
+      if (sched_getaffinity(pid, sizeof(toybuf), (void *)mask))
+        perror_exit(failed, "get", pid);
 
-			printf("pid %d's %s affinity mask: ", pid, i ? "new" : "current");
+      printf("pid %d's %s affinity mask: ", pid, i ? "new" : "current");
 
-			while (j--) {
-				int x = 255 & (mask[j/sizeof(long)] >> (8*(j&(sizeof(long)-1))));
+      while (j--) {
+        int x = 255 & (mask[j/sizeof(long)] >> (8*(j&(sizeof(long)-1))));
 
-				if (flag) printf("%02x", x);
-				else if (x) {
-					flag++;
-					printf("%x", x);
-				}
-			}
-			putchar('\n');
-		}
+        if (flag) printf("%02x", x);
+        else if (x) {
+          flag++;
+          printf("%x", x);
+        }
+      }
+      putchar('\n');
+    }
 
-		if (i || toys.optc < 2) return;
+    if (i || toys.optc < 2) return;
 
-		memset(toybuf, 0, sizeof(toybuf));
-		k = strlen(s = *toys.optargs);
-		s += k;
-		for (j = 0; j<k; j++) {
-			unsigned long digit = *(--s) - '0';
+    memset(toybuf, 0, sizeof(toybuf));
+    k = strlen(s = *toys.optargs);
+    s += k;
+    for (j = 0; j<k; j++) {
+      unsigned long digit = *(--s) - '0';
 
-			if (digit > 9) digit = 10 + tolower(*s)-'a';
-			if (digit > 15) error_exit("bad mask '%s'", *toys.optargs);
-			mask[j/(2*sizeof(long))] |= digit << 4*(j&((2*sizeof(long))-1));
-		}
+      if (digit > 9) digit = 10 + tolower(*s)-'a';
+      if (digit > 15) error_exit("bad mask '%s'", *toys.optargs);
+      mask[j/(2*sizeof(long))] |= digit << 4*(j&((2*sizeof(long))-1));
+    }
 
-		if (sched_setaffinity(pid, sizeof(toybuf), (void *)mask))
-			perror_exit(failed, "set", pid);
-	}
+    if (sched_setaffinity(pid, sizeof(toybuf), (void *)mask))
+      perror_exit(failed, "set", pid);
+  }
 }
 
 static int task_callback(struct dirtree *new)
 {
-	if (!new->parent) return DIRTREE_RECURSE;
-	if (isdigit(*new->name)) do_taskset(atoi(new->name), 0);
+  if (!new->parent) return DIRTREE_RECURSE;
+  if (isdigit(*new->name)) do_taskset(atoi(new->name), 0);
 
-	return 0;
+  return 0;
 }
 
 void taskset_main(void)
 {
-	if (!(toys.optflags & FLAG_p)) {
-		if (toys.optc < 2) error_exit("Needs 2 args");
-		do_taskset(getpid(), 1);
-		xexec(toys.optargs+1);
-	} else {
-		char *c;
-		pid_t pid = strtol(toys.optargs[toys.optc-1], &c, 10);
+  if (!(toys.optflags & FLAG_p)) {
+    if (toys.optc < 2) error_exit("Needs 2 args");
+    do_taskset(getpid(), 1);
+    xexec(toys.optargs+1);
+  } else {
+    char *c;
+    pid_t pid = strtol(toys.optargs[toys.optc-1], &c, 10);
 
-		if (*c) error_exit("Not int %s", toys.optargs[1]);
+    if (*c) error_exit("Not int %s", toys.optargs[1]);
 
-		if (toys.optflags & FLAG_a) {
-			char buf[33];
-			sprintf(buf, "/proc/%ld/task/", (long)pid);
-			dirtree_read(buf, task_callback);
-		} else do_taskset(pid, 0);
-	}
+    if (toys.optflags & FLAG_a) {
+      char buf[33];
+      sprintf(buf, "/proc/%ld/task/", (long)pid);
+      dirtree_read(buf, task_callback);
+    } else do_taskset(pid, 0);
+  }
 }
--- a/toys/other/truncate.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/other/truncate.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,44 +1,43 @@
-/* vi: set sw=4 ts=4:
- *
- * truncate.c - set file length, extending sparsely if necessary
+/* truncate.c - set file length, extending sparsely if necessary
  *
  * Copyright 2011 Rob Landley <rob@landley.net>
 
 USE_TRUNCATE(NEWTOY(truncate, "<1s#|c", TOYFLAG_BIN))
 
 config TRUNCATE
-	bool "truncate"
-	default y
-	help
-	  usage: truncate [-c] -s file...
-	  Set length of file(s), extending sparsely if necessary.
+  bool "truncate"
+  default y
+  help
+    usage: truncate [-c] -s file...
 
-	  -c	Don't create file if it doesn't exist.
-	  -s	New size
+    Set length of file(s), extending sparsely if necessary.
+
+    -c	Don't create file if it doesn't exist.
+    -s	New size
 */
 
 #define FOR_truncate
 #include "toys.h"
 
 GLOBALS(
-	long size;
+  long size;
 )
 
 static void do_truncate(int fd, char *name)
 {
-	if (fd<0) return;
-	if (ftruncate(fd, TT.size)) {
-		perror_msg("failed to set '%s' to '%ld'", name, TT.size);
-		toys.exitval = EXIT_FAILURE;
-	}
+  if (fd<0) return;
+  if (ftruncate(fd, TT.size)) {
+    perror_msg("failed to set '%s' to '%ld'", name, TT.size);
+    toys.exitval = EXIT_FAILURE;
+  }
 }
 
 void truncate_main(void)
 {
-	int cr = !(toys.optflags&1);
+  int cr = !(toys.optflags&1);
 
-	// Create files with mask rwrwrw.
-	// Nonexistent files are only an error if we're supposed to create them.
-	loopfiles_rw(toys.optargs, O_WRONLY|(cr ? O_CREAT : 0), 0666, cr,
-		do_truncate);
+  // Create files with mask rwrwrw.
+  // Nonexistent files are only an error if we're supposed to create them.
+  loopfiles_rw(toys.optargs, O_WRONLY|(cr ? O_CREAT : 0), 0666, cr,
+    do_truncate);
 }
--- a/toys/other/unshare.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/other/unshare.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,26 +1,24 @@
-/* vi: set sw=4 ts=4:
- *
- * unshare.c - run command in new context
+/* unshare.c - run command in new context
  *
  * Copyright 2011 Rob Landley <rob@landley.net>
 
 USE_UNSHARE(NEWTOY(unshare, "<1^nium", TOYFLAG_USR|TOYFLAG_BIN))
 
 config UNSHARE
-	bool "unshare"
-	default y
-	depends on TOYBOX_CONTAINER
-	help
-	  usage: unshare [-muin] COMMAND...
+  bool "unshare"
+  default y
+  depends on TOYBOX_CONTAINER
+  help
+    usage: unshare [-muin] COMMAND...
 
-	  Create new namespace(s) for this process and its children, so some
-	  attribute is not shared with the parent process.  This is part of
-	  Linux Containers.  Each process can have its own:
+    Create new namespace(s) for this process and its children, so some
+    attribute is not shared with the parent process.  This is part of
+    Linux Containers.  Each process can have its own:
 
-	  -m	Mount/unmount tree
-	  -u	Host and domain names
-	  -i	SysV IPC (message queues, semaphores, shared memory)
-	  -n	Network address, sockets, routing, iptables
+    -m	Mount/unmount tree
+    -u	Host and domain names
+    -i	SysV IPC (message queues, semaphores, shared memory)
+    -n	Network address, sockets, routing, iptables
 */
 
 #include "toys.h"
@@ -29,15 +27,13 @@
 
 void unshare_main(void)
 {
-	unsigned flags[]={CLONE_NEWNS, CLONE_NEWUTS, CLONE_NEWIPC, CLONE_NEWNET,0};
-	unsigned f=0;
-	int i;
+  unsigned flags[]={CLONE_NEWNS, CLONE_NEWUTS, CLONE_NEWIPC, CLONE_NEWNET, 0};
+  unsigned f=0;
+  int i;
 
-	for (i=0; flags[i]; i++)
-		if (toys.optflags & (1<<i))
-			f |= flags[i];
+  for (i=0; flags[i]; i++) if (toys.optflags & (1<<i)) f |= flags[i];
 
-	if(unshare(f)) perror_exit("failed");
+  if(unshare(f)) perror_exit("failed");
 
-	xexec(toys.optargs);
+  xexec(toys.optargs);
 }
--- a/toys/other/uptime.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/other/uptime.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,50 +1,45 @@
-/* vi: set sw=4 ts=4:
- *
- * uptime.c - Tell how long the system has been running.
+/* uptime.c - Tell how long the system has been running.
  *
  * Copyright 2012 Elie De Brauwer <eliedebrauwer@gmail.com>
 
 USE_UPTIME(NEWTOY(uptime, NULL, TOYFLAG_USR|TOYFLAG_BIN))
 
 config UPTIME
-	bool "uptime"
-	default y
-	help
-	  usage: uptime
+  bool "uptime"
+  default y
+  help
+    usage: uptime
 
-	  Tell how long the system has been running and the system load
-	  averages for the past 1, 5 and 15 minutes.
+    Tell how long the system has been running and the system load
+    averages for the past 1, 5 and 15 minutes.
 */
 
 #include "toys.h"
 
 void uptime_main(void)
 {
-	struct sysinfo info;
-	time_t tmptime;
-	struct tm * now;
-	unsigned int days, hours, minutes;
+  struct sysinfo info;
+  time_t tmptime;
+  struct tm * now;
+  unsigned int days, hours, minutes;
 
-	// Obtain the data we need.
-	sysinfo(&info);
-	time(&tmptime);
-	now = localtime(&tmptime);
+  // Obtain the data we need.
+  sysinfo(&info);
+  time(&tmptime);
+  now = localtime(&tmptime);
 
-	// Time
-	xprintf(" %02d:%02d:%02d up ", now->tm_hour, now->tm_min, now->tm_sec);
-	// Uptime
-	info.uptime /= 60;
-	minutes = info.uptime%60;
-	info.uptime /= 60;
-	hours = info.uptime%24;
-	days = info.uptime/24;
-	if (days) xprintf("%d day%s, ", days, (days!=1)?"s":"");
-	if (hours)
-		xprintf("%2d:%02d, ", hours, minutes);
-	else
-		printf("%d min, ", minutes);
+  // Time
+  xprintf(" %02d:%02d:%02d up ", now->tm_hour, now->tm_min, now->tm_sec);
+  // Uptime
+  info.uptime /= 60;
+  minutes = info.uptime%60;
+  info.uptime /= 60;
+  hours = info.uptime%24;
+  days = info.uptime/24;
+  if (days) xprintf("%d day%s, ", days, (days!=1)?"s":"");
+  if (hours) xprintf("%2d:%02d, ", hours, minutes);
+  else printf("%d min, ", minutes);
 
-	printf(" load average: %.02f %.02f %.02f\n", info.loads[0]/65536.0,
-		info.loads[1]/65536.0, info.loads[2]/65536.0);
-
+  printf(" load average: %.02f %.02f %.02f\n", info.loads[0]/65536.0,
+    info.loads[1]/65536.0, info.loads[2]/65536.0);
 }
--- a/toys/other/usleep.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/other/usleep.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,30 +1,26 @@
-/* vi: set sw=4 ts=4:
- *
- * usleep.c - Wait for a number of microseconds.
+/* usleep.c - Wait for a number of microseconds.
  *
  * Copyright 2012 Elie De Brauwer <eliedebrauwer@gmail.com>
 
 USE_USLEEP(NEWTOY(usleep, "<1", TOYFLAG_BIN))
 
 config USLEEP
-	bool "usleep"
-	default y
-	help
-	  usage: usleep MICROSECONDS
+  bool "usleep"
+  default y
+  help
+    usage: usleep MICROSECONDS
 
-	  Pause for MICROSECONDS microseconds.
-
+    Pause for MICROSECONDS microseconds.
 */
 
 #include "toys.h"
 
 void usleep_main(void)
 {
-    struct timespec tv;
-    long delay = atol(*toys.optargs);
-    
-    tv.tv_sec = delay/1000000;
-    tv.tv_nsec = (delay%1000000) * 1000;
-    toys.exitval = !!nanosleep(&tv, NULL);
+  struct timespec tv;
+  long delay = atol(*toys.optargs);
 
+  tv.tv_sec = delay/1000000;
+  tv.tv_nsec = (delay%1000000) * 1000;
+  toys.exitval = !!nanosleep(&tv, NULL);
 }
--- a/toys/other/vconfig.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/other/vconfig.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,6 +1,4 @@
-/* vi: set sw=4 ts=4:
- *
- * vconfig.c - Creates virtual ethernet devices.
+/* vconfig.c - Creates virtual ethernet devices.
  *
  * Copyright 2012 Sandeep Sharma <sandeep.jack2756@gmail.com>, Kyungwan Han <asura321@gmail.com>
  *
@@ -9,20 +7,19 @@
 USE_VCONFIG(NEWTOY(vconfig, "<2>4", TOYFLAG_NEEDROOT|TOYFLAG_SBIN))
 
 config VCONFIG
-	bool "vconfig"
-	default y
-	help
-	  usage: vconfig COMMAND [OPTIONS]
+  bool "vconfig"
+  default y
+  help
+    usage: vconfig COMMAND [OPTIONS]
 
-	     add             [interface-name] [vlan_id]
-	     rem             [vlan-name]
-	     set_flag        [interface-name] [flag-num]       [0 | 1]
-	     set_egress_map  [vlan-name]      [skb_priority]   [vlan_qos]
-	     set_ingress_map [vlan-name]      [skb_priority]   [vlan_qos]
-	     set_name_type   [name-type]
-       
-	   Create and remove virtual ethernet devices	
+       add             [interface-name] [vlan_id]
+       rem             [vlan-name]
+       set_flag        [interface-name] [flag-num]       [0 | 1]
+       set_egress_map  [vlan-name]      [skb_priority]   [vlan_qos]
+       set_ingress_map [vlan-name]      [skb_priority]   [vlan_qos]
+       set_name_type   [name-type]
 
+    Create and remove virtual ethernet devices
 */
 
 #include "toys.h"
@@ -34,16 +31,15 @@
  */
 static int strtol_range(char *str, int min, int max)
 {
-    char *endptr = NULL;
-    errno = 0;
-    long ret_value = strtol(str, &endptr, 10);
-    if(errno) perror_exit("Invalid num %s", str);
-    else {
-        if(endptr && (*endptr != '\0' || endptr == str)) 
-            perror_exit("Not a valid num %s", str);
-    }
-    if(ret_value >= min && ret_value <= max) return ret_value;
-    else  perror_exit("Number %s is not in valid [%d-%d] Range\n", str, min, max);
+  char *endptr = NULL;
+  errno = 0;
+  long ret_value = strtol(str, &endptr, 10);
+
+  if(errno) perror_exit("Invalid num %s", str);
+  else if(endptr && (*endptr != '\0' || endptr == str))
+    perror_exit("Not a valid num %s", str);
+  if(ret_value >= min && ret_value <= max) return ret_value;
+  else perror_exit("Number %s is not in valid [%d-%d] Range\n", str, min, max);
 }
 /*
  * vconfig main function.
@@ -51,83 +47,84 @@
 void vconfig_main(void)
 {
 #define MAX_VLAN_ID 4094
-    struct vlan_ioctl_args request;
-    char *interface_name = NULL;
-    unsigned int name_type = VLAN_NAME_TYPE_PLUS_VID;	
-    char *cmd;
-    int fd = 0; 
-    int vlan_id = 0;
+  struct vlan_ioctl_args request;
+  char *interface_name = NULL;
+  unsigned int name_type = VLAN_NAME_TYPE_PLUS_VID;
+  char *cmd;
+  int fd = 0;
+  int vlan_id = 0;
 
-    if((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) perror_exit("Can't open socket"); //Use socket instead of open
-    memset(&request, 0, sizeof(struct vlan_ioctl_args));		// Null set all the VLAN info's.	
-    cmd = toys.optargs[0];					// Fetch cmd and proceed.
-    if(strcmp(cmd, "set_name_type") == 0) {
-        if(strcmp(toys.optargs[1], "VLAN_PLUS_VID") == 0) {
-            name_type = VLAN_NAME_TYPE_PLUS_VID;
-        }
-        else if(strcmp(toys.optargs[1], "VLAN_PLUS_VID_NO_PAD") == 0) {
-            name_type = VLAN_NAME_TYPE_PLUS_VID_NO_PAD;
-        }
-        else if(strcmp(toys.optargs[1], "DEV_PLUS_VID") == 0) {
-            name_type = VLAN_NAME_TYPE_RAW_PLUS_VID;
-        }
-        else if(strcmp(toys.optargs[1], "DEV_PLUS_VID_NO_PAD") == 0) {
-            name_type = VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD;
-        }
-        else perror_exit("ERROR: Invalid name type");
+  if((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) perror_exit("Can't open socket"); //Use socket instead of open
+  memset(&request, 0, sizeof(struct vlan_ioctl_args));		// Null set all the VLAN info's.
+  cmd = toys.optargs[0];					// Fetch cmd and proceed.
+  if(strcmp(cmd, "set_name_type") == 0) {
+    if(strcmp(toys.optargs[1], "VLAN_PLUS_VID") == 0) {
+      name_type = VLAN_NAME_TYPE_PLUS_VID;
+    }
+    else if(strcmp(toys.optargs[1], "VLAN_PLUS_VID_NO_PAD") == 0) {
+      name_type = VLAN_NAME_TYPE_PLUS_VID_NO_PAD;
+    }
+    else if(strcmp(toys.optargs[1], "DEV_PLUS_VID") == 0) {
+      name_type = VLAN_NAME_TYPE_RAW_PLUS_VID;
+    }
+    else if(strcmp(toys.optargs[1], "DEV_PLUS_VID_NO_PAD") == 0) {
+      name_type = VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD;
+    }
+    else perror_exit("ERROR: Invalid name type");
 
-        request.u.name_type = name_type;	
-        request.cmd = SET_VLAN_NAME_TYPE_CMD;
-        if(ioctl(fd, SIOCSIFVLAN, &request) == 0) {
-            xprintf("Successful set_name_type for VLAN subsystem\n");
-            exit(EXIT_SUCCESS);
-        }
-        else perror_exit("Failed to set set_name_type:");
+    request.u.name_type = name_type;
+    request.cmd = SET_VLAN_NAME_TYPE_CMD;
+    if(ioctl(fd, SIOCSIFVLAN, &request) == 0) {
+      xprintf("Successful set_name_type for VLAN subsystem\n");
+      exit(EXIT_SUCCESS);
     }
-    else {
-        interface_name = toys.optargs[1]; // Store interface name.
-        if(strlen(interface_name) > 15) perror_exit("ERROR:if_name length can not be greater than 15");	
-        strcpy(request.device1, interface_name); //we had exited if interface_name length greater than 15, so here it never overflows.
-    }
+    else perror_exit("Failed to set set_name_type:");
+  }
+  else {
+    interface_name = toys.optargs[1]; // Store interface name.
+    if(strlen(interface_name) > 15) perror_exit("ERROR:if_name length can not be greater than 15");
+    strcpy(request.device1, interface_name); //we had exited if interface_name length greater than 15, so here it never overflows.
+  }
 
-    if(strcmp(cmd, "add") == 0) {
-        request.cmd = ADD_VLAN_CMD;
-        if(toys.optargs[2]) vlan_id = strtol_range(toys.optargs[2], 0, MAX_VLAN_ID);
-        else vlan_id = 0;
-        request.u.VID = vlan_id;
-    }
-    else if(strcmp(cmd, "rem") == 0) {
-        request.cmd = DEL_VLAN_CMD;
-    }
-    else if(strcmp(cmd, "set_flag") == 0) {
-        request.cmd = SET_VLAN_FLAG_CMD;
-        if(toys.optargs[2]) request.u.flag = strtol_range(toys.optargs[2], 0, 1);
-        else request.u.flag = 0;
-        if(toys.optargs[3]) request.vlan_qos = strtol_range(toys.optargs[3], 0, 7);
-        else request.vlan_qos = 0;
-    }
-    else if(strcmp(cmd, "set_egress_map") == 0) {
-        request.cmd = SET_VLAN_EGRESS_PRIORITY_CMD;
-        if(toys.optargs[2]) request.u.skb_priority = strtol_range(toys.optargs[2], 0, INT_MAX);
-        else request.u.skb_priority = 0;
-        if(toys.optargs[3]) request.vlan_qos = strtol_range(toys.optargs[3], 0, 7);
-        else request.vlan_qos = 0;
-    }
-    else if(strcmp(cmd, "set_ingress_map") == 0) {
-        request.cmd = SET_VLAN_INGRESS_PRIORITY_CMD;
-        if(toys.optargs[2]) request.u.skb_priority = strtol_range(toys.optargs[2], 0, INT_MAX);
-        else request.u.skb_priority = 0;
-        if(toys.optargs[3]) request.vlan_qos = strtol_range(toys.optargs[3], 0, 7);  	//To set flag we must have to set vlan_qos
-        else request.vlan_qos = 0;
-    }
-    else {
-        xclose(fd);
-        perror_exit("Unknown command %s", cmd);
-    }
-    if(ioctl(fd, SIOCSIFVLAN, &request) == 0) {
-        if(strcmp(cmd, "add") == 0 && vlan_id == 1)
-            xprintf("WARNING: VLAN 1 does not work with many switches,consider another number if you have problems.\n");
-        xprintf("Successful %s on device %s\n", cmd, interface_name);
-    }
-    else perror_exit("Failed to %s, on vlan subsystem %s.", cmd, interface_name);
-}	
+  if(strcmp(cmd, "add") == 0) {
+    request.cmd = ADD_VLAN_CMD;
+    if(toys.optargs[2]) vlan_id = strtol_range(toys.optargs[2], 0, MAX_VLAN_ID);
+    else vlan_id = 0;
+    request.u.VID = vlan_id;
+  }
+  else if(strcmp(cmd, "rem") == 0) {
+    request.cmd = DEL_VLAN_CMD;
+  }
+  else if(strcmp(cmd, "set_flag") == 0) {
+    request.cmd = SET_VLAN_FLAG_CMD;
+    if(toys.optargs[2]) request.u.flag = strtol_range(toys.optargs[2], 0, 1);
+    else request.u.flag = 0;
+    if(toys.optargs[3]) request.vlan_qos = strtol_range(toys.optargs[3], 0, 7);
+    else request.vlan_qos = 0;
+  }
+  else if(strcmp(cmd, "set_egress_map") == 0) {
+    request.cmd = SET_VLAN_EGRESS_PRIORITY_CMD;
+    if(toys.optargs[2]) request.u.skb_priority = strtol_range(toys.optargs[2], 0, INT_MAX);
+    else request.u.skb_priority = 0;
+    if(toys.optargs[3]) request.vlan_qos = strtol_range(toys.optargs[3], 0, 7);
+    else request.vlan_qos = 0;
+  }
+  else if(strcmp(cmd, "set_ingress_map") == 0) {
+    request.cmd = SET_VLAN_INGRESS_PRIORITY_CMD;
+    if(toys.optargs[2]) request.u.skb_priority = strtol_range(toys.optargs[2], 0, INT_MAX);
+    else request.u.skb_priority = 0;
+    //To set flag we must have to set vlan_qos
+    if(toys.optargs[3]) request.vlan_qos = strtol_range(toys.optargs[3], 0, 7);
+    else request.vlan_qos = 0;
+  }
+  else {
+    xclose(fd);
+    perror_exit("Unknown command %s", cmd);
+  }
+  if(ioctl(fd, SIOCSIFVLAN, &request) == 0) {
+    if(strcmp(cmd, "add") == 0 && vlan_id == 1)
+      xprintf("WARNING: VLAN 1 does not work with many switches,consider another number if you have problems.\n");
+    xprintf("Successful %s on device %s\n", cmd, interface_name);
+  }
+  else perror_exit("Failed to %s, on vlan subsystem %s.", cmd, interface_name);
+}
--- a/toys/other/vmstat.c	Tue Nov 13 16:13:45 2012 -0600
+++ b/toys/other/vmstat.c	Tue Nov 13 17:14:08 2012 -0600
@@ -1,189 +1,184 @@
-/* vi: set sw=4 ts=4:
- *
- * vmstat.c - Report virtual memory statistics.
+/* vmstat.c - Report virtual memory statistics.
  *
  * Copyright 2012 Elie De Brauwer <eliedebrauwer@gmail.com>
 
 USE_VMSTAT(NEWTOY(vmstat, ">2n", TOYFLAG_BIN))
 
 config VMSTAT
-	bool "vmstat"
-	default y
-	help
-	  usage: vmstat [-n] [delay [count]]
-	  -n Display the header only once
-	  delay The delay between updates in seconds, when not specified
-	        the average since boot is displayed.
-	  count Number of updates to display, the default is inifinite.
+  bool "vmstat"
+  default y
+  help
+    usage: vmstat [-n] [delay [count]]
+    -n	Display the header only once
+    delay	The delay between updates in seconds, when not specified
+    	the average since boot is displayed.
+    count	Number of updates to display, the default is inifinite.
 */
 
 #include "toys.h"
 
-void read_proc_stat(unsigned int * proc_running, unsigned int * proc_blocked,
-		uint64_t * sys_irq, uint64_t * sys_ctxt,
-		uint64_t * cpu_user, uint64_t * cpu_sys, uint64_t * cpu_idle, uint64_t * cpu_wait)
+void read_proc_stat(unsigned int *proc_running, unsigned int *proc_blocked,
+  uint64_t *sys_irq, uint64_t *sys_ctxt, uint64_t *cpu_user, uint64_t *cpu_sys,
+  uint64_t *cpu_idle, uint64_t *cpu_wait)
 {
-	char * off;
-	uint64_t c_user, c_nice, c_sys, c_irq, c_sirq;
-	int fd = xopen("/proc/stat", O_RDONLY);
-	size_t s = xread(fd, toybuf, sizeof(toybuf)-1);
-	toybuf[s] = 0;
-	if ( s == sizeof(toybuf)-1)
-		error_exit("/proc/stat is too large");
+  char * off;
+  uint64_t c_user, c_nice, c_sys, c_irq, c_sirq;
+  int fd = xopen("/proc/stat", O_RDONLY);
+  size_t s = xread(fd, toybuf, sizeof(toybuf)-1);
 
-	off = strstr(toybuf, "cpu ");
-	// Ignoring steal and guest fields for now.
-	if (off) sscanf(off, "cpu  %"PRIu64" %"PRIu64" %"PRIu64" %"PRIu64 \
-		" %"PRIu64" %"PRIu64" %"PRIu64, &c_user, &c_nice, &c_sys, cpu_idle,
-		cpu_wait, &c_irq, &c_sirq);
-	*cpu_user = c_user + c_nice;
-	*cpu_sys = c_sys + c_irq + c_sirq;
-	off = strstr(toybuf, "intr");
-	if (off) sscanf(off, "intr %"PRIu64, sys_irq);
+  toybuf[s] = 0;
+  if (s == sizeof(toybuf)-1) error_exit("/proc/stat is too large");
 
-	off = strstr(toybuf, "ctxt");
-	if (off) sscanf(off, "ctxt %"PRIu64, sys_ctxt);
+  off = strstr(toybuf, "cpu ");
+  // Ignoring steal and guest fields for now.
+  if (off) sscanf(off, "cpu  %"PRIu64" %"PRIu64" %"PRIu64" %"PRIu64 \
+    " %"PRIu64" %"PRIu64" %"PRIu64, &c_user, &c_nice, &c_sys, cpu_idle,
+    cpu_wait, &c_irq, &c_sirq);
+  *cpu_user = c_user + c_nice;
+  *cpu_sys = c_sys + c_irq + c_sirq;
+  off = strstr(toybuf, "intr");
+  if (off) sscanf(off, "intr %"PRIu64, sys_irq);
 
-	off = strstr(toybuf, "procs_running");
-	if (off) sscanf(off, "procs_running %u", proc_running);
-	(*proc_running)--; // look, i'm invisible.
+  off = strstr(toybuf, "ctxt");
+  if (off) sscanf(off, "ctxt %"PRIu64, sys_ctxt);
 
-	off = strstr(toybuf, "procs_blocked");
-	if (off) sscanf(off, "procs_blocked %u", proc_blocked);
+  off = strstr(toybuf, "procs_running");
+  if (off) sscanf(off, "procs_running %u", proc_running);
+  (*proc_running)--; // look, i'm invisible.
 
-	close(fd);
+  off = strstr(toybuf, "procs_blocked");
+  if (off) sscanf(off, "procs_blocked %u", proc_blocked);
+
+  close(fd);
 }
 
-void read_proc_meminfo(unsigned long * mem_swapped, unsigned long * mem_free,
-			unsigned long * mem_buff, unsigned long * mem_cache)
+void read_proc_meminfo(unsigned long *mem_swapped, unsigned long *mem_free,
+  unsigned long *mem_buff, unsigned long *mem_cache)
 {
-	char * off;
-	unsigned long swap_total, swap_free;
-	int fd = xopen("/proc/meminfo", O_RDONLY);
-	size_t s = xread(fd, toybuf, sizeof(toybuf)-1);
-	toybuf[s] = 0;
-	if ( s == sizeof(toybuf)-1)
-		error_exit("/proc/meminfo is too large");
+  char * off;
+  unsigned long swap_total, swap_free;
+  int fd = xopen("/proc/meminfo", O_RDONLY);
+  size_t s = xread(fd, toybuf, sizeof(toybuf)-1);
 
-	off = strstr(toybuf, "MemFree");
-	if (off) sscanf(off, "MemFree: %lu kB", mem_free);
+  toybuf[s] = 0;
+  if (s == sizeof(toybuf)-1) error_exit("/proc/meminfo is too large");
 
-	off = strstr(toybuf, "Buffers");
-	if (off) sscanf(off, "Buffers: %lu kB", mem_buff);
+  off = strstr(toybuf, "MemFree");
+  if (off) sscanf(off, "MemFree: %lu kB", mem_free);
 
-	off = strstr(toybuf, "Cached");
-	if (off) sscanf(off, "Cached: %lu kB", mem_cache);
+  off = strstr(toybuf, "Buffers");
+  if (off) sscanf(off, "Buffers: %lu kB", mem_buff);
 
-	off = strstr(toybuf, "SwapFree");
-	if (off) sscanf(off, "SwapFree: %lu kB", &swap_free); 
+  off = strstr(toybuf, "Cached");
+  if (off) sscanf(off, "Cached: %lu kB", mem_cache);
 
-	off = strstr(toybuf, "SwapTotal");
-	if (off) sscanf(off, "SwapTotal: %lu kB", &