1//
2//  remote-login-status.c
3//  OpenSSH
4//
5// Returns the status of the "Remote Login" sharing preference.
6//
7
8#include <stdio.h>
9#include <unistd.h>
10#include <string.h>
11
12#include <ServiceManagement/ServiceManagement_Private.h>
13
14int
15main(int argc, char *argv[])
16{
17		int quiet = 0;
18		Boolean persistent;
19
20		int enabled =  SMJobIsEnabled(kSMDomainSystemLaunchd, CFSTR("com.openssh.sshd"), &persistent);
21
22		if ((argc == 2) && strncmp(argv[1], "-q", 3)) {
23				quiet = 1;
24		}
25
26		if (!quiet) {
27				printf("Remote Login: %s\n", (enabled ? "on": "off"));
28		}
29
30		return enabled;
31}
32