/*
- Copyright (C) 2010-2011 jeanfi@gmail.com
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301 USA
-*/
-
+ * Copyright (C) 2010-2011 jeanfi@gmail.com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
#include <locale.h>
#include <libintl.h>
#define _(str) gettext(str)
int temp;
};
-char *hdd_fetch()
+static char *fetch()
{
int sockfd;
ssize_t n = 1;
sockfd = socket(AF_INET, SOCK_STREAM, 0);
if (sockfd == -1) {
- fprintf(stderr, _("ERROR: hdd_fetch, failed to open socket\n"));
+ fprintf(stderr, _("ERROR: hdd fetch, failed to open socket\n"));
return NULL;
}
(struct sockaddr *)&address,
(socklen_t) sizeof(address)) == -1) {
fprintf(stderr,
- _("ERROR: hdd_fetch, failed to open connection\n"));
+ _("ERROR: hdd fetch, failed to open connection\n"));
} else {
buffer = malloc(HDDTEMP_OUTPUT_BUFFER_LENGTH);
return buffer;
}
-int str_index(char *str, char d)
+static int str_index(char *str, char d)
{
char *c;
int i;
return -1;
}
-struct psensor *hdd_create_sensor(char *id, char *name, int values_max_length)
+static struct psensor *
+create_sensor(char *id, char *name, int values_max_length)
{
return psensor_create(id, name, SENSOR_TYPE_HDD_TEMP,
values_max_length);
}
-char *next_hdd_info(char *string, struct hdd_info *info)
+static char *next_hdd_info(char *string, struct hdd_info *info)
{
char *c;
int idx_name_n, i, temp;
struct psensor **hdd_psensor_list_add(struct psensor **sensors,
int values_max_length)
{
- char *hddtemp_output = hdd_fetch();
+ char *hddtemp_output = fetch();
char *c;
struct hdd_info info;
struct psensor **result;
strcpy(id, "hdd ");
strcat(id, info.name);
- sensor = hdd_create_sensor(id, info.name, values_max_length);
+ sensor = create_sensor(id, info.name, values_max_length);
tmp_sensors = psensor_list_add(result, sensor);
return result;
}
-void hdd_psensor_update(struct psensor **sensors, struct hdd_info *info)
+static void update(struct psensor **sensors, struct hdd_info *info)
{
struct psensor **sensor_cur = sensors;
void hdd_psensor_list_update(struct psensor **sensors)
{
- char *hddtemp_output = hdd_fetch();
+ char *hddtemp_output = fetch();
if (!hddtemp_output)
return;
while (c && (c = next_hdd_info(c, &info))) {
- hdd_psensor_update(sensors, &info);
+ update(sensors, &info);
free(info.name);
}