From 12bbc85e8a4cc190a818e8f3126e73433448c9a6 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Mon, 3 Mar 2025 16:46:06 -0600 Subject: [PATCH] Add nologin. --- toys/other/nologin.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 toys/other/nologin.c diff --git a/toys/other/nologin.c b/toys/other/nologin.c new file mode 100644 index 00000000..851cd793 --- /dev/null +++ b/toys/other/nologin.c @@ -0,0 +1,24 @@ +/* nologin.c - False with a message. + * + * Copyright 2025 Rob Landley + * + * No standard. + +USE_NOLOGIN(NEWTOY(nologin, 0, TOYFLAG_BIN|TOYFLAG_NOHELP)) + +config NOLOGIN + bool "nologin" + default y + help + usage: nologin + + Print /etc/nologin.txt and return failure. +*/ + +#include "toys.h" + +void nologin_main(void) +{ + toys.exitval = 1; + puts(readfile("/etc/nologin.txt", 0, 0) ? : toys.which->name); +} -- 2.39.5