summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a94f533)
raw | patch | inline | side by side (parent: a94f533)
author | Florian Forster <octo@noris.net> | |
Wed, 27 Aug 2008 13:59:22 +0000 (15:59 +0200) | ||
committer | Florian Forster <octo@noris.net> | |
Wed, 27 Aug 2008 13:59:22 +0000 (15:59 +0200) |
src/unixsock.c | patch | blob | history | |
src/utils_cmd_listval.c | patch | blob | history | |
src/utils_cmd_listval.h | patch | blob | history |
diff --git a/src/unixsock.c b/src/unixsock.c
index 6a8628a55eaf8fa3dbae2c152c1e1ac461053668..02f329f63955bc45bb4f9785d7cfe2efdf5de239 100644 (file)
--- a/src/unixsock.c
+++ b/src/unixsock.c
}
else if (strcasecmp (fields[0], "listval") == 0)
{
- handle_listval (fhout, fields, fields_num);
+ handle_listval (fhout, buffer);
}
else if (strcasecmp (fields[0], "putnotif") == 0)
{
index 6f03e757ac57b5c5d397c12821d7e6d2f45ee8c8..bca83a9996a220870fd9651555e1d56bad090397 100644 (file)
--- a/src/utils_cmd_listval.c
+++ b/src/utils_cmd_listval.c
#include "utils_cmd_listval.h"
#include "utils_cache.h"
+#include "utils_parse_option.h"
#define print_to_socket(fh, ...) \
if (fprintf (fh, __VA_ARGS__) < 0) { \
return -1; \
}
-int handle_listval (FILE *fh, char **fields, int fields_num)
+int handle_listval (FILE *fh, char *buffer)
{
+ char *command;
char **names = NULL;
time_t *times = NULL;
size_t number = 0;
size_t i;
int status;
- if (fields_num != 1)
+ DEBUG ("utils_cmd_listval: handle_listval (fh = %p, buffer = %s);",
+ (void *) fh, buffer);
+
+ command = NULL;
+ status = parse_string (&buffer, &command);
+ if (status != 0)
+ {
+ print_to_socket (fh, "-1 Cannot parse command.\n");
+ return (-1);
+ }
+ assert (command != NULL);
+
+ if (strcasecmp ("LISTVAL", command) != 0)
+ {
+ print_to_socket (fh, "-1 Unexpected command: `%s'.\n", command);
+ return (-1);
+ }
+
+ if (*buffer != 0)
{
- DEBUG ("command listval: us_handle_listval: Wrong number of fields: %i",
- fields_num);
- print_to_socket (fh, "-1 Wrong number of fields: Got %i, expected 1.\n",
- fields_num);
+ print_to_socket (fh, "-1 Garbage after end of command: %s\n", buffer);
return (-1);
}
index c918796262a979cbc7779950cfe3a7b7356ba41e..73146e785b6b4bd6cd854871fc1f333549c994da 100644 (file)
--- a/src/utils_cmd_listval.h
+++ b/src/utils_cmd_listval.h
#ifndef UTILS_CMD_LISTVAL_H
#define UTILS_CMD_LISTVAL_H 1
-int handle_listval (FILE *fh, char **fields, int fields_num);
+int handle_listval (FILE *fh, char *buffer);
#endif /* UTILS_CMD_LISTVAL_H */