1
mirror of https://code.videolan.org/videolan/vlc synced 2024-09-24 20:48:52 +02:00

* added the GNU getopt library, which gets compiled in when getopt_long

isn't available on the desired platform.
  * replaced the `--warning' flag with the standard cumulative `-v' flag.
    `-v' is like `--warning 3', and `-vvvv' is like `--warning 0'
    (`--warning' is still valid for those used to it)
  * cleaning in configure.in and Makefile.in, the Solaris port now
    builds and runs properly.
This commit is contained in:
Sam Hocevar 2001-04-05 03:50:38 +00:00
parent 646f7c4629
commit cfbe86907a
12 changed files with 1654 additions and 577 deletions

View File

@ -75,26 +75,7 @@ INCLUDE += -Iinclude -Iextras -I/usr/local/include
#
# Libraries
#
ifeq ($(SYS),gnu)
LIB += -lthreads -ldl
endif
ifneq (,$(findstring bsd,$(SYS)))
LIB += -pthread -lgnugetopt
LIB += -L/usr/local/lib
endif
ifneq (,$(findstring linux,$(SYS)))
LIB += -lpthread -ldl
endif
ifneq (,$(findstring solaris,$(SYS)))
LIB += -ldl -lsocket -lnsl -lpthread
endif
ifneq (,$(findstring darwin,$(SYS)))
LIB += -ldl
endif
LIB = @LIB@ -L/usr/local/lib
ifeq ($(SYS),beos)
LIB += -lbe -lroot -lgame
@ -180,7 +161,7 @@ DCFLAGS += -MM
#
# C compiler flags: linking
#
LCFLAGS += $(LIB)
LCFLAGS += @LCFLAGS@ $(LIB)
LCFLAGS += -Wall
#LCFLAGS += -s
@ -193,7 +174,7 @@ else
ifneq (,$(findstring darwin,$(SYS)))
LCFLAGS += -dyn
else
LCFLAGS += --export-dynamic @DYNAMIC_FLAG@
LCFLAGS += --export-dynamic
endif
endif
endif
@ -281,7 +262,6 @@ MISC = src/misc/mtime.o \
src/misc/modules.o \
src/misc/netutils.o
C_OBJ = $(INTERFACE) \
$(INPUT) \
$(VIDEO_OUTPUT) \
@ -293,7 +273,8 @@ C_OBJ = $(INTERFACE) \
$(GEN_DECODER) \
$(VIDEO_PARSER) \
$(VIDEO_DECODER) \
$(MISC)
$(MISC) \
@GETOPT@
#
@ -497,11 +478,11 @@ all: vlc @ALIASES@ plugins
clean:
rm -f $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ) $(STD_PLUGIN_OBJ)
rm -f plugins/*/*.o src/*/*.o lib/*.so
rm -f plugins/*/*.o src/*/*.o lib/*.so extras/*/*.o
rm -f vlc gvlc kvlc qvlc
distclean: clean
rm -f src/*/*.o plugins/*/*.o **/*~ *.log
rm -f **/*.o **/*~ *.log
rm -f Makefile include/defs.h include/config.h
rm -f config.status config.cache config.log
rm -f gmon.out core build-stamp

685
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -28,26 +28,26 @@ AC_C_BIGENDIAN
dnl Check for system libs needed
AC_CHECK_FUNCS(gettimeofday select strerror strtod strtol)
AC_CHECK_FUNCS(setenv putenv)
AC_CHECK_FUNC(connect,,[AC_CHECK_LIB(socket,connect)])
AC_CHECK_FUNC(gethostbyname,,[AC_CHECK_LIB(nsl,gethostbyname)])
AC_CHECK_FUNC(nanosleep,,[AC_CHECK_LIB(rt,nanosleep,,[AC_CHECK_LIB(posix4,nanosleep)])])
AC_CHECK_FUNC(connect,,[AC_CHECK_LIB(socket,connect,LIB=${LIB}" -lsocket")])
AC_CHECK_FUNC(gethostbyname,,[AC_CHECK_LIB(nsl,gethostbyname,LIB=${LIB}" -lnsl")])
AC_CHECK_FUNC(nanosleep,,[AC_CHECK_LIB(rt,nanosleep,LIB=${LIB}" -lrt",[AC_CHECK_LIB(posix4,nanosleep,LIB=${LIB}" -lposix4")])])
AC_CHECK_FUNCS(usleep)
AC_CHECK_FUNC(inet_aton,,[AC_CHECK_LIB(resolv,inet_aton)])
AC_CHECK_FUNC(inet_aton,,[AC_CHECK_LIB(resolv,inet_aton,LIB=${LIB}" -lresolv")])
AC_CHECK_FUNCS(vasprintf)
AC_CHECK_FUNC(getopt_long,[AC_DEFINE(HAVE_GETOPT_LONG,1,long getopt support)],
[ # FreeBSD has a gnugetopt library for this:
AC_CHECK_LIB([gnugetopt],[getopt_long],
[AC_DEFINE(HAVE_GETOPT_LONG,1,getopt support) LIB=${LIB}" -lgnugetopt"],
[GETOPT="extras/GNUgetopt/getopt.o extras/GNUgetopt/getopt1.o"])])
AC_SUBST(GETOPT)
AC_FUNC_MMAP
AC_TYPE_SIGNAL
AC_CHECK_LIB(dl, dlopen)
AC_CHECK_LIB(gnugetopt, optarg)
AC_CHECK_LIB(be, _)
AC_CHECK_LIB(game, _)
AC_CHECK_LIB(root, _)
AC_CHECK_LIB(m, powl)
AC_CHECK_LIB(pthread, pthread_create)
AC_CHECK_LIB(threads, thread_create)
dnl check for getopt_long, substitute the distributed versions if not
AC_CHECK_FUNC(getopt_long,,[LIBOBJS="$LIBOBJS getopt.o getopt1.o"])
AC_SUBST(LIBOBJS)
AC_CHECK_LIB(dl,dlopen,LIB=${LIB}" -ldl")
AC_CHECK_LIB(m,powl,LIB=${LIB}" -lm")
AC_CHECK_LIB(pthread,pthread_create,LIB=${LIB}" -lpthread")
AC_CHECK_LIB(threads,thread_create,LIB=${LIB}" -lthreads")
CPPFLAGS="${CPPFLAGS} -I/usr/local/include"
AC_CHECK_HEADERS(stddef.h)
@ -77,7 +77,7 @@ dnl Check for -rdynamic flag
CFLAGS="${CFLAGS} -rdynamic -Wall -Werror"
AC_MSG_CHECKING([if \$CC accepts -rdynamic])
AC_TRY_COMPILE([],,
DYNAMIC_FLAG="-rdynamic"
LCFLAGS=${LCFLAGS}" -rdynamic"
AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
dnl End of the bizarre compilation tests
@ -150,9 +150,10 @@ AC_ARG_ENABLE(optimizations,
SYS=${host_os}
# special cases
dnl special cases
if test x$host_os = xbeos; then
PLUGINS=${PLUGINS}"beos "
LIB=${LIB}" -lbe -lgame -lroot"
dnl default case
else
@ -267,7 +268,10 @@ AC_SUBST(DEBUG)
AC_SUBST(STATS)
AC_SUBST(OPTIMS)
AC_SUBST(CSS)
AC_SUBST(DYNAMIC_FLAG)
AC_SUBST(LCFLAGS)
AC_SUBST(LIB)
AC_SUBST(LIB_SDL)
AC_SUBST(LIB_GLIDE)
AC_SUBST(LIB_GGI)

View File

@ -35,8 +35,10 @@ A summary of options is included below.
.B \-I, \-\-intf <module>
Specify an interface module: "gnome", "curses", "qt", for instance.
.TP
.B \-\-warning <level>
Select the warning level. 0 is the most verbose, 3 is almost mute.
.B \-v, \-\-verbose
Set
.B vlc
verbosity. This command is cumulative, you can use "-vv" or "-vvvv" for increased verbosity.
.TP
.B \-\-noaudio
Disable audio output.
@ -138,7 +140,6 @@ also accepts a lot of parameters to customize its behaviour.
vlc_intf=<method name> interface method
vlc_init=<filename> initialization script
vlc_channels=<filename> channels list
warning_level=<level> warning level
.TP
.B Audio parameters:
vlc_aout=<method name> audio method

1004
extras/GNUgetopt/getopt.c Normal file

File diff suppressed because it is too large Load Diff

134
extras/GNUgetopt/getopt.h Normal file
View File

@ -0,0 +1,134 @@
/* Declarations for getopt.
Copyright (C) 1989,90,91,92,93,94,96,97 Free Software Foundation, Inc.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifndef _GETOPT_H
#define _GETOPT_H 1
#ifdef __cplusplus
extern "C"
{
#endif
/* For communication from `getopt' to the caller.
When `getopt' finds an option that takes an argument,
the argument value is returned here.
Also, when `ordering' is RETURN_IN_ORDER,
each non-option ARGV-element is returned here. */
extern char *optarg;
/* Index in ARGV of the next element to be scanned.
This is used for communication to and from the caller
and for communication between successive calls to `getopt'.
On entry to `getopt', zero means this is the first call; initialize.
When `getopt' returns -1, this is the index of the first of the
non-option elements that the caller should itself scan.
Otherwise, `optind' communicates from one call to the next
how much of ARGV has been scanned so far. */
extern int optind;
/* Callers store zero here to inhibit the error message `getopt' prints
for unrecognized options. */
extern int opterr;
/* Set to an option character which was unrecognized. */
extern int optopt;
/* Describe the long-named options requested by the application.
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
of `struct option' terminated by an element containing a name which is
zero.
The field `has_arg' is:
no_argument (or 0) if the option does not take an argument,
required_argument (or 1) if the option requires an argument,
optional_argument (or 2) if the option takes an optional argument.
If the field `flag' is not NULL, it points to a variable that is set
to the value given in the field `val' when the option is found, but
left unchanged if the option is not found.
To have a long-named option do something other than set an `int' to
a compiled-in constant, such as set a value from `optarg', set the
option's `flag' field to zero and its `val' field to a nonzero
value (the equivalent single-letter option character, if there is
one). For long options that have a zero `flag' field, `getopt'
returns the contents of the `val' field. */
struct option
{
#if defined (__STDC__) && __STDC__
const char *name;
#else
char *name;
#endif
/* has_arg can't be an enum because some compilers complain about
type mismatches in all the code that assumes it is an int. */
int has_arg;
int *flag;
int val;
};
/* Names for the values of the `has_arg' field of `struct option'. */
#define no_argument 0
#define required_argument 1
#define optional_argument 2
#if defined (__STDC__) && __STDC__
#ifdef __GNU_LIBRARY__
/* Many other libraries have conflicting prototypes for getopt, with
differences in the consts, in stdlib.h. To avoid compilation
errors, only prototype getopt for the GNU C library. */
extern int getopt(int argc, char *const *argv, const char *shortopts);
#else /* not __GNU_LIBRARY__ */
extern int getopt();
#endif /* __GNU_LIBRARY__ */
extern int getopt_long(int argc, char *const *argv, const char *shortopts,
const struct option *longopts, int *longind);
extern int getopt_long_only(int argc, char *const *argv,
const char *shortopts,
const struct option *longopts, int *longind);
/* Internal only. Users should not call this directly. */
extern int _getopt_internal(int argc, char *const *argv,
const char *shortopts,
const struct option *longopts, int *longind,
int long_only);
#else /* not __STDC__ */
extern int getopt();
extern int getopt_long();
extern int getopt_long_only();
extern int _getopt_internal();
#endif /* __STDC__ */
#ifdef __cplusplus
}
#endif
#endif /* _GETOPT_H */

