src/tools/wstool.c

branch
config
changeset 258
134279e804b6
parent 254
4784c14aa639
child 415
d938228c382e
equal deleted inserted replaced
257:bfeb015c98a4 258:134279e804b6
30 30
31 #include <stdio.h> 31 #include <stdio.h>
32 #include <stdlib.h> 32 #include <stdlib.h>
33 #include <string.h> 33 #include <string.h>
34 34
35 #include "../server/config/serverconf.h" 35 #include "../server/config/serverconfig.h"
36 36
37 #include "srvctrlsocket.h" 37 #include "srvctrlsocket.h"
38 38
39 static void print_info(char *cmd) { 39 static void print_info(char *cmd) {
40 fprintf(stderr, "usage:\n"); 40 fprintf(stderr, "usage:\n");
59 print_info(argv[0]); 59 print_info(argv[0]);
60 return -2; 60 return -2;
61 } 61 }
62 62
63 int tool_get_tmpdir(char *configfile) { 63 int tool_get_tmpdir(char *configfile) {
64 ServerConfig2 *serverconf = load_server_config(configfile); 64 ServerConfig *serverconf = serverconfig_load(configfile);
65 UcxList *list = ucx_map_sstr_get(serverconf->objects, sstrn("Runtime", 7)); 65 UcxList *list = serverconfig_get_node_list(serverconf->root, CONFIG_NODE_OBJECT, SC("Runtime"));
66 if(!list) { 66 if(!list) {
67 fprintf(stderr, "Error: No Runtime element in %s\n", configfile); 67 fprintf(stderr, "Error: No Runtime element in %s\n", configfile);
68 return -1; 68 return -1;
69 } 69 }
70 if(ucx_list_size(list) != 1) { 70 if(ucx_list_size(list) != 1) {
71 fprintf(stderr, "Error: Multiple Runtime elements in %s\n", configfile); 71 fprintf(stderr, "Error: Multiple Runtime elements in %s\n", configfile);
72 return -1; 72 return -1;
73 } 73 }
74 ServerConfigObject *runtime = list->data; 74 ConfigNode *runtime = list->data;
75 sstr_t tmp = cfg_directivelist_get_str(runtime->directives, sstr("Temp")); 75 scstr_t tmp = serverconfig_directive_value(runtime, SC("Temp"));
76
77 ucx_list_free(list);
78
76 if(!tmp.ptr) { 79 if(!tmp.ptr) {
77 fprintf(stderr, "Error: No Temp directive in Runtime Object\n"); 80 fprintf(stderr, "Error: No Temp directive in Runtime Object\n");
78 return -1; 81 return -1;
79 } 82 }
80 83

mercurial