Whilst hacking the Net/2 version of finger to work on Solaris 2.2 (we
needed a finger on that platform which grokked the office/phone # GCOS info), I decided to put mail status in (as the solaris version has that). The attached patch adds: - manual page typos fixed: finger doesn't scan .forward, contrary to what the man page says (and really shouldn't either, IMHO - that's what telnet host SMTP & VRFY are for :) - added a mail check (printed between login info and the project). three different messages possible: - if you have no mail: No Mail. - if you have mail, but there's no unread mail: Mail last read DDD MMM ## HH:MM (TZ) - if you have new mail: New mail received DDD MMM ## HH:MM (TZ) Unread since DDD MMM ## HH:MM (TZ) - fixed the manual page. lm@yallara.cs.rmit.OZ.AU (Luke Mewburn)
This commit is contained in:
parent
933a7b3ad8
commit
4eae27f3eb
@ -30,7 +30,7 @@
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" from: @(#)finger.1 6.14 (Berkeley) 7/27/91
|
||||
.\" $Id: finger.1,v 1.2 1993/08/01 07:32:52 mycroft Exp $
|
||||
.\" $Id: finger.1,v 1.3 1993/10/07 19:58:28 brezak Exp $
|
||||
.\"
|
||||
.Dd July 27, 1991
|
||||
.Dt FINGER 1
|
||||
@ -71,8 +71,7 @@ Produces a multi-line format displaying all of the information
|
||||
described for the
|
||||
.Fl s
|
||||
option as well as the user's home directory, home phone number, login
|
||||
shell, and the contents of the files
|
||||
.Dq Pa .forward ,
|
||||
shell, mail status, and the contents of the files
|
||||
.Dq Pa .plan
|
||||
and
|
||||
.Dq Pa .project
|
||||
@ -86,6 +85,7 @@ Phone numbers specified as eleven digits are printed as ``+N-NNN-NNN-NNNN''.
|
||||
Numbers specified as ten or seven digits are printed as the appropriate
|
||||
subset of that string.
|
||||
Numbers specified as five digits are printed as ``xN-NNNN''.
|
||||
Numbers specified as four digits are printed as ``xNNNN''.
|
||||
.Pp
|
||||
If write permission is denied to the device, the phrase ``(messages off)''
|
||||
is appended to the line containing the device name.
|
||||
@ -94,6 +94,11 @@ One entry per user is displayed with the
|
||||
option; if a user is logged on multiple times, terminal information
|
||||
is repeated once per login.
|
||||
.Pp
|
||||
Mail status is shown as ``No Mail.'' if there is no mail at all,
|
||||
``Mail last read DDD MMM ## HH:MM YYYY (TZ)'' if the person has looked
|
||||
at their mailbox since new mail arriving, or ``New mail received ...'',
|
||||
`` Unread since ...'' if they have new mail.
|
||||
.Pp
|
||||
.It Fl p
|
||||
Prevents
|
||||
the
|
||||
@ -101,7 +106,6 @@ the
|
||||
option of
|
||||
.Nm finger
|
||||
from displaying the contents of the
|
||||
.Dq Pa .forward ,
|
||||
.Dq Pa .plan
|
||||
and
|
||||
.Dq Pa .project
|
||||
|
@ -34,6 +34,10 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Mail status reporting added 931007 by Luke Mewburn, <zak@rmit.edu.au>.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
char copyright[] =
|
||||
"@(#) Copyright (c) 1989 The Regents of the University of California.\n\
|
||||
@ -42,7 +46,7 @@ char copyright[] =
|
||||
|
||||
#ifndef lint
|
||||
/*static char sccsid[] = "from: @(#)finger.c 5.22 (Berkeley) 6/29/90";*/
|
||||
static char rcsid[] = "$Id: finger.c,v 1.2 1993/08/01 18:16:02 mycroft Exp $";
|
||||
static char rcsid[] = "$Id: finger.c,v 1.3 1993/10/07 19:58:29 brezak Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
|
@ -34,12 +34,14 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)finger.h 5.5 (Berkeley) 6/1/90
|
||||
* $Id: finger.h,v 1.2 1993/08/01 18:16:03 mycroft Exp $
|
||||
* $Id: finger.h,v 1.3 1993/10/07 19:58:30 brezak Exp $
|
||||
*/
|
||||
|
||||
#include <pwd.h>
|
||||
#include <utmp.h>
|
||||
|
||||
#define _PATH_MAILSPOOL "/var/mail"
|
||||
|
||||
/*
|
||||
* All unique persons are linked in a list headed by "head" and linkd
|
||||
* by the "next" field, as well as kept in a hash table.
|
||||
@ -56,6 +58,8 @@ typedef struct person {
|
||||
char *officephone; /* pointer to office phone no. */
|
||||
char *realname; /* pointer to full name */
|
||||
char *shell; /* user's shell */
|
||||
time_t mailread; /* last time mail was read */
|
||||
time_t mailrecv; /* last time mail was read */
|
||||
struct where *whead, *wtail; /* list of where he is or has been */
|
||||
} PERSON;
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
#ifndef lint
|
||||
/*static char sccsid[] = "from: @(#)lprint.c 5.13 (Berkeley) 10/31/90";*/
|
||||
static char rcsid[] = "$Id: lprint.c,v 1.2 1993/08/01 18:16:01 mycroft Exp $";
|
||||
static char rcsid[] = "$Id: lprint.c,v 1.3 1993/10/07 19:58:31 brezak Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -198,6 +198,23 @@ lprint(pn)
|
||||
}
|
||||
putchar('\n');
|
||||
}
|
||||
if (pn->mailrecv == -1)
|
||||
printf("No Mail.\n");
|
||||
else if (pn->mailrecv > pn->mailread) {
|
||||
tp = localtime(&pn->mailrecv);
|
||||
t = asctime(tp);
|
||||
tzn = tp->tm_zone;
|
||||
printf("New mail received %.16s %.4s (%s)\n", t, t + 20, tzn);
|
||||
tp = localtime(&pn->mailread);
|
||||
t = asctime(tp);
|
||||
tzn = tp->tm_zone;
|
||||
printf(" Unread since %.16s %.4s (%s)\n", t, t + 20, tzn);
|
||||
} else {
|
||||
tp = localtime(&pn->mailread);
|
||||
t = asctime(tp);
|
||||
tzn = tp->tm_zone;
|
||||
printf("Mail last read %.16s %.4s (%s)\n", t, t + 20, tzn);
|
||||
}
|
||||
}
|
||||
|
||||
demi_print(str, oddfield)
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
#ifndef lint
|
||||
/*static char sccsid[] = "from: @(#)util.c 5.14 (Berkeley) 1/17/91";*/
|
||||
static char rcsid[] = "$Id: util.c,v 1.2 1993/08/01 18:15:57 mycroft Exp $";
|
||||
static char rcsid[] = "$Id: util.c,v 1.3 1993/10/07 19:58:32 brezak Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -46,6 +46,7 @@ static char rcsid[] = "$Id: util.c,v 1.2 1993/08/01 18:15:57 mycroft Exp $";
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <paths.h>
|
||||
#include <errno.h>
|
||||
#include "finger.h"
|
||||
|
||||
find_idle_and_ttywrite(w)
|
||||
@ -72,7 +73,10 @@ userinfo(pn, pw)
|
||||
register PERSON *pn;
|
||||
register struct passwd *pw;
|
||||
{
|
||||
extern time_t now;
|
||||
register char *p, *t;
|
||||
struct stat sb;
|
||||
extern int errno;
|
||||
char *bp, name[1024];
|
||||
|
||||
pn->realname = pn->office = pn->officephone = pn->homephone = NULL;
|
||||
@ -106,6 +110,18 @@ userinfo(pn, pw)
|
||||
strdup(p) : NULL;
|
||||
pn->homephone = ((p = strsep(&bp, ",")) && *p) ?
|
||||
strdup(p) : NULL;
|
||||
(void)sprintf(tbuf, "%s/%s", _PATH_MAILSPOOL, pw->pw_name);
|
||||
pn->mailrecv = -1; /* -1 == not_valid */
|
||||
if (stat(tbuf, &sb) < 0) {
|
||||
if (errno != ENOENT) {
|
||||
(void)fprintf(stderr,
|
||||
"finger: %s: %s\n", tbuf, strerror(errno));
|
||||
return;
|
||||
}
|
||||
} else if (sb.st_size != 0) {
|
||||
pn->mailrecv = sb.st_mtime;
|
||||
pn->mailread = sb.st_atime;
|
||||
}
|
||||
}
|
||||
|
||||
match(pw, user)
|
||||
@ -319,14 +335,17 @@ prphone(num)
|
||||
*p++ = *num++;
|
||||
break;
|
||||
case 5: /* x0-1234 */
|
||||
case 4: /* x1234 */
|
||||
*p++ = 'x';
|
||||
*p++ = *num++;
|
||||
break;
|
||||
default:
|
||||
return(num);
|
||||
}
|
||||
*p++ = '-';
|
||||
*p++ = *num++;
|
||||
if (len != 4) {
|
||||
*p++ = '-';
|
||||
*p++ = *num++;
|
||||
}
|
||||
*p++ = *num++;
|
||||
*p++ = *num++;
|
||||
*p++ = *num++;
|
||||
|
Loading…
Reference in New Issue
Block a user