187
extras/GNUgetopt/getopt1.c Normal file
View File

@ -0,0 +1,187 @@
/* getopt_long and getopt_long_only entry points for GNU getopt.
Copyright (C) 1987,88,89,90,91,92,93,94,96,97 Free Software Foundation, Inc.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "getopt.h"
#if !defined (__STDC__) || !__STDC__
/* This is a separate conditional since some stdc systems
reject `defined (const)'. */
#ifndef const
#define const
#endif
#endif
#include <stdio.h>
/* Comment out all this code if we are using the GNU C Library, and are not
actually compiling the library itself. This code is part of the GNU C
Library, but also included in many other GNU distributions. Compiling
and linking in this code is a waste when using the GNU C library
(especially if it is a shared library). Rather than having every GNU
program understand `configure --with-gnu-libc' and omit the object files,
it is simpler to just do this in the source for each such file. */
#define GETOPT_INTERFACE_VERSION 2
#if !defined (_LIBC) && defined (__GLIBC__) && __GLIBC__ >= 2
#include <gnu-versions.h>
#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
#define ELIDE_CODE
#endif
#endif
#ifndef ELIDE_CODE
/* This needs to come after some library #include
to get __GNU_LIBRARY__ defined. */
#ifdef __GNU_LIBRARY__
#include <stdlib.h>
#endif
#ifndef NULL
#define NULL 0
#endif
int
getopt_long(argc, argv, options, long_options, opt_index)
int argc;
char *const *argv;
const char *options;
const struct option *long_options;
int *opt_index;
{
return _getopt_internal(argc, argv, options, long_options, opt_index, 0);
}
/* Like getopt_long, but '-' as well as '--' can indicate a long option.
If an option that starts with '-' (not '--') doesn't match a long option,
but does match a short option, it is parsed as a short option
instead. */
int
getopt_long_only(argc, argv, options, long_options, opt_index)
int argc;
char *const *argv;
const char *options;
const struct option *long_options;
int *opt_index;
{
return _getopt_internal(argc, argv, options, long_options, opt_index, 1);
}
#endif /* Not ELIDE_CODE. */
#ifdef TEST
#include <stdio.h>
int
main(argc, argv)
int argc;
char **argv;
{
int c;
int digit_optind = 0;
while (1)
{
int this_option_optind = optind ? optind : 1;
int option_index = 0;
static struct option long_options[] =
{
{"add", 1, 0, 0},
{"append", 0, 0, 0},
{"delete", 1, 0, 0},
{"verbose", 0, 0, 0},
{"create", 0, 0, 0},
{"file", 1, 0, 0},
{0, 0, 0, 0}
};
c = getopt_long(argc, argv, "abc:d:0123456789",
long_options, &option_index);
if (c == -1)
break;
switch (c)
{
case 0:
printf("option %s", long_options[option_index].name);
if (optarg)
printf(" with arg %s", optarg);
printf("\n");
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
if (digit_optind != 0 && digit_optind != this_option_optind)
printf("digits occur in two different argv-elements.\n");
digit_optind = this_option_optind;
printf("option %c\n", c);
break;
case 'a':
printf("option a\n");
break;
case 'b':
printf("option b\n");
break;
case 'c':
printf("option c with value `%s'\n", optarg);
break;
case 'd':
printf("option d with value `%s'\n", optarg);
break;
case '?':
break;
default:
printf("?? getopt returned character code 0%o ??\n", c);
}
}
if (optind < argc)
{
printf("non-option ARGV-elements: ");
while (optind < argc)
printf("%s ", argv[optind++]);
printf("\n");
}
exit(0);
}
#endif /* TEST */

