From 58912f68c2489bcee787599837447e0d64dfd61a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 24 May 2017 21:03:56 +0200 Subject: New upstream version 1.0.27 --- sanei/sanei_init_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sanei/sanei_init_debug.c') diff --git a/sanei/sanei_init_debug.c b/sanei/sanei_init_debug.c index bb5b755..0abb891 100644 --- a/sanei/sanei_init_debug.c +++ b/sanei/sanei_init_debug.c @@ -72,7 +72,7 @@ * instead, so the debugging env var name matches the docs. * This is a particular problem in Turkish, where 'i' does * not capitalize to 'I' */ -char +static char toupper_ascii (int c) { if(c > 0x60 && c < 0x7b) -- cgit v1.2.3 From 1687222e1b9e74c89cafbb5910e72d8ec7bfd40f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 31 Jul 2019 16:59:49 +0200 Subject: New upstream version 1.0.28 --- sanei/sanei_init_debug.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'sanei/sanei_init_debug.c') diff --git a/sanei/sanei_init_debug.c b/sanei/sanei_init_debug.c index 0abb891..946aee9 100644 --- a/sanei/sanei_init_debug.c +++ b/sanei/sanei_init_debug.c @@ -107,16 +107,31 @@ sanei_init_debug (const char * backend, int * var) DBG (0, "Setting debug level of %s to %d.\n", backend, *var); } +static int +is_socket (int fd) +{ + struct stat sbuf; + + if (fstat(fd, &sbuf) == -1) return 0; + +#if defined(S_ISSOCK) + return S_ISSOCK(sbuf.st_mode); +#elif defined (S_IFMT) && defined(S_IFMT) + return (sbuf.st_mode & S_IFMT) == S_IFSOCK; +#else + return 0; +#endif +} + void sanei_debug_msg (int level, int max_level, const char *be, const char *fmt, va_list ap) { char *msg; - + if (max_level >= level) { -#ifdef S_IFSOCK - if ( 1 == isfdtype(fileno(stderr), S_IFSOCK) ) + if (is_socket(fileno(stderr))) { msg = (char *)malloc (sizeof(char) * (strlen(be) + strlen(fmt) + 4)); if (msg == NULL) @@ -132,12 +147,11 @@ sanei_debug_msg } } else -#endif { fprintf (stderr, "[%s] ", be); vfprintf (stderr, fmt, ap); } - + } } -- cgit v1.2.3 From ffa8801644a7d53cc1c785e3450f794c07a14eb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 2 Feb 2020 17:13:01 +0100 Subject: New upstream version 1.0.29 --- sanei/sanei_init_debug.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'sanei/sanei_init_debug.c') diff --git a/sanei/sanei_init_debug.c b/sanei/sanei_init_debug.c index 946aee9..3cde74e 100644 --- a/sanei/sanei_init_debug.c +++ b/sanei/sanei_init_debug.c @@ -58,6 +58,8 @@ #include #endif #include +#include +#include #ifdef HAVE_OS2_H # define INCL_DOS @@ -148,7 +150,13 @@ sanei_debug_msg } else { - fprintf (stderr, "[%s] ", be); + struct timeval tv; + struct tm *t; + + gettimeofday (&tv, NULL); + t = localtime (&tv.tv_sec); + + fprintf (stderr, "[%02d:%02d:%02d.%06ld] [%s] ", t->tm_hour, t->tm_min, t->tm_sec, tv.tv_usec, be); vfprintf (stderr, fmt, ap); } -- cgit v1.2.3