summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2002-07-22 17:19:54 +0000
committerume <ume@FreeBSD.org>2002-07-22 17:19:54 +0000
commita3550f285812f652c7cd8ace74e72d09fa9a9393 (patch)
tree83e6c1fda530bca72256aaf5459f09f353071f05 /usr.bin
parent9018f0891872e3a82f253630abc2850c6fa2dac5 (diff)
downloadFreeBSD-src-a3550f285812f652c7cd8ace74e72d09fa9a9393.zip
FreeBSD-src-a3550f285812f652c7cd8ace74e72d09fa9a9393.tar.gz
add -4 and -6 option to be able to specify an address family.
Requested by: matusita MFC after: 1 week
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/finger/finger.110
-rw-r--r--usr.bin/finger/finger.c13
-rw-r--r--usr.bin/finger/net.c3
3 files changed, 22 insertions, 4 deletions
diff --git a/usr.bin/finger/finger.1 b/usr.bin/finger/finger.1
index 432d762..4c00c54 100644
--- a/usr.bin/finger/finger.1
+++ b/usr.bin/finger/finger.1
@@ -40,7 +40,7 @@
.Nd user information lookup program
.Sh SYNOPSIS
.Nm
-.Op Fl glmpshoT
+.Op Fl 46glmpshoT
.Op Ar user ...\&
.Op Ar user@host ...\&
.Sh DESCRIPTION
@@ -50,6 +50,14 @@ utility displays information about the system users.
.Pp
Options are:
.Bl -tag -width flag
+.It Fl 4
+Forces
+.Nm
+to use IPv4 addresses only.
+.It Fl 6
+Forces
+.Nm
+to use IPv6 addresses only.
.It Fl s
Display the user's login name, real name, terminal name and write
status (as a ``*'' before the terminal name if write permission is
diff --git a/usr.bin/finger/finger.c b/usr.bin/finger/finger.c
index 0e6c176..a695672 100644
--- a/usr.bin/finger/finger.c
+++ b/usr.bin/finger/finger.c
@@ -73,6 +73,8 @@ __FBSDID("$FreeBSD$");
* well as home directory, shell, mail info, and .plan/.project files.
*/
+#include <sys/types.h>
+#include <sys/socket.h>
#include <db.h>
#include <err.h>
#include <pwd.h>
@@ -90,6 +92,7 @@ __FBSDID("$FreeBSD$");
DB *db;
time_t now;
int entries, gflag, lflag, mflag, pplan, sflag, oflag, Tflag;
+sa_family_t family = PF_UNSPEC;
int d_first = -1;
char tbuf[1024];
@@ -107,8 +110,14 @@ option(argc, argv)
optind = 1; /* reset getopt */
- while ((ch = getopt(argc, argv, "glmpshoT")) != -1)
+ while ((ch = getopt(argc, argv, "46glmpshoT")) != -1)
switch(ch) {
+ case '4':
+ family = AF_INET;
+ break;
+ case '6':
+ family = AF_INET6;
+ break;
case 'g':
gflag = 1;
break;
@@ -144,7 +153,7 @@ option(argc, argv)
static void
usage()
{
- (void)fprintf(stderr, "usage: finger [-lmpshoT] [login ...]\n");
+ (void)fprintf(stderr, "usage: finger [-46lmpshoT] [login ...]\n");
exit(1);
}
diff --git a/usr.bin/finger/net.c b/usr.bin/finger/net.c
index 67a7087..b4df124 100644
--- a/usr.bin/finger/net.c
+++ b/usr.bin/finger/net.c
@@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$");
extern int lflag; /* XXX finger.h? */
extern int Tflag; /* XXX finger.h? */
+extern sa_family_t family;
static void cleanup(int sig);;
static int do_protocol(const char *name, const struct addrinfo *ai);
@@ -82,7 +83,7 @@ netfinger(name)
alarm(TIME_LIMIT);
hint.ai_flags = AI_CANONNAME;
- hint.ai_family = PF_UNSPEC;
+ hint.ai_family = family;
hint.ai_socktype = SOCK_STREAM;
error = getaddrinfo(host, "finger", &hint, &ai0);
OpenPOWER on IntegriCloud