From: Jean-Philippe Orsini Date: Thu, 24 Apr 2014 18:29:07 +0000 (+0200) Subject: merged from plib X-Git-Tag: v1.0.1~48 X-Git-Url: https://git.wpitchoune.net/gitweb/?p=psensor.git;a=commitdiff_plain;h=8a73e67a25fc6035e4fabacaa20a65dee016d659 merged from plib --- diff --git a/NEWS.html b/NEWS.html index d35053d..cba5de7 100644 --- a/NEWS.html +++ b/NEWS.html @@ -394,6 +394,12 @@ smaller and more consistent with ubuntu themes appindicator icons. sensors displayed directly in the top bar.

+
  • +

    +improved status icon in hicolor theme to fit well with white + background. (LP: #1310323). +

    +
  • @@ -2517,7 +2523,7 @@ Fixed BR1: crash when no temperature sensor is available

    diff --git a/po/Makefile.in b/po/Makefile.in index 9da54e6..0ea07b3 100644 --- a/po/Makefile.in +++ b/po/Makefile.in @@ -34,12 +34,12 @@ INSTALL_DATA = ${INSTALL} -m 644 # We use $(mkdir_p). # In automake <= 1.9.x, $(mkdir_p) is defined either as "mkdir -p --" or as # "$(mkinstalldirs)" or as "$(install_sh) -d". For these automake versions, -# ${SHELL} /home/jporsini/work.local/psensor/install-sh does not start with $(SHELL), so we add it. +# ${SHELL} /home/jporsini/work/psensor/install-sh does not start with $(SHELL), so we add it. # In automake >= 1.10, /bin/mkdir -p is derived from ${MKDIR_P}, which is defined # either as "/path/to/mkdir -p" or ".../install-sh -c -d". For these automake # versions, $(mkinstalldirs) and $(install_sh) are unused. -mkinstalldirs = $(SHELL) ${SHELL} /home/jporsini/work.local/psensor/install-sh -d -install_sh = $(SHELL) ${SHELL} /home/jporsini/work.local/psensor/install-sh +mkinstalldirs = $(SHELL) ${SHELL} /home/jporsini/work/psensor/install-sh -d +install_sh = $(SHELL) ${SHELL} /home/jporsini/work/psensor/install-sh MKDIR_P = /bin/mkdir -p mkdir_p = /bin/mkdir -p diff --git a/po/POTFILES.in b/po/POTFILES.in index 3101cb6..abf0ea6 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -6,7 +6,7 @@ src/lib/cpu.c src/lib/hdd_atasmart.c src/lib/hdd_hddtemp.c src/lib/lmsensor.c -src/lib/log.c +src/lib/plog.c src/lib/nvidia.c src/lib/psensor.c src/lib/slog.c diff --git a/src/cfg.c b/src/cfg.c index 26c026c..a5014ff 100644 --- a/src/cfg.c +++ b/src/cfg.c @@ -22,7 +22,7 @@ #include #include "cfg.h" -#include "log.h" +#include static const char *KEY_SENSORS = "/apps/psensor/sensors"; diff --git a/src/graph.c b/src/graph.c index d8ca848..dec0a94 100644 --- a/src/graph.c +++ b/src/graph.c @@ -25,7 +25,7 @@ #include #include "cfg.h" -#include "log.h" +#include #include "psensor.h" /* horizontal padding */ diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index 03ffdc8..df0c5eb 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -7,7 +7,7 @@ libpsensor_a_SOURCES = \ cpu.h \ hdd.h hdd_hddtemp.c\ lmsensor.h lmsensor.c \ - log.h log.c \ + plog.h plog.c \ measure.h measure.c \ ptime.h ptime.c \ nvidia.h \ @@ -49,4 +49,4 @@ endif EXTRA_DIST=$(libpsensor_a_SOURCES) \ amd.c \ cpu.c \ - nvidia.c \ No newline at end of file + nvidia.c diff --git a/src/lib/Makefile.in b/src/lib/Makefile.in index d366e16..afac274 100644 --- a/src/lib/Makefile.in +++ b/src/lib/Makefile.in @@ -79,7 +79,7 @@ ARFLAGS = cru libpsensor_a_AR = $(AR) $(ARFLAGS) libpsensor_a_LIBADD = am__libpsensor_a_SOURCES_DIST = amd.h bool.h color.h color.c cpu.h \ - hdd.h hdd_hddtemp.c lmsensor.h lmsensor.c log.h log.c \ + hdd.h hdd_hddtemp.c lmsensor.h lmsensor.c plog.h plog.c \ measure.h measure.c ptime.h ptime.c nvidia.h psensor.h \ psensor.c pio.h pio.c slog.c slog.h url.c url.h hdd_atasmart.c \ nvidia.c amd.c cpu.c psensor_json.h psensor_json.c @@ -89,7 +89,7 @@ am__libpsensor_a_SOURCES_DIST = amd.h bool.h color.h color.c cpu.h \ @GTOP_TRUE@am__objects_4 = cpu.$(OBJEXT) @JSON_TRUE@am__objects_5 = psensor_json.$(OBJEXT) am_libpsensor_a_OBJECTS = color.$(OBJEXT) hdd_hddtemp.$(OBJEXT) \ - lmsensor.$(OBJEXT) log.$(OBJEXT) measure.$(OBJEXT) \ + lmsensor.$(OBJEXT) plog.$(OBJEXT) measure.$(OBJEXT) \ ptime.$(OBJEXT) psensor.$(OBJEXT) pio.$(OBJEXT) slog.$(OBJEXT) \ url.$(OBJEXT) $(am__objects_1) $(am__objects_2) \ $(am__objects_3) $(am__objects_4) $(am__objects_5) @@ -268,7 +268,7 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LIBRARIES = libpsensor.a libpsensor_a_SOURCES = amd.h bool.h color.h color.c cpu.h hdd.h \ - hdd_hddtemp.c lmsensor.h lmsensor.c log.h log.c measure.h \ + hdd_hddtemp.c lmsensor.h lmsensor.c plog.h plog.c measure.h \ measure.c ptime.h ptime.c nvidia.h psensor.h psensor.c pio.h \ pio.c slog.c slog.h url.c url.h $(am__append_1) \ $(am__append_4) $(am__append_7) $(am__append_8) \ @@ -334,10 +334,10 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hdd_atasmart.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hdd_hddtemp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lmsensor.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/measure.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nvidia.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plog.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/psensor.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/psensor_json.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ptime.Po@am__quote@ diff --git a/src/lib/hdd_atasmart.c b/src/lib/hdd_atasmart.c index 8da5c85..3606c8e 100644 --- a/src/lib/hdd_atasmart.c +++ b/src/lib/hdd_atasmart.c @@ -37,7 +37,7 @@ #include "pio.h" #include "hdd.h" -#include "log.h" +#include static int filter_sd(const char *p) { diff --git a/src/lib/log.c b/src/lib/log.c deleted file mode 100644 index 9df4629..0000000 --- a/src/lib/log.c +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (C) 2010-2014 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 - */ -#define _LARGEFILE_SOURCE 1 -#include "config.h" - -#include -#include -#define _(str) gettext(str) - -#include -#include -#include -#include -#include - -#include "log.h" -#include "ptime.h" - -static FILE *file; -int log_level = LOG_WARN; - -void log_open(const char *path) -{ - file = fopen(path, "a"); - - if (!file) - log_printf(LOG_ERR, _("Cannot open log file: %s"), path); -} - -void log_close() -{ - if (!file) - return ; - - fclose(file); - - file = NULL; -} - - -#define LOG_BUFFER 4096 -static void vlogf(int lvl, const char *fmt, va_list ap) -{ - char buffer[1 + LOG_BUFFER]; - char *lvl_str, *t; - FILE *stdf; - - if (lvl > LOG_INFO && (!file || lvl > log_level)) - return ; - - vsnprintf(buffer, LOG_BUFFER, fmt, ap); - buffer[LOG_BUFFER] = '\0'; - - switch (lvl) { - case LOG_WARN: - lvl_str = "[WARN]"; - break; - case LOG_ERR: - lvl_str = "[ERR]"; - break; - case LOG_DEBUG: - lvl_str = "[DEBUG]"; - break; - case LOG_INFO: - lvl_str = "[INFO]"; - break; - default: - lvl_str = "[??]"; - } - - t = get_time_str(); - if (!t) - return ; - - if (file && lvl <= log_level) { - fprintf(file, "[%s] %s %s\n", t, lvl_str, buffer); - fflush(file); - } else { - t = NULL; - } - - if (lvl <= LOG_INFO) { - if (lvl == LOG_WARN || lvl == LOG_ERR) - stdf = stderr; - else - stdf = stdout; - - - fprintf(stdf, "[%s] %s %s\n", t, lvl_str, buffer); - } - - free(t); -} - -void log_printf(int lvl, const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - vlogf(lvl, fmt, ap); - va_end(ap); -} - -void log_debug(const char *fmt, ...) -{ - va_list ap; - - if (log_level < LOG_DEBUG) - return ; - - va_start(ap, fmt); - vlogf(LOG_DEBUG, fmt, ap); - va_end(ap); -} - -void log_err(const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - vlogf(LOG_ERR, fmt, ap); - va_end(ap); -} - -void log_warn(const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - vlogf(LOG_WARN, fmt, ap); - va_end(ap); -} - -void log_info(const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - vlogf(LOG_INFO, fmt, ap); - va_end(ap); -} diff --git a/src/lib/log.h b/src/lib/log.h deleted file mode 100644 index 30a904b..0000000 --- a/src/lib/log.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2010-2014 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 - */ -#ifndef _PSENSOR_LOG_H_ -#define _PSENSOR_LOG_H_ - -enum log_level { - LOG_ERR , - LOG_WARN, - LOG_INFO, - LOG_DEBUG -}; - -void log_open(const char *path); - -void log_printf(int lvl, const char *fmt, ...); -void log_debug(const char *fmt, ...); -void log_err(const char *fmt, ...); -void log_info(const char *fmt, ...); -void log_warn(const char *fmt, ...); - -void log_close(); - -/* level of the log file. */ -extern int log_level; - -#endif diff --git a/src/lib/pio.c b/src/lib/pio.c index cf92139..b7d3839 100644 --- a/src/lib/pio.c +++ b/src/lib/pio.c @@ -19,25 +19,67 @@ #define _LARGEFILE_SOURCE 1 #include "config.h" -#include +#include +#include #include -#include +#include #include -#include +#include +#include + +#include +#include + +/* Directory separator is \ when cross-compiling for MS Windows + systems */ +#if defined(__MINGW32__) +#define DIRSEP ('\\') +#else +#define DIRSEP '/' +#endif -#include "pio.h" +#define FCOPY_BUF_SZ 4096 -static char *path_append(const char *dir, const char *path) +int is_dir(const char *path) { - char *result; + struct stat st; - result = malloc(strlen(dir) + 1 + strlen(path) + 1); + int ret = lstat(path, &st); - strcpy(result, dir); - strcat(result, "/"); - strcat(result, path); + if (ret == 0 && S_ISDIR(st.st_mode)) + return 1; - return result; + return 0; +} + +int is_file(const char *path) +{ + struct stat st; + + int ret = lstat(path, &st); + + if (ret == 0 && S_ISREG(st.st_mode)) + return 1; + + return 0; +} + +char *dir_normalize(const char *dpath) +{ + char *npath; + int n; + + if (!dpath || !strlen(dpath)) + return NULL; + + npath = strdup(dpath); + + n = strlen(npath); + + if (n > 1 && npath[n - 1] == '/') + npath[n - 1] = '\0'; + + return npath; } static char **paths_add(char **paths, int n, char *path) @@ -106,3 +148,254 @@ void paths_free(char **paths) free(paths); } + +char *file_get_content(const char *fpath) +{ + long size; + + char *page; + + size = file_get_size(fpath); + if (size == -1) { + page = NULL; + + } else if (size == 0) { + page = malloc(1); + *page = '\0'; + + } else { + FILE *fp = fopen(fpath, "rb"); + if (fp) { + page = malloc(size + 1); + if (!page || size != fread(page, 1, size, fp)) { + free(page); + return NULL; + } + + *(page + size) = '\0'; + + fclose(fp); + } else { + page = NULL; + } + } + + return page; +} + +long file_get_size(const char *path) +{ + FILE *fp; + + if (!is_file(path)) + return -1; + + fp = fopen(path, "rb"); + if (fp) { + long size; + + if (fseek(fp, 0, SEEK_END) == -1) + return -1; + + size = ftell(fp); + + fclose(fp); + + return size; + } + + return -1; +} + +#define FCOPY_BUF_SZ 4096 +static int FILE_copy(FILE *src, FILE *dst) +{ + int ret = 0; + char *buf = malloc(FCOPY_BUF_SZ); + int n; + + if (!buf) + return FILE_COPY_ERROR_ALLOC_BUFFER; + + while (!ret) { + n = fread(buf, 1, FCOPY_BUF_SZ, src); + if (n) { + if (fwrite(buf, 1, n, dst) != n) + ret = FILE_COPY_ERROR_WRITE; + } else { + if (!feof(src)) + ret = FILE_COPY_ERROR_READ; + else + break; + } + } + + free(buf); + + return ret; +} + +int +file_copy(const char *src, const char *dst) +{ + FILE *fsrc, *fdst; + int ret = 0; + + log_fct("copy %s to %s", src, dst); + + fsrc = fopen(src, "r"); + + if (fsrc) { + fdst = fopen(dst, "w+"); + + if (fdst) { + ret = FILE_copy(fsrc, fdst); + fclose(fdst); + } else { + ret = FILE_COPY_ERROR_OPEN_DST; + } + + fclose(fsrc); + } else { + ret = FILE_COPY_ERROR_OPEN_SRC; + } + + return ret; +} + +char *path_append(const char *dir, const char *path) +{ + char *ret, *ndir; + + ndir = dir_normalize(dir); + + if (!ndir && (!path || !strlen(path))) + ret = NULL; + + else if (!ndir) { + ret = strdup(path); + + } else if (!path || !strlen(path)) { + return ndir; + + } else { + ret = malloc(strlen(ndir) + 1 + strlen(path) + 1); + strcpy(ret, ndir); + strcat(ret, "/"); + strcat(ret, path); + } + + free(ndir); + + return ret; +} + +void mkdirs(const char *dirs, mode_t mode) +{ + char *c, *dir; + int i; + + log_fct("mkdirs %s", dirs); + + c = (char *)dirs; + dir = malloc(strlen(dirs) + 1); + + i = 0; + while (*c) { + if ((*c == DIRSEP || *c == '\0') && c != dirs) { + strncpy(dir, dirs, i); + dir[i] = '\0'; + mkdir(dir, mode); + } + + c++; + i++; + } + + mkdir(dirs, mode); + + free(dir); +} + +void +file_copy_print_error(int code, const char *src, const char *dst) +{ + switch (code) { + case 0: + break; + case FILE_COPY_ERROR_OPEN_SRC: + printf("File copy error: failed to open %s.\n", src); + break; + case FILE_COPY_ERROR_OPEN_DST: + printf("File copy error: failed to open %s.\n", dst); + break; + case FILE_COPY_ERROR_READ: + printf("File copy error: failed to read %s.\n", src); + break; + case FILE_COPY_ERROR_WRITE: + printf("File copy error: failed to write %s.\n", src); + break; + case FILE_COPY_ERROR_ALLOC_BUFFER: + printf("File copy error: failed to allocate buffer.\n"); + break; + default: + printf("File copy error: unknown error %d.\n", code); + } +} + +int dir_rcopy(const char *src, const char *dst) +{ + int ret; + char **paths; + FTS *ftsp; + FTSENT *p, *chp; + int fts_options = FTS_COMFOLLOW | FTS_LOGICAL | FTS_NOCHDIR; + char *p_dst, *n_dst; + + log_fct_enter(); + + log_fct("copy dir %s to %s", src, dst); + + paths = malloc(2 * sizeof(char *)); + paths[0] = strdup(src); + paths[1] = NULL; + + ftsp = fts_open(paths, fts_options, NULL); + if (!ftsp) + return 1; + + chp = fts_children(ftsp, 0); + if (!chp) + return 0; + + n_dst = dir_normalize(dst); + + while ((p = fts_read(ftsp)) != NULL) { + switch (p->fts_info) { + case FTS_D: + p_dst = path_append(n_dst, + p->fts_path + strlen(src) + 1); + mkdirs(p_dst, 0777); + free(p_dst); + break; + case FTS_F: + p_dst = path_append(n_dst, + p->fts_path + strlen(src) + 1); + file_copy(p->fts_path, p_dst); + free(p_dst); + break; + default: + break; + } + } + fts_close(ftsp); + + free(n_dst); + free(paths); + + ret = 0; + + log_fct_exit(); + + return ret; +} diff --git a/src/lib/pio.h b/src/lib/pio.h index 808a0cc..26867f8 100644 --- a/src/lib/pio.h +++ b/src/lib/pio.h @@ -1,25 +1,77 @@ /* - * Copyright (C) 2010-2014 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-2014 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 +*/ + #ifndef _P_IO_H #define _P_IO_H +#define P_IO_VER 3 + +/* Returns '1' if a given 'path' denotates a directory else returns + 0 */ +int is_dir(const char *path); + +/* Returns '1' if a given 'path' denotates a file else returns + 0 */ +int is_file(const char *path); + +/* Returns a normalized path */ +char *path_normalize(const char *dpath); + +/* Returns the null-terminated entries of a directory */ char **dir_list(const char *dpath, int (*filter) (const char *path)); void paths_free(char **paths); +char *path_append(const char *dir, const char *path); + +/* + Returns the size of a file. + Returns '-1' if the size cannot be retrieved or not a file. +*/ +long file_get_size(const char *path); + +/* + Returns the content of a file. + Returns 'NULL' if the file cannot be read or failed to allocate + enough memory. + Returns an empty string if the file exists but is empty. +*/ +char *file_get_content(const char *path); + +enum file_copy_error { + FILE_COPY_ERROR_OPEN_SRC = 1, + FILE_COPY_ERROR_OPEN_DST, + FILE_COPY_ERROR_READ, + FILE_COPY_ERROR_WRITE, + FILE_COPY_ERROR_ALLOC_BUFFER +}; + +void file_copy_print_error(int code, const char *src, const char *dst); + +/* + Copy a file. + + Returns '0' if sucessfull, otherwise return the error code. +*/ +int file_copy(const char *src, const char *dst); + +int dir_rcopy(const char *, const char *); + +void mkdirs(const char *dirs, mode_t mode); + #endif diff --git a/src/lib/plog.c b/src/lib/plog.c new file mode 100644 index 0000000..21427a9 --- /dev/null +++ b/src/lib/plog.c @@ -0,0 +1,173 @@ +/* + * Copyright (C) 2010-2014 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 + */ +#define _LARGEFILE_SOURCE 1 +#include "config.h" + +#include +#include +#define _(str) gettext(str) + +#include +#include +#include +#include +#include + +#include +#include + +static FILE *file; +int log_level = LOG_WARN; + +void log_open(const char *path) +{ + file = fopen(path, "a"); + + if (!file) + log_printf(LOG_ERR, _("Cannot open log file: %s"), path); +} + +void log_close() +{ + if (!file) + return ; + + fclose(file); + + file = NULL; +} + + +#define LOG_BUFFER 4096 +static void vlogf(int lvl, const char *fct, const char *fmt, va_list ap) +{ + char buffer[1 + LOG_BUFFER]; + char *lvl_str, *t; + FILE *stdf; + + if (lvl > LOG_INFO && (!file || lvl > log_level)) + return ; + + vsnprintf(buffer, LOG_BUFFER, fmt, ap); + buffer[LOG_BUFFER] = '\0'; + + switch (lvl) { + case LOG_WARN: + lvl_str = "[WARN]"; + break; + case LOG_ERR: + lvl_str = "[ERR]"; + break; + case LOG_DEBUG: + lvl_str = "[DEBUG]"; + break; + case LOG_INFO: + lvl_str = "[INFO]"; + break; + default: + lvl_str = "[??]"; + } + + t = get_current_ISO8601_time(); + if (!t) + return ; + + if (file && lvl <= log_level) { + if (fct) + fprintf(file, + "[%s] %s %s(): %s\n", t, lvl_str, fct, buffer); + else + fprintf(file, "[%s] %s %s\n", t, lvl_str, buffer); + fflush(file); + } else { + t = NULL; + } + + if (lvl <= LOG_INFO) { + if (lvl == LOG_WARN || lvl == LOG_ERR) + stdf = stderr; + else + stdf = stdout; + + if (fct) + fprintf(file, + "[%s] %s %s(): %s\n", t, lvl_str, fct, buffer); + else + fprintf(stdf, "[%s] %s %s\n", t, lvl_str, buffer); + } + + free(t); +} + +void log_printf(int lvl, const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + vlogf(lvl, NULL, fmt, ap); + va_end(ap); +} + +void log_debug(const char *fmt, ...) +{ + va_list ap; + + if (log_level < LOG_DEBUG) + return ; + + va_start(ap, fmt); + vlogf(LOG_DEBUG, NULL, fmt, ap); + va_end(ap); +} + +void log_err(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + vlogf(LOG_ERR, NULL, fmt, ap); + va_end(ap); +} + +void log_warn(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + vlogf(LOG_WARN, NULL, fmt, ap); + va_end(ap); +} + +void log_info(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + vlogf(LOG_INFO, NULL, fmt, ap); + va_end(ap); +} + +void _log(const char *fct, const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + vlogf(LOG_DEBUG, fct, fmt, ap); + va_end(ap); +} diff --git a/src/lib/plog.h b/src/lib/plog.h new file mode 100644 index 0000000..29880e9 --- /dev/null +++ b/src/lib/plog.h @@ -0,0 +1,49 @@ +/* + Copyright (C) 2010-2014 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 + */ +#ifndef _P_LOG_H_ +#define _P_LOG_H_ + +#define P_LOG_VER 2 + +enum log_level { + LOG_ERR , + LOG_WARN, + LOG_INFO, + LOG_DEBUG +}; + +void log_open(const char *path); +void log_close(); + +void log_printf(int lvl, const char *fmt, ...); +void log_debug(const char *fmt, ...); +void log_err(const char *fmt, ...); +void log_info(const char *fmt, ...); +void log_warn(const char *fmt, ...); + +void _log(const char *fct, const char *fmt, ...); + +#define log_fct(...) _log(__func__, __VA_ARGS__) +#define log_fct_enter() log_fct("ENTER") +#define log_fct_exit() log_fct("EXIT") + +/* level of the log file. */ +extern int log_level; + +#endif diff --git a/src/lib/psensor.h b/src/lib/psensor.h index 292525a..9509c0d 100644 --- a/src/lib/psensor.h +++ b/src/lib/psensor.h @@ -28,7 +28,7 @@ #include "bool.h" #include "color.h" -#include "log.h" +#include #include "measure.h" enum psensor_type { diff --git a/src/lib/ptime.c b/src/lib/ptime.c index 95c3342..2c06c7c 100644 --- a/src/lib/ptime.c +++ b/src/lib/ptime.c @@ -1,36 +1,74 @@ /* - * Copyright (C) 2010-2014 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-2014 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 +#include + +#include + +const int P_TIME_VER = 2; + +static const int ISO8601_TIME_LENGTH = 19; /* YYYY-MM-DDThh:mm:ss */ +static const int ISO8601_DATE_LENGTH = 10; /* YYYY-MM-DD */ + +char *time_to_ISO8601_time(time_t *t) +{ + struct tm lt; -#include "ptime.h" + memset(<, 0, sizeof(struct tm)); + if (!gmtime_r(t, <)) + return NULL; -char *time_to_str(time_t *t) + return tm_to_ISO8601_time(<); +} + +char *time_to_ISO8601_date(time_t *t) { struct tm lt; + + memset(<, 0, sizeof(struct tm)); + if (!gmtime_r(t, <)) + return NULL; + + return tm_to_ISO8601_date(<); +} + +char *tm_to_ISO8601_date(struct tm *tm) +{ char *str; - if (!localtime_r(t, <)) + str = malloc(ISO8601_DATE_LENGTH + 1); + + if (strftime(str, ISO8601_DATE_LENGTH + 1, "%F", tm)) { + return str; + } else { + free(str); return NULL; + } +} + +char *tm_to_ISO8601_time(struct tm *tm) +{ + char *str; - str = malloc(64); + str = malloc(ISO8601_TIME_LENGTH + 1); - if (strftime(str, 64, "%s", <)) { + if (strftime(str, ISO8601_TIME_LENGTH + 1, "%FT%T", tm)) { return str; } else { free(str); @@ -38,10 +76,10 @@ char *time_to_str(time_t *t) } } -char *get_time_str() +char *get_current_ISO8601_time() { time_t t; t = time(NULL); - return time_to_str(&t); + return time_to_ISO8601_time(&t); } diff --git a/src/lib/ptime.h b/src/lib/ptime.h index 63e1e80..eac7342 100644 --- a/src/lib/ptime.h +++ b/src/lib/ptime.h @@ -21,7 +21,14 @@ #include -char *get_time_str(); -char *time_to_str(time_t *t); +extern const int P_TIME_VER; + +char *get_current_ISO8601_time(); + +char *time_to_ISO8601_time(time_t *); +char *time_to_ISO8601_date(time_t *); + +char *tm_to_ISO8601_date(struct tm *); +char *tm_to_ISO8601_time(struct tm *); #endif diff --git a/src/lib/slog.c b/src/lib/slog.c index cb2b124..99eb536 100644 --- a/src/lib/slog.c +++ b/src/lib/slog.c @@ -33,7 +33,7 @@ #include "bool.h" #include "config.h" -#include "log.h" +#include #include "ptime.h" #include "slog.h" @@ -47,6 +47,24 @@ static time_t st; static const char *DEFAULT_FILENAME = "sensors.log"; +static char *time_to_str(time_t *t) +{ + struct tm lt; + char *str; + + if (!localtime_r(t, <)) + return NULL; + + str = malloc(64); + + if (strftime(str, 64, "%s", <)) { + return str; + } else { + free(str); + return NULL; + } +} + static char *get_default_path() { char *home, *path, *dir; diff --git a/src/server/server.c b/src/server/server.c index f4557d8..55649b8 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -42,7 +42,7 @@ #include "cpu.h" #endif -#include "log.h" +#include #include "psensor_json.h" #include "url.h" #include "server.h" diff --git a/src/ui_appindicator.c b/src/ui_appindicator.c index 4b4f9d6..e07ce70 100644 --- a/src/ui_appindicator.c +++ b/src/ui_appindicator.c @@ -172,23 +172,19 @@ static GtkWidget *get_menu(struct ui_psensor *ui) return GTK_WIDGET(menu); } -void ui_appindicator_update(struct ui_psensor *ui, unsigned int attention) +static void update_label(struct ui_psensor *ui) { - AppIndicatorStatus status; - char *label, *str, *tmp; + char *label, *str, *tmp, *guide; struct psensor **p; - if (!indicator) - return; - - status = app_indicator_get_status(indicator); - p = ui_get_sensors_ordered_by_position(ui); label = NULL; + guide = NULL; while (*p) { if (config_is_appindicator_label_enabled((*p)->id)) { str = psensor_current_value_to_str (*p, ui->config->temperature_unit == CELCIUS); + if (label == NULL) { label = str; } else { @@ -201,11 +197,45 @@ void ui_appindicator_update(struct ui_psensor *ui, unsigned int attention) free(str); label = tmp; } + + if (is_temp_type((*p)->type)) + str = "999UUU"; + else if (is_fan_type((*p)->type)) + str = "999UUU"; + else /* cpu load */ + str = "999%"; + + if (guide == NULL) { + guide = strdup(str); + } else { + tmp = malloc(strlen(guide) + + 1 + + strlen(str) + + 1); + sprintf(tmp, "%sW%s", guide, str); + free(guide); + guide = tmp; + } + } p++; } + printf("%s\n", label); + printf("%s\n", guide); + + app_indicator_set_label(indicator, label, guide); +} - app_indicator_set_label(indicator, label, NULL); +void ui_appindicator_update(struct ui_psensor *ui, unsigned int attention) +{ + AppIndicatorStatus status; + + if (!indicator) + return; + + update_label(ui); + + status = app_indicator_get_status(indicator); if (!attention && status == APP_INDICATOR_STATUS_ATTENTION) app_indicator_set_status(indicator, diff --git a/src/ui_status.c b/src/ui_status.c index ddaf75c..60814d6 100644 --- a/src/ui_status.c +++ b/src/ui_status.c @@ -16,7 +16,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301 USA */ -#include "log.h" +#include #include "ui_status.h" static const char *ICON = "psensor_normal"; diff --git a/tests/Makefile.am b/tests/Makefile.am index 554305d..332c0a2 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -29,7 +29,9 @@ endif test_io_dir_list_SOURCES = test_io_dir_list.c test_psensor_type_to_unit_str_SOURCES = test_psensor_type_to_unit_str.c +test_psensor_type_to_unit_str_CFLAGS = -I$(top_srcdir)/src/lib test_psensor_value_to_str_SOURCES = test_psensor_value_to_str.c +test_psensor_value_to_str_CFLAGS = -I$(top_srcdir)/src/lib test_url_encode_SOURCES = test_url_encode.c test_url_normalize_SOURCES = test_url_normalize.c @@ -41,4 +43,4 @@ TESTS = test-io-dir-list.sh \ if CPPCHECK TESTS += test-cppcheck.sh -endif \ No newline at end of file +endif diff --git a/tests/Makefile.in b/tests/Makefile.in index fa88ff7..d94f08e 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -73,16 +73,21 @@ CONFIG_CLEAN_VPATH_FILES = am_test_io_dir_list_OBJECTS = test_io_dir_list.$(OBJEXT) test_io_dir_list_OBJECTS = $(am_test_io_dir_list_OBJECTS) test_io_dir_list_LDADD = $(LDADD) -am_test_psensor_type_to_unit_str_OBJECTS = \ - test_psensor_type_to_unit_str.$(OBJEXT) +am_test_psensor_type_to_unit_str_OBJECTS = test_psensor_type_to_unit_str-test_psensor_type_to_unit_str.$(OBJEXT) test_psensor_type_to_unit_str_OBJECTS = \ $(am_test_psensor_type_to_unit_str_OBJECTS) test_psensor_type_to_unit_str_LDADD = $(LDADD) +test_psensor_type_to_unit_str_LINK = $(CCLD) \ + $(test_psensor_type_to_unit_str_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ am_test_psensor_value_to_str_OBJECTS = \ - test_psensor_value_to_str.$(OBJEXT) + test_psensor_value_to_str-test_psensor_value_to_str.$(OBJEXT) test_psensor_value_to_str_OBJECTS = \ $(am_test_psensor_value_to_str_OBJECTS) test_psensor_value_to_str_LDADD = $(LDADD) +test_psensor_value_to_str_LINK = $(CCLD) \ + $(test_psensor_value_to_str_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ am_test_url_encode_OBJECTS = test_url_encode.$(OBJEXT) test_url_encode_OBJECTS = $(am_test_url_encode_OBJECTS) test_url_encode_LDADD = $(LDADD) @@ -276,7 +281,9 @@ EXTRA_DIST = checkpatch.pl \ AM_CPPFLAGS = -Wall -Werror test_io_dir_list_SOURCES = test_io_dir_list.c test_psensor_type_to_unit_str_SOURCES = test_psensor_type_to_unit_str.c +test_psensor_type_to_unit_str_CFLAGS = -I$(top_srcdir)/src/lib test_psensor_value_to_str_SOURCES = test_psensor_value_to_str.c +test_psensor_value_to_str_CFLAGS = -I$(top_srcdir)/src/lib test_url_encode_SOURCES = test_url_encode.c test_url_normalize_SOURCES = test_url_normalize.c all: all-am @@ -321,10 +328,10 @@ test-io-dir-list$(EXEEXT): $(test_io_dir_list_OBJECTS) $(test_io_dir_list_DEPEND $(LINK) $(test_io_dir_list_OBJECTS) $(test_io_dir_list_LDADD) $(LIBS) test-psensor-type-to-unit-str$(EXEEXT): $(test_psensor_type_to_unit_str_OBJECTS) $(test_psensor_type_to_unit_str_DEPENDENCIES) $(EXTRA_test_psensor_type_to_unit_str_DEPENDENCIES) @rm -f test-psensor-type-to-unit-str$(EXEEXT) - $(LINK) $(test_psensor_type_to_unit_str_OBJECTS) $(test_psensor_type_to_unit_str_LDADD) $(LIBS) + $(test_psensor_type_to_unit_str_LINK) $(test_psensor_type_to_unit_str_OBJECTS) $(test_psensor_type_to_unit_str_LDADD) $(LIBS) test-psensor-value-to-str$(EXEEXT): $(test_psensor_value_to_str_OBJECTS) $(test_psensor_value_to_str_DEPENDENCIES) $(EXTRA_test_psensor_value_to_str_DEPENDENCIES) @rm -f test-psensor-value-to-str$(EXEEXT) - $(LINK) $(test_psensor_value_to_str_OBJECTS) $(test_psensor_value_to_str_LDADD) $(LIBS) + $(test_psensor_value_to_str_LINK) $(test_psensor_value_to_str_OBJECTS) $(test_psensor_value_to_str_LDADD) $(LIBS) test-url-encode$(EXEEXT): $(test_url_encode_OBJECTS) $(test_url_encode_DEPENDENCIES) $(EXTRA_test_url_encode_DEPENDENCIES) @rm -f test-url-encode$(EXEEXT) $(LINK) $(test_url_encode_OBJECTS) $(test_url_encode_LDADD) $(LIBS) @@ -339,8 +346,8 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_io_dir_list.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_psensor_type_to_unit_str.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_psensor_value_to_str.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_psensor_type_to_unit_str-test_psensor_type_to_unit_str.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_psensor_value_to_str-test_psensor_value_to_str.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_url_encode.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_url_normalize.Po@am__quote@ @@ -358,6 +365,34 @@ distclean-compile: @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` +test_psensor_type_to_unit_str-test_psensor_type_to_unit_str.o: test_psensor_type_to_unit_str.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_psensor_type_to_unit_str_CFLAGS) $(CFLAGS) -MT test_psensor_type_to_unit_str-test_psensor_type_to_unit_str.o -MD -MP -MF $(DEPDIR)/test_psensor_type_to_unit_str-test_psensor_type_to_unit_str.Tpo -c -o test_psensor_type_to_unit_str-test_psensor_type_to_unit_str.o `test -f 'test_psensor_type_to_unit_str.c' || echo '$(srcdir)/'`test_psensor_type_to_unit_str.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/test_psensor_type_to_unit_str-test_psensor_type_to_unit_str.Tpo $(DEPDIR)/test_psensor_type_to_unit_str-test_psensor_type_to_unit_str.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_psensor_type_to_unit_str.c' object='test_psensor_type_to_unit_str-test_psensor_type_to_unit_str.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_psensor_type_to_unit_str_CFLAGS) $(CFLAGS) -c -o test_psensor_type_to_unit_str-test_psensor_type_to_unit_str.o `test -f 'test_psensor_type_to_unit_str.c' || echo '$(srcdir)/'`test_psensor_type_to_unit_str.c + +test_psensor_type_to_unit_str-test_psensor_type_to_unit_str.obj: test_psensor_type_to_unit_str.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_psensor_type_to_unit_str_CFLAGS) $(CFLAGS) -MT test_psensor_type_to_unit_str-test_psensor_type_to_unit_str.obj -MD -MP -MF $(DEPDIR)/test_psensor_type_to_unit_str-test_psensor_type_to_unit_str.Tpo -c -o test_psensor_type_to_unit_str-test_psensor_type_to_unit_str.obj `if test -f 'test_psensor_type_to_unit_str.c'; then $(CYGPATH_W) 'test_psensor_type_to_unit_str.c'; else $(CYGPATH_W) '$(srcdir)/test_psensor_type_to_unit_str.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/test_psensor_type_to_unit_str-test_psensor_type_to_unit_str.Tpo $(DEPDIR)/test_psensor_type_to_unit_str-test_psensor_type_to_unit_str.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_psensor_type_to_unit_str.c' object='test_psensor_type_to_unit_str-test_psensor_type_to_unit_str.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_psensor_type_to_unit_str_CFLAGS) $(CFLAGS) -c -o test_psensor_type_to_unit_str-test_psensor_type_to_unit_str.obj `if test -f 'test_psensor_type_to_unit_str.c'; then $(CYGPATH_W) 'test_psensor_type_to_unit_str.c'; else $(CYGPATH_W) '$(srcdir)/test_psensor_type_to_unit_str.c'; fi` + +test_psensor_value_to_str-test_psensor_value_to_str.o: test_psensor_value_to_str.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_psensor_value_to_str_CFLAGS) $(CFLAGS) -MT test_psensor_value_to_str-test_psensor_value_to_str.o -MD -MP -MF $(DEPDIR)/test_psensor_value_to_str-test_psensor_value_to_str.Tpo -c -o test_psensor_value_to_str-test_psensor_value_to_str.o `test -f 'test_psensor_value_to_str.c' || echo '$(srcdir)/'`test_psensor_value_to_str.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/test_psensor_value_to_str-test_psensor_value_to_str.Tpo $(DEPDIR)/test_psensor_value_to_str-test_psensor_value_to_str.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_psensor_value_to_str.c' object='test_psensor_value_to_str-test_psensor_value_to_str.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_psensor_value_to_str_CFLAGS) $(CFLAGS) -c -o test_psensor_value_to_str-test_psensor_value_to_str.o `test -f 'test_psensor_value_to_str.c' || echo '$(srcdir)/'`test_psensor_value_to_str.c + +test_psensor_value_to_str-test_psensor_value_to_str.obj: test_psensor_value_to_str.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_psensor_value_to_str_CFLAGS) $(CFLAGS) -MT test_psensor_value_to_str-test_psensor_value_to_str.obj -MD -MP -MF $(DEPDIR)/test_psensor_value_to_str-test_psensor_value_to_str.Tpo -c -o test_psensor_value_to_str-test_psensor_value_to_str.obj `if test -f 'test_psensor_value_to_str.c'; then $(CYGPATH_W) 'test_psensor_value_to_str.c'; else $(CYGPATH_W) '$(srcdir)/test_psensor_value_to_str.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/test_psensor_value_to_str-test_psensor_value_to_str.Tpo $(DEPDIR)/test_psensor_value_to_str-test_psensor_value_to_str.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test_psensor_value_to_str.c' object='test_psensor_value_to_str-test_psensor_value_to_str.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_psensor_value_to_str_CFLAGS) $(CFLAGS) -c -o test_psensor_value_to_str-test_psensor_value_to_str.obj `if test -f 'test_psensor_value_to_str.c'; then $(CYGPATH_W) 'test_psensor_value_to_str.c'; else $(CYGPATH_W) '$(srcdir)/test_psensor_value_to_str.c'; fi` + ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \