Um, try executing the 'P' command first:

$ ed
P
*q

I assume that when '-p' refers to the default being no prompt string,
that means that there is no prompt at program start if '-p' is not
passed. I guess there are two prompt strings, the "declared" prompt
string that would be active if 'P' is active (this is passed to '-p'
and defaults to '*' if '-p' is not passed), and the actual active
prompt (which would be the declared prompt string if 'P' is active, or
on program start if '-p' is passed; or the null string if 'P' is
inactive). The description of '-p' seems to use both definitions
interchangeably, which is confusing, while the 'P' description in the
ed manual only uses the "declared" prompt string definition.

Regarding the POSIX standard, it says 'P' will "cause ed to prompt
[...] with string [the parameter to -p], if -p is specified[.]" I see
no issue with this being the null string. The only practical use I can
see for this is for using a script that contains 'P' commands
(particularly one written by another author) that you wouldn't want to
redirect prompts for. It's actively harmful interactively.

We should also consider that Arg_parser (where the issue originates)
is used by more than just ed. I use it for my personal C/C++ projects,
and other consumers may need null-string arguments.


On Thu, Jun 13, 2024 at 8:35 PM <jack...@fastmail.com> wrote:
>
> I wrote and posted:
>
> >> Recommendation:  Provide the capability to disable the prompt.
>
> Then I read the damn manual:
>
> 'P'
>      Toggles the command prompt on and off. Unless a prompt string is
>      specified with the command-line option '-p', the command prompt is by
>      default turned off. The default prompt string is an asterisk ('*').
>
> So ... if you want no prompt (in other words, a zero length prompt)
>  in some scripted invocation of ed, just don't specify the "-p" option.
>
> Problem solved.  It all works as coded, documented and standardized.
>
> --
> Paul Jackson
>   jack...@fastmail.fm
>

Reply via email to