sbase

suckless unix tools
git clone git://git.2f30.org/sbase.git
Log | Files | Refs | README | LICENSE

commit a9c970b9737c45e30756d81ff8e16e5ad0944daa
parent da757ff7d1949e74f7209fb45a930d857dede1e0
Author: Connor Lane Smith <cls@lubutu.com>
Date:   Wed May 25 11:00:15 +0100

add mkfifo
Diffstat:
Makefile | 2+-
chown.1 | 2+-
config.mk | 2--
ln.1 | 2+-
mkfifo.1 | 9+++++++++
mkfifo.c | 17+++++++++++++++++
rm.1 | 2+-
7 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/Makefile b/Makefile @@ -2,7 +2,7 @@ include config.mk LIB = util/enmasse.o util/eprintf.o util/recurse.o SRC = basename.c cat.c chown.c date.c dirname.c echo.c false.c grep.c ln.c \ - pwd.c rm.c sleep.c tee.c touch.c true.c wc.c + mkfifo.c pwd.c rm.c sleep.c tee.c touch.c true.c wc.c OBJ = $(SRC:.c=.o) $(LIB) BIN = $(SRC:.c=) MAN = $(SRC:.c=.1) diff --git a/chown.1 b/chown.1 @@ -5,7 +5,7 @@ chown \- change file ownership .B chown .RB [ -Rr ] .RI [ owner ][: group ] -.RI [ files ...] +.RI [ file ...] .SH DESCRIPTION .B chown changes the user or group ownership for the given files. diff --git a/config.mk b/config.mk @@ -4,8 +4,6 @@ VERSION = 0.0 #CC = cc #CC = musl-gcc -AR = ar - CPPFLAGS = -D_POSIX_C_SOURCE=200112L CFLAGS = -Os -ansi -Wall -pedantic $(CPPFLAGS) LDFLAGS = -s -static diff --git a/ln.1 b/ln.1 @@ -9,7 +9,7 @@ ln \- make links between files .P .B ln .RB [ \-s ] -.RI [ files ...] +.RI [ file ...] .RI [ directory ] .SH DESCRIPTION .B ln diff --git a/mkfifo.1 b/mkfifo.1 @@ -0,0 +1,9 @@ +.TH MKFIFO 1 sbase\-VERSION +.SH NAME +mkfifo \- make named pipe +.SH SYNOPSIS +.B mkfifo +.RI [ name ...] +.SH DESCRIPTION +.B mkfifo +creates named pipes (FIFOs) with the given names. diff --git a/mkfifo.c b/mkfifo.c @@ -0,0 +1,17 @@ +/* See LICENSE file for copyright and license details. */ +#include <fcntl.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/stat.h> +#include "util.h" + +int +main(int argc, char *argv[]) +{ + while(getopt(argc, argv, "") != -1) + exit(EXIT_FAILURE); + for(; optind < argc; optind++) + if(mkfifo(argv[optind], S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) != 0) + eprintf("mkfifo %s:", argv[optind]); + return EXIT_SUCCESS; +} diff --git a/rm.1 b/rm.1 @@ -4,7 +4,7 @@ rm \- remove files and directories .SH SYNOPSIS .B rm .RB [ \-fr ] -.RI [ files ...] +.RI [ file ...] .SH DESCRIPTION .B rm removes the given files and directories.