chiark / gitweb /
util: properly divide in 64bit in format_timestamp()
[elogind.git] / src / systemctl.c
index 447a24458adc31071c6189365851e82ec9c2b09c..444ddf370c4ead051985dfab198f7b9ae5675ed9 100644 (file)
@@ -39,6 +39,7 @@
 #include "utmp-wtmp.h"
 #include "special.h"
 #include "initreq.h"
+#include "strv.h"
 
 static const char *arg_type = NULL;
 static bool arg_all = false;
@@ -139,6 +140,23 @@ static void warn_wall(enum action action) {
         if (arg_no_wall)
                 return;
 
+        if (arg_wall) {
+                char *p;
+
+                if (!(p = strv_join(arg_wall, " "))) {
+                        log_error("Failed to join strings.");
+                        return;
+                }
+
+                if (*p) {
+                        utmp_wall(p);
+                        free(p);
+                        return;
+                }
+
+                free(p);
+        }
+
         if (!table[action])
                 return;
 
@@ -1447,7 +1465,7 @@ static int halt_help(void) {
 
 static int shutdown_help(void) {
 
-        printf("%s [options] [IGNORED] [WALL...]\n\n"
+        printf("%s [options] [now] [WALL...]\n\n"
                "Shut down the system.\n\n"
                "     --help      Show this help\n"
                "  -H --halt      Halt the machine\n"
@@ -1723,6 +1741,9 @@ static int shutdown_parse_argv(int argc, char *argv[]) {
                 }
         }
 
+        if (argc > optind && !streq(argv[optind], "now"))
+                log_warning("First argument '%s' isn't 'now'. Ignoring.", argv[optind]);
+
         /* We ignore the time argument */
         if (argc > optind + 1)
                 arg_wall = argv + optind + 1;