-struct timeval boottime;
-struct utmp utmp;
-struct winsize ws;
-kvm_t *kd;
-time_t now; /* the current time of day */
-time_t uptime; /* time of last reboot & elapsed time since */
-int ttywidth; /* width of tty */
-int argwidth; /* width of tty */
-int header = 1; /* true if -h flag: don't print heading */
-int nflag; /* true if -n flag: don't convert addrs */
-int sortidle; /* sort bu idle time */
-char *sel_user; /* login of particular user selected */
-char *program;
-char domain[MAXHOSTNAMELEN];
+struct timeval boottime;
+struct utmp utmp;
+struct winsize ws;
+kvm_t *kd;
+time_t now; /* the current time of day */
+time_t uptime; /* time of last reboot & elapsed time since */
+int ttywidth; /* width of tty */
+int argwidth; /* width of tty */
+int header = 1; /* true if -h flag: don't print heading */
+int nflag; /* true if -n flag: don't convert addrs */
+int sortidle; /* sort bu idle time */
+char *sel_user; /* login of particular user selected */
+char domain[MAXHOSTNAMELEN];
char buf[MAXHOSTNAMELEN], errbuf[256];
/* Are we w(1) or uptime(1)? */
char buf[MAXHOSTNAMELEN], errbuf[256];
/* Are we w(1) or uptime(1)? */
argv += optind;
if ((kd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, errbuf)) == NULL)
argv += optind;
if ((kd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, errbuf)) == NULL)
if ((kp = kvm_getprocs(kd, KERN_PROC_ALL, 0, &nentries)) == NULL)
err(1, "%s", kvm_geterr(kd));
for (i = 0; i < nentries; i++, kp++) {
if ((kp = kvm_getprocs(kd, KERN_PROC_ALL, 0, &nentries)) == NULL)
err(1, "%s", kvm_geterr(kd));
for (i = 0; i < nentries; i++, kp++) {
* Note, SCCS forces the string manipulation below, as it
* replaces w.c with file information.
*/
* Note, SCCS forces the string manipulation below, as it
* replaces w.c with file information.
*/
- (void)strcpy(fmt, "%l:%%%p");
- fmt[4] = 'M';
- (void)strftime(buf, sizeof(buf), fmt, localtime(nowp));
+ (void)strftime(buf,sizeof(buf),__CONCAT("%l:%","M%p"),localtime(nowp));