From 2f8984613e17f9e5971ec338240b0bb6d2dd1cc6 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Sat, 11 Feb 2023 08:13:14 +0000 Subject: Code refactor; only s6-ps has remaining globals now Signed-off-by: Laurent Bercot --- src/minutils/s6-hostname.c | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 src/minutils/s6-hostname.c (limited to 'src/minutils/s6-hostname.c') diff --git a/src/minutils/s6-hostname.c b/src/minutils/s6-hostname.c deleted file mode 100644 index d673e81..0000000 --- a/src/minutils/s6-hostname.c +++ /dev/null @@ -1,37 +0,0 @@ -/* ISC license. */ - -#ifndef _BSD_SOURCE -#define _BSD_SOURCE -#endif - -#include -#include -#include -#include -#include -#include - -#define USAGE "s6-hostname [ hostname ]" - -static int getit (void) -{ - stralloc sa = STRALLOC_ZERO ; - if (sagethostname(&sa) < 0) strerr_diefu1sys(111, "get hostname") ; - sa.s[sa.len++] = '\n' ; - if (allwrite(1, sa.s, sa.len) < sa.len) - strerr_diefu1sys(111, "write to stdout") ; - return 0 ; -} - -static int setit (char const *h) -{ - if (sethostname(h, strlen(h)) < 0) - strerr_diefu1sys(111, "set hostname") ; - return 0 ; -} - -int main (int argc, char const *const *argv) -{ - PROG = "s6-hostname" ; - return (argc < 2) ? getit() : setit(argv[1]) ; -} -- cgit v1.3.1