programs/*.c : Clean up and normailize printing of version strings.

Suggested-by: Jan Stary <hans@stare.cz>
This commit is contained in:
Erik de Castro Lopo 2014-06-23 17:07:22 +10:00
parent ff8b1ae3b5
commit c1a09a5065
3 changed files with 7 additions and 33 deletions

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 2001-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2001-2014 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** All rights reserved.
**
@ -41,17 +41,10 @@ int
main (void)
{ SF_FORMAT_INFO info ;
SF_INFO sfinfo ;
char buffer [128] ;
int format, major_count, subtype_count, m, s ;
memset (&sfinfo, 0, sizeof (sfinfo)) ;
buffer [0] = 0 ;
sf_command (NULL, SFC_GET_LIB_VERSION, buffer, sizeof (buffer)) ;
if (strlen (buffer) < 1)
{ printf ("Line %d: could not retrieve lib version.\n", __LINE__) ;
exit (1) ;
} ;
printf ("Version : %s\n\n", buffer) ;
printf ("Version : %s\n\n", sf_version_string ()) ;
sf_command (NULL, SFC_GET_FORMAT_MAJOR_COUNT, &major_count, sizeof (int)) ;
sf_command (NULL, SFC_GET_FORMAT_SUBTYPE_COUNT, &subtype_count, sizeof (int)) ;

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 2008-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2008-2014 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2008 Conrad Parker <conrad@metadecks.org>
**
** All rights reserved.
@ -124,21 +124,12 @@ out :
return retval ;
} /* compare */
static void
print_version (void)
{ char buffer [256] ;
sf_command (NULL, SFC_GET_LIB_VERSION, buffer, sizeof (buffer)) ;
printf ("\nVersion : %s\n\n", buffer) ;
} /* print_version */
static void
usage_exit (void)
{
print_version () ;
printf ("Usage : %s <filename> <filename>\n", progname) ;
printf (" Compare the PCM data of two sound files.\n\n") ;
printf ("Using %s.\n\n", sf_version_string ()) ;
exit (0) ;
} /* usage_exit */

View File

@ -1,5 +1,5 @@
/*
** Copyright (C) 1999-2013 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 1999-2014 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** All rights reserved.
**
@ -47,7 +47,6 @@
#include <windows.h>
#endif
static void print_version (void) ;
static void usage_exit (const char *progname) ;
static void info_dump (const char *filename) ;
@ -63,8 +62,6 @@ int
main (int argc, char *argv [])
{ int k ;
print_version () ;
if (argc < 2 || strcmp (argv [1], "--help") == 0 || strcmp (argv [1], "-h") == 0)
{ usage_exit (program_name (argv [0])) ;
return 1 ;
@ -117,15 +114,6 @@ main (int argc, char *argv [])
static double data [BUFFER_LEN] ;
static void
print_version (void)
{ char buffer [256] ;
sf_command (NULL, SFC_GET_LIB_VERSION, buffer, sizeof (buffer)) ;
printf ("\nVersion : %s\n\n", buffer) ;
} /* print_version */
static void
usage_exit (const char *progname)
{ printf ("Usage :\n %s <file> ...\n", progname) ;
@ -138,6 +126,8 @@ usage_exit (const char *progname)
printf (" Prints out the channel map for the given file.\n\n") ;
printf (" %s --cart <file>\n", progname) ;
printf (" Prints out the cart chunk WAV info for the given file.\n\n") ;
printf ("Using %s.\n\n", sf_version_string ()) ;
#if (defined (_WIN32) || defined (WIN32))
printf ("This is a Unix style command line application which\n"
"should be run in a MSDOS box or Command Shell window.\n\n") ;