For my personal use and tail, I've arrived at:
if(argv[0] && argv[1] && (!argv[2] || !argv[3]) &&
(*argv[1] == '-' || *argv[1] == '+') &&
(*argv[1] != '-' || (*(argv[1] + 1) != 'c' && *(argv[1] + 1) != 'f'
&& *(argv[1] + 1) != 'r')) && (!argv[2] || *argv[2] != '-'))
>> Do we want to support postfix options in something like old style
>> +qF ?
Personally, I curse every time I run into a tail that doesn't support
"tail +0f" or "tail -f". I think that and "tail -%d" are the only
forms I use enough for it to be any kind of issue for me for them to
change.
/~\
On Fri, 30 Jun 2023, Valery Ushakov wrote:
The man page seems to be completely silent about the old style
options.
What exactly are we aiming for here? Do we want to support postfix
options in something like old style +qF ?
It would be nice to retain `[+-]N' as a shortcut for `-n [+-]N'.
Date:Fri, 30 Jun 2023 15:37:02 +0300
From:Valery Ushakov
Message-ID:
| What exactly are we aiming for here? Do we want to support postfix
| options in something like old style +qF ?
What we want I will leave for others to determine, but in v7 tail
there was a
bin/57483 reports that tail(1) doesn't correctly handle old style
options in all cases. The current approach taken by tail is to
massage the command line to convert old style options into the new
style options and then use getopt to parse only the new style.
Unfortunately the code that does the