[xiph-commits] r16526 - in trunk/ezstream: . src

moritz at svn.xiph.org moritz at svn.xiph.org
Sat Aug 29 02:14:13 PDT 2009


Author: moritz
Date: 2009-08-29 02:14:12 -0700 (Sat, 29 Aug 2009)
New Revision: 16526

Modified:
   trunk/ezstream/NEWS
   trunk/ezstream/src/playlist.c
Log:
... also fix ezstream in this regard: No need to complain when receiving such
an empty line, and not receiving any output should not be a fatal error.
Consider the latter to be "end-of-playlist", too.


Modified: trunk/ezstream/NEWS
===================================================================
--- trunk/ezstream/NEWS	2009-08-29 09:12:53 UTC (rev 16525)
+++ trunk/ezstream/NEWS	2009-08-29 09:14:12 UTC (rev 16526)
@@ -5,6 +5,11 @@
              Failure to open a resource (e.g. a media file) is no longer fatal
              and operation will continue as far as possible. Idea from dhorton.
              (Ticket #1585)
+ * src/playlist.c:
+   - [MISC]  Consider no output from a playlist program to be equivalent to an
+             empty line, indicating that the end of the playlist is reached.
+   - [FIX]   Do not complain when receiving an empty line from a playlist
+             program.
  * examples/:
    - [NEW]   Add a real-world example playlist script with logging feature.
 

Modified: trunk/ezstream/src/playlist.c
===================================================================
--- trunk/ezstream/src/playlist.c	2009-08-29 09:12:53 UTC (rev 16525)
+++ trunk/ezstream/src/playlist.c	2009-08-29 09:14:12 UTC (rev 16526)
@@ -499,13 +499,18 @@
 	}
 
 	if (fgets(buf, (int)sizeof(buf), filep) == NULL) {
-		if (ferror(filep))
+		int	errnum = errno;
+
+		pclose(filep);
+
+		if (ferror(filep)) {
 			printf("%s: Error while reading output from program '%s': %s\n",
-			       __progname, pl->filename, strerror(errno));
-		pclose(filep);
-		printf("%s: FATAL: External program '%s' not (or no longer) usable.\n",
-		       __progname, pl->filename);
-		exit(1);
+			       __progname, pl->filename, strerror(errnum));
+			exit(1);
+		}
+
+		/* No output (end of playlist.) */
+		return (NULL);
 	}
 
 	pclose(filep);
@@ -518,11 +523,9 @@
 
 	buf[strcspn(buf, "\n")] = '\0';
 	buf[strcspn(buf, "\r")] = '\0';
-	if (buf[0] == '\0') {
-		printf("%s: Empty line received from program '%s'\n",
-		       __progname, pl->filename);
+	if (buf[0] == '\0')
+		/* Empty line (end of playlist.) */
 		return (NULL);
-	}
 
 	if (pl->prog_track != NULL)
 		xfree(pl->prog_track);



More information about the commits mailing list