X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;ds=sidebyside;f=src%2Flogin%2Floginctl.c;h=820fcc05b5c7c3b2f540d7ab54a51e81118a068b;hb=bbb8486e1709ee297a1eb803f88041e1da1fa436;hp=97c6617d7d4ef3f131d3e36584acdd6afba7b52b;hpb=c846716a5a0c12eb9c7aa566da4666c50cdf2eba;p=elogind.git diff --git a/src/login/loginctl.c b/src/login/loginctl.c index 97c6617d7..820fcc05b 100644 --- a/src/login/loginctl.c +++ b/src/login/loginctl.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "log.h" #include "util.h" @@ -50,26 +51,9 @@ static enum transport { static bool arg_ask_password = true; static const char *arg_host = NULL; -static bool on_tty(void) { - static int t = -1; - - /* Note that this is invoked relatively early, before we start - * the pager. That means the value we return reflects whether - * we originally were started on a tty, not if we currently - * are. But this is intended, since we want colour and so on - * when run in our own pager. */ - - if (_unlikely_(t < 0)) - t = isatty(STDOUT_FILENO) > 0; - - return t; -} - static void pager_open_if_enabled(void) { /* Cache result before we open the pager */ - on_tty(); - if (arg_no_pager) return; @@ -350,7 +334,7 @@ static void print_session_status_info(SessionStatusInfo *i) { else printf("%u\n", (unsigned) i->uid); - s1 = format_timestamp_pretty(since1, sizeof(since1), i->timestamp); + s1 = format_timestamp_relative(since1, sizeof(since1), i->timestamp); s2 = format_timestamp(since2, sizeof(since2), i->timestamp); if (s1) @@ -443,7 +427,7 @@ static void print_user_status_info(UserStatusInfo *i) { else printf("%u\n", (unsigned) i->uid); - s1 = format_timestamp_pretty(since1, sizeof(since1), i->timestamp); + s1 = format_timestamp_relative(since1, sizeof(since1), i->timestamp); s2 = format_timestamp(since2, sizeof(since2), i->timestamp); if (s1) @@ -1585,6 +1569,7 @@ int main(int argc, char*argv[]) { dbus_error_init(&error); + setlocale(LC_ALL, ""); log_parse_environment(); log_open();