History

Improve version reporting.

Erik de Castro Lopo committed 22 years ago

Commit 01d94cc1 parent 6c6b9061 file · +8 −9Browse files

Unified · Split

examples/sndfile-resample.c+8−9
@@ -44,15 +44,16 @@ main (int argc, char *argv []) · 43 unmodified lines
4444 int new_sample_rate = -1, k, converter, max_speed = SF_FALSE ;
4545
4646 if (argc == 2 && strcmp (argv [1], "--version") == 0)
47− { char *progname, *cptr ;
47+ { char buffer [64], *cptr ;
4848
49− progname = argv [0] ;
50− if ((cptr = strrchr (progname, '/')) != NULL)
51− progname = cptr + 1 ;
52− if ((cptr = strrchr (progname, '\\')) != NULL)
53− progname = cptr + 1 ;
49+ if ((cptr = strrchr (argv [0], '/')) != NULL)
50+ argv [0] = cptr + 1 ;
51+ if ((cptr = strrchr (argv [0], '\\')) != NULL)
52+ argv [0] = cptr + 1 ;
5453
55− printf ("%s (%s)\n", progname, src_get_version ()) ;
54+ sf_command (NULL, SFC_GET_LIB_VERSION, buffer, sizeof (buffer)) ;
55+
56+ printf ("%s (%s,%s)\n", argv [0], src_get_version (), buffer) ;
5657 exit (0) ;
5758 } ;
5859
@@ -99,8 +100,6 @@ main (int argc, char *argv []) · 40 unmodified lines
99100 exit (1) ;
100101 } ;
101102
102− printf ("Version : %s\n", src_get_version ()) ;
103−
104103 printf ("Input File : %s\n", argv [argc - 2]) ;
105104 printf ("Sample Rate : %d\n", sfinfo.samplerate) ;
106105 printf ("Input Frames : %ld\n\n", (long) sfinfo.frames) ;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t