summaryrefslogtreecommitdiff
path: root/src/skaembutils/s6-head.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-02-10 20:12:16 +0000
committerLaurent Bercot <ska@appnovation.com>2023-02-10 20:12:16 +0000
commit790c8681d3451b61a536871dad234fc294796fd8 (patch)
treea75384fa450410cb339d50439b4c522568138688 /src/skaembutils/s6-head.c
parentcf07a7b62346c8b5ab8e1c0714590f6566c411fe (diff)
downloads6-portable-utils-790c8681d3451b61a536871dad234fc294796fd8.tar.xz
Clean up all the code
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/skaembutils/s6-head.c')
-rw-r--r--src/skaembutils/s6-head.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/skaembutils/s6-head.c b/src/skaembutils/s6-head.c
index a8eebf3..de7d937 100644
--- a/src/skaembutils/s6-head.c
+++ b/src/skaembutils/s6-head.c
@@ -16,10 +16,10 @@
#define USAGE "s6-head [ -S ] [ -1..9 | -n lines | -c chars ] [ file... ]"
#define dieusage() strerr_dieusage(100, USAGE)
-typedef int hea$1_func (int, size_t) ;
-typedef hea$1_func *hea$1_func_ref ;
+typedef int head_func (int, size_t) ;
+typedef head_func *head_func_ref ;
-static int dolines (int fd, size_t lines)
+static int head_dolines (int fd, size_t lines)
{
char buf[BUFFER_INSIZE] ;
buffer in = BUFFER_INIT(&buffer_read, fd, buf, BUFFER_INSIZE) ;
@@ -56,7 +56,7 @@ static int dolines (int fd, size_t lines)
return 1 ;
}
-static int safedolines (int fd, size_t lines)
+static int head_safedolines (int fd, size_t lines)
{
char tmp[lines] ;
while (lines)
@@ -72,14 +72,14 @@ static int safedolines (int fd, size_t lines)
return 1 ;
}
-static int safedochars (int fd, size_t chars)
+static int head_safedochars (int fd, size_t chars)
{
return (fd_catn(fd, 1, chars) >= chars) ;
}
int main (int argc, char const *const *argv)
{
- hea$1_func_ref f ;
+ head_func_ref f ;
unsigned int lines = 10 ;
int islines = 1, safe = 0 ;
PROG = "s6-head" ;
@@ -131,7 +131,7 @@ int main (int argc, char const *const *argv)
argc -= l.ind ; argv += l.ind ;
}
if (argc) safe = 0 ;
- f = islines ? safe ? &safedolines : &dolines : &safedochars ;
+ f = islines ? safe ? &head_safedolines : &head_dolines : &head_safedochars ;
if (!argc)
{
if (!(*f)(0, lines))