16cd6a6acSopenharmony_ci#include <errno.h>
26cd6a6acSopenharmony_ci#include <unistd.h>
36cd6a6acSopenharmony_ci#include <stdio.h>
46cd6a6acSopenharmony_ci#include <stdlib.h>
56cd6a6acSopenharmony_ci#include <getopt.h>
66cd6a6acSopenharmony_ci#include <errno.h>
76cd6a6acSopenharmony_ci#include <string.h>
86cd6a6acSopenharmony_ci#include <sys/types.h>
96cd6a6acSopenharmony_ci#include <sys/stat.h>
106cd6a6acSopenharmony_ci#include <selinux/selinux.h>
116cd6a6acSopenharmony_ci
126cd6a6acSopenharmony_cistatic __attribute__ ((__noreturn__)) void usage(const char *progname)
136cd6a6acSopenharmony_ci{
146cd6a6acSopenharmony_ci	fprintf(stderr, "usage:  %s tty_context...\n", progname);
156cd6a6acSopenharmony_ci	exit(1);
166cd6a6acSopenharmony_ci}
176cd6a6acSopenharmony_ci
186cd6a6acSopenharmony_ciint main(int argc, char **argv)
196cd6a6acSopenharmony_ci{
206cd6a6acSopenharmony_ci	int i;
216cd6a6acSopenharmony_ci	if (argc < 2)
226cd6a6acSopenharmony_ci		usage(argv[0]);
236cd6a6acSopenharmony_ci
246cd6a6acSopenharmony_ci	for (i = 1; i < argc; i++) {
256cd6a6acSopenharmony_ci		switch (selinux_check_securetty_context(argv[i])) {
266cd6a6acSopenharmony_ci		case 0:
276cd6a6acSopenharmony_ci			printf("%s securetty.\n", argv[i]);
286cd6a6acSopenharmony_ci			break;
296cd6a6acSopenharmony_ci		default:
306cd6a6acSopenharmony_ci			printf("%s not securetty.\n", argv[i]);
316cd6a6acSopenharmony_ci			break;
326cd6a6acSopenharmony_ci		}
336cd6a6acSopenharmony_ci	}
346cd6a6acSopenharmony_ci	return 0;
356cd6a6acSopenharmony_ci}
36