find: improve usage text (Natanael Copa <natanael.copa@gmail.com>)
[oweals/busybox.git] / coreutils / mkfifo.c
1 /* vi: set sw=4 ts=4: */
2 /*
3  * mkfifo implementation for busybox
4  *
5  * Copyright (C) 2003  Manuel Novoa III  <mjn3@codepoet.org>
6  *
7  * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
8  */
9
10 /* BB_AUDIT SUSv3 compliant */
11 /* http://www.opengroup.org/onlinepubs/007904975/utilities/mkfifo.html */
12
13 #include <stdlib.h>
14 #include <unistd.h>
15 #include <sys/types.h>
16 #include "busybox.h"
17 #include "libcoreutils/coreutils.h"
18
19 int mkfifo_main(int argc, char **argv);
20 int mkfifo_main(int argc, char **argv)
21 {
22         mode_t mode;
23         int retval = EXIT_SUCCESS;
24
25         mode = getopt_mk_fifo_nod(argc, argv);
26
27         if (!*(argv += optind)) {
28                 bb_show_usage();
29         }
30
31         do {
32                 if (mkfifo(*argv, mode) < 0) {
33                         bb_perror_msg("%s", *argv);     /* Avoid multibyte problems. */
34                         retval = EXIT_FAILURE;
35                 }
36         } while (*++argv);
37
38         return retval;
39 }