diff options
author | Erik Andersen <andersen@codepoet.org> | 2000-02-08 19:58:47 +0000 |
---|---|---|
committer | Erik Andersen <andersen@codepoet.org> | 2000-02-08 19:58:47 +0000 |
commit | e49d5ecbbe51718fa925b6890a735e5937cc2aa2 (patch) | |
tree | c90bda10731ad9333ce3b404f993354c9fc104b8 /coreutils/mkfifo.c | |
parent | c0bf817bbc5c7867fbe8fb76d5c39f8ee802692f (diff) | |
download | busybox-w32-e49d5ecbbe51718fa925b6890a735e5937cc2aa2.tar.gz busybox-w32-e49d5ecbbe51718fa925b6890a735e5937cc2aa2.tar.bz2 busybox-w32-e49d5ecbbe51718fa925b6890a735e5937cc2aa2.zip |
Some formatting updates (ran the code through indent)
-Erik
Diffstat (limited to 'coreutils/mkfifo.c')
-rw-r--r-- | coreutils/mkfifo.c | 64 |
1 files changed, 36 insertions, 28 deletions
diff --git a/coreutils/mkfifo.c b/coreutils/mkfifo.c index 676592ac7..c74402d4c 100644 --- a/coreutils/mkfifo.c +++ b/coreutils/mkfifo.c | |||
@@ -1,3 +1,4 @@ | |||
1 | /* vi: set sw=4 ts=4: */ | ||
1 | /* | 2 | /* |
2 | * Mini mkfifo implementation for busybox | 3 | * Mini mkfifo implementation for busybox |
3 | * | 4 | * |
@@ -26,36 +27,43 @@ | |||
26 | #include <errno.h> | 27 | #include <errno.h> |
27 | 28 | ||
28 | static const char mkfifo_usage[] = "mkfifo [OPTIONS] name\n\n" | 29 | static const char mkfifo_usage[] = "mkfifo [OPTIONS] name\n\n" |
29 | "Create the named fifo\n\n" | 30 | "Create the named fifo\n\n" |
30 | "Options:\n" | 31 | |
31 | "\t-m\tcreate the fifo with the specified mode; default = a=rw-umask\n"; | 32 | "Options:\n" |
33 | "\t-m\tcreate the fifo with the specified mode; default = a=rw-umask\n"; | ||
32 | 34 | ||
33 | extern int mkfifo_main(int argc, char **argv) | 35 | extern int mkfifo_main(int argc, char **argv) |
34 | { | 36 | { |
35 | char *thisarg; | 37 | char *thisarg; |
36 | mode_t mode = 0666; | 38 | mode_t mode = 0666; |
37 | argc--; | 39 | |
38 | argv++; | 40 | argc--; |
41 | argv++; | ||
39 | 42 | ||
40 | /* Parse any options */ | 43 | /* Parse any options */ |
41 | while (argc > 1) { | 44 | while (argc > 1) { |
42 | if (**argv != '-') usage(mkfifo_usage); | 45 | if (**argv != '-') |
43 | thisarg = *argv; thisarg++; | 46 | usage(mkfifo_usage); |
44 | switch (*thisarg) { | 47 | thisarg = *argv; |
45 | case 'm': | 48 | thisarg++; |
46 | argc--; argv++; | 49 | switch (*thisarg) { |
47 | parse_mode(*argv, &mode); | 50 | case 'm': |
48 | break; | 51 | argc--; |
49 | default: | 52 | argv++; |
50 | usage (mkfifo_usage); | 53 | parse_mode(*argv, &mode); |
51 | } | 54 | break; |
52 | argc--; argv++; | 55 | default: |
53 | } | 56 | usage(mkfifo_usage); |
54 | if (argc < 1) usage (mkfifo_usage); | 57 | } |
55 | if (mkfifo(*argv, mode) < 0) { | 58 | argc--; |
56 | perror("mkfifo"); | 59 | argv++; |
57 | exit(255); | 60 | } |
58 | } else { | 61 | if (argc < 1) |
59 | exit(TRUE); | 62 | usage(mkfifo_usage); |
60 | } | 63 | if (mkfifo(*argv, mode) < 0) { |
64 | perror("mkfifo"); | ||
65 | exit(255); | ||
66 | } else { | ||
67 | exit(TRUE); | ||
68 | } | ||
61 | } | 69 | } |