shithub: sox

Download patch

ref: 0a599ea3c7f4700d75b7a15db9ebf049326192e6
parent: 6ed1e47dc50f0042e9045225487d0b07ebe410cd
author: cbagwell <cbagwell>
date: Wed May 9 14:07:22 EDT 2001

Detect invalid command lines better.  Still need to work on detecting
invalid effect names more.

--- a/mix.c
+++ b/mix.c
@@ -341,16 +341,16 @@
 static void process() {
     LONG result, i, *ibuf, *mbuf, *obuf, ilen=0, mlen=0, olen=0;
 
-    if ( st_gettype(&informat) )
-	st_fail("bad input format");
-    
-    if ( st_gettype(&mixformat) )
-	st_fail("bad input format");
+    if( st_gettype(&informat) )
+                st_fail("Unknown input file format for '%s'.  Use -t option to override",informat.filename);
 
+    if( st_gettype(&mixformat) )
+                st_fail("Unknown input file format for '%s'.  Use -t option to override",mixformat.filename);
+
     if (writing)
-	if (st_gettype(&outformat))
-	    st_fail("bad output format");
-    
+        if ( st_gettype(&outformat) )
+                st_fail("Unknown output file format for '%s'.  Use -t option to override",outformat.filename);
+
     /* Read and write starters can change their formats. */
     if ((* informat.h->startread)(&informat) == ST_EOF)
     {
--- a/src/sox.c
+++ b/src/sox.c
@@ -162,7 +162,12 @@
 	     * Determine if we will need to loop around again.  If we don't
 	     * then we know we just grabbed the output file information.
 	     */
-	    if (optind < argc && st_checkeffect(argv[optind]) != ST_SUCCESS)
+	    /* FIXME: When this file handles multiple input filenames,
+	     * remove the check for !informat.  Instead store next empty
+	     * slot in array of input filename.
+	     */
+	    if (!informat && optind < argc && 
+		st_checkeffect(argv[optind]) != ST_SUCCESS)
 	    {
 		informat = ft;
 
@@ -403,10 +408,10 @@
     int e, f, flowstatus;
 
     if( st_gettype(informat) )
-		st_fail("bad input format");	
+		st_fail("Unknown input file format for '%s'.  Use -t option to override",informat->filename);	
     if (writing)
 	if ( st_gettype(outformat) )
-		st_fail("bad output format");	
+		st_fail("Unknown output file format for '%s'.  Use -t option to override",outformat->filename);
     
     /* Read and write starters can change their formats. */
     if ((* informat->h->startread)(informat) == ST_EOF)