]> git.sesse.net Git - vlc/blobdiff - src/misc/configuration.c
all: fix a bug in packet parsing and can now play unseekable stream.
[vlc] / src / misc / configuration.c
index a4d8e41768cf58f8076ab7377dd677ade34703db..68c10d5584a05f6b6568ebfb47aa378048aff9fd 100644 (file)
@@ -2,7 +2,7 @@
  * configuration.c management of the modules configuration
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: configuration.c,v 1.38 2002/08/20 18:25:42 sam Exp $
+ * $Id: configuration.c,v 1.42 2002/11/09 17:44:09 sam Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -37,7 +37,7 @@
 #       include <getopt.h>                                       /* getopt() */
 #   endif
 #else
-#   include "GNUgetopt/getopt.h"
+#   include "../extras/getopt.h"
 #endif
 
 #if defined(HAVE_GETPWUID)
@@ -883,7 +883,7 @@ int __config_SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name )
 int __config_LoadCmdLine( vlc_object_t *p_this, int *pi_argc, char *ppsz_argv[],
                           vlc_bool_t b_ignore_errors )
 {
-    int i_cmd, i_index, i_opts, i_shortopts, flag;
+    int i_cmd, i_index, i_opts, i_shortopts, flag, i_verbose = 0;
     module_t **pp_parser;
     vlc_list_t *p_list;
     module_config_t *p_item;
@@ -1043,6 +1043,12 @@ int __config_LoadCmdLine( vlc_object_t *p_this, int *pi_argc, char *ppsz_argv[],
                 {
                     psz_shortopts[i_shortopts] = ':';
                     i_shortopts++;
+
+                    if( p_item->i_short == 'v' )
+                    {
+                        psz_shortopts[i_shortopts] = ':';
+                        i_shortopts++;
+                    }
                 }
             }
         }
@@ -1107,8 +1113,36 @@ int __config_LoadCmdLine( vlc_object_t *p_this, int *pi_argc, char *ppsz_argv[],
                 config_PutPsz( p_this, pp_shortopts[i_cmd]->psz_name, optarg );
                 break;
             case CONFIG_ITEM_INTEGER:
-                config_PutInt( p_this, pp_shortopts[i_cmd]->psz_name,
-                                       atoi(optarg));
+                if( i_cmd == 'v' )
+                {
+                    if( optarg )
+                    {
+                        if( *optarg == 'v' ) /* eg. -vvv */
+                        {
+                            i_verbose++;
+                            while( *optarg == 'v' )
+                            {
+                                i_verbose++;
+                                optarg++;
+                            }
+                        }
+                        else
+                        {
+                            i_verbose += atoi( optarg ); /* eg. -v2 */
+                        }
+                    }
+                    else
+                    {
+                        i_verbose++; /* -v */
+                    }
+                    config_PutInt( p_this, pp_shortopts[i_cmd]->psz_name,
+                                           i_verbose );
+                }
+                else
+                {
+                    config_PutInt( p_this, pp_shortopts[i_cmd]->psz_name,
+                                           atoi(optarg) );
+                }
                 break;
             case CONFIG_ITEM_BOOL:
                 config_PutInt( p_this, pp_shortopts[i_cmd]->psz_name, 1 );