2 * Copyright (C) 2013 Karel Zak <kzak@redhat.com>
15 #include "pathnames.h"
18 * Always return EXIT_FAILURE (1), don't try to be smart!
21 static void __attribute__((__noreturn__
)) usage(FILE *out
)
23 fputs(USAGE_HEADER
, out
);
25 _(" %s [options]\n"), program_invocation_short_name
);
27 fputs(USAGE_SEPARATOR
, out
);
28 fputs(_("Politely refuse a login.\n"), out
);
30 fputs(USAGE_OPTIONS
, out
);
31 fputs(USAGE_HELP
, out
);
32 fputs(USAGE_VERSION
, out
);
34 fprintf(out
, USAGE_MAN_TAIL("nologin(8)"));
38 int main(int argc
, char *argv
[])
41 static const struct option longopts
[] = {
42 { "help", 0, 0, 'h' },
43 { "version", 0, 0, 'V' },
47 setlocale(LC_ALL
, "");
48 bindtextdomain(PACKAGE
, LOCALEDIR
);
51 while ((c
= getopt_long(argc
, argv
, "hV", longopts
, NULL
)) != -1) {
57 printf(UTIL_LINUX_VERSION
);
65 fd
= open(_PATH_NOLOGIN_TXT
, O_RDONLY
);
70 while ((rd
= read(fd
, buf
, sizeof(buf
))) > 0)
71 ignore_result( write(STDOUT_FILENO
, buf
, rd
) );
74 fprintf(stdout
, _("This account is currently not available.\n"));