- if (strncmp(buf1, "/dev/", 5)) {
- strncpy(buf1 + 5, buf1, 32 - 5);
- strncpy(buf1, "/dev/", 5);
+static void add_hddtemp_info(char *dev, short temp, char unit)
+{
+ struct hdd_info *hdi = &hdd_info_head;
+
+ DBGP("add_hddtemp_info(%s, %d, %c) being called", dev, temp, unit);
+ while (hdi->next)
+ hdi = hdi->next;
+
+ hdi->next = malloc(sizeof(struct hdd_info));
+ memset(hdi->next, 0, sizeof(struct hdd_info));
+ hdi->next->dev = strdup(dev);
+ hdi->next->temp = temp;
+ hdi->next->unit = unit;
+}
+
+static char *fetch_hddtemp_output(void)
+{
+ int sockfd;
+ const char *dst_host, *dst_port;
+ char *buf = NULL;
+ int buflen, offset = 0, rlen;
+ struct addrinfo hints, *result, *rp;
+ int i;
+
+ dst_host = hddtemp_host ? hddtemp_host : DEFAULT_HOST;
+ dst_port = hddtemp_port ? hddtemp_port : DEFAULT_PORT;
+
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = AF_INET; /* XXX: hddtemp has no ipv6 support (yet?) */
+ hints.ai_socktype = SOCK_STREAM;
+
+ if ((i = getaddrinfo(dst_host, dst_port, &hints, &result))) {
+ NORM_ERR("getaddrinfo(): %s", gai_strerror(i));
+ return NULL;