blob: 268d8227e86dc74bbb3ee48bd231109f0051606d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
/* ISC license. */
#include <sys/types.h>
#include <skalibs/sgetopt.h>
#include <skalibs/gidstuff.h>
#include <skalibs/strerr2.h>
#include <s6/ftrigw.h>
#define USAGE "s6-mkfifodir [ -f ] [ -g gid ] fifodir"
int main (int argc, char const *const *argv)
{
subgetopt_t l = SUBGETOPT_ZERO ;
gid_t gid = -1 ;
int force = 0 ;
PROG = "s6-mkfifodir" ;
for (;;)
{
register int opt = subgetopt_r(argc, argv, "fg:", &l) ;
if (opt == -1) break ;
switch (opt)
{
case 'f' : force = 1 ; break ;
case 'g' : if (!gid0_scan(l.arg, &gid)) strerr_dieusage(100, USAGE) ; break ;
default : strerr_dieusage(100, USAGE) ;
}
}
argc -= l.ind ; argv += l.ind ;
if (argc < 1) strerr_dieusage(100, USAGE) ;
if (!ftrigw_fifodir_make(*argv, gid, force))
strerr_diefu2sys(111, "create fifodir at ", *argv) ;
return 0 ;
}
|