secgateway/Platform/user/configm/config-test/configtest.c

40 lines
942 B
C
Raw Normal View History

#include <stdlib.h>
#include <stdio.h>
#include "rpc.h"
#include "configm.h"
#include "ipconfig.h"
int main(int argc, char **argv)
{
FILE *f = fopen("configtest","r+");
char config_linebuf[512];
char* output = NULL;
int output_len;
ret_code code;
if(f == NULL)
{
printf("OPEN CONFIG test file FALID\n");
return EXIT_FAILURE;
}
memset(config_linebuf, 0, sizeof(config_linebuf));
while(fgets(config_linebuf, 512, f) != NULL)
{
printf("configure: %s\n", config_linebuf);
code = web_config_exec_sync(CM_CONFIG_GET, IPCONFIG_V4,
config_linebuf, strlen(config_linebuf) + 1, &output, &output_len);
printf("call config type retturn:%s,result:%s\n", rpc_code_format(code), output);
memset(config_linebuf, 0, sizeof(config_linebuf));
}
fclose(f);
return EXIT_SUCCESS;
}