diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2023-02-10 20:12:16 +0000 |
---|---|---|
committer | Laurent Bercot <ska@appnovation.com> | 2023-02-10 20:12:16 +0000 |
commit | 790c8681d3451b61a536871dad234fc294796fd8 (patch) | |
tree | a75384fa450410cb339d50439b4c522568138688 /src/skaembutils/s6-mkdir.c | |
parent | cf07a7b62346c8b5ab8e1c0714590f6566c411fe (diff) | |
download | s6-portable-utils-790c8681d3451b61a536871dad234fc294796fd8.tar.gz s6-portable-utils-790c8681d3451b61a536871dad234fc294796fd8.tar.xz s6-portable-utils-790c8681d3451b61a536871dad234fc294796fd8.zip |
Clean up all the code
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/skaembutils/s6-mkdir.c')
-rw-r--r-- | src/skaembutils/s6-mkdir.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/skaembutils/s6-mkdir.c b/src/skaembutils/s6-mkdir.c index 3985b5a..8212813 100644 --- a/src/skaembutils/s6-mkdir.c +++ b/src/skaembutils/s6-mkdir.c @@ -4,6 +4,7 @@ #include <sys/stat.h> #include <unistd.h> #include <errno.h> + #include <skalibs/sgetopt.h> #include <skalibs/types.h> #include <skalibs/buffer.h> @@ -12,7 +13,7 @@ #define USAGE "s6-mkdir [ -p ] [ -v ] [ -m mode ] dir" #define dieusage() strerr_dieusage(100, USAGE) -static int doit (char const *s, unsigned int mode, int verbose, int ee) +static int mkdir_doit (char const *s, unsigned int mode, int verbose, int ee) { if (mkdir(s, mode) == -1) { @@ -32,7 +33,7 @@ static int doit (char const *s, unsigned int mode, int verbose, int ee) return 0 ; } -static int doparents (char const *s, unsigned int mode, int verbose) +static int mkdir_doparents (char const *s, unsigned int mode, int verbose) { size_t n = strlen(s), i = 0 ; char tmp[n+1] ; @@ -42,12 +43,12 @@ static int doparents (char const *s, unsigned int mode, int verbose) { int e ; tmp[i] = 0 ; - e = doit(tmp, mode, verbose, 0) ; + e = mkdir_doit(tmp, mode, verbose, 0) ; if (e) return e ; } tmp[i] = s[i] ; } - return doit(s, mode, verbose, 0) ; + return mkdir_doit(s, mode, verbose, 0) ; } int main (int argc, char const *const *argv) @@ -75,7 +76,7 @@ int main (int argc, char const *const *argv) } if (noumask) umask(0) ; for ( ; *argv ; argv++) - e |= parents ? doparents(*argv, mode, verbose) : - doit(*argv, mode, verbose, 1) ; + e |= parents ? mkdir_doparents(*argv, mode, verbose) : + mkdir_doit(*argv, mode, verbose, 1) ; return e ; } |