Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
21cda08b
Commit
21cda08b
authored
Feb 14, 2011
by
antirez
Browse files
CONFIG GET/SET dir implemented
parent
05600eb8
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/config.c
View file @
21cda08b
...
@@ -423,6 +423,11 @@ void configSetCommand(redisClient *c) {
...
@@ -423,6 +423,11 @@ void configSetCommand(redisClient *c) {
if
(
yn
==
-
1
)
goto
badfmt
;
if
(
yn
==
-
1
)
goto
badfmt
;
server
.
repl_serve_stale_data
=
yn
;
server
.
repl_serve_stale_data
=
yn
;
}
else
if
(
!
strcasecmp
(
c
->
argv
[
2
]
->
ptr
,
"dir"
))
{
if
(
chdir
((
char
*
)
o
->
ptr
)
==
-
1
)
{
addReplyErrorFormat
(
c
,
"Changing directory: %s"
,
strerror
(
errno
));
return
;
}
}
else
{
}
else
{
addReplyErrorFormat
(
c
,
"Unsupported CONFIG parameter: %s"
,
addReplyErrorFormat
(
c
,
"Unsupported CONFIG parameter: %s"
,
(
char
*
)
c
->
argv
[
2
]
->
ptr
);
(
char
*
)
c
->
argv
[
2
]
->
ptr
);
...
@@ -445,6 +450,15 @@ void configGetCommand(redisClient *c) {
...
@@ -445,6 +450,15 @@ void configGetCommand(redisClient *c) {
int
matches
=
0
;
int
matches
=
0
;
redisAssert
(
o
->
encoding
==
REDIS_ENCODING_RAW
);
redisAssert
(
o
->
encoding
==
REDIS_ENCODING_RAW
);
if
(
stringmatch
(
pattern
,
"dir"
,
0
))
{
char
buf
[
1024
];
buf
[
0
]
=
'\0'
;
getcwd
(
buf
,
sizeof
(
buf
));
addReplyBulkCString
(
c
,
"dir"
);
addReplyBulkCString
(
c
,
buf
);
matches
++
;
}
if
(
stringmatch
(
pattern
,
"dbfilename"
,
0
))
{
if
(
stringmatch
(
pattern
,
"dbfilename"
,
0
))
{
addReplyBulkCString
(
c
,
"dbfilename"
);
addReplyBulkCString
(
c
,
"dbfilename"
);
addReplyBulkCString
(
c
,
server
.
dbfilename
);
addReplyBulkCString
(
c
,
server
.
dbfilename
);
...
...
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