summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2001-01-04 17:59:22 +0000
committerJim Meyering <jim@meyering.net>2001-01-04 17:59:22 +0000
commitcc49da4ddf6e10330fd46d76c54c1afd37a01d70 (patch)
tree4eb43f3ab09d88c0145780ca361ba5b24a1c67dc
parentb7b4bec8df7275d3ea5b2bce68080a48e18dccf6 (diff)
downloadcoreutils-cc49da4ddf6e10330fd46d76c54c1afd37a01d70.tar.xz
(main): Fail when --rfc-822 (-R) is specified along
with a format string. Reported by Jochen Hein.
-rw-r--r--src/date.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/date.c b/src/date.c
index b521d661d..dbb9d42da 100644
--- a/src/date.c
+++ b/src/date.c
@@ -1,5 +1,5 @@
/* date - print or set the system date and time
- Copyright (C) 1989-2000 Free Software Foundation, Inc.
+ Copyright (C) 1989-2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -355,6 +355,15 @@ argument must be a format string beginning with `+'."),
usage (1);
}
+ /* Simply ignore --rfc-822 if specified when setting the date. */
+ if (rfc_format && !set_date && n_args > 0)
+ {
+ error (0, 0,
+ _("a format string may not be specified when using\
+ the --rfc-822 (-R) option"));
+ usage (1);
+ }
+
if (set_date)
datestr = set_datestr;