diff options
author | Brian Somers <brian@FreeBSD.org> | 2000-08-25 01:01:07 +0000 |
---|---|---|
committer | Brian Somers <brian@FreeBSD.org> | 2000-08-25 01:01:07 +0000 |
commit | 040864ac7a706ff9f138d9f0d77373722c64167c (patch) | |
tree | 7fbffcf095afee855f18c1dca84ad8ec3a1ab9cd /usr.bin/finger/finger.c | |
parent | 6bd9abd49aaa4102fad95c5c47a456a603e59b51 (diff) |
Allow finger.conf to contain aliases for files that will be displayed
when fingered.
Submitted by: Mark Knight <markk@knigma.org>
Notes
Notes:
svn path=/head/; revision=65064
Diffstat (limited to 'usr.bin/finger/finger.c')
-rw-r--r-- | usr.bin/finger/finger.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/usr.bin/finger/finger.c b/usr.bin/finger/finger.c index e4269e4384ae..ff9dd3c21bee 100644 --- a/usr.bin/finger/finger.c +++ b/usr.bin/finger/finger.c @@ -274,6 +274,7 @@ userlist(argc, argv) char conf_alias[LINE_MAX]; char *conf_realname; int conf_length; + int nip; if ((nargv = malloc((argc+1) * sizeof(char *))) == NULL || (used = calloc(argc, sizeof(int))) == NULL) @@ -318,20 +319,31 @@ userlist(argc, argv) /* * Traverse the list of possible login names and check the login name - * and real name against the name specified by the user. + * and real name against the name specified by the user. If the name + * begins with a '/', try to read the file of that name instead of + * gathering the traditional finger information. */ if (mflag) - for (p = argv; *p; ++p) - if (((pw = getpwnam(*p)) != NULL) && !hide(pw)) - enter_person(pw); - else - warnx("%s: no such user", *p); + for (p = argv; *p; ++p) { + if (**p == '/' && !show_text("", *p, "")) { + if (((pw = getpwnam(*p)) != NULL) && !hide(pw)) + enter_person(pw); + else + warnx("%s: no such user", *p); + } + } else { - while ((pw = getpwent()) != NULL) { + nip = 0; + while (nip < argc && (pw = getpwent()) != NULL) { for (p = argv, ip = used; *p; ++p, ++ip) - if (match(pw, *p) && !hide(pw)) { + if (**p == '/' && *ip != 1 + && show_text("", *p, "")) { + *ip = 1; + nip++; + } else if (match(pw, *p) && !hide(pw)) { enter_person(pw); *ip = 1; + nip++; } } for (p = argv, ip = used; *p; ++p, ++ip) |