From: [email protected]
> Sent: 20 November 2021 17:17
>
> The POSIX.1-2008 specification of ed(1) mandates two command-line
> options: -p (for specifying a prompt string) and -s (to suppress writing
> of byte counts). This commit adds support for the former. Furthermore,
> it also changes the default prompt string to an empty string (instead
> of ": ") since this is also mandated by POSIX:
>
> -p string Use string as the prompt string when in command mode.
> By default, there shall be no prompt string.
>
...
> - if (argv[1]) {
> - fileName = xstrdup(argv[1]);
> + opt = getopt32(argv, "p:", &prompt);
> + if (!(opt & 0x1))
> + prompt = xstrdup(""); /* no prompt by default */
You shouldn't need the strdup().
I think you can even do:
if (!(opt & 1))
prompt = "";
because (IIRC and for historic reasons) quoted strings are char[] not const
char[].
OTOH an explicit local static or a zero byte in the data area
might be more usual for busybox.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT,
UK
Registration No: 1397386 (Wales)
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox