1/* See LICENSE file for copyright and license details. */
2
3#include <fcntl.h>
4#include <stdio.h>
5#include <unistd.h>
6
7// ?man nologin: politely refuse login
8// ?man politely refuse a login attempt by exiting with status 1
9int
10main(void)
11{
12 int fd;
13 char buf[BUFSIZ];
14 ssize_t n;
15
16 fd = open("/etc/nologin.txt", O_RDONLY);
17 if (fd >= 0) {
18 while ((n = read(fd, buf, sizeof(buf))) > 0)
19 write(STDOUT_FILENO, buf, n);
20 close(fd);
21 } else {
22 printf("The account is currently unavailable.\n");
23 }
24 return 1;
25}