/* If nonzero, print the version on standard output and exit. */
static int show_version;
+/* If nonzero, attempt to canonicalize hostnames via a DNS lookup. */
+static int do_lookup;
+
/* If nonzero, display only a list of usernames and count of
the users logged on.
Ignored for `who am i'. */
{"count", no_argument, NULL, 'q'},
{"idle", no_argument, NULL, 'u'},
{"heading", no_argument, NULL, 'H'},
+ {"lookup", no_argument, NULL, 'l'},
{"message", no_argument, NULL, 'T'},
{"mesg", no_argument, NULL, 'T'},
{"writable", no_argument, NULL, 'T'},
printf (" . ");
}
#ifdef HAVE_UT_HOST
- if (utmp_ent->ut_host[0])
+ if (utmp_ent->ut_host[0] && do_lookup)
{
extern char *canon_host ();
char ut_host[sizeof (utmp_ent->ut_host) + 1];
\n\
-H, --heading print line of column headings\n\
-i, -u, --idle add user idle time as HOURS:MINUTES, . or old\n\
+ -l, --lookup attempt to canonicalize hostnames via DNS\n\
-m only hostname and user associated with stdin\n\
-q, --count all login names and number of users logged on\n\
-s (ignored)\n\
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- while ((optc = getopt_long (argc, argv, "imqsuwHT", longopts, &longind)) != -1)
+ while ((optc = getopt_long (argc, argv, "ilmqsuwHT", longopts, &longind)) != -1)
{
switch (optc)
{
my_line_only = 1;
break;
+ case 'l':
+ do_lookup = 1;
+ break;
+
case 'q':
short_list = 1;
break;