Patchwork arch_init.c: Improve '-soundhw help' for non-HAS_AUDIO_CHOICE archs

login
register
mail settings
Submitter Peter Maydell
Date Sept. 19, 2012, 1:51 p.m.
Message ID <1348062698-4528-1-git-send-email-peter.maydell@linaro.org>
Download mbox | patch
Permalink /patch/185051/
State New
Headers show

Comments

Peter Maydell - Sept. 19, 2012, 1:51 p.m.
For architectures which don't set HAS_AUDIO_CHOICE, improve the
'-soundhw help' message so that it doesn't simply print an empty
list, implying no sound support at all.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 arch_init.c |    5 +++++
 1 file changed, 5 insertions(+)
Michael Tokarev - Sept. 19, 2012, 5:07 p.m.
On 19.09.2012 17:51, Peter Maydell wrote:

> +#else
> +        printf("Machine has no user-selectable audio hardware "
> +               "(it may or may not have always-present audio hardware).\n");

Can't we add a linefeed here the same way it is written in the code?

/mjt
Peter Maydell - Sept. 19, 2012, 5:12 p.m.
On 19 September 2012 18:07, Michael Tokarev <mjt@tls.msk.ru> wrote:
> On 19.09.2012 17:51, Peter Maydell wrote:
>
>> +#else
>> +        printf("Machine has no user-selectable audio hardware "
>> +               "(it may or may not have always-present audio hardware).\n");
>
> Can't we add a linefeed here the same way it is written in the code?

Since there's no way to know how big the user's terminal is I
generally prefer to avoid linefeeds in error messages.

-- PMM

Patch

diff --git a/arch_init.c b/arch_init.c
index 47977de..f849f9b 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -922,11 +922,16 @@  void select_soundhw(const char *optarg)
     if (is_help_option(optarg)) {
     show_valid_cards:
 
+#ifdef HAS_AUDIO_CHOICE
         printf("Valid sound card names (comma separated):\n");
         for (c = soundhw; c->name; ++c) {
             printf ("%-11s %s\n", c->name, c->descr);
         }
         printf("\n-soundhw all will enable all of the above\n");
+#else
+        printf("Machine has no user-selectable audio hardware "
+               "(it may or may not have always-present audio hardware).\n");
+#endif
         exit(!is_help_option(optarg));
     }
     else {