static bool bflg = false; /* print excludes most recent days */
static bool Cflg = false; /* clear record for user */
static bool Sflg = false; /* set record for user */
+static bool aflg = false; /* print only users that have logged in */
#define NOW time(NULL)
(void) fputs (_(" -S, --set set lastlog record to current time (usable only with -u)\n"), usageout);
(void) fputs (_(" -t, --time DAYS print only lastlog records more recent than DAYS\n"), usageout);
(void) fputs (_(" -u, --user LOGIN print lastlog record of the specified LOGIN\n"), usageout);
+ (void) fputs (_(" -a, --active print lastlog excluding '**Never logged in**' users"), usageout);
(void) fputs ("\n", usageout);
exit (status);
}
cp = ptime;
}
if (ll.ll_time == (time_t) 0) {
+ /* If aflg is used,i.e aflag=true omit the 'Never logged in' lines */
+ if (aflg)
+ return;
cp = _("**Never logged in**\0");
}
{"set", no_argument, NULL, 'S'},
{"time", required_argument, NULL, 't'},
{"user", required_argument, NULL, 'u'},
+ {"active", no_argument, NULL, 'a'},
{NULL, 0, NULL, '\0'}
};
- while ((c = getopt_long (argc, argv, "b:ChR:St:u:", longopts,
+ while ((c = getopt_long (argc, argv, "b:ChR:St:u:a", longopts,
NULL)) != -1) {
switch (c) {
case 'b':
}
break;
}
+ case 'a':
+ {
+ aflg = true;
+ break;
+ }
default:
usage (EXIT_FAILURE);
/*@notreached@*/break;