[Toybox] [PATCH] vi: rename `-s` flag to `-c`

Rob Landley rob at landley.net
Tue Jun 11 02:03:50 PDT 2024


On 6/7/24 03:41, Rob Landley wrote:
> On 6/5/24 00:46, Jarno Mäkipää wrote:
>> You cannot test against other vi clones with -c after this patch. But
>> you could have test against vim with -s {script} implementation. I
>> used vim as reference for testing with original test case files.
> 
> If I'm cloning bash specifically for toysh, I don't have an objection to
> targeting vim specifically in a toybox vi implementation.
> 
>> Ex command only switch -c could be added as  addition to -s if you
>> wanna achieve something with ex commands, but maybe dont delete -s
>> implementation, unless you have better way to test vi mode motions.
> 
> Right now the regression test contexts I'm paying attention to are busybox
> defconfig and debian's default install. How does this impact testing against those?

Looking further at this, what is the behavioral difference between -c and -s?
The patch does nothing but change one into the other, with no other behavior
change I've spotted?

The vim man page says:

       -c {command}
                   {command} will be executed after the first  file  has  been
                   read.   {command}  is interpreted as an Ex command.  If the
                   {command} contains spaces it must  be  enclosed  in  double
                   quotes  (this depends on the shell that is used).  Example:
                   Vim "+set si" main.c
                   Note: You can use up to 10 "+" or "-c" commands.

       -s {scriptin}
                   The script file {scriptin} is read.  The characters in  the
                   file  are  interpreted  as if you had typed them.  The same
                   can be done with the command ":source! {scriptin}".  If the
                   end of the file is reached before the editor exits, further
                   characters are read from the keyboard.

I thought for a moment that -c was jumping straight into esc-colon mode with the
command line at the bottom of the screen, but the -c example above does not
provide -c on the command line and I am just CONFUSED.

Jarno: what "other clones" were you referring to? Posix has -c, and does not
have -s. Are we supporting non-posix clones other than vim? (Is there a default
freebsd or macos version that ignores posix, maybe?)

  https://pubs.opengroup.org/onlinepubs/9699919799/utilities/vi.html

I do not have the domain expertise to understand the objection here.

> Rob

Still Rob


More information about the Toybox mailing list