summaryrefslogtreecommitdiffstats
path: root/login-utils/last.c
diff options
context:
space:
mode:
authorKarel Zak2013-09-02 11:42:44 +0200
committerKarel Zak2013-09-02 11:42:44 +0200
commit2ea747ebf1ed89cd1d5a704677e72c2d008eb6f1 (patch)
tree80b27ebed5f0212087122a0cf05b020514639510 /login-utils/last.c
parentlast: consolidate time formatting to one struct (diff)
downloadkernel-qcow2-util-linux-2ea747ebf1ed89cd1d5a704677e72c2d008eb6f1.tar.gz
kernel-qcow2-util-linux-2ea747ebf1ed89cd1d5a704677e72c2d008eb6f1.tar.xz
kernel-qcow2-util-linux-2ea747ebf1ed89cd1d5a704677e72c2d008eb6f1.zip
last: --fulltime and --time-format are mutually exclusive
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'login-utils/last.c')
-rw-r--r--login-utils/last.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/login-utils/last.c b/login-utils/last.c
index d407bf9d6..eb64bde6a 100644
--- a/login-utils/last.c
+++ b/login-utils/last.c
@@ -42,6 +42,7 @@
#include "c.h"
#include "nls.h"
+#include "optutils.h"
#include "pathnames.h"
#include "xalloc.h"
#include "closestream.h"
@@ -834,7 +835,6 @@ int main(int argc, char **argv)
enum {
OPT_TIME_FORMAT = CHAR_MAX + 1
};
-
static const struct option long_opts[] = {
{ "limit", required_argument, NULL, 'n' },
{ "help", no_argument, NULL, 'h' },
@@ -853,6 +853,11 @@ int main(int argc, char **argv)
{ "time-format", required_argument, NULL, OPT_TIME_FORMAT },
{ NULL, 0, NULL, 0 }
};
+ static const ul_excl_t excl[] = { /* rows and cols in in ASCII order */
+ { 'F', OPT_TIME_FORMAT }, /* fulltime, time-format */
+ { 0 }
+ };
+ int excl_st[ARRAY_SIZE(excl)] = UL_EXCL_STATUS_INIT;
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
@@ -861,6 +866,9 @@ int main(int argc, char **argv)
while ((c = getopt_long(argc, argv,
"hVf:n:RxadFit:p:s:0123456789w", long_opts, NULL)) != -1) {
+
+ err_exclusive_options(c, long_opts, excl, excl_st);
+
switch(c) {
case 'h':
usage(stdout);