From: Dave Rutherford <dave@evilpettingzoo.com>
To: util-linux@vger.kernel.org
Subject: [PATCH] wall: Print time and date (rather than just time) in wall banner
Date: Fri, 26 Jun 2015 20:34:53 -0400 [thread overview]
Message-ID: <E1Z8e57-0003js-1r@bb> (raw)
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", " ");
next reply other threads:[~2015-06-27 0:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-27 0:34 Dave Rutherford [this message]
2015-06-27 8:20 ` [PATCH] wall: Print time and date (rather than just time) in wall banner Sami Kerola
2015-06-29 9:27 ` Karel Zak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1Z8e57-0003js-1r@bb \
--to=dave@evilpettingzoo.com \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.