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 "libbb.h" 14#include "libcoreutils/coreutils.h" 15 16int mkfifo_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 17int mkfifo_main(int argc UNUSED_PARAM, char **argv) 18{ 19 mode_t mode; 20 int retval = EXIT_SUCCESS; 21 22 mode = getopt_mk_fifo_nod(argv); 23 24 argv += optind; 25 if (!*argv) { 26 bb_show_usage(); 27 } 28 29 do { 30 if (mkfifo(*argv, mode) < 0) { 31 bb_simple_perror_msg(*argv); /* Avoid multibyte problems. */ 32 retval = EXIT_FAILURE; 33 } 34 } while (*++argv); 35 36 return retval; 37} 38