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 fputs(USAGE_HELP
, out
);
34 fputs(USAGE_VERSION
, out
);
36 fprintf(out
, USAGE_MAN_TAIL("nologin(8)"));
40 int main(int argc
, char *argv
[])
44 static const struct option longopts
[] = {
45 { "help", 0, NULL
, 'h' },
46 { "version", 0, NULL
, 'V' },
50 setlocale(LC_ALL
, "");
51 bindtextdomain(PACKAGE
, LOCALEDIR
);
54 while ((c
= getopt_long(argc
, argv
, "hV", longopts
, NULL
)) != -1) {
60 printf(UTIL_LINUX_VERSION
);
63 errtryhelp(EXIT_FAILURE
);
67 fd
= open(_PATH_NOLOGIN_TXT
, O_RDONLY
);
72 if (c
< 0 || !S_ISREG(st
.st_mode
))
78 while ((rd
= read(fd
, buf
, sizeof(buf
))) > 0)
79 ignore_result( write(STDOUT_FILENO
, buf
, rd
) );
88 fprintf(stdout
, _("This account is currently not available.\n"));