Re: cal's -y flag usage
Johannes Thyssen Tishman <[email protected]>
| Newsgroups | gmane.os.openbsd.tech |
|---|---|
| Message-ID | <[email protected]> |
2026-06-26T16:34:57+0200 Jeremie Courreges-Anglas <[email protected]>: > The error message isn't accurate. I'd rather you use something like > below. ok jca@ if you like it. Thanks, fine by me. Any objections? Index: usr.bin/cal/cal.1 =================================================================== RCS file: /cvs/src/usr.bin/cal/cal.1,v diff -u -p -r1.33 cal.1 --- usr.bin/cal/cal.1 31 Jul 2024 17:09:23 -0000 1.33 +++ usr.bin/cal/cal.1 27 Jun 2026 08:57:39 -0000 @@ -72,6 +72,10 @@ and are mutually exclusive. .It Fl y Display a calendar for the current year. +This option is ignored if +.Ar year +is specified and conflicts with specifying a +.Ar month . .El .Pp A single numerical parameter specifies the Index: usr.bin/cal/cal.c =================================================================== RCS file: /cvs/src/usr.bin/cal/cal.c,v diff -u -p -r1.33 cal.c --- usr.bin/cal/cal.c 26 Jun 2026 12:34:45 -0000 1.33 +++ usr.bin/cal/cal.c 27 Jun 2026 08:57:39 -0000 @@ -193,10 +193,14 @@ main(int argc, char *argv[]) month = 0; switch(argc) { case 2: + if (yflag) + errx(1, "specifying a month conflicts with -y"); month = parsemonth(*argv++); /* FALLTHROUGH */ case 1: if (argc == 1 && !isdigit((unsigned char)*argv[0])) { + if (yflag) + errx(1, "specifying a month conflicts with -y"); month = parsemonth(*argv); (void)time(&now); local_time = localtime(&now);