[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: RE: [PATCH v2] ed: add support for -p command-line option as mandated by POSIX
From: David Laight <David.Laight () ACULAB ! COM>
Date: 2021-11-22 8:53:54
Message-ID: 04aeb833f7df4697bf3793409c0acd76 () AcuMS ! aculab ! com
[Download RAW message or body]
From: soeren@soeren-tempel.net
> Sent: 21 November 2021 11:25
>
> 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.
>
> Support for the remaining -s option will be added in a separate commit
> since it requires a general restructuring of error handling in Busybox
> ed.
...
> @@ -790,7 +792,7 @@ static void doCommands(void)
> * 0 on ctrl-C,
> * >0 length of input string, including terminating '\n'
> */
> - len = read_line_input(NULL, ": ", buf, sizeof(buf));
> + len = read_line_input(NULL, prompt, buf, sizeof(buf));
Actually it is probably cleaner to put the NULL test when prompt is used:
len = read_line_input(NULL, prompt ? prompt : "", buf, sizeof(buf));
Saves all the faffing about.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic