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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
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
nexedi
MariaDB
Commits
9212433e
Commit
9212433e
authored
Jan 30, 2002
by
jani@hynda.mysql.fi
Browse files
Options
Browse Files
Download
Plain Diff
Merge work:/home/bk/mysql-4.0/ into hynda.mysql.fi:/home/my/bk/mysql-4.0
parents
d0834b6c
784e1d8b
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
246 additions
and
239 deletions
+246
-239
include/my_getopt.h
include/my_getopt.h
+4
-3
myisam/myisamchk.c
myisam/myisamchk.c
+56
-99
mysys/getvar.c
mysys/getvar.c
+0
-75
mysys/my_getopt.c
mysys/my_getopt.c
+186
-62
No files found.
include/my_getopt.h
View file @
9212433e
...
...
@@ -23,14 +23,15 @@ struct my_optarg
};
enum
get_opt_var_type
{
GET_NO_ARG
,
GET_
INT
,
GET_LL
,
GET_STR
};
enum
get_opt_var_type
{
GET_NO_ARG
,
GET_
LONG
,
GET_LL
,
GET_STR
};
enum
get_opt_arg_type
{
NO_ARG
,
OPT_ARG
,
REQUIRED_ARG
};
struct
my_option
{
const
char
*
name
;
/* Name of the option */
const
char
*
comment
;
/* option comment, for autom. --help */
char
*
value
;
/* The variable value */
gptr
*
value
;
/* The variable value */
gptr
*
u_max_value
;
/* The user def. max variable value */
const
char
**
str_values
;
/* Pointer to possible values */
enum
get_opt_var_type
var_type
;
enum
get_opt_arg_type
arg_type
;
...
...
@@ -41,6 +42,6 @@ struct my_option
longlong
sub_size
;
/* Subtract this from given value */
long
block_size
;
/* Value should be a mult. of this */
int
app_type
;
/* To be used by an application */
my_bool
changeable_var
;
/* If true, the option is a variable */
my_bool
opt_is_var
;
/* If true, the option is a variable */
};
myisam/myisamchk.c
View file @
9212433e
This diff is collapsed.
Click to expand it.
mysys/getvar.c
View file @
9212433e
...
...
@@ -109,78 +109,3 @@ my_bool set_changeable_var(my_string str,CHANGEABLE_VAR *vars)
}
DBUG_RETURN
(
1
);
}
my_bool
my_set_changeable_var
(
my_string
str
,
const
struct
my_option
*
vars
)
{
char
endchar
;
my_string
end
;
DBUG_ENTER
(
"my_set_changeable_var"
);
DBUG_PRINT
(
"enter"
,(
"%s"
,
str
));
if
(
str
)
{
if
(
!
(
end
=
strchr
(
str
,
'='
)))
fprintf
(
stderr
,
"Can't find '=' in expression '%s' to option -O
\n
"
,
str
);
else
{
uint
length
,
found_count
=
0
;
const
struct
my_option
*
var
,
*
found
;
my_string
var_end
;
const
char
*
name
;
longlong
num
;
/* Skip end space from variable */
for
(
var_end
=
end
;
end
>
str
&&
isspace
(
var_end
[
-
1
])
;
var_end
--
)
;
length
=
(
uint
)
(
var_end
-
str
);
/* Skip start space from argument */
for
(
end
++
;
isspace
(
*
end
)
;
end
++
)
;
for
(
var
=
vars
,
found
=
0
;
(
name
=
var
->
name
);
var
++
)
{
if
(
var
->
changeable_var
)
{
if
(
!
my_casecmp
(
name
,
str
,
length
))
{
found
=
var
;
found_count
++
;
if
(
!
name
[
length
])
{
found_count
=
1
;
break
;
}
}
}
}
if
(
found_count
==
0
)
{
fprintf
(
stderr
,
"No variable match for: -O '%s'
\n
"
,
str
);
DBUG_RETURN
(
1
);
}
if
(
found_count
>
1
)
{
fprintf
(
stderr
,
"Variable prefix '%*s' is not unique
\n
"
,
length
,
str
);
DBUG_RETURN
(
1
);
}
num
=
strtoll
(
end
,
(
char
**
)
NULL
,
10
);
endchar
=
strend
(
end
)[
-
1
];
if
(
endchar
==
'k'
||
endchar
==
'K'
)
num
*=
1024
;
else
if
(
endchar
==
'm'
||
endchar
==
'M'
)
num
*=
1024L
*
1024L
;
else
if
(
endchar
==
'g'
||
endchar
==
'G'
)
num
*=
1024L
*
1024L
*
1024L
;
else
if
(
!
isdigit
(
endchar
))
{
fprintf
(
stderr
,
"Unknown prefix used for variable value '%s'
\n
"
,
str
);
DBUG_RETURN
(
1
);
}
if
(
num
<
(
longlong
)
found
->
min_value
)
num
=
(
longlong
)
found
->
min_value
;
else
if
(
num
>
0
&&
(
ulonglong
)
num
>
(
ulonglong
)
(
ulong
)
found
->
max_value
)
num
=
(
longlong
)
(
ulong
)
found
->
max_value
;
num
=
((
num
-
(
longlong
)
found
->
sub_size
)
/
(
ulonglong
)
found
->
block_size
);
/* (*found->varptr)= (long) (num*(ulonglong) found->block_size);*/
DBUG_RETURN
(
0
);
}
}
DBUG_RETURN
(
1
);
}
mysys/my_getopt.c
View file @
9212433e
This diff is collapsed.
Click to expand it.
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