2 * Copyright (C) 2013 Karel Zak <kzak@redhat.com>
16 #include "pathnames.h"
19 * Always return EXIT_FAILURE (1), don't try to be smart!
22 static void __attribute__((__noreturn__
)) usage(void)
25 fputs(USAGE_HEADER
, out
);
27 _(" %s [options]\n"), program_invocation_short_name
);
29 fputs(USAGE_SEPARATOR
, out
);
30 fputs(_("Politely refuse a login.\n"), out
);
32 fputs(USAGE_OPTIONS
, out
);
33 printf(USAGE_HELP_OPTIONS(16));
35 printf(USAGE_MAN_TAIL("nologin(8)"));
39 int main(int argc
, char *argv
[])
43 static const struct option longopts
[] = {
44 { "help", 0, NULL
, 'h' },
45 { "version", 0, NULL
, 'V' },
49 setlocale(LC_ALL
, "");
50 bindtextdomain(PACKAGE
, LOCALEDIR
);
53 while ((c
= getopt_long(argc
, argv
, "hV", longopts
, NULL
)) != -1) {
59 printf(UTIL_LINUX_VERSION
);
62 errtryhelp(EXIT_FAILURE
);
66 fd
= open(_PATH_NOLOGIN_TXT
, O_RDONLY
);
71 if (c
< 0 || !S_ISREG(st
.st_mode
))
77 while ((rd
= read(fd
, buf
, sizeof(buf
))) > 0)
78 ignore_result( write(STDOUT_FILENO
, buf
, rd
) );
87 fprintf(stdout
, _("This account is currently not available.\n"));