Scott Cheloha <scottchel...@gmail.com> wrote:

> On Wed, Aug 07, 2019 at 05:52:54PM -0600, Theo de Raadt wrote:
> > Scott Cheloha <scottchel...@gmail.com> wrote:
> > 
> > > - while ((ch = getopt(argc, argv, "ad:f:jr:ut:z:")) != -1)
> > > + while ((ch = getopt(argc, argv, "af:jr:uz:")) != -1)
> > 
> > You remove d and t, so:
> > 
> > > +         case 'd':               /* compat: daylight saving time */
> > >                   break;
> > 
> > Can't be reached.
> > 
> > > +         case 't':               /* compat: minutes west of GMT */
> > >                   break;
> > 
> > Can't be reached.
> 
> 
> Whoops, corrected.
> 
> Index: date.c
> ===================================================================
> RCS file: /cvs/src/bin/date/date.c,v
> retrieving revision 1.55
> diff -u -p -r1.55 date.c
> --- date.c    28 Jun 2019 13:34:58 -0000      1.55
> +++ date.c    8 Aug 2019 00:06:09 -0000
> @@ -58,22 +58,19 @@ static void __dead usage(void);
>  int
>  main(int argc, char *argv[])
>  {
> -     struct timezone tz;
>       const char *errstr;
>       struct tm *tp;
>       int ch, rflag;
>       char *format, buf[1024], *outzone = NULL;
>       const char *pformat = NULL;
>  
> -     tz.tz_dsttime = tz.tz_minuteswest = 0;
>       rflag = 0;
> -     while ((ch = getopt(argc, argv, "ad:f:jr:ut:z:")) != -1)
> +     while ((ch = getopt(argc, argv, "ad:f:jr:t:uz:")) != -1)
>               switch(ch) {
>               case 'a':
>                       slidetime = 1;
>                       break;
> -             case 'd':               /* daylight saving time */
> -                     tz.tz_dsttime = atoi(optarg) ? 1 : 0;
> +             case 'd':               /* compat: daylight saving time */
>                       break;
>               case 'f':               /* parse with strptime */
>                       pformat = optarg;
> @@ -91,10 +88,7 @@ main(int argc, char *argv[])
>                       if (setenv("TZ", "UTC", 1) == -1)
>                               err(1, "cannot unsetenv TZ");
>                       break;
> -             case 't':               /* minutes west of GMT */
> -                     tz.tz_minuteswest = strtonum(optarg, 0, 24*60-1, 
> &errstr);
> -                     if (errstr)
> -                             errx(1, "-t %s: %s", optarg, errstr);
> +             case 't':               /* compat: minutes west of GMT */
>                       break;


I don't understand what you are trying to do.

What does "compat" mean, when it ignores the option.  Is it not better
to de-support the option, so that people know it doesn't behave same
anymore??

Reply via email to