← Commit list

e039e689e

Bernhard Reutner-Fischer
Bernhard Reutner-Fischer
2009-10-27
FAILED Duration: 33s

Subject

wall: new applet

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

include/applets.h+1 -0
@@ -417,6 +417,7 @@ IF_VCONFIG(APPLET(vconfig, _BB_DIR_SBIN, _BB_SUID_DROP))
IF_VI(APPLET(vi, _BB_DIR_BIN, _BB_SUID_DROP))
IF_VLOCK(APPLET(vlock, _BB_DIR_USR_BIN, _BB_SUID_REQUIRE))
IF_VOLNAME(APPLET(volname, _BB_DIR_USR_BIN, _BB_SUID_DROP))
+IF_WALL(APPLET(wall, _BB_DIR_USR_BIN, _BB_SUID_REQUIRE))
IF_WATCH(APPLET(watch, _BB_DIR_BIN, _BB_SUID_DROP))
IF_WATCHDOG(APPLET(watchdog, _BB_DIR_SBIN, _BB_SUID_DROP))
IF_WC(APPLET(wc, _BB_DIR_USR_BIN, _BB_SUID_DROP))
include/usage.h+8 -0
@@ -4950,6 +4950,14 @@
#define volname_full_usage "\n\n" \
"Show CD volume name of the DEVICE (default /dev/cdrom)"
+#define wall_trivial_usage \
+ "[file]"
+#define wall_full_usage "\n\n" \
+ "Write content of file or standard-input to all logged-in users"
+#define wall_sample_usage \
+ "echo foo | wall\n" \
+ "wall ./mymessage"
+
#define watch_trivial_usage \
"[-n seconds] [-t] PROG [ARGS]"
#define watch_full_usage "\n\n" \
miscutils/Config.in+6 -0
@@ -612,6 +612,12 @@ config VOLNAME
help
Prints a CD-ROM volume name.
+config WALL
+ bool "wall"
+ default n
+ help
+ Write a message to all users that are logged in.
+
config WATCHDOG
bool "watchdog"
default n
miscutils/Kbuild+1 -0
@@ -42,4 +42,5 @@ lib-$(CONFIG_TIME) += time.o
lib-$(CONFIG_TIMEOUT) += timeout.o
lib-$(CONFIG_TTYSIZE) += ttysize.o
lib-$(CONFIG_VOLNAME) += volname.o
+lib-$(CONFIG_WALL) += wall.o
lib-$(CONFIG_WATCHDOG) += watchdog.o
miscutils/wall.c+36 -0
@@ -0,0 +1,36 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * wall - write a message to all logged-in users
+ * Copyright (c) 2009 Bernhard Reutner-Fischer
+ *
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+ */
+
+#include "libbb.h"
+#include <utmp.h>
+
+int wall_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
+int wall_main(int argc UNUSED_PARAM, char **argv)
+{
+ struct utmp *ut;
+ char *msg;
+ int fd = argv[1] ? xopen(argv[1], O_RDONLY) : STDIN_FILENO;
+
+ msg = xmalloc_read(fd, NULL);
+ if (ENABLE_FEATURE_CLEAN_UP && argv[1])
+ close(fd);
+ setutent();
+ while ((ut = getutent()) != NULL) {
+ char *line;
+ if (ut->ut_type != USER_PROCESS)
+ continue;
+ line = concat_path_file("/dev", ut->ut_line);
+ xopen_xwrite_close(line, msg);
+ free(line);
+ }
+ if (ENABLE_FEATURE_CLEAN_UP) {
+ endutent();
+ free(msg);
+ }
+ return EXIT_SUCCESS;
+}
scripts/defconfig+1 -0
@@ -638,6 +638,7 @@ CONFIG_TIME=y
CONFIG_TIMEOUT=y
CONFIG_TTYSIZE=y
CONFIG_VOLNAME=y
+CONFIG_WALL=y
CONFIG_WATCHDOG=y
#