aboutsummaryrefslogtreecommitdiff
path: root/coreutils/chroot.c
diff options
context:
space:
mode:
authorErik Andersen <andersen@codepoet.org>2000-02-08 19:58:47 +0000
committerErik Andersen <andersen@codepoet.org>2000-02-08 19:58:47 +0000
commite49d5ecbbe51718fa925b6890a735e5937cc2aa2 (patch)
treec90bda10731ad9333ce3b404f993354c9fc104b8 /coreutils/chroot.c
parentc0bf817bbc5c7867fbe8fb76d5c39f8ee802692f (diff)
downloadbusybox-e49d5ecbbe51718fa925b6890a735e5937cc2aa2.tar.gz
Some formatting updates (ran the code through indent)
-Erik
Diffstat (limited to 'coreutils/chroot.c')
-rw-r--r--coreutils/chroot.c57
1 files changed, 29 insertions, 28 deletions
diff --git a/coreutils/chroot.c b/coreutils/chroot.c
index 16524d92e..6a01be603 100644
--- a/coreutils/chroot.c
+++ b/coreutils/chroot.c
@@ -1,3 +1,4 @@
+/* vi: set sw=4 ts=4: */
/*
* Mini chroot implementation for busybox
*
@@ -28,39 +29,39 @@
static const char chroot_usage[] = "chroot NEWROOT [COMMAND...]\n\n"
-"Run COMMAND with root directory set to NEWROOT.\n";
+
+ "Run COMMAND with root directory set to NEWROOT.\n";
int chroot_main(int argc, char **argv)
{
- if ( (argc < 2) || (**(argv+1) == '-') ) {
- usage( chroot_usage);
- }
- argc--;
- argv++;
+ if ((argc < 2) || (**(argv + 1) == '-')) {
+ usage(chroot_usage);
+ }
+ argc--;
+ argv++;
- if (chroot (*argv) || (chdir ("/"))) {
- fprintf(stderr, "chroot: cannot change root directory to %s: %s\n",
- *argv, strerror(errno));
- exit( FALSE);
- }
+ if (chroot(*argv) || (chdir("/"))) {
+ fprintf(stderr, "chroot: cannot change root directory to %s: %s\n",
+ *argv, strerror(errno));
+ exit(FALSE);
+ }
- argc--;
- argv++;
- if (argc >= 1) {
- fprintf(stderr, "command: %s\n", *argv);
- execvp (*argv, argv);
- }
- else {
- char *prog;
- prog = getenv ("SHELL");
- if (!prog)
- prog = "/bin/sh";
- execlp (prog, prog, NULL);
- }
- fprintf(stderr, "chroot: cannot execute %s: %s\n",
- *argv, strerror(errno));
- exit( FALSE);
-}
+ argc--;
+ argv++;
+ if (argc >= 1) {
+ fprintf(stderr, "command: %s\n", *argv);
+ execvp(*argv, argv);
+ } else {
+ char *prog;
+ prog = getenv("SHELL");
+ if (!prog)
+ prog = "/bin/sh";
+ execlp(prog, prog, NULL);
+ }
+ fprintf(stderr, "chroot: cannot execute %s: %s\n",
+ *argv, strerror(errno));
+ exit(FALSE);
+}