Output help messages to stdout

Output help messages and lists to stdout instead of stderr.
This commit is contained in:
Takashi Iwai 2005-06-23 10:39:16 +00:00
parent 6343f35202
commit 39ff48b437
7 changed files with 53 additions and 52 deletions

View file

@ -2228,8 +2228,9 @@ main (int argc,
{ {
case '?': case '?':
case 'h': case 'h':
fprintf (stderr, "%s v%s\n", PRGNAME_UPPER, VERSION); printf ("%s v%s\n", PRGNAME_UPPER, VERSION);
fprintf (stderr, "Usage: %s [-h] [-c <card: 0...7>] [-D <mixer device>] [-g] [-s] [-V <view>] [-a <abst>]\n", PRGNAME); printf ("Usage: %s [-h] [-c <card: 0...7>] [-D <mixer device>] [-g] [-s] [-V <view>] [-a <abst>]\n", PRGNAME);
return 1;
case 'c': case 'c':
{ {
int i = snd_card_get_index(optarg); int i = snd_card_get_index(optarg);

View file

@ -63,7 +63,7 @@ static void error(const char *format, ...)
static void usage(void) static void usage(void)
{ {
fprintf(stderr, printf(
"Usage: amidi options\n" "Usage: amidi options\n"
"\n" "\n"
"-h, --help this help\n" "-h, --help this help\n"
@ -82,7 +82,7 @@ static void usage(void)
static void version(void) static void version(void)
{ {
fputs("amidi version " SND_UTIL_VERSION_STR "\n", stderr); puts("amidi version " SND_UTIL_VERSION_STR);
} }
static void *my_malloc(size_t size) static void *my_malloc(size_t size)

View file

@ -146,7 +146,7 @@ struct fmt_capture {
static void usage(char *command) static void usage(char *command)
{ {
snd_pcm_format_t k; snd_pcm_format_t k;
fprintf(stderr, printf(
_("Usage: %s [OPTION]... [FILE]...\n" _("Usage: %s [OPTION]... [FILE]...\n"
"\n" "\n"
"-h, --help help\n" "-h, --help help\n"
@ -174,17 +174,17 @@ _("Usage: %s [OPTION]... [FILE]...\n"
"-v, --verbose show PCM structure and setup (accumulative)\n" "-v, --verbose show PCM structure and setup (accumulative)\n"
"-I, --separate-channels one file for each channel\n") "-I, --separate-channels one file for each channel\n")
, command); , command);
fprintf(stderr, _("Recognized sample formats are:")); printf(_("Recognized sample formats are:"));
for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) { for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) {
const char *s = snd_pcm_format_name(k); const char *s = snd_pcm_format_name(k);
if (s) if (s)
fprintf(stderr, " %s", s); printf(" %s", s);
} }
fprintf(stderr, _("\nSome of these may not be available on selected hardware\n")); printf(_("\nSome of these may not be available on selected hardware\n"));
fprintf(stderr, _("The availabled format shortcuts are:\n")); printf(_("The availabled format shortcuts are:\n"));
fprintf(stderr, _("-f cd (16 bit little endian, 44100, stereo)\n")); printf(_("-f cd (16 bit little endian, 44100, stereo)\n"));
fprintf(stderr, _("-f cdr (16 bit big endian, 44100, stereo)\n")); printf(_("-f cdr (16 bit big endian, 44100, stereo)\n"));
fprintf(stderr, _("-f dat (16 bit little endian, 48000, stereo)\n")); printf(_("-f dat (16 bit little endian, 48000, stereo)\n"));
} }
static void names_list(void) static void names_list(void)
@ -219,7 +219,7 @@ static void device_list(void)
error(_("no soundcards found...")); error(_("no soundcards found..."));
return; return;
} }
fprintf(stderr, _("**** List of %s Hardware Devices ****\n"), printf(_("**** List of %s Hardware Devices ****\n"),
snd_pcm_stream_name(stream)); snd_pcm_stream_name(stream));
while (card >= 0) { while (card >= 0) {
char name[32]; char name[32];
@ -248,20 +248,20 @@ static void device_list(void)
error("control digital audio info (%i): %s", card, snd_strerror(err)); error("control digital audio info (%i): %s", card, snd_strerror(err));
continue; continue;
} }
fprintf(stderr, _("card %i: %s [%s], device %i: %s [%s]\n"), printf(_("card %i: %s [%s], device %i: %s [%s]\n"),
card, snd_ctl_card_info_get_id(info), snd_ctl_card_info_get_name(info), card, snd_ctl_card_info_get_id(info), snd_ctl_card_info_get_name(info),
dev, dev,
snd_pcm_info_get_id(pcminfo), snd_pcm_info_get_id(pcminfo),
snd_pcm_info_get_name(pcminfo)); snd_pcm_info_get_name(pcminfo));
count = snd_pcm_info_get_subdevices_count(pcminfo); count = snd_pcm_info_get_subdevices_count(pcminfo);
fprintf(stderr, _(" Subdevices: %i/%i\n"), printf( _(" Subdevices: %i/%i\n"),
snd_pcm_info_get_subdevices_avail(pcminfo), count); snd_pcm_info_get_subdevices_avail(pcminfo), count);
for (idx = 0; idx < (int)count; idx++) { for (idx = 0; idx < (int)count; idx++) {
snd_pcm_info_set_subdevice(pcminfo, idx); snd_pcm_info_set_subdevice(pcminfo, idx);
if ((err = snd_ctl_pcm_info(handle, pcminfo)) < 0) { if ((err = snd_ctl_pcm_info(handle, pcminfo)) < 0) {
error("control digital audio playback info (%i): %s", card, snd_strerror(err)); error("control digital audio playback info (%i): %s", card, snd_strerror(err));
} else { } else {
fprintf(stderr, _(" Subdevice #%i: %s\n"), printf(_(" Subdevice #%i: %s\n"),
idx, snd_pcm_info_get_subdevice_name(pcminfo)); idx, snd_pcm_info_get_subdevice_name(pcminfo));
} }
} }
@ -284,19 +284,19 @@ static void pcm_list(void)
error("snd_config_update: %s", snd_strerror(err)); error("snd_config_update: %s", snd_strerror(err));
return; return;
} }
err = snd_output_stdio_attach(&out, stderr, 0); err = snd_output_stdio_attach(&out, stdout, 0);
assert(err >= 0); assert(err >= 0);
err = snd_config_search(snd_config, "pcm", &conf); err = snd_config_search(snd_config, "pcm", &conf);
if (err < 0) if (err < 0)
return; return;
fprintf(stderr, _("PCM list:\n")); printf(_("PCM list:\n"));
snd_config_save(conf, out); snd_config_save(conf, out);
snd_output_close(out); snd_output_close(out);
} }
static void version(void) static void version(void)
{ {
fprintf(stderr, "%s: version " SND_UTIL_VERSION_STR " by Jaroslav Kysela <perex@suse.cz>\n", command); printf("%s: version " SND_UTIL_VERSION_STR " by Jaroslav Kysela <perex@suse.cz>\n", command);
} }
static void signal_handler(int sig) static void signal_handler(int sig)

View file

@ -45,23 +45,23 @@ static void error_handler(const char *file, int line, const char *function, int
static void usage(void) static void usage(void)
{ {
fprintf(stderr, _("aconnect - ALSA sequencer connection manager\n")); printf(_("aconnect - ALSA sequencer connection manager\n"));
fprintf(stderr, _("Copyright (C) 1999-2000 Takashi Iwai\n")); printf(_("Copyright (C) 1999-2000 Takashi Iwai\n"));
fprintf(stderr, _("Usage:\n")); printf(_("Usage:\n"));
fprintf(stderr, _(" * Connection/disconnection between two ports\n")); printf(_(" * Connection/disconnection between two ports\n"));
fprintf(stderr, _(" aconnect [-options] sender receiver\n")); printf(_(" aconnect [-options] sender receiver\n"));
fprintf(stderr, _(" sender, receiver = client:port pair\n")); printf(_(" sender, receiver = client:port pair\n"));
fprintf(stderr, _(" -d,--disconnect disconnect\n")); printf(_(" -d,--disconnect disconnect\n"));
fprintf(stderr, _(" -e,--exclusive exclusive connection\n")); printf(_(" -e,--exclusive exclusive connection\n"));
fprintf(stderr, _(" -r,--real # convert real-time-stamp on queue\n")); printf(_(" -r,--real # convert real-time-stamp on queue\n"));
fprintf(stderr, _(" -t,--tick # convert tick-time-stamp on queue\n")); printf(_(" -t,--tick # convert tick-time-stamp on queue\n"));
fprintf(stderr, _(" * List connected ports (no subscription action)\n")); printf(_(" * List connected ports (no subscription action)\n"));
fprintf(stderr, _(" aconnect -i|-o [-options]\n")); printf(_(" aconnect -i|-o [-options]\n"));
fprintf(stderr, _(" -i,--input list input (readable) ports\n")); printf(_(" -i,--input list input (readable) ports\n"));
fprintf(stderr, _(" -o,--output list output (writable) ports\n")); printf(_(" -o,--output list output (writable) ports\n"));
fprintf(stderr, _(" -l,--list list current connections of each port\n")); printf(_(" -l,--list list current connections of each port\n"));
fprintf(stderr, _(" * Remove all exported connections\n")); printf(_(" * Remove all exported connections\n"));
fprintf(stderr, _(" -x, --removeall\n")); printf(_(" -x, --removeall\n"));
} }
/* /*

View file

@ -802,7 +802,7 @@ static void list_ports(void)
static void usage(const char *argv0) static void usage(const char *argv0)
{ {
fprintf(stderr, printf(
"Usage: %s -p client:port[,...] [-d delay] midifile ...\n" "Usage: %s -p client:port[,...] [-d delay] midifile ...\n"
"-h, --help this help\n" "-h, --help this help\n"
"-V, --version print current version\n" "-V, --version print current version\n"
@ -814,7 +814,7 @@ static void usage(const char *argv0)
static void version(void) static void version(void)
{ {
fputs("aplaymidi version " SND_UTIL_VERSION_STR "\n", stderr); puts("aplaymidi version " SND_UTIL_VERSION_STR);
} }
int main(int argc, char *argv[]) int main(int argc, char *argv[])

View file

@ -327,7 +327,7 @@ static void list_ports(void)
static void help(const char *argv0) static void help(const char *argv0)
{ {
fprintf(stderr, "Usage: %s [options]\n" printf("Usage: %s [options]\n"
"\nAvailable options:\n" "\nAvailable options:\n"
" -h,--help this help\n" " -h,--help this help\n"
" -V,--version show version\n" " -V,--version show version\n"
@ -338,7 +338,7 @@ static void help(const char *argv0)
static void version(void) static void version(void)
{ {
fputs("aseqdump version " SND_UTIL_VERSION_STR "\n", stderr); puts("aseqdump version " SND_UTIL_VERSION_STR);
} }
static void sighandler(int sig) static void sighandler(int sig)

View file

@ -157,17 +157,17 @@ int main(int argc, char **argv)
*/ */
static void usage(void) static void usage(void)
{ {
fprintf(stderr, _("aseqnet - network client/server on ALSA sequencer\n")); printf(_("aseqnet - network client/server on ALSA sequencer\n"));
fprintf(stderr, _(" Copyright (C) 1999 Takashi Iwai\n")); printf(_(" Copyright (C) 1999 Takashi Iwai\n"));
fprintf(stderr, _("usage:\n")); printf(_("usage:\n"));
fprintf(stderr, _(" server mode: aseqnet [-options]\n")); printf(_(" server mode: aseqnet [-options]\n"));
fprintf(stderr, _(" client mode: aseqnet [-options] server_host\n")); printf(_(" client mode: aseqnet [-options] server_host\n"));
fprintf(stderr, _("options:\n")); printf(_("options:\n"));
fprintf(stderr, _(" -p,--port # : sepcify TCP port (digit or service name)\n")); printf(_(" -p,--port # : sepcify TCP port (digit or service name)\n"));
fprintf(stderr, _(" -s,--source addr : read from given addr (client:port)\n")); printf(_(" -s,--source addr : read from given addr (client:port)\n"));
fprintf(stderr, _(" -d,--dest addr : write to given addr (client:port)\n")); printf(_(" -d,--dest addr : write to given addr (client:port)\n"));
fprintf(stderr, _(" -v, --verbose : print verbose messages\n")); printf(_(" -v, --verbose : print verbose messages\n"));
fprintf(stderr, _(" -i, --info : print certain received events\n")); printf(_(" -i, --info : print certain received events\n"));
} }