bin/177047: [patch] Adding date to wall(1) output message can be useful
Ivan Ivanyuk
ivan.ivanyuk at gmail.com
Sun Mar 17 09:40:01 UTC 2013
>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 at 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:
More information about the freebsd-bugs
mailing list