View File

@ -0,0 +1 @@
build

View File

@ -2,7 +2,7 @@
* config.h: limits and configuration
* Defines all compilation-time configuration constants and size limits
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* Copyright (C) 1999, 2000, 2001 VideoLAN
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
@ -43,9 +43,9 @@
/* Program version and copyright message */
#define VERSION_MESSAGE "vlc @VLC_VERSION@ @VLC_CODENAME@ " \
/* "(" PROGRAM_BUILD ") (" PROGRAM_OPTIONS ")\n" */ \
"Copyright 1996-2000 VideoLAN\n"
"Copyright 1996-2001 VideoLAN\n"
#define COPYRIGHT_MESSAGE "VideoLAN Client - version @VLC_VERSION@" \
" @VLC_CODENAME@ - (c)1996-2000 VideoLAN\n"
" @VLC_CODENAME@ - (C)1996-2001 VideoLAN\n"
#define VERSION "@VLC_VERSION@"

View File

@ -121,41 +121,11 @@
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define if you have the be library (-lbe). */
#undef HAVE_LIBBE
/* long getopt support */
#undef HAVE_GETOPT_LONG
/* Define if you have the dl library (-ldl). */
#undef HAVE_LIBDL
/* Define if you have the game library (-lgame). */
#undef HAVE_LIBGAME
/* Define if you have the gnugetopt library (-lgnugetopt). */
#undef HAVE_LIBGNUGETOPT
/* Define if you have the m library (-lm). */
#undef HAVE_LIBM
/* Define if you have the nsl library (-lnsl). */
#undef HAVE_LIBNSL
/* Define if you have the pthread library (-lpthread). */
#undef HAVE_LIBPTHREAD
/* Define if you have the resolv library (-lresolv). */
#undef HAVE_LIBRESOLV
/* Define if you have the root library (-lroot). */
#undef HAVE_LIBROOT
/* Define if you have the rt library (-lrt). */
#undef HAVE_LIBRT
/* Define if you have the socket library (-lsocket). */
#undef HAVE_LIBSOCKET
/* Define if you have the threads library (-lthreads). */
#undef HAVE_LIBTHREADS
/* getopt support */
#undef HAVE_GETOPT_LONG
/* Define if ntohl is in <sys/param.h>. */
#undef NTOHL_IN_SYS_PARAM_H

