Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
6f060081
Commit
6f060081
authored
Jul 29, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
command: moved command_process_list() to client.c
parent
7f865f72
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
35 deletions
+30
-35
client_process.c
src/client_process.c
+26
-4
command.c
src/command.c
+3
-26
command.h
src/command.h
+1
-5
No files found.
src/client_process.c
View file @
6f060081
...
@@ -25,6 +25,28 @@
...
@@ -25,6 +25,28 @@
#define CLIENT_LIST_OK_MODE_BEGIN "command_list_ok_begin"
#define CLIENT_LIST_OK_MODE_BEGIN "command_list_ok_begin"
#define CLIENT_LIST_MODE_END "command_list_end"
#define CLIENT_LIST_MODE_END "command_list_end"
static
enum
command_return
client_process_command_list
(
struct
client
*
client
,
bool
list_ok
,
GSList
*
list
)
{
enum
command_return
ret
=
COMMAND_RETURN_OK
;
unsigned
num
=
0
;
for
(
GSList
*
cur
=
list
;
cur
!=
NULL
;
cur
=
g_slist_next
(
cur
))
{
char
*
cmd
=
cur
->
data
;
g_debug
(
"command_process_list: process command
\"
%s
\"
"
,
cmd
);
ret
=
command_process
(
client
,
num
++
,
cmd
);
g_debug
(
"command_process_list: command returned %i"
,
ret
);
if
(
ret
!=
COMMAND_RETURN_OK
||
client_is_expired
(
client
))
break
;
else
if
(
list_ok
)
client_puts
(
client
,
"list_OK
\n
"
);
}
return
ret
;
}
enum
command_return
enum
command_return
client_process_line
(
struct
client
*
client
,
char
*
line
)
client_process_line
(
struct
client
*
client
,
char
*
line
)
{
{
...
@@ -61,9 +83,9 @@ client_process_line(struct client *client, char *line)
...
@@ -61,9 +83,9 @@ client_process_line(struct client *client, char *line)
to restore the correct order */
to restore the correct order */
client
->
cmd_list
=
g_slist_reverse
(
client
->
cmd_list
);
client
->
cmd_list
=
g_slist_reverse
(
client
->
cmd_list
);
ret
=
c
ommand_process
_list
(
client
,
ret
=
c
lient_process_command
_list
(
client
,
client
->
cmd_list_OK
,
client
->
cmd_list_OK
,
client
->
cmd_list
);
client
->
cmd_list
);
g_debug
(
"[%u] process command "
g_debug
(
"[%u] process command "
"list returned %i"
,
client
->
num
,
ret
);
"list returned %i"
,
client
->
num
,
ret
);
...
@@ -104,7 +126,7 @@ client_process_line(struct client *client, char *line)
...
@@ -104,7 +126,7 @@ client_process_line(struct client *client, char *line)
}
else
{
}
else
{
g_debug
(
"[%u] process command
\"
%s
\"
"
,
g_debug
(
"[%u] process command
\"
%s
\"
"
,
client
->
num
,
line
);
client
->
num
,
line
);
ret
=
command_process
(
client
,
line
);
ret
=
command_process
(
client
,
0
,
line
);
g_debug
(
"[%u] command returned %i"
,
g_debug
(
"[%u] command returned %i"
,
client
->
num
,
ret
);
client
->
num
,
ret
);
...
...
src/command.c
View file @
6f060081
...
@@ -1878,7 +1878,7 @@ command_checked_lookup(struct client *client, unsigned permission,
...
@@ -1878,7 +1878,7 @@ command_checked_lookup(struct client *client, unsigned permission,
}
}
enum
command_return
enum
command_return
command_process
(
struct
client
*
client
,
char
*
line
)
command_process
(
struct
client
*
client
,
unsigned
num
,
char
*
line
)
{
{
GError
*
error
=
NULL
;
GError
*
error
=
NULL
;
int
argc
;
int
argc
;
...
@@ -1886,6 +1886,8 @@ command_process(struct client *client, char *line)
...
@@ -1886,6 +1886,8 @@ command_process(struct client *client, char *line)
const
struct
command
*
cmd
;
const
struct
command
*
cmd
;
enum
command_return
ret
=
COMMAND_RETURN_ERROR
;
enum
command_return
ret
=
COMMAND_RETURN_ERROR
;
command_list_num
=
num
;
/* get the command name (first word on the line) */
/* get the command name (first word on the line) */
argv
[
0
]
=
tokenizer_next_word
(
&
line
,
&
error
);
argv
[
0
]
=
tokenizer_next_word
(
&
line
,
&
error
);
...
@@ -1940,32 +1942,7 @@ command_process(struct client *client, char *line)
...
@@ -1940,32 +1942,7 @@ command_process(struct client *client, char *line)
ret
=
cmd
->
handler
(
client
,
argc
,
argv
);
ret
=
cmd
->
handler
(
client
,
argc
,
argv
);
current_command
=
NULL
;
current_command
=
NULL
;
return
ret
;
}
enum
command_return
command_process_list
(
struct
client
*
client
,
bool
list_ok
,
GSList
*
list
)
{
enum
command_return
ret
=
COMMAND_RETURN_OK
;
command_list_num
=
0
;
command_list_num
=
0
;
for
(
GSList
*
cur
=
list
;
cur
!=
NULL
;
cur
=
g_slist_next
(
cur
))
{
char
*
cmd
=
cur
->
data
;
g_debug
(
"command_process_list: process command
\"
%s
\"
"
,
cmd
);
ret
=
command_process
(
client
,
cmd
);
g_debug
(
"command_process_list: command returned %i"
,
ret
);
if
(
ret
!=
COMMAND_RETURN_OK
||
client_is_expired
(
client
))
break
;
else
if
(
list_ok
)
client_puts
(
client
,
"list_OK
\n
"
);
command_list_num
++
;
}
command_list_num
=
0
;
return
ret
;
return
ret
;
}
}
src/command.h
View file @
6f060081
...
@@ -39,11 +39,7 @@ void command_init(void);
...
@@ -39,11 +39,7 @@ void command_init(void);
void
command_finish
(
void
);
void
command_finish
(
void
);
enum
command_return
enum
command_return
command_process_list
(
struct
client
*
client
,
command_process
(
struct
client
*
client
,
unsigned
num
,
char
*
line
);
bool
list_ok
,
GSList
*
list
);
enum
command_return
command_process
(
struct
client
*
client
,
char
*
commandString
);
void
command_success
(
struct
client
*
client
);
void
command_success
(
struct
client
*
client
);
...
...
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