Hi Martijn, Martijn van Duren wrote on Sun, Aug 15, 2021 at 11:40:49PM +0200: > To quote schwarze in the jot mutually exclusive thread: > On Fri, 2021-08-13 at 11:48 +0200, Ingo Schwarze wrote:
>> In this case, even though this is not a POSIX command, POSIX utility >> convention 12.2.11 is pertinent: >> >> The order of different options relative to one another should not >> matter, unless the options are documented as mutually-exclusive >> and such an option is documented to override any incompatible >> options preceding it. If an option that has option-arguments is >> repeated, the option and option-argument combinations should be >> interpreted in the order specified on the command line. > This is also violated by cal(1) You seem to misunderstand. The cal(1) utility does *not* violate this syntax guideline. It neither has options where the order on the command line matters nor options that take arguments, so this guideline simply makes no recommendation whatsoever for cal(1). > (and maybe others, but this one came > up first). Diff below should fix this. I think the diff is not OK. It changes established and documented behaviour of a program, and you provide no explanation why the new behaviour would be more useful than the old one. Also, considering whether this might or might not cause compatibility issues would would be required. Compatibility issues may be unlikely because it merely defines new behaviour for something that is now a syntax error. That alone does not make the change useful, though. The change itself seems illogical and confusing to me. If a user says "i want days numbered consecutively from Jan 1 *and* week numbers displayed in addition", why should the first half of the request be ignored? And worse, *silently* ignored? Both halfs of the request are unrelated to each other, so both one overriding the other and their effect depending on their order would seem surprising and hardly useful. Also, allowing additional syntax makes the user interface more complex, which should not be done without a very good reason. Finally, even *if* we would decide to make the UI more complex and allow -jw and -wj (i see no pressing need because -j does not seem all that useful in the first place, and needing both at the same time would be an even less common task), then the logical behaviour would be to simply honour both at the the same time. So your change not only makes the UI more complex without a good reason. It also blocks syntax space that could, in the future, possibly be assigned to more useful functionality. I admit there are no strong logical reasons why these two options have to mutually exclusive. That's seems merely an implementation choice to keep the command and documentation simpler. Nothing is wrong with having some (not usually needed) functionality unimplemented in a program. In this case, this is even properly documented. To summarize, i oppose the diff as a whole, and i see not parts in it that could be salvaged. Yours, Ingo > Index: cal.1 > =================================================================== > RCS file: /cvs/src/usr.bin/cal/cal.1,v > retrieving revision 1.31 > diff -u -p -r1.31 cal.1 > --- cal.1 27 Nov 2016 10:37:22 -0000 1.31 > +++ cal.1 15 Aug 2021 21:39:28 -0000 > @@ -53,11 +53,8 @@ The options are as follows: > .Bl -tag -width Ds > .It Fl j > Display Julian dates (days one-based, numbered from January 1). > -The options > -.Fl j > -and > -.Fl w > -are mutually exclusive. > +Overrides earlier > +.Fl w . > .It Fl m > Display weeks starting on Monday instead of Sunday. > .It Fl w > @@ -65,11 +62,8 @@ Display week numbers in the month displa > If > .Fl m > is specified the ISO week format is assumed. > -The options > -.Fl j > -and > -.Fl w > -are mutually exclusive. > +Overrides earlier > +.Fl j . > .It Fl y > Display a calendar for the current year. > .El > Index: cal.c > =================================================================== > RCS file: /cvs/src/usr.bin/cal/cal.c,v > retrieving revision 1.30 > diff -u -p -r1.30 cal.c > --- cal.c 9 Oct 2015 01:37:06 -0000 1.30 > +++ cal.c 15 Aug 2021 21:39:28 -0000 > @@ -158,12 +158,14 @@ main(int argc, char *argv[]) > switch(ch) { > case 'j': > julian = 1; > + wflag = 0; > break; > case 'm': > mflag = 1; > break; > case 'w': > wflag = 1; > + julian = 0; > break; > case 'y': > yflag = 1; > @@ -174,9 +176,6 @@ main(int argc, char *argv[]) > } > argc -= optind; > argv += optind; > - > - if (julian && wflag) > - usage(); > > day_headings = DAY_HEADINGS_S; > sep1752 = sep1752s;