--- mqtt/src/utils.c 2012/01/27 15:05:38 1.2 +++ mqtt/src/utils.c 2012/04/11 15:08:27 1.2.2.1 @@ -2,11 +2,11 @@ int -srv_Socket(sl_config * __restrict cfg) +srv_Socket(cfg_root_t * __restrict cfg) { int s = -1, n = 1; struct hostent *host; - char szStr[STRSIZ]; + ait_val_t v; u_short port; struct sockaddr_storage ss; struct sockaddr_in *sin = (struct sockaddr_in*) &ss; @@ -14,11 +14,13 @@ srv_Socket(sl_config * __restrict cfg) ioTRACE(2); - cfg_LoadAttribute(cfg, CFG("mqttd"), CFG("port"), CFG(szStr), sizeof szStr, MQTT_PORT); - port = strtol(szStr, NULL, 0); - cfg_LoadAttribute(cfg, CFG("mqttd"), CFG("listen"), CFG(szStr), sizeof szStr, MQTT_HOST); + cfg_loadAttribute(cfg, "mqttd", "port", &v, MQTT_PORT); + port = strtol(AIT_GET_STR(&v), NULL, 0); + AIT_FREE_VAL(&v); + cfg_loadAttribute(cfg, "mqttd", "listen", &v, MQTT_HOST); - host = gethostbyname(szStr); + host = gethostbyname(AIT_GET_STR(&v)); + AIT_FREE_VAL(&v); if (!host) { printf("Error:: resolver #%d - %s\n", h_errno, hstrerror(h_errno)); return -1;