/***
This file is part of systemd.
Copyright 2011 Lennart Poettering
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <poll.h>
#include <string.h>
#include "sd-login.h"
#include "alloc-util.h"
#include "fd-util.h"
#include "formats-util.h"
#include "string-util.h"
#include "strv.h"
#include "util.h"
static void test_login(void) {
int r, k;
char *session;
char *state;
char *session2;
char *t;
unsigned n;
sd_login_monitor *m = NULL;
assert_se(r >= 0);
printf("sessions = %s\n", t);
free(t);
assert_se(r >= 0);
printf("seats = %s\n", t);
free(t);
r = sd_session_is_active(session);
assert_se(r >= 0);
r = sd_session_is_remote(session);
assert_se(r >= 0);
assert_se(r >= 0);
remote_user = NULL;
remote_host = NULL;
assert_se(r >= 0);
r = sd_seat_can_tty(seat);
assert_se(r >= 0);
r = sd_seat_can_graphical(seat);
assert_se(r >= 0);
assert_se(k >= 0);
assert_se(!!r == !!r);
assert_se(r >= 0);
printf("n_sessions = %i\n", r);
printf("sessions = %s\n", t);
free(t);
printf("uids =");
for (k = 0; k < (int) n; k++)
printf("\n");
r = sd_get_seats(&seats);
assert_se(r >= 0);
printf("n_seats = %i\n", r);
printf("seats = %s\n", t);
free(t);
assert_se(r >= 0);
printf("active session on current seat = %s\n", t);
free(t);
r = sd_get_sessions(&sessions);
assert_se(r >= 0);
printf("n_sessions = %i\n", r);
printf("sessions = %s\n", t);
free(t);
r = sd_get_uids(&uids);
assert_se(r >= 0);
printf("uids =");
for (k = 0; k < r; k++)
printf("\n");
printf("n_uids = %i\n", r);
r = sd_get_machine_names(&machines);
assert_se(r >= 0);
printf("n_machines = %i\n", r);
printf("machines = %s\n", t);
free(t);
r = sd_login_monitor_new("session", &m);
assert_se(r >= 0);
for (n = 0; n < 5; n++) {
0);
assert_se(r >= 0);
printf("Wake!\n");
}
}
log_open();
test_login();
return 0;
}