add mkfifo

This commit is contained in:
Connor Lane Smith 2011-05-25 11:00:15 +01:00
parent da757ff7d1
commit a9c970b973
7 changed files with 30 additions and 6 deletions

View File

@ -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)

View File

@ -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.

View File

@ -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

2
ln.1
View File

@ -9,7 +9,7 @@ ln \- make links between files
.P
.B ln
.RB [ \-s ]
.RI [ files ...]
.RI [ file ...]
.RI [ directory ]
.SH DESCRIPTION
.B ln

9
mkfifo.1 Normal file
View File

@ -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.

17
mkfifo.c Normal file
View File

@ -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;
}

2
rm.1
View File

@ -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.