TIME_SHORT_RELATIVE,
TIME_SHORT,
TIME_FULL,
+ TIME_ISO,
};
/*
case TIME_SHORT:
strftime(buf, 32, "%a %b %d %Y", &tm);
break;
+ case TIME_ISO:
+ strftime(buf, 32, "%Y-%m-%dT%H:%M:%S%z", &tm);
+ break;
}
return xstrdup(buf);
}
fputs(_(" -f, --failed Display data about the last users' failed logins\n"), out);
fputs(_(" -fulltimes Show dates in a long format\n"), out);
fputs(_(" -g, --groups=<groups> Display users belonging to a group in GROUPS\n"), out);
+ fputs(_(" -i, --iso Display dates in the ISO-8601 format\n"), out);
fputs(_(" -l, --logins=<logins> Display only users from LOGINS\n"), out);
fputs(_(" --last Show info about the users' last login sessions\n"), out);
fputs(_(" -m, --supp-groups Display supplementary groups as well\n"), out);
static int get_sgroups(int *len, gid_t **list, struct passwd *pwd)
{
int n = 0;
- gid_t *safelist;
*len = 0;
*list = NULL;
(*list)[n] = (*list)[--(*len)];
*list = xrealloc(*list, *len * sizeof(gid_t));
-#if 0
- if (!safelist && *len) {
- free(*list);
- return -1;
- }
- *list = safelist;
-#endif
return 0;
}
{ "fulltimes", no_argument, 0, OPT_FULLT },
{ "groups", required_argument, 0, 'g' },
{ "help", no_argument, 0, 'h' },
+ { "iso", no_argument, 0, 'i' },
{ "logins", required_argument, 0, 'l' },
{ "supp-groups", no_argument, 0, 'm' },
{ "newline", no_argument, 0, 'n' },
ctl->cmp_fn = cmp_uid;
- while ((c = getopt_long(argc, argv, "acefg:hl:mno:rstuxzZ",
+ while ((c = getopt_long(argc, argv, "acefg:hil:mno:rstuxzZ",
longopts, NULL)) != -1) {
err_exclusive_options(c, longopts, excl, excl_st);
break;
case 'h':
usage(stdout);
+ case 'i':
+ ctl->time_mode = TIME_ISO;
+ break;
case 'l':
logins = optarg;
break;