浏览代码

Fix query operation names

git-svn-id: https://klish.googlecode.com/svn/trunk@123 0eaa4687-2ee9-07dd-09d9-bcdd2d2dd5fb
Serj Kalichev 14 年之前
父节点
当前提交
f88552c39e
共有 4 个文件被更改,包括 37 次插入37 次删除
  1. 12 12
      bin/konfd.c
  2. 3 3
      clish/clish_config_callback.c
  3. 7 7
      konf/query.h
  4. 15 15
      konf/query/query.c

+ 12 - 12
bin/konfd.c

@@ -224,36 +224,36 @@ static char * process_query(int sock, konf_tree_t * conf, char *str)
 
 	switch (konf_query__get_op(query)) {
 
-	case konf_query_OP_SET:
+	case KONF_QUERY_OP_SET:
 		if (konf_tree_find_conf(iconf, konf_query__get_line(query), 0)) {
-			ret = konf_query_OP_OK;
+			ret = KONF_QUERY_OP_OK;
 			break;
 		}
 		konf_tree_del_pattern(iconf, konf_query__get_pattern(query));
 		tmpconf = konf_tree_new_conf(iconf, 
 			konf_query__get_line(query), konf_query__get_priority(query));
 		if (!tmpconf) {
-			ret = konf_query_OP_ERROR;
+			ret = KONF_QUERY_OP_ERROR;
 			break;
 		}
 		konf_tree__set_splitter(tmpconf, konf_query__get_splitter(query));
-		ret = konf_query_OP_OK;
+		ret = KONF_QUERY_OP_OK;
 		break;
 
-	case konf_query_OP_UNSET:
+	case KONF_QUERY_OP_UNSET:
 		konf_tree_del_pattern(iconf, konf_query__get_pattern(query));
-		ret = konf_query_OP_OK;
+		ret = KONF_QUERY_OP_OK;
 		break;
 
-	case konf_query_OP_DUMP:
+	case KONF_QUERY_OP_DUMP:
 		if (dump_running_config(sock, iconf, query))
-			ret = konf_query_OP_ERROR;
+			ret = KONF_QUERY_OP_ERROR;
 		else
-			ret = konf_query_OP_OK;
+			ret = KONF_QUERY_OP_OK;
 		break;
 
 	default:
-		ret = konf_query_OP_ERROR;
+		ret = KONF_QUERY_OP_ERROR;
 		break;
 	}
 
@@ -266,10 +266,10 @@ static char * process_query(int sock, konf_tree_t * conf, char *str)
 	konf_query_free(query);
 
 	switch (ret) {
-	case konf_query_OP_OK:
+	case KONF_QUERY_OP_OK:
 		lub_string_cat(&retval, "-o");
 		break;
-	case konf_query_OP_ERROR:
+	case KONF_QUERY_OP_ERROR:
 		lub_string_cat(&retval, "-e");
 		break;
 	default:

+ 3 - 3
clish/clish_config_callback.c

@@ -309,15 +309,15 @@ static int process_answer(konf_client_t * client, char *str, konf_buf_t *buf, ko
 
 	switch (konf_query__get_op(query)) {
 
-	case konf_query_OP_OK:
+	case KONF_QUERY_OP_OK:
 		res = 0;
 		break;
 
-	case konf_query_OP_ERROR:
+	case KONF_QUERY_OP_ERROR:
 		res = -1;
 		break;
 
-	case konf_query_OP_STREAM:
+	case KONF_QUERY_OP_STREAM:
 		if (receive_data(client, buf, data) < 0)
 			res = -1;
 		else

+ 7 - 7
konf/query.h

@@ -3,13 +3,13 @@
 
 typedef enum
 {
-  konf_query_OP_NONE,
-  konf_query_OP_OK,
-  konf_query_OP_ERROR,
-  konf_query_OP_SET,
-  konf_query_OP_UNSET,
-  konf_query_OP_STREAM,
-  konf_query_OP_DUMP
+  KONF_QUERY_OP_NONE,
+  KONF_QUERY_OP_OK,
+  KONF_QUERY_OP_ERROR,
+  KONF_QUERY_OP_SET,
+  KONF_QUERY_OP_UNSET,
+  KONF_QUERY_OP_STREAM,
+  KONF_QUERY_OP_DUMP
 } konf_query_op_t;
 
 typedef struct konf_query_s konf_query_t;

+ 15 - 15
konf/query/query.c

@@ -19,7 +19,7 @@ konf_query_t *konf_query_new(void)
 	if (!(query = malloc(sizeof(*query))))
 		return NULL;
 
-	query->op = konf_query_OP_NONE;
+	query->op = KONF_QUERY_OP_NONE;
 	query->pattern = NULL;
 	query->priority = 0x7f00;
 	query->pwdc = 0;
@@ -34,22 +34,22 @@ konf_query_t *konf_query_new(void)
 void konf_query_dump(konf_query_t *query)
 {
 	switch (query->op) {
-	case konf_query_OP_SET:
+	case KONF_QUERY_OP_SET:
 		printf("op=SET\n");
 		break;
-	case konf_query_OP_UNSET:
+	case KONF_QUERY_OP_UNSET:
 		printf("op=UNSET\n");
 		break;
-	case konf_query_OP_DUMP:
+	case KONF_QUERY_OP_DUMP:
 		printf("op=DUMP\n");
 		break;
-	case konf_query_OP_OK:
+	case KONF_QUERY_OP_OK:
 		printf("op=OK\n");
 		break;
-	case konf_query_OP_ERROR:
+	case KONF_QUERY_OP_ERROR:
 		printf("op=ERROR\n");
 		break;
-	case konf_query_OP_STREAM:
+	case KONF_QUERY_OP_STREAM:
 		printf("op=STREAM\n");
 		break;
 	default:
@@ -130,22 +130,22 @@ int konf_query_parse(konf_query_t *query, int argc, char **argv)
 			break;
 		switch (opt) {
 		case 'o':
-			query->op = konf_query_OP_OK;
+			query->op = KONF_QUERY_OP_OK;
 			break;
 		case 'e':
-			query->op = konf_query_OP_ERROR;
+			query->op = KONF_QUERY_OP_ERROR;
 			break;
 		case 's':
-			query->op = konf_query_OP_SET;
+			query->op = KONF_QUERY_OP_SET;
 			break;
 		case 'u':
-			query->op = konf_query_OP_UNSET;
+			query->op = KONF_QUERY_OP_UNSET;
 			break;
 		case 'd':
-			query->op = konf_query_OP_DUMP;
+			query->op = KONF_QUERY_OP_DUMP;
 			break;
 		case 't':
-			query->op = konf_query_OP_STREAM;
+			query->op = KONF_QUERY_OP_STREAM;
 			break;
 		case 'p':
 			{
@@ -180,9 +180,9 @@ int konf_query_parse(konf_query_t *query, int argc, char **argv)
 	}
 
 	/* Check options */
-	if (konf_query_OP_NONE == query->op)
+	if (KONF_QUERY_OP_NONE == query->op)
 		return -1;
-	if (konf_query_OP_SET == query->op) {
+	if (KONF_QUERY_OP_SET == query->op) {
 		if (NULL == query->pattern)
 			return -1;
 		if (NULL == query->line)