Util-Linux package development
 help / color / mirror / Atom feed
* [PATCH] wall: Print time and date (rather than just time) in wall banner
@ 2015-06-27  0:34 Dave Rutherford
  2015-06-27  8:20 ` Sami Kerola
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Rutherford @ 2015-06-27  0:34 UTC (permalink / raw)
  To: util-linux

Hello,

This is a simple change to print the date and time in the wall banner.
Previously just the time was printed.  This made more sense during the era
of scarce and/or real terminals with interactive sessions of brief usage,
when a terminal was likely to be attended, but makes less sense in the era
of long-lived x-terminals, screen sessions, and so forth.  The latter may
be left open for days or weeks at a time, and returning to one it may no
longer be obvious just when a wall message was sent.  This can be relevant.

This adds the seconds and the date (locale-appropriate format) to the
wall banner, if any.

Regards,
   Dave Rutherford <dave@evilpettingzoo.com>


$ diff -u term-utils/wall.c.orig term-utils/wall.c
--- term-utils/wall.c.orig      2015-06-25 04:31:10.957160529 -0400
+++ term-utils/wall.c   2015-06-26 01:45:04.150729302 -0400
@@ -238,8 +238,9 @@
                sprintf(lbuf, _("Broadcast Message from %s@%s"),
                              whom, hostname);
                fprintf(fp, "%-79.79s\007\007\r\n", lbuf);
-               sprintf(lbuf, "        (%s) at %d:%02d ...",
-                             where, lt->tm_hour, lt->tm_min);
+               cnt = sprintf(lbuf, "        (%s) at ", where);
+               mbuf = lbuf + cnt;
+               strftime(mbuf, 79-cnt, "%T %x ...", lt);
                fprintf(fp, "%-79.79s\r\n", lbuf);
        }
        fprintf(fp, "%79s\r\n", " ");


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-06-29  9:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-27  0:34 [PATCH] wall: Print time and date (rather than just time) in wall banner Dave Rutherford
2015-06-27  8:20 ` Sami Kerola
2015-06-29  9:27   ` Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox