Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
770b9ef3
Commit
770b9ef3
authored
Oct 06, 2005
by
jani@ua141d10.elisa.omakaista.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed a bug in argument sending to get_one_option.
Fixed documentation for findopt(). Cleaned code a bit.
parent
3af12c47
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
12 deletions
+33
-12
mysys/my_getopt.c
mysys/my_getopt.c
+33
-12
No files found.
mysys/my_getopt.c
View file @
770b9ef3
...
...
@@ -358,7 +358,8 @@ invalid value '%s'\n",
continue
;
}
get_one_option
(
optp
->
id
,
optp
,
value
?
(
char
*
)
"1"
:
disabled_my_option
);
*
((
my_bool
*
)
value
)
?
(
char
*
)
"1"
:
disabled_my_option
);
continue
;
}
argument
=
optend
;
...
...
@@ -599,16 +600,27 @@ static int setval(const struct my_option *opts, gptr *value, char *argument,
return
0
;
}
/*
function: findopt
Arguments: opt_pattern, length of opt_pattern, opt_struct, first found
name (ffname)
/*
Find option
Go through all options in the my_option struct. Return number
of options found that match the pattern and in the argument
list the option found, if any. In case of ambiguous option, store
the name in ffname argument
SYNOPSIS
findopt()
optpat Prefix of option to find (with - or _)
length Length of optpat
opt_res Options
ffname Place for pointer to first found name
IMPLEMENTATION
Go through all options in the my_option struct. Return number
of options found that match the pattern and in the argument
list the option found, if any. In case of ambiguous option, store
the name in ffname argument
RETURN
0 No matching options
# Number of matching options
ffname points to first matching option
*/
static
int
findopt
(
char
*
optpat
,
uint
length
,
...
...
@@ -623,12 +635,21 @@ static int findopt(char *optpat, uint length,
if
(
!
getopt_compare_strings
(
opt
->
name
,
optpat
,
length
))
/* match found */
{
(
*
opt_res
)
=
opt
;
if
(
!
count
)
*
ffname
=
(
char
*
)
opt
->
name
;
/* We only need to know one prev */
if
(
!
opt
->
name
[
length
])
/* Exact match */
return
1
;
if
(
!
count
||
strcmp
(
*
ffname
,
opt
->
name
))
/* Don't count synonyms */
if
(
!
count
)
{
count
=
1
;
*
ffname
=
(
char
*
)
opt
->
name
;
/* We only need to know one prev */
}
else
if
(
strcmp
(
*
ffname
,
opt
->
name
))
{
/*
The above test is to not count same option twice
(see mysql.cc, option "help")
*/
count
++
;
}
}
}
return
count
;
...
...
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