diff parser-mpcmd.c @ 16345:feb16d0117c8

allow multiple help clauses on the command line, Patch by kiriuja " mplayer-patches AH en-directo POUM net " This one makes mplayer -vo help -ao help -ac help -vc help -pphelp -af help -vfm help -vf help -afm help -fstype help produce the desired output. From the thread: Date: Jul 16, 2005 8:25 PM Subject: [MPlayer-dev-eng] [PATCH] allow multiple help clauses on the command line
author gpoirier
date Fri, 02 Sep 2005 08:29:30 +0000
parents 55cbf0c204bc
children 526abfe30498
line wrap: on
line diff
--- a/parser-mpcmd.c	Fri Sep 02 00:05:21 2005 +0000
+++ b/parser-mpcmd.c	Fri Sep 02 08:29:30 2005 +0000
@@ -63,6 +63,7 @@
   char *opt,*splitpos=NULL;
   char entbuf[10];
   int no_more_opts = 0;
+  int opt_exit = 0; // flag indicating whether mplayer should exit without playing anything
   play_tree_t *last_parent, *last_entry = NULL, *root;
 #ifdef MACOSX_FINDER_SUPPORT
   extern play_tree_t *macosx_finder_args(m_config_t *, int , char **);
@@ -196,9 +197,11 @@
 	  }
 	}
 
+	if (tmp <= M_OPT_EXIT) {
+	  opt_exit = 1;
+	  tmp = M_OPT_EXIT - tmp;
+	} else
 	if (tmp < 0) {
-	  if (tmp == M_OPT_EXIT)
-	    exit(0);
 	  goto err_out;
 	}
 	i += tmp;
@@ -252,6 +255,8 @@
       }
   }
 
+  if (opt_exit)
+    goto err_out;
   --recursion_depth;
   if(last_parent != root)
     mp_msg(MSGT_CFGPARSER, MSGL_ERR,"Missing }- ?\n");