summaryrefslogtreecommitdiff
path: root/usr.bin/finger/finger.c
diff options
context:
space:
mode:
authorJason Downs <downsj@cvs.openbsd.org>1996-12-08 13:29:20 +0000
committerJason Downs <downsj@cvs.openbsd.org>1996-12-08 13:29:20 +0000
commit3ad754d0d330b9f180d89790ed8726eac24c3e9d (patch)
tree9e8deeb6c05b05d1fa865f073a45b5c8933fa410 /usr.bin/finger/finger.c
parentf3f5e12fa7233f550991d8f88d1e6d7a88ba6803 (diff)
Disable matching by default if a domainname is set, adding -M to reenable it.
Diffstat (limited to 'usr.bin/finger/finger.c')
-rw-r--r--usr.bin/finger/finger.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/usr.bin/finger/finger.c b/usr.bin/finger/finger.c
index c2993d08d40..3bc15431568 100644
--- a/usr.bin/finger/finger.c
+++ b/usr.bin/finger/finger.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: finger.c,v 1.3 1996/08/30 11:39:36 deraadt Exp $ */
+/* $OpenBSD: finger.c,v 1.4 1996/12/08 13:29:19 downsj Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
@@ -48,7 +48,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)finger.c 5.22 (Berkeley) 6/29/90";*/
-static char rcsid[] = "$OpenBSD: finger.c,v 1.3 1996/08/30 11:39:36 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: finger.c,v 1.4 1996/12/08 13:29:19 downsj Exp $";
#endif /* not lint */
/*
@@ -71,7 +71,7 @@ static char rcsid[] = "$OpenBSD: finger.c,v 1.3 1996/08/30 11:39:36 deraadt Exp
#include "finger.h"
time_t now;
-int lflag, sflag, mflag, pplan;
+int lflag, sflag, mflag, pplan, Mflag;
char tbuf[1024];
int loginlist __P((void));
@@ -84,9 +84,10 @@ main(argc, argv)
{
extern int optind;
int ch;
+ char domain[256];
time_t time();
- while ((ch = getopt(argc, argv, "lmps")) != EOF)
+ while ((ch = getopt(argc, argv, "lmMps")) != EOF)
switch(ch) {
case 'l':
lflag = 1; /* long format */
@@ -94,6 +95,9 @@ main(argc, argv)
case 'm':
mflag = 1; /* force exact match of names */
break;
+ case 'M':
+ Mflag = 1; /* allow name matching */
+ break;
case 'p':
pplan = 1; /* don't show .plan/.project */
break;
@@ -103,12 +107,16 @@ main(argc, argv)
case '?':
default:
(void)fprintf(stderr,
- "usage: finger [-lmps] [login ...]\n");
+ "usage: finger [-lmMps] [login ...]\n");
exit(1);
}
argc -= optind;
argv += optind;
+ /* if a domainname is set, increment mflag. */
+ if ((getdomainname(&domain, sizeof(domain)) == 0) && domain[0])
+ mflag++;
+
(void)time(&now);
setpassent(1);
if (!*argv) {
@@ -208,7 +216,7 @@ 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.
*/
- if (mflag) {
+ if ((mflag - Mflag) > 0) {
for (i = 0; i < argc; i++)
if (used[i] >= 0 && (pw = getpwnam(argv[i]))) {
enter_person(pw);