[PATCH] ed: add support for -s command-line option as mandated by POSIX

Denys Vlasenko vda.linux at googlemail.com
Tue Dec 28 20:20:03 UTC 2021


On Tue, Dec 28, 2021 at 11:46 AM <soeren at soeren-tempel.net> wrote:
>
> From: Sören Tempel <soeren+git at soeren-tempel.net>
>
> Apart from the -p option, POSIX also mandates an -s option which
> suppresses the output of byte counts for the e, E, r, and w command.
> From these commands, Busybox ed presently only implements the r and w
> commands. This commit ensures that these two command do not output any
> bytes counts when the -s option is passed. The shell escape command,
> also effected by the -s option, is not implemented by Busybox at the
> moment.

> @@ -52,6 +52,7 @@ struct globals {
>         LINE lines;
>         smallint dirty;
>         int marks[26];
> +       int silentMode;
>  };

No need for a new variable.
Please use existing option_mask32 instead:

       if (!(option_mask32 & OPT_SILENT))
               printf("%u\n", charCount);


More information about the busybox mailing list