summary refs log tree commit diff
path: root/src/minutils/s6-hostname.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-02-11 08:13:14 +0000
committerLaurent Bercot <ska@appnovation.com>2023-02-11 08:13:14 +0000
commit2f8984613e17f9e5971ec338240b0bb6d2dd1cc6 (patch)
tree4061a64dc5ee8c415ca249ec1852cfc666e1468b /src/minutils/s6-hostname.c
parent3caba3fd8f3825544c065ec62e4298c6edc76b28 (diff)
downloads6-linux-utils-2f8984613e17f9e5971ec338240b0bb6d2dd1cc6.tar.gz
s6-linux-utils-2f8984613e17f9e5971ec338240b0bb6d2dd1cc6.tar.xz
s6-linux-utils-2f8984613e17f9e5971ec338240b0bb6d2dd1cc6.zip
Code refactor; only s6-ps has remaining globals now
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/minutils/s6-hostname.c')
-rw-r--r--src/minutils/s6-hostname.c37
1 files changed, 0 insertions, 37 deletions
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 <unistd.h>
-#include <string.h>
-#include <skalibs/allreadwrite.h>
-#include <skalibs/strerr.h>
-#include <skalibs/stralloc.h>
-#include <skalibs/djbunix.h>
-
-#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]) ;
-}