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).
This commit is contained in:
Warner Losh 2019-04-24 05:24:10 +00:00
parent b106e0fccc
commit 8b82def341
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=346624
2 changed files with 7 additions and 3 deletions

View File

@ -32,7 +32,7 @@
.\" @(#)date.1 8.3 (Berkeley) 4/28/95 .\" @(#)date.1 8.3 (Berkeley) 4/28/95
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd March 20, 2019 .Dd April 23, 2019
.Dt DATE 1 .Dt DATE 1
.Os .Os
.Sh NAME .Sh NAME
@ -40,7 +40,7 @@
.Nd display or set date and time .Nd display or set date and time
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm .Nm
.Op Fl jRu .Op Fl jnRu
.Op Fl r Ar seconds | Ar filename .Op Fl r Ar seconds | Ar filename
.Oo .Oo
.Fl v .Fl v
@ -142,6 +142,8 @@ This allows you to use the
flag in addition to the flag in addition to the
.Cm + .Cm +
option to convert one date format to another. option to convert one date format to another.
.It Fl n
Obsolete flag, accepted and ignored for compatibility.
.It Fl R .It Fl R
Use RFC 2822 date and time output format. Use RFC 2822 date and time output format.
This is equivalent to using This is equivalent to using

View File

@ -108,7 +108,7 @@ main(int argc, char *argv[])
(void) setlocale(LC_TIME, ""); (void) setlocale(LC_TIME, "");
rflag = 0; rflag = 0;
Iflag = jflag = 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) { switch((char)ch) {
case 'f': case 'f':
fmt = optarg; fmt = optarg;
@ -132,6 +132,8 @@ main(int argc, char *argv[])
case 'j': case 'j':
jflag = 1; /* don't set time */ jflag = 1; /* don't set time */
break; break;
case 'n':
break;
case 'R': /* RFC 2822 datetime format */ case 'R': /* RFC 2822 datetime format */
if (Iflag) if (Iflag)
multipleformats(); multipleformats();