View File

@ -2,7 +2,7 @@
* aout_darwin.c : Darwin audio output plugin
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: aout_darwin.c,v 1.3 2001/03/21 13:42:33 sam Exp $
* $Id: aout_darwin.c,v 1.4 2001/04/05 03:50:38 sam Exp $
*
* Authors: Colin Delacroix <colin@zoy.org>
*
@ -220,7 +220,7 @@ static int aout_Open( aout_thread_t *p_aout )
#if WRITE_AUDIO_OUTPUT_TO_FILE
p_aout->p_sys->fd = open( "/Users/bofh/audio-darwin.pcm", O_RDWR|O_CREAT );
intf_WarnMsg( "open(...) -> %d", p_aout->p_sys->fd );
intf_WarnMsg( 1, "open(...) -> %d", p_aout->p_sys->fd );
#endif
vlc_cond_init( &p_aout->p_sys->cond_sync );

View File

@ -4,7 +4,7 @@
* and spawn threads.
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: main.c,v 1.80 2001/03/21 13:42:34 sam Exp $
* $Id: main.c,v 1.81 2001/04/05 03:50:38 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
@ -32,8 +32,12 @@
#include <signal.h> /* SIGHUP, SIGINT, SIGKILL */
#include <stdio.h> /* sprintf() */
#ifdef HAVE_GETOPT_H
#include <getopt.h> /* getopt() */
#ifdef HAVE_GETOPT_LONG
# ifdef HAVE_GETOPT_H
# include <getopt.h> /* getopt() */
# endif
#else
# include "GNUgetopt/getopt.h"
#endif
#ifdef SYS_DARWIN1_3
@ -105,6 +109,7 @@
#define OPT_SYNCHRO 190
#define OPT_WARNING 191
#define OPT_VERSION 192
/* Usage fashion */
#define USAGE 0
@ -112,7 +117,6 @@
#define LONG_HELP 2
/* Long options */
#ifdef HAVE_GETOPT_H
static const struct option longopts[] =
{
/* name, has_arg, flag, val */
@ -120,7 +124,7 @@ static const struct option longopts[] =
/* General/common options */
{ "help", 0, 0, 'h' },
{ "longhelp", 0, 0, 'H' },
{ "version", 0, 0, 'v' },
{ "version", 0, 0, OPT_VERSION },
/* Interface options */
{ "intf", 1, 0, 'I' },
@ -167,8 +171,6 @@ static const struct option longopts[] =
/* Short options */
static const char *psz_shortopts = "hHvgt:T:a:s:c:I:A:V:";
#endif
/*****************************************************************************
* Global variable program_data - this is the one and only, see main.h
@ -178,7 +180,6 @@ main_t *p_main;
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static void SetDefaultConfiguration ( void );
static int GetConfiguration ( int i_argc, char *ppsz_argv[],
char *ppsz_env[] );
static int GetFilenames ( int i_argc, char *ppsz_argv[] );
@ -259,9 +260,6 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
return( errno );
}
p_main->i_warning_level = main_GetIntVariable( INTF_WARNING_VAR,
INTF_WARNING_DEFAULT );
/*
* Initialize playlist and get commandline files
*/
@ -501,24 +499,6 @@ void main_PutIntVariable( char *psz_name, int i_value )
/* following functions are local */
/*****************************************************************************
* SetDefaultConfiguration: set default options
*****************************************************************************
* This function is called by GetConfiguration before command line is parsed.
* It sets all the default values required later by the program. At this stage,
* most structure are not yet allocated, so initialization must be done using
* environment.
*****************************************************************************/
static void SetDefaultConfiguration( void )
{
/*
* All features are activated by default except vlans
*/
p_main->b_audio = 1;
p_main->b_video = 1;
p_main->b_vlans = 0;
}
/*****************************************************************************
* GetConfiguration: parse command line
*****************************************************************************
@ -530,35 +510,40 @@ static void SetDefaultConfiguration( void )
*****************************************************************************/
static int GetConfiguration( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
{
int c;
char * p_pointer;
int i_cmd;
char *p_tmp;
/* Set default configuration and copy arguments */
p_main->i_argc = i_argc;
p_main->ppsz_argv = ppsz_argv;
p_main->ppsz_env = ppsz_env;
SetDefaultConfiguration();
p_main->b_audio = 1;
p_main->b_video = 1;
p_main->b_vlans = 0;
p_main->i_warning_level = 4;
/* Get the executable name (similar to the basename command) */
p_main->psz_arg0 = p_pointer = ppsz_argv[ 0 ];
while( *p_pointer )
p_main->psz_arg0 = p_tmp = ppsz_argv[ 0 ];
while( *p_tmp )
{
if( *p_pointer == '/' )
if( *p_tmp == '/' )
{
p_main->psz_arg0 = ++p_pointer;
p_main->psz_arg0 = ++p_tmp;
}
else
{
++p_pointer;
++p_tmp;
}
}
/* Parse command line options */
#ifdef HAVE_GETOPT_H
opterr = 0;
while( ( c = getopt_long( i_argc, ppsz_argv, psz_shortopts, longopts, 0 ) ) != EOF )
while( ( i_cmd = getopt_long( i_argc, ppsz_argv,
psz_shortopts, longopts, 0 ) ) != EOF )
{
switch( c )
switch( i_cmd )
{
/* General/common options */
case 'h': /* -h, --help */
@ -569,17 +554,21 @@ static int GetConfiguration( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
Usage( LONG_HELP );
return( -1 );
break;
case 'v': /* -v, --version */
case OPT_VERSION: /* --version */
Version();
return( -1 );
break;
case 'v': /* -v, --verbose */
p_main->i_warning_level--;
break;
/* Interface warning messages level */
case 'I': /* -I, --intf */
main_PutPszVariable( INTF_METHOD_VAR, optarg );
break;
case OPT_WARNING: /* --warning */
main_PutIntVariable( INTF_WARNING_VAR, atoi(optarg) );
intf_ErrMsg( "intf error: `--warning' is deprecated, use `-v'" );
p_main->i_warning_level = atoi(optarg);
break;
/* Audio options */
@ -683,13 +672,19 @@ static int GetConfiguration( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
/* Internal error: unknown option */
case '?':
default:
intf_ErrMsg( "intf error: unknown option `%s'", ppsz_argv[optind - 1] );
intf_ErrMsg( "intf error: unknown option `%s'",
ppsz_argv[optind - 1] );
Usage( USAGE );
return( EINVAL );
break;
}
}
#endif
if( p_main->i_warning_level < 0 )
{
p_main->i_warning_level = 0;
}
return( 0 );
}
@ -733,7 +728,7 @@ static void Usage( int i_fashion )
/* Options */
intf_MsgImm( "\nOptions:"
"\n -I, --intf <module> \tinterface method"
"\n --warning <level> \tdisplay warning messages"
"\n -v, --verbose \tverbose mode (cumulative)"
"\n"
"\n --noaudio \tdisable audio"
"\n -A, --aout <module> \taudio output method"
@ -766,7 +761,7 @@ static void Usage( int i_fashion )
"\n"
"\n -h, --help \tprint help and exit"
"\n -H, --longhelp \tprint long help and exit"
"\n -v, --version \toutput version information and exit" );
"\n --version \toutput version information and exit" );
if( i_fashion == SHORT_HELP )
return;
@ -775,8 +770,7 @@ static void Usage( int i_fashion )
intf_MsgImm( "\nInterface parameters:"
"\n " INTF_METHOD_VAR "=<method name> \tinterface method"
"\n " INTF_INIT_SCRIPT_VAR "=<filename> \tinitialization script"
"\n " INTF_CHANNELS_VAR "=<filename> \tchannels list"
"\n " INTF_WARNING_VAR "=<level> \twarning level" );
"\n " INTF_CHANNELS_VAR "=<filename> \tchannels list" );
/* Audio parameters */
intf_MsgImm( "\nAudio parameters:"