X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=mkfifo.c;h=728e1ec2f44d7a01d1278a2698ff46ca49cb7fb7;hb=05ebdd03d4507bb92bff395906a3076fecc1010d;hp=676592ac7df6df779c1a184073f73c86727a1463;hpb=19db07b3d4ca4c333f9a53bfbc113b44f3c55750;p=oweals%2Fbusybox.git diff --git a/mkfifo.c b/mkfifo.c index 676592ac7..728e1ec2f 100644 --- a/mkfifo.c +++ b/mkfifo.c @@ -1,3 +1,4 @@ +/* vi: set sw=4 ts=4: */ /* * Mini mkfifo implementation for busybox * @@ -19,43 +20,40 @@ * */ -#include "internal.h" +#include "busybox.h" #include #include -#include #include -static const char mkfifo_usage[] = "mkfifo [OPTIONS] name\n\n" -"Create the named fifo\n\n" -"Options:\n" -"\t-m\tcreate the fifo with the specified mode; default = a=rw-umask\n"; - extern int mkfifo_main(int argc, char **argv) { - char *thisarg; - mode_t mode = 0666; - argc--; - argv++; + char *thisarg; + mode_t mode = 0666; + + argc--; + argv++; - /* Parse any options */ - while (argc > 1) { - if (**argv != '-') usage(mkfifo_usage); - thisarg = *argv; thisarg++; - switch (*thisarg) { - case 'm': - argc--; argv++; - parse_mode(*argv, &mode); - break; - default: - usage (mkfifo_usage); - } - argc--; argv++; - } - if (argc < 1) usage (mkfifo_usage); - if (mkfifo(*argv, mode) < 0) { - perror("mkfifo"); - exit(255); - } else { - exit(TRUE); - } + /* Parse any options */ + while (argc > 1) { + if (**argv != '-') + usage(mkfifo_usage); + thisarg = *argv; + thisarg++; + switch (*thisarg) { + case 'm': + argc--; + argv++; + parse_mode(*argv, &mode); + break; + default: + usage(mkfifo_usage); + } + argc--; + argv++; + } + if (argc < 1 || *argv[0] == '-') + usage(mkfifo_usage); + if (mkfifo(*argv, mode) < 0) + perror_msg_and_die("mkfifo"); + return EXIT_SUCCESS; }