From 8b82def341087b6512496f05f3aa3ca0ebc9b5a8 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Wed, 24 Apr 2019 05:24:10 +0000 Subject: [PATCH] Restore the -n flag parsing, but ignore it. Since D19668 was done, new users of the -n flag have surfaced. Parse and ignore it on the command line until they can be updated. Suggested by: rgrimes (in D19668). --- bin/date/date.1 | 6 ++++-- bin/date/date.c | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/bin/date/date.1 b/bin/date/date.1 index bfdb26adeaee..9943fb6669bc 100644 --- a/bin/date/date.1 +++ b/bin/date/date.1 @@ -32,7 +32,7 @@ .\" @(#)date.1 8.3 (Berkeley) 4/28/95 .\" $FreeBSD$ .\" -.Dd March 20, 2019 +.Dd April 23, 2019 .Dt DATE 1 .Os .Sh NAME @@ -40,7 +40,7 @@ .Nd display or set date and time .Sh SYNOPSIS .Nm -.Op Fl jRu +.Op Fl jnRu .Op Fl r Ar seconds | Ar filename .Oo .Fl v @@ -142,6 +142,8 @@ This allows you to use the flag in addition to the .Cm + option to convert one date format to another. +.It Fl n +Obsolete flag, accepted and ignored for compatibility. .It Fl R Use RFC 2822 date and time output format. This is equivalent to using diff --git a/bin/date/date.c b/bin/date/date.c index 7f216e484740..cde299f6de61 100644 --- a/bin/date/date.c +++ b/bin/date/date.c @@ -108,7 +108,7 @@ main(int argc, char *argv[]) (void) setlocale(LC_TIME, ""); rflag = 0; Iflag = jflag = Rflag = 0; - while ((ch = getopt(argc, argv, "f:I::jRr:uv:")) != -1) + while ((ch = getopt(argc, argv, "f:I::jnRr:uv:")) != -1) switch((char)ch) { case 'f': fmt = optarg; @@ -132,6 +132,8 @@ main(int argc, char *argv[]) case 'j': jflag = 1; /* don't set time */ break; + case 'n': + break; case 'R': /* RFC 2822 datetime format */ if (Iflag) multipleformats();