+/*****************************************************************************
+ * file_next : Opens the next available file
+ *****************************************************************************/
+
+int file_next( options_t *options )
+{
+ /* the check for index == 0 should be done _before_ */
+ options->i_list_index--;
+
+ if( options->in != -1 )
+ {
+ close( options->in );
+ }
+
+ if( !strcmp( options->playlist[options->i_list_index], "-" ) )
+ {
+ /* read stdin */
+ return ( options->in = 0 );
+ }
+ else
+ {
+ /* read the actual file */
+ fprintf( stderr, "Playing file %s\n",
+ options->playlist[options->i_list_index] );
+ return ( options->in = open( options->playlist[options->i_list_index],
+ O_RDONLY | O_NDELAY ) );
+ }
+}
+
+/*****************************************************************************