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-cut.c | |
parent | cf07a7b62346c8b5ab8e1c0714590f6566c411fe (diff) | |
download | s6-portable-utils-790c8681d3451b61a536871dad234fc294796fd8.tar.xz |
Clean up all the code
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/skaembutils/s6-cut.c')
-rw-r--r-- | src/skaembutils/s6-cut.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/skaembutils/s6-cut.c b/src/skaembutils/s6-cut.c index d111ecd..e55907b 100644 --- a/src/skaembutils/s6-cut.c +++ b/src/skaembutils/s6-cut.c @@ -34,7 +34,7 @@ static void disizealloc_normalize (genalloc *list) genalloc_setlen(disize, list, cur+1) ; } -static void scanlist (genalloc *list, char const *s) +static void s6cut_scanlist (genalloc *list, char const *s) { size_t i = 0 ; genalloc_setlen(disize, list, 0) ; @@ -72,7 +72,7 @@ static void scanlist (genalloc *list, char const *s) } } -static int doit (int fd, disize const *s, size_t len, unsigned int flags, char delim) +static int s6cut_doit (int fd, disize const *s, size_t len, unsigned int flags, char delim) { char buf[BUFFER_INSIZE] ; buffer b = BUFFER_INIT(&buffer_flush1read, fd, buf, BUFFER_INSIZE) ; @@ -164,14 +164,14 @@ int main (int argc, char const *const *argv) { if (what) strerr_dieusage(100, USAGE) ; what = 2 ; - scanlist(&list, l.arg) ; + s6cut_scanlist(&list, l.arg) ; break ; } case 'f': { if (what) strerr_dieusage(100, USAGE) ; what = 4 ; - scanlist(&list, l.arg) ; + s6cut_scanlist(&list, l.arg) ; break ; } default : strerr_dieusage(100, USAGE) ; @@ -185,7 +185,7 @@ int main (int argc, char const *const *argv) if (!argc) { - if (!doit(0, genalloc_s(disize, &list), genalloc_len(disize, &list), what, delim)) + if (!s6cut_doit(0, genalloc_s(disize, &list), genalloc_len(disize, &list), what, delim)) strerr_diefu1sys(111, "cut stdin") ; } else @@ -194,7 +194,7 @@ int main (int argc, char const *const *argv) { if ((argv[0][0] == '-') && !argv[0][1]) { - if (!doit(0, genalloc_s(disize, &list), genalloc_len(disize, &list), what, delim)) + if (!s6cut_doit(0, genalloc_s(disize, &list), genalloc_len(disize, &list), what, delim)) strerr_diefu1sys(111, "process stdin") ; } else @@ -202,7 +202,7 @@ int main (int argc, char const *const *argv) int fd = open_readb(*argv) ; if (fd == -1) strerr_diefu3sys(111, "open ", *argv, " for reading") ; - if (!doit(fd, genalloc_s(disize, &list), genalloc_len(disize, &list), what, delim)) + if (!s6cut_doit(fd, genalloc_s(disize, &list), genalloc_len(disize, &list), what, delim)) strerr_diefu2sys(111, "cut ", *argv) ; fd_close(fd) ; } |