[xiph-cvs] cvs commit: vorbis-tools/ogg123 ogg123.c

Stan Seibert volsung at xiph.org
Mon Jul 23 05:59:56 PDT 2001



volsung     01/07/23 05:59:56

  Modified:    ogg123   Tag: volsung_20010721 ogg123.c
  Log:
  Added better error checking after device is opened.

Revision  Changes    Path
No                   revision

No                   revision

1.40.2.2  +34 -2     vorbis-tools/ogg123/ogg123.c

Index: ogg123.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogg123/ogg123.c,v
retrieving revision 1.40.2.1
retrieving revision 1.40.2.2
diff -u -r1.40.2.1 -r1.40.2.2
--- ogg123.c	2001/07/22 21:25:21	1.40.2.1
+++ ogg123.c	2001/07/23 12:59:55	1.40.2.2
@@ -14,7 +14,7 @@
  *                                                                  *
  ********************************************************************
 
- last mod: $Id: ogg123.c,v 1.40.2.1 2001/07/22 21:25:21 volsung Exp $
+ last mod: $Id: ogg123.c,v 1.40.2.2 2001/07/23 12:59:55 volsung Exp $
 
  ********************************************************************/
 
@@ -602,7 +602,39 @@
                                      0, &format, current->options);
 
     if (current->device == NULL) {
-      fprintf(stderr, "Error opening device.\n");
+      switch (errno) {
+      case AO_ENODRIVER:
+	fprintf(stderr, "Error: No device not available.\n");
+	break;
+      case AO_ENOTLIVE:
+	fprintf(stderr, "Error: %s requires an ouput filename to be specified with -f.\n", info->short_name);
+	break;
+      case AO_EBADOPTION:
+	fprintf(stderr, "Error: Unsupported option value to %s device.\n",
+		info->short_name);
+	break;
+      case AO_EOPENDEVICE:
+	fprintf(stderr, "Error: Cannot open device %s.\n",
+		info->short_name);
+	break;
+      case AO_EFAIL:
+	fprintf(stderr, "Error: Device failure.\n");
+	break;
+      case AO_ENOTFILE:
+	fprintf(stderr, "Error: An output file cannot be given for %s device.\n", info->short_name);
+	break;
+      case AO_EOPENFILE:
+	fprintf(stderr, "Error: Cannot open file %s for writing.\n",
+		current->filename);
+	break;
+      case AO_EFILEEXISTS:
+	fprintf(stderr, "Error: File %s already exists.\n", current->filename);
+	break;
+      default:
+	fprintf(stderr, "Error: This error should never happen.  Panic!\n");
+	break;
+      }
+	
       return -1;
     }
     current = current->next_device;

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list