summaryrefslogtreecommitdiffstats
path: root/usr.bin/finger/finger.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>2000-08-25 01:01:07 +0000
committerbrian <brian@FreeBSD.org>2000-08-25 01:01:07 +0000
commit4dcf00026aaae753bf32fad240e4299b3ba402d2 (patch)
tree143fea435ceadf8708a385282ea8d122e9aa2042 /usr.bin/finger/finger.c
parent841b54e275fef021259a25a34650c6cfd02a3faa (diff)
downloadFreeBSD-src-4dcf00026aaae753bf32fad240e4299b3ba402d2.zip
FreeBSD-src-4dcf00026aaae753bf32fad240e4299b3ba402d2.tar.gz
Allow finger.conf to contain aliases for files that will be displayed
when fingered. Submitted by: Mark Knight <markk@knigma.org>
Diffstat (limited to 'usr.bin/finger/finger.c')
-rw-r--r--usr.bin/finger/finger.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/usr.bin/finger/finger.c b/usr.bin/finger/finger.c
index e4269e4..ff9dd3c 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)
OpenPOWER on IntegriCloud