From nobody@FreeBSD.org  Sun Mar 17 09:32:44 2013
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
	by hub.freebsd.org (Postfix) with ESMTP id 68B2FE24
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 17 Mar 2013 09:32:44 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 37B73934
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 17 Mar 2013 09:32:44 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.5/8.14.5) with ESMTP id r2H9WiFS060135
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 17 Mar 2013 09:32:44 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.5/8.14.5/Submit) id r2H9WiE4060134;
	Sun, 17 Mar 2013 09:32:44 GMT
	(envelope-from nobody)
Message-Id: <201303170932.r2H9WiE4060134@red.freebsd.org>
Date: Sun, 17 Mar 2013 09:32:44 GMT
From: Ivan Ivanyuk <ivan.ivanyuk@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [patch] Adding date to wall(1) output message can be useful
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         177047
>Category:       bin
>Synopsis:       [patch] Adding date to wall(1) output message can be useful
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Mar 17 09:40:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Ivan Ivanyuk
>Release:        8.3
>Organization:
>Environment:
FreeBSD planetes 8.3-RELEASE FreeBSD 8.3-RELEASE #1: Fri Aug 17 15:18:30 EEST 2012     root@planetes:/usr/obj/usr/src/sys/GW  amd64

>Description:
Currently wall output includes date in short format: HH:MM TZ

 It can be useful to have date included. Some utils use wall(1) for reporting events and it would be easier to see date of them at one glance.


>How-To-Repeat:

>Fix:
Sample patch against 8.3 source attached. Very likely it has to be improved by real developer.

Patch attached with submission follows:

--- /usr/src/usr.bin/wall/wall.c        2012-03-03 08:15:13.000000000 +0200
+++ /home/zxadmin/wall/wall.c   2013-03-17 11:00:40.000000000 +0200
@@ -204,7 +204,7 @@
        time_t now;
        FILE *fp;
        int fd;
-       char *p, hostname[MAXHOSTNAMELEN], lbuf[256], tmpname[64];
+       char *p, hostname[MAXHOSTNAMELEN], lbuf[256], tmpname[64], datestr[20];
        const char *tty;
        const char *whom;
        gid_t egid;
@@ -224,6 +224,7 @@
                (void)gethostname(hostname, sizeof(hostname));
                (void)time(&now);
                lt = localtime(&now);
+               (void)strftime(datestr, sizeof datestr, "%b %d %H:%M %Z", lt);

                /*
                 * all this stuff is to blank out a square for the message;
@@ -238,8 +239,7 @@
                    whom, hostname);
                (void)fprintf(fp, "%-79.79s\007\007\r\n", lbuf);
                (void)snprintf(lbuf, sizeof(lbuf),
-                   "        (%s) at %d:%02d %s...", tty,
-                   lt->tm_hour, lt->tm_min, lt->tm_zone);
+                   "        (%s) at %s...", tty, datestr);
                (void)fprintf(fp, "%-79.79s\r\n", lbuf);
        }
        (void)fprintf(fp, "%79s\r\n", " ");

>Release-Note:
>Audit-Trail:
>Unformatted:
