chiark / gitweb /
systemctl: use on_tty() helper everywhere
[elogind.git] / src / systemctl.c
index c77f831eaaafdf72b255d810517e64b30ab45e78..ff6f86a0d2ef76036a35e6b8282945a837ec9c33 100644 (file)
@@ -52,6 +52,7 @@
 #include "shutdownd.h"
 #include "exit-status.h"
 #include "bus-errors.h"
+#include "build.h"
 
 static const char *arg_type = NULL;
 static char **arg_property = NULL;
@@ -336,7 +337,7 @@ static int list_units(DBusConnection *bus, char **args, unsigned n) {
 
         qsort(unit_infos, c, sizeof(struct unit_info), compare_unit_info);
 
-        if (isatty(STDOUT_FILENO)) {
+        if (on_tty()) {
                 if (columns() >= 80+12 || arg_full)
                         printf("%-25s %-6s %-12s %-18s %-15s %s\n", "UNIT", "LOAD", "ACTIVE", "SUB", "JOB", "DESCRIPTION");
                 else
@@ -399,7 +400,7 @@ static int list_units(DBusConnection *bus, char **args, unsigned n) {
                 }
         }
 
-        if (isatty(STDOUT_FILENO)) {
+        if (on_tty()) {
 
                 printf("\nLOAD   = Reflects whether the unit definition was properly loaded.\n"
                        "ACTIVE = The high-level unit activation state, i.e. generalization of SUB.\n"
@@ -1253,7 +1254,11 @@ static int start_unit(DBusConnection *bus, char **args, unsigned n) {
                 method = "StartUnit";
 
                 mode = (arg_action == ACTION_EMERGENCY ||
-                        arg_action == ACTION_RESCUE) ? "isolate" : "replace";
+                        arg_action == ACTION_RESCUE ||
+                        arg_action == ACTION_RUNLEVEL2 ||
+                        arg_action == ACTION_RUNLEVEL3 ||
+                        arg_action == ACTION_RUNLEVEL4 ||
+                        arg_action == ACTION_RUNLEVEL5) ? "isolate" : "replace";
 
                 one_name = table[arg_action];
         }
@@ -4031,6 +4036,8 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
 
                 case ARG_VERSION:
                         puts(PACKAGE_STRING);
+                        puts(DISTRIBUTION);
+                        puts(SYSTEMD_FEATURES);
                         return 0;
 
                 case 't':