Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
6edb2da8
Commit
6edb2da8
authored
Feb 28, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
getopt: remove opterr global (always 0 within LibVLC)
parent
2361280d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1 addition
and
84 deletions
+1
-84
src/config/cmdline.c
src/config/cmdline.c
+0
-1
src/config/getopt.c
src/config/getopt.c
+1
-78
src/config/vlc_getopt.h
src/config/vlc_getopt.h
+0
-5
No files found.
src/config/cmdline.c
View file @
6edb2da8
...
@@ -211,7 +211,6 @@ int config_LoadCmdLine( vlc_object_t *p_this, int *pi_argc,
...
@@ -211,7 +211,6 @@ int config_LoadCmdLine( vlc_object_t *p_this, int *pi_argc,
/*
/*
* Parse the command line options
* Parse the command line options
*/
*/
opterr
=
0
;
optind
=
0
;
/* set to 0 to tell GNU getopt to reinitialize */
optind
=
0
;
/* set to 0 to tell GNU getopt to reinitialize */
while
(
(
i_cmd
=
vlc_getopt_long
(
*
pi_argc
,
(
char
**
)
ppsz_argv
,
psz_shortopts
,
while
(
(
i_cmd
=
vlc_getopt_long
(
*
pi_argc
,
(
char
**
)
ppsz_argv
,
psz_shortopts
,
p_longopts
,
&
i_index
)
)
!=
-
1
)
p_longopts
,
&
i_index
)
)
!=
-
1
)
...
...
src/config/getopt.c
View file @
6edb2da8
...
@@ -81,11 +81,6 @@ int __getopt_initialized = 0;
...
@@ -81,11 +81,6 @@ int __getopt_initialized = 0;
static
char
*
nextchar
;
static
char
*
nextchar
;
/* Callers store zero here to inhibit the error message
for unrecognized options. */
int
opterr
=
1
;
/* Set to an option character which was unrecognized.
/* Set to an option character which was unrecognized.
This must be initialized on some systems to avoid linking in the
This must be initialized on some systems to avoid linking in the
system's own getopt implementation. */
system's own getopt implementation. */
...
@@ -268,8 +263,7 @@ static const char *
...
@@ -268,8 +263,7 @@ static const char *
OPTSTRING is a string containing the legitimate option characters.
OPTSTRING is a string containing the legitimate option characters.
If an option character is seen that is not listed in OPTSTRING,
If an option character is seen that is not listed in OPTSTRING,
return '?' after printing an error message. If you set `opterr' to
return '?'.
zero, the error message is suppressed but we still return '?'.
If a char in OPTSTRING is followed by a colon, that means it wants an arg,
If a char in OPTSTRING is followed by a colon, that means it wants an arg,
so the following text in the same ARGV-element, or the text of the following
so the following text in the same ARGV-element, or the text of the following
...
@@ -441,9 +435,6 @@ int
...
@@ -441,9 +435,6 @@ int
if
(
ambig
&&
!
exact
)
if
(
ambig
&&
!
exact
)
{
{
if
(
opterr
)
fprintf
(
stderr
,
_
(
"%s: option `%s' is ambiguous
\n
"
),
argv
[
0
],
argv
[
optind
]);
nextchar
+=
strlen
(
nextchar
);
nextchar
+=
strlen
(
nextchar
);
optind
++
;
optind
++
;
optopt
=
0
;
optopt
=
0
;
...
@@ -462,20 +453,6 @@ int
...
@@ -462,20 +453,6 @@ int
optarg
=
nameend
+
1
;
optarg
=
nameend
+
1
;
else
else
{
{
if
(
opterr
)
{
if
(
argv
[
optind
-
1
][
1
]
==
'-'
)
/* --option */
fprintf
(
stderr
,
_
(
"%s: option `--%s' doesn't allow an argument
\n
"
),
argv
[
0
],
pfound
->
name
);
else
/* +option or -option */
fprintf
(
stderr
,
_
(
"%s: option `%c%s' doesn't allow an argument
\n
"
),
argv
[
0
],
argv
[
optind
-
1
][
0
],
pfound
->
name
);
}
nextchar
+=
strlen
(
nextchar
);
nextchar
+=
strlen
(
nextchar
);
optopt
=
pfound
->
val
;
optopt
=
pfound
->
val
;
...
@@ -488,10 +465,6 @@ int
...
@@ -488,10 +465,6 @@ int
optarg
=
argv
[
optind
++
];
optarg
=
argv
[
optind
++
];
else
else
{
{
if
(
opterr
)
fprintf
(
stderr
,
_
(
"%s: option `%s' requires an argument
\n
"
),
argv
[
0
],
argv
[
optind
-
1
]);
nextchar
+=
strlen
(
nextchar
);
nextchar
+=
strlen
(
nextchar
);
optopt
=
pfound
->
val
;
optopt
=
pfound
->
val
;
return
optstring
[
0
]
==
':'
?
':'
:
'?'
;
return
optstring
[
0
]
==
':'
?
':'
:
'?'
;
...
@@ -508,21 +481,6 @@ int
...
@@ -508,21 +481,6 @@ int
return
pfound
->
val
;
return
pfound
->
val
;
}
}
/* Can't find it as a long option. It's an error. */
if
(
opterr
)
{
if
(
argv
[
optind
][
1
]
==
'-'
)
/* --option */
fprintf
(
stderr
,
_
(
"%s: unrecognized option `%s%s'
\n
"
),
"--"
,
argv
[
0
],
nextchar
);
else
{
char
t
[
2
]
=
{
argv
[
optind
][
0
],
'\0'
};
/* +option or -option */
fprintf
(
stderr
,
_
(
"%s: unrecognized option `%s%s'
\n
"
),
argv
[
0
],
t
,
nextchar
);
}
}
nextchar
=
(
char
*
)
""
;
nextchar
=
(
char
*
)
""
;
optind
++
;
optind
++
;
optopt
=
0
;
optopt
=
0
;
...
@@ -541,16 +499,6 @@ int
...
@@ -541,16 +499,6 @@ int
if
(
temp
==
NULL
||
c
==
':'
)
if
(
temp
==
NULL
||
c
==
':'
)
{
{
if
(
opterr
)
{
if
(
posixly_correct
)
/* 1003.2 specifies the format of this message. */
fprintf
(
stderr
,
_
(
"%s: illegal option -- %c
\n
"
),
argv
[
0
],
c
);
else
fprintf
(
stderr
,
_
(
"%s: invalid option -- %c
\n
"
),
argv
[
0
],
c
);
}
optopt
=
c
;
optopt
=
c
;
return
'?'
;
return
'?'
;
}
}
...
@@ -575,12 +523,6 @@ int
...
@@ -575,12 +523,6 @@ int
}
}
else
if
(
optind
==
argc
)
else
if
(
optind
==
argc
)
{
{
if
(
opterr
)
{
/* 1003.2 specifies the format of this message. */
fprintf
(
stderr
,
_
(
"%s: option requires an argument -- %c
\n
"
),
argv
[
0
],
c
);
}
optopt
=
c
;
optopt
=
c
;
if
(
optstring
[
0
]
==
':'
)
if
(
optstring
[
0
]
==
':'
)
c
=
':'
;
c
=
':'
;
...
@@ -624,9 +566,6 @@ int
...
@@ -624,9 +566,6 @@ int
}
}
if
(
ambig
&&
!
exact
)
if
(
ambig
&&
!
exact
)
{
{
if
(
opterr
)
fprintf
(
stderr
,
_
(
"%s: option `-W %s' is ambiguous
\n
"
),
argv
[
0
],
argv
[
optind
]);
nextchar
+=
strlen
(
nextchar
);
nextchar
+=
strlen
(
nextchar
);
optind
++
;
optind
++
;
return
'?'
;
return
'?'
;
...
@@ -642,11 +581,6 @@ int
...
@@ -642,11 +581,6 @@ int
optarg
=
nameend
+
1
;
optarg
=
nameend
+
1
;
else
else
{
{
if
(
opterr
)
fprintf
(
stderr
,
_
(
"\
%s: option `-W %s' doesn't allow an argument
\n
"
),
argv
[
0
],
pfound
->
name
);
nextchar
+=
strlen
(
nextchar
);
nextchar
+=
strlen
(
nextchar
);
return
'?'
;
return
'?'
;
}
}
...
@@ -657,10 +591,6 @@ int
...
@@ -657,10 +591,6 @@ int
optarg
=
argv
[
optind
++
];
optarg
=
argv
[
optind
++
];
else
else
{
{
if
(
opterr
)
fprintf
(
stderr
,
_
(
"%s: option `%s' requires an argument
\n
"
),
argv
[
0
],
argv
[
optind
-
1
]);
nextchar
+=
strlen
(
nextchar
);
nextchar
+=
strlen
(
nextchar
);
return
optstring
[
0
]
==
':'
?
':'
:
'?'
;
return
optstring
[
0
]
==
':'
?
':'
:
'?'
;
}
}
...
@@ -704,13 +634,6 @@ int
...
@@ -704,13 +634,6 @@ int
}
}
else
if
(
optind
==
argc
)
else
if
(
optind
==
argc
)
{
{
if
(
opterr
)
{
/* 1003.2 specifies the format of this message. */
fprintf
(
stderr
,
_
(
"%s: option requires an argument -- %c
\n
"
),
argv
[
0
],
c
);
}
optopt
=
c
;
optopt
=
c
;
if
(
optstring
[
0
]
==
':'
)
if
(
optstring
[
0
]
==
':'
)
c
=
':'
;
c
=
':'
;
...
...
src/config/vlc_getopt.h
View file @
6edb2da8
...
@@ -44,11 +44,6 @@
...
@@ -44,11 +44,6 @@
extern
int
optind
;
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. */
/* Set to an option character which was unrecognized. */
extern
int
optopt
;
extern
int
optopt
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment