programs/*.c : Add the libsndfile version to the usage message of all programs.

This commit is contained in:
Erik de Castro Lopo 2010-10-11 20:33:52 +11:00
parent 27c736b7d6
commit 565e1c0fe1
10 changed files with 40 additions and 24 deletions

View File

@ -1,3 +1,8 @@
2010-10-10 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* programs/*.c
Add the libsndfile version to the usage message of all programs.
2010-10-10 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* configure.ac src/version-metadata.rc.in src/Makefile.am

View File

@ -34,6 +34,7 @@
#include "sfconfig.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
@ -130,13 +131,14 @@ print_version (void)
} /* print_version */
static void
print_usage (void)
usage_exit (void)
{
print_version () ;
printf ("Usage : %s <filename> <filename>\n", progname) ;
printf (" Compare the PCM data of two sound files.\n\n") ;
} /* print_usage */
exit (0) ;
} /* usage_exit */
int
main (int argc, char *argv [])
@ -145,7 +147,7 @@ main (int argc, char *argv [])
progname = progname ? progname + 1 : argv [0] ;
if (argc != 3)
{ print_usage () ;
{ usage_exit () ;
return 1 ;
} ;
@ -154,7 +156,7 @@ main (int argc, char *argv [])
if (strcmp (filename1, filename2) == 0)
{ printf ("Error : Input filenames are the same.\n\n") ;
print_usage () ;
usage_exit () ;
return 1 ;
} ;

View File

@ -48,7 +48,7 @@ typedef struct
static void copy_metadata (SNDFILE *outfile, SNDFILE *infile, int channels) ;
static void
print_usage (char *progname)
usage_exit (char *progname)
{
printf ("\nUsage : %s [options] [encoding] <input file> <output file>\n", progname) ;
puts ("\n"
@ -85,7 +85,8 @@ print_usage (char *progname)
sfe_dump_format_map () ;
puts ("") ;
} /* print_usage */
exit (0) ;
} /* usage_exit */
int
main (int argc, char * argv [])
@ -99,7 +100,7 @@ main (int argc, char * argv [])
progname = progname ? progname + 1 : argv [0] ;
if (argc < 3 || argc > 5)
{ print_usage (progname) ;
{ usage_exit (progname) ;
return 1 ;
} ;
@ -108,19 +109,19 @@ main (int argc, char * argv [])
if (strcmp (infilename, outfilename) == 0)
{ printf ("Error : Input and output filenames are the same.\n\n") ;
print_usage (progname) ;
usage_exit (progname) ;
return 1 ;
} ;
if (strlen (infilename) > 1 && infilename [0] == '-')
{ printf ("Error : Input filename (%s) looks like an option.\n\n", infilename) ;
print_usage (progname) ;
usage_exit (progname) ;
return 1 ;
} ;
if (outfilename [0] == '-')
{ printf ("Error : Output filename (%s) looks like an option.\n\n", outfilename) ;
print_usage (progname) ;
usage_exit (progname) ;
return 1 ;
} ;

View File

@ -153,6 +153,7 @@ usage_exit (void)
"If the input file is named 'a.wav', the output files will be named\n"
"a_00.wav, a_01.wav and so on.\n"
) ;
printf ("Using %s.\n\n", sf_version_string ()) ;
exit (0) ;
} /* usage_exit */

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 1999-2010Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 1999-2010 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** All rights reserved.
**
@ -48,7 +48,7 @@
#endif
static void print_version (void) ;
static void print_usage (const char *progname) ;
static void usage_exit (const char *progname) ;
static void info_dump (const char *filename) ;
static int instrument_dump (const char *filename) ;
@ -70,7 +70,7 @@ main (int argc, char *argv [])
progname = strrchr (argv [0], '/') ;
progname = progname ? progname + 1 : argv [0] ;
print_usage (progname) ;
usage_exit (progname) ;
return 1 ;
} ;
@ -123,7 +123,7 @@ print_version (void)
static void
print_usage (const char *progname)
usage_exit (const char *progname)
{ printf ("Usage :\n %s <file> ...\n", progname) ;
printf (" Prints out information about one or more sound files.\n\n") ;
printf (" %s -i <file>\n", progname) ;
@ -143,7 +143,9 @@ print_usage (const char *progname)
*/
Sleep (5 * 1000) ;
#endif
} /* print_usage */
printf ("Using %s.\n\n", sf_version_string ()) ;
exit (0) ;
} /* usage_exit */
/*==============================================================================
** Dumping of sndfile info.

View File

@ -145,6 +145,7 @@ static void
usage_exit (void)
{ puts ("\nUsage : sndfile-interleave <input 1> <input 2> ... -o <output file>\n") ;
puts ("Merge two or more mono files into a single multi-channel file.\n") ;
printf ("Using %s.\n\n", sf_version_string ()) ;
exit (0) ;
} /* usage_exit */

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 2008 George Blood Audio
** Copyright (C) 2008-2010 George Blood Audio
** Written by Erik de Castro Lopo <erikd@mega-nerd.com>
**
** All rights reserved.
@ -123,6 +123,7 @@ usage_exit (const char *progname, int exit_code)
" --str-license Print the license metadata.\n"
) ;
printf ("Using %s.\n\n", sf_version_string ()) ;
exit (exit_code) ;
} /* usage_exit */

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 2008 George Blood Audio
** Copyright (C) 2008-2010 George Blood Audio
** Written by Erik de Castro Lopo <erikd@mega-nerd.com>
**
** All rights reserved.
@ -235,6 +235,7 @@ usage_exit (const char *progname, int exit_code)
"exit with an appropriate error message.\n"
) ;
printf ("Using %s.\n\n", sf_version_string ()) ;
exit (exit_code) ;
} /* usage_exit */

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 1999-2010 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** All rights reserved.
**
@ -978,6 +978,7 @@ main (int argc, char *argv [])
if (argc < 2)
{
printf ("\nUsage : %s <input sound file>\n\n", argv [0]) ;
printf (" Using %s.\n\n", sf_version_string ()) ;
#if (OS_IS_WIN32 == 1)
printf ("This is a Unix style command line application which\n"
"should be run in a MSDOS box or Command Shell window.\n\n") ;

View File

@ -49,7 +49,7 @@
#define NOT(x) (! (x))
static void print_usage (const char *progname) ;
static void usage_exit (const char *progname) ;
static void salvage_file (const char * broken_wav, const char * fixed_w64) ;
int
@ -61,8 +61,7 @@ main (int argc, char *argv [])
progname = strrchr (argv [0], '/') ;
progname = progname ? progname + 1 : argv [0] ;
print_usage (progname) ;
exit (1) ;
usage_exit (progname) ;
} ;
salvage_file (argv [1], argv [2]) ;
@ -80,10 +79,12 @@ static void copy_data (int fd, SNDFILE * sndfile, int readsize) ;
static void
print_usage (const char *progname)
usage_exit (const char *progname)
{ printf ("Usage :\n\n %s <broken wav file> <fixed w64 file>\n\n", progname) ;
puts (" Salvages the audio data from WAV files which are more than 4G in length.\n") ;
} /* print_usage */
puts ("Salvages the audio data from WAV files which are more than 4G in length.\n") ;
printf ("Using %s.\n\n", sf_version_string ()) ;
exit (0) ;
} /* usage_exit */
static void
salvage_file (const char * broken_wav, const char * fixed_w64)