diff options
author | Martin Wilke <miwi@FreeBSD.org> | 2010-07-12 03:15:52 +0000 |
---|---|---|
committer | Martin Wilke <miwi@FreeBSD.org> | 2010-07-12 03:15:52 +0000 |
commit | ae61f5a2643c40ee46e6bb7e8c609aa3ffa57fa8 (patch) | |
tree | a01a0326276cfb0b1e4685cb6f23311d821ebf51 /sysutils/conky | |
parent | d577018019385846190dc0ffb17293cad2a7538f (diff) | |
download | ports-ae61f5a2643c40ee46e6bb7e8c609aa3ffa57fa8.tar.gz ports-ae61f5a2643c40ee46e6bb7e8c609aa3ffa57fa8.zip |
Notes
Diffstat (limited to 'sysutils/conky')
44 files changed, 1868 insertions, 158 deletions
diff --git a/sysutils/conky/Makefile b/sysutils/conky/Makefile index 9fd6cdf8a86f..60aac1810bdc 100644 --- a/sysutils/conky/Makefile +++ b/sysutils/conky/Makefile @@ -6,8 +6,7 @@ # PORTNAME= conky -PORTVERSION= 1.7.2 -PORTREVISION= 7 +PORTVERSION= 1.8.0 CATEGORIES= sysutils MASTER_SITES= SF @@ -40,6 +39,7 @@ OPTIONS+= APCUPSD "Enable APCUPSD support" Off \ AUDACIOUS "Enable Audacious support" Off \ BMPX "Enable BMPX support" Off \ MPD "Enable MPD support" Off \ + NCURSES "Enable ncurses support" Off \ RSS "Enable RSS support" Off \ METAR "Enable METAR Weather support" Off \ XOAP "Enable XOAP Weather support" Off \ @@ -115,6 +115,12 @@ BUILD_DEPENDS+= tolua++-5.1:${PORTSDIR}/lang/tolua++ CONFIGURE_ARGS+= --enable-lua-imlib2 .endif +.if defined(WITH_NCURSES) +CONFIGURE_ARGS+= --enable-ncurses +.else +CONFIGURE_ARGS+= --disable-ncurses +.endif + .if defined(WITH_XFT) LIB_DEPENDS+= Xft.2:${PORTSDIR}/x11-fonts/libXft CONFIGURE_ARGS+= --enable-xft diff --git a/sysutils/conky/distinfo b/sysutils/conky/distinfo index f8ad55fa1043..a4990f9bad35 100644 --- a/sysutils/conky/distinfo +++ b/sysutils/conky/distinfo @@ -1,3 +1,3 @@ -MD5 (conky-1.7.2.tar.bz2) = cf6f5d45d42ad68c618c00271813b80d -SHA256 (conky-1.7.2.tar.bz2) = b3c0a1b0ff90579d48df542a6070adbe67d3926d6d0c66ee12b52b2d5a2c675c -SIZE (conky-1.7.2.tar.bz2) = 585099 +MD5 (conky-1.8.0.tar.bz2) = 494cbaf1108cfdb977fc80454d9b13e2 +SHA256 (conky-1.8.0.tar.bz2) = badb3824a9655eee90281939df8bdb3ca95cf8bab03269b3b3775bfea2ed0a51 +SIZE (conky-1.8.0.tar.bz2) = 610545 diff --git a/sysutils/conky/files/patch-configure b/sysutils/conky/files/patch-configure index cebc6f7c9049..7d02cd40a805 100644 --- a/sysutils/conky/files/patch-configure +++ b/sysutils/conky/files/patch-configure @@ -1,37 +1,81 @@ ---- configure.orig -+++ configure -@@ -12805,7 +12805,7 @@ +--- configure.orig 2010-05-01 05:57:07.000000000 +0300 ++++ configure 2010-05-01 06:00:45.000000000 +0300 +@@ -11233,12 +11233,12 @@ + pkg_cv_Audacious_CFLAGS="$Audacious_CFLAGS" + else + if test -n "$PKG_CONFIG" && \ +- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"audacious >= 1.4.0 dbus-glib-1 glib-2.0 gobject-2.0\""; } >&5 +- ($PKG_CONFIG --exists --print-errors "audacious >= 1.4.0 dbus-glib-1 glib-2.0 gobject-2.0") 2>&5 ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"audacious >= 1.4.0 audclient dbus-glib-1 glib-2.0 gobject-2.0\""; } >&5 ++ ($PKG_CONFIG --exists --print-errors "audacious >= 1.4.0 audclient dbus-glib-1 glib-2.0 gobject-2.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then +- pkg_cv_Audacious_CFLAGS=`$PKG_CONFIG --cflags "audacious >= 1.4.0 dbus-glib-1 glib-2.0 gobject-2.0" 2>/dev/null` ++ pkg_cv_Audacious_CFLAGS=`$PKG_CONFIG --cflags "audacious >= 1.4.0 audclient dbus-glib-1 glib-2.0 gobject-2.0" 2>/dev/null` + else + pkg_failed=yes + fi +@@ -11251,12 +11251,12 @@ + pkg_cv_Audacious_LIBS="$Audacious_LIBS" + else + if test -n "$PKG_CONFIG" && \ +- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"audacious >= 1.4.0 dbus-glib-1 glib-2.0 gobject-2.0\""; } >&5 +- ($PKG_CONFIG --exists --print-errors "audacious >= 1.4.0 dbus-glib-1 glib-2.0 gobject-2.0") 2>&5 ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"audacious >= 1.4.0 audclient dbus-glib-1 glib-2.0 gobject-2.0\""; } >&5 ++ ($PKG_CONFIG --exists --print-errors "audacious >= 1.4.0 audclient dbus-glib-1 glib-2.0 gobject-2.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then +- pkg_cv_Audacious_LIBS=`$PKG_CONFIG --libs "audacious >= 1.4.0 dbus-glib-1 glib-2.0 gobject-2.0" 2>/dev/null` ++ pkg_cv_Audacious_LIBS=`$PKG_CONFIG --libs "audacious >= 1.4.0 audclient dbus-glib-1 glib-2.0 gobject-2.0" 2>/dev/null` + else + pkg_failed=yes + fi +@@ -11275,14 +11275,14 @@ + _pkg_short_errors_supported=no + fi + if test $_pkg_short_errors_supported = yes; then +- Audacious_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "audacious >= 1.4.0 dbus-glib-1 glib-2.0 gobject-2.0"` ++ Audacious_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "audacious >= 1.4.0 audclient dbus-glib-1 glib-2.0 gobject-2.0"` + else +- Audacious_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "audacious >= 1.4.0 dbus-glib-1 glib-2.0 gobject-2.0"` ++ Audacious_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "audacious >= 1.4.0 audclient dbus-glib-1 glib-2.0 gobject-2.0"` + fi + # Put the nasty error message in config.log where it belongs + echo "$Audacious_PKG_ERRORS" >&5 + +- as_fn_error "Package requirements (audacious >= 1.4.0 dbus-glib-1 glib-2.0 gobject-2.0) were not met: ++ as_fn_error "Package requirements (audacious >= 1.4.0 audclient dbus-glib-1 glib-2.0 gobject-2.0) were not met: + + $Audacious_PKG_ERRORS + +@@ -11645,7 +11645,7 @@ if test x$want_apcupsd = xyes; then - if test x"$uname" != xLinux; then + if test x"$uname" != xLinux -a x"$uname" != xFreeBSD; then - { $as_echo "$as_me:$LINENO: apcupsd not supported on $uname... disabling" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: apcupsd not supported on $uname... disabling" >&5 $as_echo "$as_me: apcupsd not supported on $uname... disabling" >&6;} - want_apcupsd=no -@@ -15930,7 +15930,7 @@ - - fi - fi -- for ac_prog in tolua++ tolua++5.1 -+ for ac_prog in tolua++ tolua++5.1 tolua++-5.1 - do - # Extract the first word of "$ac_prog", so it can be a program name with args. - set dummy $ac_prog; ac_word=$2 -@@ -16006,7 +16006,7 @@ - return 0; - } - _ACEOF --for ac_lib in '' tolua++ tolua++5.1; do -+for ac_lib in '' tolua++-5.1 tolua++ tolua++5.1; do - if test -z "$ac_lib"; then - ac_res="none required" - else -@@ -19845,7 +19845,6 @@ - ac_res=$ac_cv_search_clock_gettime - if test "$ac_res" != no; then - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" -- conky_LIBS="$conky_LIBS -lrt" - - cat >>confdefs.h <<\_ACEOF - #define HAVE_CLOCK_GETTIME 1 + want_apcupsd="not supported on $uname" +@@ -15950,11 +15950,6 @@ + fi + + fi +-if test x$want_alsa = xyes; then +- +-$as_echo "#define MIXER_IS_ALSA 1" >>confdefs.h +- +-fi + + for ac_header in signal.h unistd.h sys/utsname.h sys/stat.h linux/soundcard.h alsa/asoundlib.h dirent.h mcheck.h \ + sys/statfs.h sys/param.h pthread.h semaphore.h assert.h errno.h time.h +@@ -18905,6 +18900,7 @@ + ALSA mixer: $want_alsa + apcupsd: $want_apcupsd + I/O stats: $want_iostats ++ ncurses: $want_ncurses + + * Lua ($want_lua) bindings: + Cairo: $want_lua_cairo diff --git a/sysutils/conky/files/patch-doc-variables.xml b/sysutils/conky/files/patch-doc-variables.xml new file mode 100644 index 000000000000..815ce712b9ab --- /dev/null +++ b/sysutils/conky/files/patch-doc-variables.xml @@ -0,0 +1,29 @@ +--- doc/variables.xml.orig ++++ doc/variables.xml +@@ -7,8 +7,8 @@ + <option>(adapter)</option> + </term> + <listitem>ACPI ac adapter state. On linux, the adapter option specifies the +- subfolder of /sys/class/power_supply containing the state information (defaults +- to "AC"). Other systems ignore it. ++ subfolder of /sys/class/power_supply containing the state information (tries "AC" ++ and "ADP1" if there is no argument given). Non-linux systems ignore it. + <para /></listitem> + </varlistentry> + <varlistentry> +@@ -2416,6 +2416,15 @@ + <listitem>Hostname + <para /></listitem> + </varlistentry> ++ <varlistentry> ++ <term> ++ <command> ++ <option>nodename_short</option> ++ </command> ++ </term> ++ <listitem>Short hostname (same as 'hostname -s' shell command). ++ <para /></listitem> ++ </varlistentry> + <varlistentry> + <term> + <command> diff --git a/sysutils/conky/files/patch-lua-cairo.pkg b/sysutils/conky/files/patch-lua-cairo.pkg new file mode 100644 index 000000000000..8b361db373d2 --- /dev/null +++ b/sysutils/conky/files/patch-lua-cairo.pkg @@ -0,0 +1,10 @@ +--- lua/cairo.pkg.orig 2010-05-01 04:41:44.000000000 +0300 ++++ lua/cairo.pkg 2010-05-01 04:20:40.000000000 +0300 +@@ -4,6 +4,7 @@ + $#include <cairo-xlib.h> + $#include <X11/Xlib.h> + $#include "libcairo-helper.h" ++$#define tolua_outside + /* + * This code was mostly copied from cairo.h and cairo-xlib.h with comments + * removed. The licence noticed below is present for the sake of clarity. diff --git a/sysutils/conky/files/patch-src-Makefile.in b/sysutils/conky/files/patch-src-Makefile.in new file mode 100644 index 000000000000..6b67bfcfe640 --- /dev/null +++ b/sysutils/conky/files/patch-src-Makefile.in @@ -0,0 +1,11 @@ +--- src/Makefile.in.orig 2010-04-30 21:55:48.000000000 +0300 ++++ src/Makefile.in 2010-04-30 21:55:50.000000000 +0300 +@@ -141,7 +141,7 @@ + am__objects_15 = conky-linux.$(OBJEXT) conky-top.$(OBJEXT) \ + conky-users.$(OBJEXT) conky-sony.$(OBJEXT) conky-i8k.$(OBJEXT) + @BUILD_LINUX_TRUE@am__objects_16 = $(am__objects_15) +-am__objects_17 = conky-freebsd.$(OBJEXT) ++am__objects_17 = conky-freebsd.$(OBJEXT) conky-top.$(OBJEXT) + @BUILD_FREEBSD_TRUE@am__objects_18 = $(am__objects_17) + am__objects_19 = conky-openbsd.$(OBJEXT) + @BUILD_OPENBSD_TRUE@am__objects_20 = $(am__objects_19) diff --git a/sysutils/conky/files/patch-src-apcupsd.c b/sysutils/conky/files/patch-src-apcupsd.c new file mode 100644 index 000000000000..f41d28b13788 --- /dev/null +++ b/sysutils/conky/files/patch-src-apcupsd.c @@ -0,0 +1,18 @@ +--- src/apcupsd.c.orig ++++ src/apcupsd.c +@@ -154,7 +154,7 @@ static int fill_items(int sock, PAPCUPSD_S apc) { + // + // Conky update function for apcupsd data + // +-void update_apcupsd(void) { ++int update_apcupsd(void) { + + int i; + APCUPSD_S apc; +@@ -225,5 +225,5 @@ void update_apcupsd(void) { + // "atomically" copy the data into working set + // + memcpy(info.apcupsd.items, apc.items, sizeof(info.apcupsd.items)); +- return; ++ return 0; + } diff --git a/sysutils/conky/files/patch-src-apcupsd.h b/sysutils/conky/files/patch-src-apcupsd.h new file mode 100644 index 000000000000..1d3035b3eacd --- /dev/null +++ b/sysutils/conky/files/patch-src-apcupsd.h @@ -0,0 +1,10 @@ +--- src/apcupsd.h.orig ++++ src/apcupsd.h +@@ -49,6 +49,6 @@ typedef struct apcupsd_s { + } APCUPSD_S, *PAPCUPSD_S; + + /* Service routine for the conky main thread */ +-void update_apcupsd(void); ++int update_apcupsd(void); + + #endif /*APCUPSD_H_*/ diff --git a/sysutils/conky/files/patch-src-audacious.c b/sysutils/conky/files/patch-src-audacious.c new file mode 100644 index 000000000000..8d92f1da2c0e --- /dev/null +++ b/sysutils/conky/files/patch-src-audacious.c @@ -0,0 +1,19 @@ +--- src/audacious.c.orig ++++ src/audacious.c +@@ -62,7 +62,7 @@ static audacious_t audacious_items; + /* ----------------------------------------- + * Conky update function for audacious data. + * ----------------------------------------- */ +-void update_audacious(void) ++int update_audacious(void) + { + /* The worker thread is updating audacious_items array asynchronously + * to the main conky thread. +@@ -79,6 +79,7 @@ void update_audacious(void) + timed_thread_lock(info.audacious.p_timed_thread); + memcpy(&info.audacious.items, audacious_items, sizeof(audacious_items)); + timed_thread_unlock(info.audacious.p_timed_thread); ++ return 0; + } + + /* --------------------------------------------------------- diff --git a/sysutils/conky/files/patch-src-audacious.h b/sysutils/conky/files/patch-src-audacious.h new file mode 100644 index 000000000000..feba3243f09e --- /dev/null +++ b/sysutils/conky/files/patch-src-audacious.h @@ -0,0 +1,11 @@ +--- src/audacious.h.orig ++++ src/audacious.h +@@ -60,7 +60,7 @@ int create_audacious_thread(void); + int destroy_audacious_thread(void); + + /* Service routine for the conky main thread */ +-void update_audacious(void); ++int update_audacious(void); + + /* Thread functions */ + void *audacious_thread_func(void *); diff --git a/sysutils/conky/files/patch-src-bmpx.c b/sysutils/conky/files/patch-src-bmpx.c deleted file mode 100644 index 895c8675c1f0..000000000000 --- a/sysutils/conky/files/patch-src-bmpx.c +++ /dev/null @@ -1,60 +0,0 @@ ---- src/bmpx.c.orig 2009-09-23 22:02:33.000000000 +0300 -+++ src/bmpx.c 2009-09-23 22:03:54.000000000 +0300 -@@ -41,7 +41,7 @@ - static int connected = 0; - static char *unknown = "unknown"; - --void fail(GError *error); -+void fail(GError *error, struct information *); - - void update_bmpx() - { -@@ -57,15 +57,15 @@ - bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error); - if (bus == NULL) { - ERR("BMPx error 1: %s\n", error->message); -- fail(error); -+ fail(error, current_info); - return; - } - - remote_object = dbus_g_proxy_new_for_name(bus, BMP_DBUS_SERVICE, -- BMP_DBUS_PATH, BMP_DBUS_INTERFACE); -+ BMP_DBUS_PATH__BMP, BMP_DBUS_INTERFACE__BMP); - if (!remote_object) { - ERR("BMPx error 2: %s\n", error->message); -- fail(error); -+ fail(error, current_info); - return; - } - -@@ -77,7 +77,7 @@ - G_TYPE_INVALID, G_TYPE_INT, ¤t_track, G_TYPE_INVALID)) { - } else { - ERR("BMPx error 3: %s\n", error->message); -- fail(error); -+ fail(error, current_info); - return; - } - -@@ -111,17 +111,17 @@ - g_value_get_string(g_hash_table_lookup(metadata, "location")); - } else { - ERR("BMPx error 4: %s\n", error->message); -- fail(error); -+ fail(error, current_info); - return; - } - - g_hash_table_destroy(metadata); - } else { -- fail(error); -+ fail(error, current_info); - } - } - --void fail(GError *error) -+void fail(GError *error, struct information *current_info) - { - if (error) { - g_error_free(error); diff --git a/sysutils/conky/files/patch-src-bmpx.h b/sysutils/conky/files/patch-src-bmpx.h deleted file mode 100644 index 0bb5e98c6a77..000000000000 --- a/sysutils/conky/files/patch-src-bmpx.h +++ /dev/null @@ -1,42 +0,0 @@ ---- src/bmpx.h.orig 2009-09-23 22:04:47.000000000 +0300 -+++ src/bmpx.h 2009-09-23 22:02:05.000000000 +0300 -@@ -0,0 +1,39 @@ -+/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*- -+ * vim: ts=4 sw=4 noet ai cindent syntax=c -+ * -+ * Conky, a system monitor, based on torsmo -+ * -+ * Please see COPYING for details -+ * -+ * Copyright (c) 2005-2009 Brenden Matthews, Philip Kovacs, et. al. -+ * (see AUTHORS) -+ * All rights reserved. -+ * -+ * 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 3 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, see <http://www.gnu.org/licenses/>. -+ * -+ */ -+ -+#ifndef BMPX_H_ -+#define BMPX_H_ -+ -+void update_bmpx(void); -+struct bmpx_s { -+ char *title; -+ char *artist; -+ char *album; -+ char *uri; -+ int bitrate; -+ int track; -+}; -+ -+#endif /*BMPX_H_*/ diff --git a/sysutils/conky/files/patch-src-common.c b/sysutils/conky/files/patch-src-common.c new file mode 100644 index 000000000000..5b0c5a82ca28 --- /dev/null +++ b/sysutils/conky/files/patch-src-common.c @@ -0,0 +1,62 @@ +--- src/common.c.orig ++++ src/common.c +@@ -84,9 +84,10 @@ char *strndup(const char *s, size_t n) + } + #endif /* HAVE_STRNDUP */ + +-void update_uname(void) ++int update_uname(void) + { + uname(&info.uname_s); ++ return 0; + } + + double get_time(void) +@@ -268,7 +269,7 @@ void format_seconds_short(char *buf, unsigned int n, long seconds) + * Populated while initialising text objects in construct_text_object(). */ + static struct update_cb { + struct update_cb *next; +- void (*func)(void); ++ int (*func)(void); + pthread_t thread; + sem_t start_wait, end_wait; + +@@ -286,7 +287,7 @@ static int threading_started = 0; + + /* Register an update callback. Don't allow duplicates, to minimise side + * effects and overhead. */ +-void add_update_callback(void (*func)(void)) ++void add_update_callback(int (*func)(void)) + { + struct update_cb *uc = &update_cb_head; + +@@ -376,7 +377,12 @@ static void *run_update_callback(void *data) + while (1) { + if (sem_wait(&ucb->start_wait)) pthread_exit(NULL); + if (ucb->running == 0) pthread_exit(NULL); +- (*ucb->func)(); ++ if((*ucb->func)()) { ++ ucb->next = ucb; //this is normally not be possible, so we use it to show that there was a critical error ++ sem_post(&ucb->end_wait); ++ sem_post(&ucb->end_wait); ++ pthread_exit(NULL); ++ } + if (sem_post(&ucb->end_wait)) pthread_exit(NULL); + } + } +@@ -411,8 +417,14 @@ void update_stuff(void) + } + /* need to synchronise here, otherwise locking is needed (as data + * would be printed with some update callbacks still running) */ +- for (uc = update_cb_head.next; uc; uc = uc->next) ++ for (uc = update_cb_head.next; uc; uc = uc->next) { + sem_wait(&uc->end_wait); ++ if(uc == uc->next) { ++ pthread_join(uc->thread, NULL); ++ free(uc); ++ exit(EXIT_FAILURE); ++ } ++ } + + /* XXX: move the following into the update_meminfo() functions? */ + if (no_buffers) { diff --git a/sysutils/conky/files/patch-src-common.h b/sysutils/conky/files/patch-src-common.h new file mode 100644 index 000000000000..55f19f768f25 --- /dev/null +++ b/sysutils/conky/files/patch-src-common.h @@ -0,0 +1,51 @@ +--- src/common.h.orig ++++ src/common.h +@@ -11,7 +11,7 @@ + #include <sys/socket.h> + #include "text_object.h" + +-void add_update_callback(void (*func)(void)); ++void add_update_callback(int (*func)(void)); + void free_update_callbacks(void); + void start_update_threading(void); + +@@ -19,20 +19,20 @@ void start_update_threading(void); + void strfold(char *start, int count); + int check_mount(char *s); + void prepare_update(void); +-void update_uptime(void); +-void update_meminfo(void); +-void update_net_stats(void); +-void update_cpu_usage(void); +-void update_total_processes(void); +-void update_uname(void); +-void update_threads(void); +-void update_running_processes(void); ++int update_uptime(void); ++int update_meminfo(void); ++int update_net_stats(void); ++int update_cpu_usage(void); ++int update_total_processes(void); ++int update_uname(void); ++int update_threads(void); ++int update_running_processes(void); + void update_stuff(void); + char get_freq(char *, size_t, const char *, int, unsigned int); + void print_voltage_mv(struct text_object *, char *, int); + void print_voltage_v(struct text_object *, char *, int); +-void update_load_average(void); +-void update_top(void); ++int update_load_average(void); ++int update_top(void); + void free_all_processes(void); + struct process *get_first_process(void); + void get_cpu_count(void); +@@ -50,7 +50,7 @@ void format_seconds(char *buf, unsigned int n, long t); + void format_seconds_short(char *buf, unsigned int n, long t); + + #ifdef X11 +-void update_x11info(void); ++int update_x11info(void); + #endif + + int round_to_int_temp(float); diff --git a/sysutils/conky/files/patch-src-conky.c b/sysutils/conky/files/patch-src-conky.c new file mode 100644 index 000000000000..2a9228f6c157 --- /dev/null +++ b/sysutils/conky/files/patch-src-conky.c @@ -0,0 +1,404 @@ +--- src/conky.c.orig 2010-03-25 22:27:32.000000000 +0200 ++++ src/conky.c 2010-06-11 23:10:56.000000000 +0300 +@@ -166,9 +166,7 @@ + #ifdef IOSTATS + int top_io; + #endif +-#ifdef __linux__ + int top_running; +-#endif + int output_methods; + static int extra_newline; + enum x_initialiser_state x_initialised = NO; +@@ -269,9 +267,6 @@ + #ifdef IMLIB2 + " * Imlib2\n" + #endif /* IMLIB2 */ +-#ifdef MIXER_IS_ALSA +- " * ALSA mixer support\n" +-#endif /* MIXER_IS_ALSA */ + #ifdef APCUPSD + " * apcupsd\n" + #endif /* APCUPSD */ +@@ -463,7 +458,7 @@ + } + fclose(where); + } else { +- NORM_ERR("Could not open the file"); ++ NORM_ERR("Could not open the file '%s'", f); + } + return ret; + } +@@ -512,6 +507,7 @@ + char *ps, *pe; + int special_index = 0; /* specials index */ + ++ if(! b) return; + for (ps = b, pe = b; *pe; pe++) { + if (*pe == '\n') { + *pe = '\0'; +@@ -765,6 +761,8 @@ + buff_in[0] = 0; + #endif /* HAVE_ICONV */ + ++ if(! p) return; ++ + p[0] = 0; + obj = root.next; + while (obj && p_max_size > 0) { +@@ -1330,7 +1328,7 @@ + DO_JUMP; + } else if (spc) { + *spc = '\0'; +- if (check_contains(obj->data.s, spc + 1)) ++ if (!check_contains(obj->data.s, spc + 1)) + DO_JUMP; + *spc = ' '; + } +@@ -1503,6 +1501,15 @@ + OBJ(nodename) { + snprintf(p, p_max_size, "%s", cur->uname_s.nodename); + } ++ OBJ(nodename_short) { ++ char *pos; ++ pos = strstr(cur->uname_s.nodename, "."); ++ if(pos != NULL) { ++ snprintf(p, MIN(pos-cur->uname_s.nodename+1, p_max_size), "%s", cur->uname_s.nodename); ++ } else { ++ snprintf(p, p_max_size, "%s", cur->uname_s.nodename); ++ } ++ } + OBJ(outlinecolor) { + new_outline(p, obj->data.l); + } +@@ -2062,9 +2069,11 @@ + OBJ(xmms2_percent) { + snprintf(p, p_max_size, "%2.0f", cur->xmms2.progress * 100); + } ++#ifdef X11 + OBJ(xmms2_bar) { + new_bar(obj, p, p_max_size, (int) (cur->xmms2.progress * 255.0f)); + } ++#endif /* X11 */ + OBJ(xmms2_playlist) { + snprintf(p, p_max_size, "%s", cur->xmms2.playlist); + } +@@ -2140,6 +2149,7 @@ + snprintf(p, p_max_size, "%s", + cur->audacious.items[AUDACIOUS_MAIN_VOLUME]); + } ++#ifdef X11 + OBJ(audacious_bar) { + double progress; + +@@ -2148,6 +2158,7 @@ + atof(cur->audacious.items[AUDACIOUS_LENGTH_SECONDS]); + new_bar(obj, p, p_max_size, (int) (progress * 255.0f)); + } ++#endif /* X11 */ + #endif /* AUDACIOUS */ + + #ifdef BMPX +@@ -2173,7 +2184,6 @@ + /* we have four different types of top (top, top_mem, + * top_time and top_io). To avoid having almost-same code four + * times, we have this special handler. */ +-#ifdef __linux__ + break; + case OBJ_top: + case OBJ_top_mem: +@@ -2182,7 +2192,6 @@ + case OBJ_top_io: + #endif + print_top(obj, p, p_max_size); +-#endif /* __linux__ */ + OBJ(tail) { + print_tailhead("tail", obj, p, p_max_size); + } +@@ -2375,13 +2384,7 @@ + #ifdef HAVE_ICONV + iconv_convert(&a, buff_in, p, p_max_size); + #endif /* HAVE_ICONV */ +- if (obj->type != OBJ_text && obj->type != OBJ_execp && obj->type != OBJ_execpi +-#ifdef HAVE_LUA +- && obj->type != OBJ_lua && obj->type != OBJ_lua_parse +-#endif /* HAVE_LUA */ +- ) { +- substitute_newlines(p, a - 2); +- } ++ substitute_newlines(p, a - 2); + p += a; + p_max_size -= a; + (*p) = 0; +@@ -3119,36 +3122,49 @@ + if (seconds != 0) { + timeunits = seconds / 86400; seconds %= 86400; + if (timeunits > 0) { +- asprintf(&tmp_day_str, "%dd", timeunits); ++ if (asprintf(&tmp_day_str, "%dd", timeunits) < 0) { ++ tmp_day_str = 0; ++ } + } else { + tmp_day_str = strdup(""); + } + timeunits = seconds / 3600; seconds %= 3600; + if (timeunits > 0) { +- asprintf(&tmp_hour_str, "%dh", timeunits); ++ if (asprintf(&tmp_hour_str, "%dh", timeunits) < 0) { ++ tmp_day_str = 0; ++ } + } else { + tmp_hour_str = strdup(""); + } + timeunits = seconds / 60; seconds %= 60; + if (timeunits > 0) { +- asprintf(&tmp_min_str, "%dm", timeunits); ++ if (asprintf(&tmp_min_str, "%dm", timeunits) < 0) { ++ tmp_min_str = 0; ++ } + } else { + tmp_min_str = strdup(""); + } + if (seconds > 0) { +- asprintf(&tmp_sec_str, "%ds", seconds); ++ if (asprintf(&tmp_sec_str, "%ds", seconds) < 0) { ++ tmp_sec_str = 0; ++ } + } else { + tmp_sec_str = strdup(""); + } +- asprintf(&tmp_str, "%s%s%s%s", tmp_day_str, tmp_hour_str, tmp_min_str, tmp_sec_str); +- free(tmp_day_str); free(tmp_hour_str); free(tmp_min_str); free(tmp_sec_str); ++ if (asprintf(&tmp_str, "%s%s%s%s", tmp_day_str, ++ tmp_hour_str, tmp_min_str, tmp_sec_str) < 0) { ++ tmp_str = 0; ++ } ++#define FREE(a) if ((a)) free((a)); ++ FREE(tmp_day_str); FREE(tmp_hour_str); FREE(tmp_min_str); FREE(tmp_sec_str); + } else { +- asprintf(&tmp_str, "Range not possible"); // should never happen, but better safe then sorry ++ tmp_str = strdup("Range not possible"); /* should never happen, but better safe then sorry */ + } + cur_x += (w / 2) - (font_ascent() * (strlen(tmp_str) / 2)); + cur_y += font_h / 2; + draw_string(tmp_str); +- free(tmp_str); ++ FREE(tmp_str); ++#undef FREE + cur_x = tmp_x; + cur_y = tmp_y; + } +@@ -3974,11 +3990,39 @@ + initialisation(argc_copy, argv_copy); + } + +-void clean_up(void *memtofree1, void* memtofree2) +-{ +- int i; ++#ifdef X11 ++void clean_up_x11() { ++ if(window_created == 1) { ++ XClearArea(display, window.window, text_start_x - window.border_inner_margin - window.border_outer_margin - window.border_width, ++ text_start_y - window.border_inner_margin - window.border_outer_margin - window.border_width, ++ text_width + window.border_inner_margin * 2 + window.border_outer_margin * 2 + window.border_width * 2, ++ text_height + window.border_inner_margin * 2 + window.border_outer_margin * 2 + window.border_width * 2, 0); ++ } ++ destroy_window(); ++ free_fonts(); ++ fonts = NULL; ++ if(x11_stuff.region) { ++ XDestroyRegion(x11_stuff.region); ++ x11_stuff.region = NULL; ++ } ++ if(display) { ++ XCloseDisplay(display); ++ display = NULL; ++ } ++ if(info.x11.desktop.all_names) { ++ free(info.x11.desktop.all_names); ++ info.x11.desktop.all_names = NULL; ++ } ++ if (info.x11.desktop.name) { ++ free(info.x11.desktop.name); ++ info.x11.desktop.name = NULL; ++ } ++ x_initialised = NO; ++} ++#endif + +- free_update_callbacks(); ++void clean_up_without_threads(void *memtofree1, void* memtofree2) { ++ int i; + + #ifdef NCURSES + if(output_methods & TO_NCURSES) { +@@ -4001,29 +4045,7 @@ + } + #ifdef X11 + if (x_initialised == YES) { +- if(window_created == 1) { +- XClearArea(display, window.window, text_start_x - window.border_inner_margin - window.border_outer_margin - window.border_width, +- text_start_y - window.border_inner_margin - window.border_outer_margin - window.border_width, +- text_width + window.border_inner_margin * 2 + window.border_outer_margin * 2 + window.border_width * 2, +- text_height + window.border_inner_margin * 2 + window.border_outer_margin * 2 + window.border_width * 2, 0); +- } +- destroy_window(); +- free_fonts(); +- if(x11_stuff.region) { +- XDestroyRegion(x11_stuff.region); +- x11_stuff.region = NULL; +- } +- XCloseDisplay(display); +- display = NULL; +- if(info.x11.desktop.all_names) { +- free(info.x11.desktop.all_names); +- info.x11.desktop.all_names = NULL; +- } +- if (info.x11.desktop.name) { +- free(info.x11.desktop.name); +- info.x11.desktop.name = NULL; +- } +- x_initialised = NO; ++ clean_up_x11(); + }else{ + free(fonts); //in set_default_configurations a font is set but not loaded + font_count = -1; +@@ -4097,6 +4119,12 @@ + } + } + ++void clean_up(void *memtofree1, void* memtofree2) ++{ ++ free_update_callbacks(); ++ clean_up_without_threads(memtofree1, memtofree2); ++} ++ + static int string_to_bool(const char *s) + { + if (!s) { +@@ -4200,9 +4228,7 @@ + #ifdef IOSTATS + top_io = 0; + #endif +-#ifdef __linux__ + top_running = 0; +-#endif + #ifdef MPD + mpd_env_host = getenv("MPD_HOST"); + mpd_env_port = getenv("MPD_PORT"); +@@ -4252,6 +4278,9 @@ + output_methods = TO_STDOUT; + #endif + #ifdef X11 ++#ifdef BUILD_XFT ++ use_xft = 0; ++#endif + show_graph_scale = 0; + show_graph_range = 0; + draw_shades = 1; +@@ -4282,11 +4311,11 @@ + text_alignment = BOTTOM_LEFT; + info.x11.monitor.number = 1; + info.x11.monitor.current = 0; +- info.x11.desktop.current = 1; ++ info.x11.desktop.current = 1; + info.x11.desktop.number = 1; + info.x11.desktop.nitems = 0; +- info.x11.desktop.all_names = NULL; +- info.x11.desktop.name = NULL; ++ info.x11.desktop.all_names = NULL; ++ info.x11.desktop.name = NULL; + #endif /* X11 */ + + free_templates(); +@@ -4518,13 +4547,13 @@ + int a = string_to_alignment(value); + + if (a <= 0) { +- if(setbyconffile == true) { ++ if (setbyconffile) { + CONF_ERR; + } else NORM_ERR("'%s' is not a alignment setting", value); + } else { + *ltext_alignment = a; + } +- } else if(setbyconffile == true) { ++ } else if (setbyconffile) { + CONF_ERR; + } + } +@@ -4552,15 +4581,12 @@ + + #ifdef X11 + CONF2("out_to_x") { +- /* don't listen if X is already initialised or +- * if we already know we don't want it */ +- if(x_initialised != YES) { +- if (string_to_bool(value)) { +- output_methods &= TO_X; +- } else { +- output_methods &= ~TO_X; +- x_initialised = NEVER; +- } ++ if (string_to_bool(value)) { ++ output_methods &= TO_X; ++ } else { ++ clean_up_x11(); ++ output_methods &= ~TO_X; ++ x_initialised = NEVER; + } + } + CONF("display") { +@@ -4573,7 +4599,7 @@ + } + } + CONF("alignment") { +- setalignment(&text_alignment, window.type, value, f, line, true); ++ setalignment(&text_alignment, window.type, value, f, line, 1); + } + CONF("background") { + fork_to_background = string_to_bool(value); +@@ -4609,7 +4635,7 @@ + CONF("border_width") { + if (value) { + window.border_width = strtol(value, 0, 0); +- if (window.border_width < 0) window.border_width = 0; ++ if (window.border_width < 1) window.border_width = 1; + } else { + CONF_ERR; + } +@@ -5696,7 +5722,7 @@ + set_first_font(optarg); + break; + case 'a': +- setalignment(&text_alignment, window.type, optarg, NULL, 0, false); ++ setalignment(&text_alignment, window.type, optarg, NULL, 0, 0); + break; + + #ifdef OWN_WINDOW +@@ -5895,7 +5921,9 @@ + current_config = strndup(optarg, max_user_text); + break; + case 'q': +- freopen("/dev/null", "w", stderr); ++ if (!freopen("/dev/null", "w", stderr)) { ++ NORM_ERR("unable to redirect stderr to /dev/null"); ++ } + break; + case 'h': + print_help(argv[0]); +@@ -5929,7 +5957,13 @@ + #endif /* XOAP */ + + #ifdef HAVE_SYS_INOTIFY_H +- inotify_fd = inotify_init1(IN_NONBLOCK); ++ inotify_fd = inotify_init(); ++ if(inotify_fd != -1) { ++ int fl; ++ ++ fl = fcntl(inotify_fd, F_GETFL); ++ fcntl(inotify_fd, F_SETFL, fl | O_NONBLOCK); ++ } + #endif /* HAVE_SYS_INOTIFY_H */ + + initialisation(argc, argv); diff --git a/sysutils/conky/files/patch-src-conky.h b/sysutils/conky/files/patch-src-conky.h new file mode 100644 index 000000000000..e285a2e7d431 --- /dev/null +++ b/sysutils/conky/files/patch-src-conky.h @@ -0,0 +1,21 @@ +--- src/conky.h.orig ++++ src/conky.h +@@ -296,9 +296,7 @@ extern int top_cpu, top_mem, top_time; + #ifdef IOSTATS + extern int top_io; + #endif +-#ifdef __linux__ + extern int top_running; +-#endif + + /* defined in conky.c, needed by top.c */ + extern int cpu_separate; +@@ -308,7 +306,7 @@ extern int cpu_separate; + extern struct information info; + + /* defined in users.c */ +-void update_users(void); ++int update_users(void); + void update_user_time(char *tty); + + /* defined in conky.c */ diff --git a/sysutils/conky/files/patch-src-core.c b/sysutils/conky/files/patch-src-core.c new file mode 100644 index 000000000000..0bd49ec8afed --- /dev/null +++ b/sysutils/conky/files/patch-src-core.c @@ -0,0 +1,126 @@ +--- src/core.c.orig 2010-03-25 22:27:32.000000000 +0200 ++++ src/core.c 2010-06-15 10:38:22.000000000 +0300 +@@ -171,8 +171,6 @@ + NORM_ERR("acpiacadapter: arg is only used on linux"); + #endif + } +- if(! obj->data.opaque) +- obj->data.opaque = strdup("AC"); + #endif /* !__OpenBSD__ */ + END OBJ(freq, 0) + get_cpu_count(); +@@ -279,8 +277,9 @@ + obj->data.s = strndup(bat, text_buffer_size); + END OBJ(battery_bar, 0) + char bat[64]; +- if (arg) { +- arg = scan_bar(obj, arg); ++ ++ arg = scan_bar(obj, arg); ++ if (arg && strlen(arg)>0) { + sscanf(arg, "%63s", bat); + } else { + strcpy(bat, "BAT0"); +@@ -372,18 +371,18 @@ + scan_loadgraph_arg(obj, arg); + #endif /* X11 */ + END OBJ(diskio, &update_diskio) +- parse_diskio_arg(obj, arg); ++ parse_diskio_arg(obj, dev_name(arg)); + END OBJ(diskio_read, &update_diskio) +- parse_diskio_arg(obj, arg); ++ parse_diskio_arg(obj, dev_name(arg)); + END OBJ(diskio_write, &update_diskio) +- parse_diskio_arg(obj, arg); ++ parse_diskio_arg(obj, dev_name(arg)); + #ifdef X11 + END OBJ(diskiograph, &update_diskio) +- parse_diskiograph_arg(obj, arg); ++ parse_diskiograph_arg(obj, dev_name(arg)); + END OBJ(diskiograph_read, &update_diskio) +- parse_diskiograph_arg(obj, arg); ++ parse_diskiograph_arg(obj, dev_name(arg)); + END OBJ(diskiograph_write, &update_diskio) +- parse_diskiograph_arg(obj, arg); ++ parse_diskiograph_arg(obj, dev_name(arg)); + #endif /* X11 */ + END OBJ(color, 0) + #ifdef X11 +@@ -542,6 +541,11 @@ + parse_platform_sensor(obj, arg); + END OBJ_ARG(hwmon, 0, "hwmon needs argumanets") + parse_hwmon_sensor(obj, arg); ++ END OBJ(addr, &update_net_stats) ++ parse_net_stat_arg(obj, arg, free_at_crash); ++ END OBJ(addrs, &update_net_stats) ++ parse_net_stat_arg(obj, arg, free_at_crash); ++#endif /* __linux__ */ + END + /* we have four different types of top (top, top_mem, top_time and top_io). To + * avoid having almost-same code four times, we have this special +@@ -552,12 +556,8 @@ + if (!parse_top_args(s, arg, obj)) { + return NULL; + } +- } else OBJ(addr, &update_net_stats) +- parse_net_stat_arg(obj, arg, free_at_crash); +- END OBJ(addrs, &update_net_stats) +- parse_net_stat_arg(obj, arg, free_at_crash); +-#endif /* __linux__ */ +- END OBJ_ARG(tail, 0, "tail needs arguments") ++ } else ++ OBJ_ARG(tail, 0, "tail needs arguments") + init_tailhead("tail", arg, obj, free_at_crash); + END OBJ_ARG(head, 0, "head needs arguments") + init_tailhead("head", arg, obj, free_at_crash); +@@ -657,6 +657,7 @@ + obj->sub = malloc(sizeof(struct text_object)); + extract_variable_text_internal(obj->sub, arg); + END OBJ(nodename, 0) ++ END OBJ(nodename_short, 0) + END OBJ_ARG(cmdline_to_pid, 0, "cmdline_to_pid needs a command line as argument") + scan_cmdline_to_pid_arg(obj, arg, free_at_crash); + END OBJ_ARG(pid_chroot, 0, "pid_chroot needs a pid as argument") +@@ -786,9 +787,9 @@ + obj->sub = malloc(sizeof(struct text_object)); + extract_variable_text_internal(obj->sub, arg); + END OBJ(processes, &update_total_processes) +-#ifdef __linux__ + END OBJ(running_processes, &update_top) + top_running = 1; ++#ifdef __linux__ + END OBJ(threads, &update_threads) + END OBJ(running_threads, &update_stat) + #else +@@ -966,8 +967,10 @@ + END OBJ(xmms2_size, &update_xmms2) + END OBJ(xmms2_status, &update_xmms2) + END OBJ(xmms2_percent, &update_xmms2) ++#ifdef X11 + END OBJ(xmms2_bar, &update_xmms2) + scan_bar(obj, arg); ++#endif + END OBJ(xmms2_smart, &update_xmms2) + END OBJ(xmms2_playlist, &update_xmms2) + END OBJ(xmms2_timesplayed, &update_xmms2) +@@ -993,9 +996,11 @@ + END OBJ(audacious_playlist_length, &update_audacious) + END OBJ(audacious_playlist_position, &update_audacious) + END OBJ(audacious_main_volume, &update_audacious) ++#ifdef X11 + END OBJ(audacious_bar, &update_audacious) + scan_bar(obj, arg); + #endif ++#endif + #ifdef BMPX + END OBJ(bmpx_title, &update_bmpx) + memset(&(info.bmpx), 0, sizeof(struct bmpx_s)); +@@ -1327,7 +1332,7 @@ + strfold(p, 1); + } else if (*p == '#') { + char c; +- if (remove_comment(p, &c) && p > orig_p && c == '\n') { ++ if (remove_comment(p, &c) && p >= orig_p && c == '\n') { + /* if remove_comment removed a newline, we need to 'back up' with p */ + p--; + } diff --git a/sysutils/conky/files/patch-src-diskio.c b/sysutils/conky/files/patch-src-diskio.c new file mode 100644 index 000000000000..6623c8f14fe4 --- /dev/null +++ b/sysutils/conky/files/patch-src-diskio.c @@ -0,0 +1,15 @@ +--- src/diskio.c.orig ++++ src/diskio.c +@@ -76,12 +76,6 @@ struct diskio_stat *prepare_diskio_stat(const char *s) + if (!s) + return &stats; + +-#if defined(__FreeBSD__) +- if (strncmp(s, "/dev/", 5) == 0) { +- // supplied a /dev/device arg, so cut off the /dev part +- strncpy(device_name, s + 5, text_buffer_size); +- } else +-#endif + strncpy(device_name, s, text_buffer_size); + + snprintf(stat_name, text_buffer_size, "/dev/%s", device_name); diff --git a/sysutils/conky/files/patch-src-diskio.h b/sysutils/conky/files/patch-src-diskio.h new file mode 100644 index 000000000000..de61ed550fa4 --- /dev/null +++ b/sysutils/conky/files/patch-src-diskio.h @@ -0,0 +1,11 @@ +--- src/diskio.h.orig ++++ src/diskio.h +@@ -47,7 +47,7 @@ struct diskio_stat { + extern struct diskio_stat stats; + + struct diskio_stat *prepare_diskio_stat(const char *); +-void update_diskio(void); ++int update_diskio(void); + void clear_diskio_stats(void); + void update_diskio_values(struct diskio_stat *, unsigned int, unsigned int); + diff --git a/sysutils/conky/files/patch-src-entropy.c b/sysutils/conky/files/patch-src-entropy.c new file mode 100644 index 000000000000..bc3b15c8ecbd --- /dev/null +++ b/sysutils/conky/files/patch-src-entropy.c @@ -0,0 +1,15 @@ +--- src/entropy.c.orig ++++ src/entropy.c +@@ -49,10 +49,11 @@ static struct { + .poolsize = 0, + }; + +-void update_entropy(void) ++int update_entropy(void) + { + get_entropy_avail(&entropy.avail); + get_entropy_poolsize(&entropy.poolsize); ++ return 0; + } + + void print_entropy_avail(struct text_object *obj, char *p, int p_max_size) diff --git a/sysutils/conky/files/patch-src-entropy.h b/sysutils/conky/files/patch-src-entropy.h new file mode 100644 index 000000000000..9559e87d9a2d --- /dev/null +++ b/sysutils/conky/files/patch-src-entropy.h @@ -0,0 +1,11 @@ +--- src/entropy.h.orig ++++ src/entropy.h +@@ -31,7 +31,7 @@ + #ifndef _ENTROPY_H + #define _ENTROPY_H + +-void update_entropy(void); ++int update_entropy(void); + + void print_entropy_avail(struct text_object *, char *, int); + void print_entropy_perc(struct text_object *, char *, int); diff --git a/sysutils/conky/files/patch-src-exec.c b/sysutils/conky/files/patch-src-exec.c new file mode 100644 index 000000000000..e5a9618666d8 --- /dev/null +++ b/sysutils/conky/files/patch-src-exec.c @@ -0,0 +1,129 @@ +--- src/exec.c.orig ++++ src/exec.c +@@ -140,7 +140,8 @@ static inline double get_barnum(char *buf) + return barnum; + } + +-static inline void read_exec(const char *data, char *buf, const int size) ++static inline void read_exec(const char *data, char *buf, const int size, const ++ char use_alarm) + { + FILE *fp; + +@@ -149,7 +150,7 @@ static inline void read_exec(const char *data, char *buf, const int size) + if (!data) + return; + +- alarm(update_interval); ++ if (use_alarm) alarm(update_interval); + fp = pid_popen(data, "r", &childpid); + if(fp) { + int length; +@@ -163,7 +164,7 @@ static inline void read_exec(const char *data, char *buf, const int size) + } else { + buf[0] = '\0'; + } +- alarm(0); ++ if (use_alarm) alarm(0); + } + + static void *threaded_exec(void *) __attribute__((noreturn)); +@@ -176,7 +177,7 @@ static void *threaded_exec(void *arg) + + while (1) { + buff = malloc(text_buffer_size); +- read_exec(ed->cmd, buff, text_buffer_size); ++ read_exec(ed->cmd, buff, text_buffer_size, 0); + p2 = buff; + while (*p2) { + if (*p2 == '\001') { +@@ -216,7 +217,7 @@ void scan_pre_exec_arg(struct text_object *obj, const char *arg) + char buf[2048]; + + obj->type = OBJ_text; +- read_exec(arg, buf, sizeof(buf)); ++ read_exec(arg, buf, sizeof(buf), 1); + obj->data.s = strndup(buf, text_buffer_size); + } + +@@ -258,7 +259,7 @@ void scan_execgraph_arg(struct text_object *obj, const char *arg) + + void print_exec(struct text_object *obj, char *p, int p_max_size) + { +- read_exec(obj->data.s, p, p_max_size); ++ read_exec(obj->data.s, p, p_max_size, 1); + remove_deleted_chars(p); + } + +@@ -271,7 +272,7 @@ void print_execp(struct text_object *obj, char *p, int p_max_size) + buf = malloc(text_buffer_size); + memset(buf, 0, text_buffer_size); + +- read_exec(obj->data.s, buf, text_buffer_size); ++ read_exec(obj->data.s, buf, text_buffer_size, 1); + + tmp_info = malloc(sizeof(struct information)); + memcpy(tmp_info, &info, sizeof(struct information)); +@@ -292,7 +293,7 @@ void print_execi(struct text_object *obj, char *p, int p_max_size) + if (time_to_update(ed)) { + if (!ed->buffer) + ed->buffer = malloc(text_buffer_size); +- read_exec(ed->cmd, ed->buffer, text_buffer_size); ++ read_exec(ed->cmd, ed->buffer, text_buffer_size, 1); + ed->last_update = current_update_time; + } + snprintf(p, p_max_size, "%s", ed->buffer); +@@ -365,7 +366,7 @@ void print_execgauge(struct text_object *obj, char *p, int p_max_size) + { + double barnum; + +- read_exec(obj->data.s, p, p_max_size); ++ read_exec(obj->data.s, p, p_max_size, 1); + barnum = get_barnum(p); /*using the same function*/ + + if (barnum >= 0.0) { +@@ -383,7 +384,7 @@ void print_execgraph(struct text_object *obj, char *p, int p_max_size) + if (!ed) + return; + +- read_exec(ed->cmd, p, p_max_size); ++ read_exec(ed->cmd, p, p_max_size, 1); + barnum = get_barnum(p); + + if (barnum > 0) { +@@ -401,7 +402,7 @@ void print_execigraph(struct text_object *obj, char *p, int p_max_size) + if (time_to_update(ed)) { + double barnum; + +- read_exec(ed->cmd, p, p_max_size); ++ read_exec(ed->cmd, p, p_max_size, 1); + barnum = get_barnum(p); + + if (barnum >= 0.0) { +@@ -423,7 +424,7 @@ void print_execigauge(struct text_object *obj, char *p, int p_max_size) + if (time_to_update(ed)) { + double barnum; + +- read_exec(ed->cmd, p, p_max_size); ++ read_exec(ed->cmd, p, p_max_size, 1); + barnum = get_barnum(p); + + if (barnum >= 0.0) { +@@ -437,7 +438,7 @@ void print_execigauge(struct text_object *obj, char *p, int p_max_size) + void print_execbar(struct text_object *obj, char *p, int p_max_size) + { + double barnum; +- read_exec(obj->data.s, p, p_max_size); ++ read_exec(obj->data.s, p, p_max_size, 1); + barnum = get_barnum(p); + + if (barnum >= 0.0) { +@@ -455,7 +456,7 @@ void print_execibar(struct text_object *obj, char *p, int p_max_size) + return; + + if (time_to_update(ed)) { +- read_exec(ed->cmd, p, p_max_size); ++ read_exec(ed->cmd, p, p_max_size, 1); + barnum = get_barnum(p); + + if (barnum >= 0.0) { diff --git a/sysutils/conky/files/patch-src-freebsd.c b/sysutils/conky/files/patch-src-freebsd.c index 91be322e191d..7146ad9dc658 100644 --- a/sysutils/conky/files/patch-src-freebsd.c +++ b/sysutils/conky/files/patch-src-freebsd.c @@ -1,7 +1,96 @@ ---- src/freebsd.c.orig 2009-08-09 00:05:55.000000000 +0400 -+++ src/freebsd.c 2010-01-11 01:20:59.000000000 +0300 -@@ -284,40 +284,38 @@ +--- src/freebsd.c.orig ++++ src/freebsd.c +@@ -67,7 +67,7 @@ + #endif + + __attribute__((gnu_inline)) inline void +-proc_find_top(struct process **cpu, struct process **mem); ++proc_find_top(struct process **cpu, struct process **mem, struct process **time); + + static short cpu_setup = 0; + +@@ -118,7 +118,7 @@ void prepare_update(void) + { + } + +-void update_uptime(void) ++int update_uptime(void) + { + int mib[2] = { CTL_KERN, KERN_BOOTTIME }; + struct timeval boottime; +@@ -133,6 +133,8 @@ void update_uptime(void) + fprintf(stderr, "Could not get uptime\n"); + info.uptime = 0; + } ++ ++ return 0; + } + + int check_mount(char *s) +@@ -150,7 +152,7 @@ int check_mount(char *s) + return 0; + } + +-void update_meminfo(void) ++int update_meminfo(void) + { + u_int total_pages, inactive_pages, free_pages; + unsigned long swap_avail, swap_free; +@@ -182,9 +184,11 @@ void update_meminfo(void) + info.swap = 0; + info.swapfree = 0; + } ++ ++ return 0; + } + +-void update_net_stats(void) ++int update_net_stats(void) + { + struct net_stat *ns; + double delta; +@@ -195,11 +199,11 @@ void update_net_stats(void) + /* get delta */ + delta = current_update_time - last_update_time; + if (delta <= 0.0001) { +- return; ++ return 0; + } + + if (getifaddrs(&ifap) < 0) { +- return; ++ return 0; + } + + for (ifa = ifap; ifa; ifa = ifa->ifa_next) { +@@ -255,18 +259,20 @@ void update_net_stats(void) + } + + freeifaddrs(ifap); ++ return 0; + } + +-void update_total_processes(void) ++int update_total_processes(void) + { + int n_processes; + + kvm_getprocs(kd, KERN_PROC_ALL, 0, &n_processes); + + info.procs = n_processes; ++ return 0; + } + +-void update_running_processes(void) ++int update_running_processes(void) + { + struct kinfo_proc *p; + int n_processes; +@@ -284,42 +290,41 @@ void update_running_processes(void) + } + info.run_procs = cnt; ++ return 0; } -struct cpu_load_struct { @@ -39,12 +128,13 @@ } -/* XXX: SMP support */ +-void update_cpu_usage(void) +struct cpu_info { + long oldtotal; + long oldused; +}; + - void update_cpu_usage(void) ++int update_cpu_usage(void) { + int i, j = 0; long used, total; @@ -58,7 +148,7 @@ /* add check for !info.cpu_usage since that mem is freed on a SIGUSR1 */ if ((cpu_setup == 0) || (!info.cpu_usage)) { -@@ -325,28 +323,68 @@ +@@ -327,31 +332,72 @@ void update_cpu_usage(void) cpu_setup = 1; } @@ -69,14 +159,6 @@ + cpu = malloc(malloc_cpu_size); + memset(cpu, 0, malloc_cpu_size); + global_cpu = cpu; -+ } -+ -+ /* cpu[0] is overall stats, get it from separate sysctl */ -+ cp_len = CPUSTATES * sizeof(long); -+ cp_time = malloc(cp_len); -+ -+ if (sysctlbyname("kern.cp_time", cp_time, &cp_len, NULL, 0) < 0) { -+ fprintf(stderr, "Cannot get kern.cp_time\n"); } - fresh.load[0] = cp_time[CP_USER]; @@ -84,17 +166,23 @@ - fresh.load[2] = cp_time[CP_SYS]; - fresh.load[3] = cp_time[CP_IDLE]; - fresh.load[4] = cp_time[CP_IDLE]; -- ++ /* cpu[0] is overall stats, get it from separate sysctl */ ++ cp_len = CPUSTATES * sizeof(long); ++ cp_time = malloc(cp_len); + - used = fresh.load[0] + fresh.load[1] + fresh.load[2]; - total = fresh.load[0] + fresh.load[1] + fresh.load[2] + fresh.load[3]; -- -- if ((total - oldtotal) != 0) { -- info.cpu_usage[0] = ((double) (used - oldused)) / -- (double) (total - oldtotal); ++ if (sysctlbyname("kern.cp_time", cp_time, &cp_len, NULL, 0) < 0) { ++ fprintf(stderr, "Cannot get kern.cp_time\n"); ++ } ++ + total = 0; + for (j = 0; j < CPUSTATES; j++) + total += cp_time[j]; -+ + +- if ((total - oldtotal) != 0) { +- info.cpu_usage[0] = ((double) (used - oldused)) / +- (double) (total - oldtotal); + used = total - cp_time[CP_IDLE]; + + if ((total - cpu[0].oldtotal) != 0) { @@ -140,6 +228,144 @@ + } + + free(cp_time); ++ return 0; + } + +-void update_load_average(void) ++int update_load_average(void) + { + double v[3]; + +@@ -360,6 +406,8 @@ void update_load_average(void) + info.loadavg[0] = (double) v[0]; + info.loadavg[1] = (double) v[1]; + info.loadavg[2] = (double) v[2]; ++ ++ return 0; + } + + double get_acpi_temperature(int fd) +@@ -540,9 +588,10 @@ char get_freq(char *p_client_buffer, size_t client_buffer_size, const char *p_fo + return 1; + } + +-void update_top(void) ++int update_top(void) + { +- proc_find_top(info.cpu, info.memu); ++ proc_find_top(info.cpu, info.memu, info.time); ++ return 0; + } + + #if 0 +@@ -600,7 +649,7 @@ cleanup: + } + #endif + +-void update_diskio(void) ++int update_diskio(void) + { + int devs_count, num_selected, num_selections, dn; + struct device_selection *dev_select = NULL; +@@ -618,7 +667,7 @@ void update_diskio(void) + + if (devstat_getdevs(NULL, &statinfo_cur) < 0) { + free(statinfo_cur.dinfo); +- return; ++ return 0; + } + + devs_count = statinfo_cur.dinfo->numdevs; +@@ -650,6 +699,7 @@ void update_diskio(void) + } + + free(statinfo_cur.dinfo); ++ return 0; } - void update_load_average(void) + /* While topless is obviously better, top is also not bad. */ +@@ -676,8 +726,15 @@ int comparemem(const void *a, const void *b) + } + } + ++int comparetime(const void *va, const void *vb) ++{ ++ struct process *a = (struct process *)va, *b = (struct process *)vb; ++ ++ return b->total_cpu_time - a->total_cpu_time; ++} ++ + __attribute__((gnu_inline)) inline void +-proc_find_top(struct process **cpu, struct process **mem) ++proc_find_top(struct process **cpu, struct process **mem, struct process **time) + { + struct kinfo_proc *p; + int n_processes; +@@ -701,6 +758,9 @@ proc_find_top(struct process **cpu, struct process **mem) + processes[j].amount = 100.0 * p[i].ki_pctcpu / FSCALE; + processes[j].vsize = p[i].ki_size; + processes[j].rss = (p[i].ki_rssize * getpagesize()); ++ /* ki_runtime is in microseconds, total_cpu_time in centiseconds. ++ * Therefore we divide by 10000. */ ++ processes[j].total_cpu_time = p[i].ki_runtime / 10000; + j++; + } + } +@@ -710,11 +770,8 @@ proc_find_top(struct process **cpu, struct process **mem) + struct process *tmp, *ttmp; + + tmp = malloc(sizeof(struct process)); +- tmp->pid = processes[i].pid; +- tmp->amount = processes[i].amount; ++ memcpy(tmp, &processes[i], sizeof(struct process)); + tmp->name = strndup(processes[i].name, text_buffer_size); +- tmp->rss = processes[i].rss; +- tmp->vsize = processes[i].vsize; + + ttmp = mem[i]; + mem[i] = tmp; +@@ -729,11 +786,8 @@ proc_find_top(struct process **cpu, struct process **mem) + struct process *tmp, *ttmp; + + tmp = malloc(sizeof(struct process)); +- tmp->pid = processes[i].pid; +- tmp->amount = processes[i].amount; ++ memcpy(tmp, &processes[i], sizeof(struct process)); + tmp->name = strndup(processes[i].name, text_buffer_size); +- tmp->rss = processes[i].rss; +- tmp->vsize = processes[i].vsize; + + ttmp = cpu[i]; + cpu[i] = tmp; +@@ -743,6 +797,22 @@ proc_find_top(struct process **cpu, struct process **mem) + } + } + ++ qsort(processes, j - 1, sizeof(struct process), comparetime); ++ for (i = 0; i < 10 && i < n_processes; i++) { ++ struct process *tmp, *ttmp; ++ ++ tmp = malloc(sizeof(struct process)); ++ memcpy(tmp, &processes[i], sizeof(struct process)); ++ tmp->name = strndup(processes[i].name, text_buffer_size); ++ ++ ttmp = time[i]; ++ time[i] = tmp; ++ if (ttmp != NULL) { ++ free(ttmp->name); ++ free(ttmp); ++ } ++ } ++ + #if defined(FREEBSD_DEBUG) + printf("=====\nmem\n"); + for (i = 0; i < 10; i++) { +@@ -916,8 +986,3 @@ int get_entropy_poolsize(unsigned int *val) + (void)val; + return 1; + } +- +-/* empty stub so conky links */ +-void free_all_processes(void) +-{ +-} diff --git a/sysutils/conky/files/patch-src-fs.c b/sysutils/conky/files/patch-src-fs.c new file mode 100644 index 000000000000..44ef2eb1ca51 --- /dev/null +++ b/sysutils/conky/files/patch-src-fs.c @@ -0,0 +1,26 @@ +--- src/fs.c.orig ++++ src/fs.c +@@ -65,13 +65,13 @@ static void update_fs_stat(struct fs_stat *fs); + + void get_fs_type(const char *path, char *result); + +-void update_fs_stats(void) ++int update_fs_stats(void) + { + unsigned i; + static double last_fs_update = 0.0; + + if (current_update_time - last_fs_update < 13) +- return; ++ return 0; + + for (i = 0; i < MAX_FS_STATS; ++i) { + if (fs_stats[i].set) { +@@ -79,6 +79,7 @@ void update_fs_stats(void) + } + } + last_fs_update = current_update_time; ++ return 0; + } + + void clear_fs_stats(void) diff --git a/sysutils/conky/files/patch-src-fs.h b/sysutils/conky/files/patch-src-fs.h new file mode 100644 index 000000000000..41e103eaaf5c --- /dev/null +++ b/sysutils/conky/files/patch-src-fs.h @@ -0,0 +1,11 @@ +--- src/fs.h.orig ++++ src/fs.h +@@ -28,7 +28,7 @@ void print_fs_size(struct text_object *, char *, int); + void print_fs_used(struct text_object *, char *, int); + void print_fs_type(struct text_object *, char *, int); + +-void update_fs_stats(void); ++int update_fs_stats(void); + struct fs_stat *prepare_fs_stat(const char *path); + void clear_fs_stats(void); + diff --git a/sysutils/conky/files/patch-src-i8k.c b/sysutils/conky/files/patch-src-i8k.c new file mode 100644 index 000000000000..951310af7252 --- /dev/null +++ b/sysutils/conky/files/patch-src-i8k.c @@ -0,0 +1,34 @@ +--- src/i8k.c.orig ++++ src/i8k.c +@@ -53,7 +53,7 @@ struct { + #define PROC_I8K "/proc/i8k" + #define I8K_DELIM " " + static char *i8k_procbuf = NULL; +-void update_i8k(void) ++int update_i8k(void) + { + FILE *fp; + +@@ -61,8 +61,13 @@ void update_i8k(void) + i8k_procbuf = (char *) malloc(128 * sizeof(char)); + } + if ((fp = fopen(PROC_I8K, "r")) == NULL) { +- CRIT_ERR(NULL, NULL, "/proc/i8k doesn't exist! use insmod to make sure the kernel " ++ free(i8k_procbuf); ++ i8k_procbuf = NULL; ++ NORM_ERR("/proc/i8k doesn't exist! use insmod to make sure the kernel " + "driver is loaded..."); ++ clean_up_without_threads(NULL, NULL); ++ free(current_mail_spool); ++ return 1; + } + + memset(&i8k_procbuf[0], 0, 128); +@@ -82,6 +87,7 @@ void update_i8k(void) + i8k.right_fan_rpm = strtok(NULL, I8K_DELIM); + i8k.ac_status = strtok(NULL, I8K_DELIM); + i8k.buttons_status = strtok(NULL, I8K_DELIM); ++ return 0; + } + + static const char *fan_status_to_string(int status) diff --git a/sysutils/conky/files/patch-src-i8k.h b/sysutils/conky/files/patch-src-i8k.h new file mode 100644 index 000000000000..45be71a8ccaf --- /dev/null +++ b/sysutils/conky/files/patch-src-i8k.h @@ -0,0 +1,11 @@ +--- src/i8k.h.orig ++++ src/i8k.h +@@ -32,7 +32,7 @@ + #ifndef _I8K_H + #define _I8K_H + +-void update_i8k(void); ++int update_i8k(void); + void print_i8k_left_fan_status(struct text_object *, char *, int); + void print_i8k_cpu_temp(struct text_object *, char *, int); + void print_i8k_right_fan_status(struct text_object *, char *, int); diff --git a/sysutils/conky/files/patch-src-logging.h b/sysutils/conky/files/patch-src-logging.h new file mode 100644 index 000000000000..39e1a748d6b4 --- /dev/null +++ b/sysutils/conky/files/patch-src-logging.h @@ -0,0 +1,20 @@ +--- src/logging.h.orig ++++ src/logging.h +@@ -30,6 +30,7 @@ + #include "mail.h" + + void clean_up(void *memtofree1, void* memtofree2); ++void clean_up_without_threads(void *memtofree1, void* memtofree2); + + #ifndef _LOGGING_H + #define _LOGGING_H +@@ -44,6 +45,9 @@ void clean_up(void *memtofree1, void* memtofree2); + #define CRIT_ERR(memtofree1, memtofree2, ...) \ + { NORM_ERR(__VA_ARGS__); clean_up(memtofree1, memtofree2); free(current_mail_spool); exit(EXIT_FAILURE); } + ++#define THREAD_CRIT_ERR(memtofree1, memtofree2, ...) \ ++ { NORM_ERR(__VA_ARGS__); clean_up_without_threads(memtofree1, memtofree2); free(current_mail_spool); return; } ++ + /* debugging output */ + extern int global_debug_level; + #define __DBGP(level, ...) \ diff --git a/sysutils/conky/files/patch-src-mail.c b/sysutils/conky/files/patch-src-mail.c new file mode 100644 index 000000000000..ac0b652beeb3 --- /dev/null +++ b/sysutils/conky/files/patch-src-mail.c @@ -0,0 +1,46 @@ +--- src/mail.c.orig ++++ src/mail.c +@@ -61,6 +61,8 @@ + #define POP3_TYPE 1 + #define IMAP_TYPE 2 + ++#define MAXFOLDERSIZE 128 ++ + struct mail_s { // for imap and pop3 + unsigned long unseen; + unsigned long messages; +@@ -74,7 +76,7 @@ struct mail_s { // for imap and pop3 + char user[128]; + char pass[128]; + char command[1024]; +- char folder[128]; ++ char folder[MAXFOLDERSIZE]; + timed_thread *p_timed_thread; + char secure; + }; +@@ -465,17 +467,20 @@ struct mail_s *parse_mail_args(char type, const char *arg) + if (type == IMAP_TYPE) { + tmp = strstr(arg, "-f "); + if (tmp) { +- int len = 1024; ++ int len = MAXFOLDERSIZE-1; + tmp += 3; + if (tmp[0] == '\'') { + len = strstr(tmp + 1, "'") - tmp - 1; +- if (len > 1024) { +- len = 1024; ++ if (len > MAXFOLDERSIZE-1) { ++ len = MAXFOLDERSIZE-1; + } ++ tmp++; + } +- strncpy(mail->folder, tmp + 1, len); ++ strncpy(mail->folder, tmp, len); ++ mail->folder[len-1] = 0; + } else { +- strncpy(mail->folder, "INBOX", 128); // default imap inbox ++ strncpy(mail->folder, "INBOX", MAXFOLDERSIZE-1); // default imap inbox ++ mail->folder[MAXFOLDERSIZE-1] = 0; + } + } + tmp = strstr(arg, "-e "); diff --git a/sysutils/conky/files/patch-src-mixer.c b/sysutils/conky/files/patch-src-mixer.c new file mode 100644 index 000000000000..a343b5b654c9 --- /dev/null +++ b/sysutils/conky/files/patch-src-mixer.c @@ -0,0 +1,196 @@ +--- src/mixer.c.orig ++++ src/mixer.c +@@ -38,9 +38,6 @@ + #include <ctype.h> + + +-#ifdef MIXER_IS_ALSA +-#include <alsa/asoundlib.h> +-#else + #ifdef HAVE_LINUX_SOUNDCARD_H + #include <linux/soundcard.h> + #else +@@ -50,173 +47,12 @@ + #include <sys/soundcard.h> + #endif /* __OpenBSD__ */ + #endif /* HAVE_LINUX_SOUNDCARD_H */ +-#endif /* MIXER_IS_ALSA */ + + #define MIXER_DEV "/dev/mixer" + +-#ifdef MIXER_IS_ALSA +-#define MAX_MIXERS 8 +-struct mixer_control { +- char name[64]; +- snd_mixer_t *mixer; +- snd_mixer_selem_id_t *sid; +- snd_mixer_elem_t *elem; +- long vol_min, vol_max; +-}; +- +-static struct mixer_control mixer_data[MAX_MIXERS]; +-int num_mixers = 0; +-static char soundcard[64] = "default"; +-#else + static int mixer_fd; + static const char *devs[] = SOUND_DEVICE_NAMES; +-#endif +- +-#ifdef MIXER_IS_ALSA +-static int parse_simple_id(const char *str, snd_mixer_selem_id_t *sid) +-{ +- int c, size; +- char buf[128]; +- char *ptr = buf; +- +- while (*str == ' ' || *str == '\t') +- str++; +- if (!(*str)) +- return -EINVAL; +- size = 1; /* for '\0' */ +- if (*str != '"' && *str != '\'') { +- while (*str && *str != ',') { +- if (size < (int)sizeof(buf)) { +- *ptr++ = *str; +- size++; +- } +- str++; +- } +- } else { +- c = *str++; +- while (*str && *str != c) { +- if (size < (int)sizeof(buf)) { +- *ptr++ = *str; +- size++; +- } +- str++; +- } +- if (*str == c) +- str++; +- } +- if (*str == '\0') { +- snd_mixer_selem_id_set_index(sid, 0); +- *ptr = 0; +- goto _set; +- } +- if (*str != ',') +- return -EINVAL; +- *ptr = 0; /* terminate the string */ +- str++; +- if (!isdigit(*str)) +- return -EINVAL; +- snd_mixer_selem_id_set_index(sid, atoi(str)); +- _set: +- snd_mixer_selem_id_set_name(sid, buf); +- return 0; +-} +- +-int mixer_init (const char *name) +-{ +- /* from amixer.c, replaced -EINVAL with -1 */ +- int i, err; +- if (!name) +- name = "Master"; +- +- for (i = 0; i < num_mixers; i++) { +- if (!strcasecmp (mixer_data[i].name, name)) { +- return i; +- } +- } +- if (i == MAX_MIXERS) { +- fprintf (stderr, "max mixers (%d) reached\n", MAX_MIXERS); +- return -1; +- }; +- +- num_mixers++; +-#define data mixer_data[i] +- +- strncpy (mixer_data[i].name, name, 63); +- mixer_data[i].name[63] = '\0'; +- snd_mixer_selem_id_alloca (&data.sid); +- data.mixer = NULL; +- if (parse_simple_id (name, data.sid) < 0) { +- fprintf (stderr, "Wrong mixer identifier: %s\n", name); +- return -1; +- } +- if ((err = snd_mixer_open (&data.mixer, 0)) < 0) { +- fprintf (stderr, "snd_mixer_open: %s\n", snd_strerror (err)); +- return -1; +- } +- if ((err = snd_mixer_attach (data.mixer, soundcard)) < 0) { +- fprintf (stderr, "snd_mixer_attach: %s\n", snd_strerror (err)); +- return -1; +- } +- if ((err = snd_mixer_selem_register (data.mixer, NULL, NULL)) < 0) { +- fprintf (stderr, "snd_mixer_selem_register: %s\n", +- snd_strerror (err)); +- return -1; +- } +- if ((err = snd_mixer_load (data.mixer)) < 0) { +- fprintf (stderr, "snd_mixer_load: %s\n", snd_strerror (err)); +- return -1; +- } +- if (!(data.elem = snd_mixer_find_selem (data.mixer, data.sid))) { +- fprintf (stderr, "snd_mixer_find_selem (\"%s\", %i)\n", +- snd_mixer_selem_id_get_name (data.sid), +- snd_mixer_selem_id_get_index (data.sid)); +- return -1; +- } +- snd_mixer_selem_get_playback_volume_range(data.elem, &data.vol_min, &data.vol_max); +- return i; +-} +-static int mixer_get_avg (int i) +-{ +- long val; +- +- snd_mixer_handle_events (data.mixer); +- snd_mixer_selem_get_playback_volume (data.elem, 0, &val); +- if(data.vol_max != 100) { +- float avgf = ((float)val / data.vol_max) * 100; +- int avg = (int)avgf; +- return (avgf - avg < 0.5) ? avg : avg + 1; +- } +- return (int) val; +-} +-static int mixer_get_left (int i) +-{ +- /* stub */ +- return mixer_get_avg (i); +-} +-static int mixer_get_right (int i) +-{ +- /* stub */ +- return mixer_get_avg (i); +-} +-int mixer_to_255(int i, int x) +-{ +- return (x-data.vol_min)*255/(data.vol_max-data.vol_min); +-} +-int mixer_is_mute(int i) +-{ +- snd_mixer_handle_events (data.mixer); +- if (snd_mixer_selem_has_playback_switch (data.elem)) { +- int val, err; +- if ((err = snd_mixer_selem_get_playback_switch(data.elem, 0, &val)) < 0) +- fprintf (stderr, "playback_switch: %s\n", snd_strerror (err)); +- return !val; +- } else { +- return !mixer_get_avg(i); +- } +-} +-#undef data + +-#else /* MIXER_IS_ALSA */ + int mixer_init(const char *name) + { + unsigned int i; +@@ -281,8 +117,7 @@ int mixer_is_mute(int i) + return !mixer_get(i); + } + +-#define mixer_to_255(i, x) x +-#endif /* MIXER_IS_ALSA */ ++#define mixer_to_255(i, x) x * 2.55 + + void parse_mixer_arg(struct text_object *obj, const char *arg) + { diff --git a/sysutils/conky/files/patch-src-moc.c b/sysutils/conky/files/patch-src-moc.c new file mode 100644 index 000000000000..a5e23555ca72 --- /dev/null +++ b/sysutils/conky/files/patch-src-moc.c @@ -0,0 +1,12 @@ +--- src/moc.c.orig ++++ src/moc.c +@@ -133,7 +133,8 @@ static int run_moc_thread(double interval) + return 0; + } + +-void update_moc(void) ++int update_moc(void) + { + run_moc_thread(info.music_player_interval * 100000); ++ return 0; + } diff --git a/sysutils/conky/files/patch-src-moc.h b/sysutils/conky/files/patch-src-moc.h new file mode 100644 index 000000000000..a3e7d2fc8dda --- /dev/null +++ b/sysutils/conky/files/patch-src-moc.h @@ -0,0 +1,11 @@ +--- src/moc.h.orig ++++ src/moc.h +@@ -40,7 +40,7 @@ struct moc_s { + }; + extern struct moc_s moc; + +-void update_moc(void); ++int update_moc(void); + void free_moc(void); + + #endif /* MOC_H_ */ diff --git a/sysutils/conky/files/patch-src-mpd.c b/sysutils/conky/files/patch-src-mpd.c new file mode 100644 index 000000000000..725de2ee78bb --- /dev/null +++ b/sysutils/conky/files/patch-src-mpd.c @@ -0,0 +1,30 @@ +--- src/mpd.c.orig ++++ src/mpd.c +@@ -113,23 +113,24 @@ void free_mpd(void) + + static void *update_mpd_thread(void *) __attribute__((noreturn)); + +-void update_mpd(void) ++int update_mpd(void) + { + int interval; + static timed_thread *thread = NULL; + + if (thread) +- return; ++ return 0; + + interval = info.music_player_interval * 1000000; + thread = timed_thread_create(&update_mpd_thread, &thread, interval); + if (!thread) { + NORM_ERR("Failed to create MPD timed thread"); +- return; ++ return 0; + } + timed_thread_register(thread, &thread); + if (timed_thread_run(thread)) + NORM_ERR("Failed to run MPD timed thread"); ++ return 0; + } + + /* stringMAXdup dups at most text_buffer_size bytes */ diff --git a/sysutils/conky/files/patch-src-mpd.h b/sysutils/conky/files/patch-src-mpd.h new file mode 100644 index 000000000000..7020649fef03 --- /dev/null +++ b/sysutils/conky/files/patch-src-mpd.h @@ -0,0 +1,11 @@ +--- src/mpd.h.orig ++++ src/mpd.h +@@ -31,7 +31,7 @@ int mpd_set_port(const char *); + void init_mpd(void); + struct mpd_s *mpd_get_info(void); + void free_mpd(void); +-void update_mpd(void); ++int update_mpd(void); + + void print_mpd_elapsed(struct text_object *, char *, int); + void print_mpd_length(struct text_object *, char *, int); diff --git a/sysutils/conky/files/patch-src-net_stat.c b/sysutils/conky/files/patch-src-net_stat.c new file mode 100644 index 000000000000..2645df002159 --- /dev/null +++ b/sysutils/conky/files/patch-src-net_stat.c @@ -0,0 +1,28 @@ +--- src/net_stat.c.orig ++++ src/net_stat.c +@@ -400,7 +400,7 @@ void free_dns_data(void) + memset(&dns_data, 0, sizeof(dns_data)); + } + +-void update_dns_data(void) ++int update_dns_data(void) + { + FILE *fp; + char line[256]; +@@ -416,7 +416,7 @@ void update_dns_data(void) + free_dns_data(); + + if ((fp = fopen("/etc/resolv.conf", "r")) == NULL) +- return; ++ return 0; + while(!feof(fp)) { + if (fgets(line, 255, fp) == NULL) { + break; +@@ -429,6 +429,7 @@ void update_dns_data(void) + } + } + fclose(fp); ++ return 0; + } + + void parse_nameserver_arg(struct text_object *obj, const char *arg) diff --git a/sysutils/conky/files/patch-src-net_stat.h b/sysutils/conky/files/patch-src-net_stat.h new file mode 100644 index 000000000000..c57156907cc1 --- /dev/null +++ b/sysutils/conky/files/patch-src-net_stat.h @@ -0,0 +1,11 @@ +--- src/net_stat.h.orig ++++ src/net_stat.h +@@ -94,7 +94,7 @@ int interface_up(struct text_object *); + void free_if_up(struct text_object *); + + void free_dns_data(void); +-void update_dns_data(void); ++int update_dns_data(void); + void parse_nameserver_arg(struct text_object *, const char *); + void print_nameserver(struct text_object *, char *, int); + diff --git a/sysutils/conky/files/patch-src-read_tcp.c b/sysutils/conky/files/patch-src-read_tcp.c new file mode 100644 index 000000000000..f5b702ad6043 --- /dev/null +++ b/sysutils/conky/files/patch-src-read_tcp.c @@ -0,0 +1,11 @@ +--- src/read_tcp.c.orig ++++ src/read_tcp.c +@@ -87,7 +87,7 @@ void print_read_tcp(struct text_object *obj, char *p, int p_max_size) + addr.sin_family = AF_INET; + addr.sin_port = rtd->port; + memcpy(&addr.sin_addr, he->h_addr, he->h_length); +- if (!connect(sock, (struct sockaddr*)&addr, sizeof(struct sockaddr))) { ++ if (connect(sock, (struct sockaddr*)&addr, sizeof(struct sockaddr)) != 0) { + NORM_ERR("read_tcp: Couldn't create a connection"); + return; + } diff --git a/sysutils/conky/files/patch-src-rss.c b/sysutils/conky/files/patch-src-rss.c new file mode 100644 index 000000000000..ee335ef1f741 --- /dev/null +++ b/sysutils/conky/files/patch-src-rss.c @@ -0,0 +1,11 @@ +--- src/rss.c.orig ++++ src/rss.c +@@ -67,7 +67,7 @@ static void rss_process_info(char *p, int p_max_size, char *uri, char *action, i + curloc->result = malloc(sizeof(PRSS)); + memset(curloc->result, 0, sizeof(PRSS)); + curloc->process_function = &prss_parse_data; +- ccurl_init_thread(curloc, interval); ++ ccurl_init_thread(curloc, interval * 60); + if (!curloc->p_timed_thread) { + NORM_ERR("error setting up RSS thread"); + } diff --git a/sysutils/conky/files/patch-src-tcp-portmon.c b/sysutils/conky/files/patch-src-tcp-portmon.c new file mode 100644 index 000000000000..44eb45831da9 --- /dev/null +++ b/sysutils/conky/files/patch-src-tcp-portmon.c @@ -0,0 +1,14 @@ +--- src/tcp-portmon.c.orig ++++ src/tcp-portmon.c +@@ -139,9 +139,10 @@ int tcp_portmon_action(struct text_object *obj, char *p, int p_max_size) + return 0; + } + +-void tcp_portmon_update(void) ++int tcp_portmon_update(void) + { + update_tcp_port_monitor_collection(pmc); ++ return 0; + } + + int tcp_portmon_clear(void) diff --git a/sysutils/conky/files/patch-src-tcp-portmon.h b/sysutils/conky/files/patch-src-tcp-portmon.h new file mode 100644 index 000000000000..ead7e83e1333 --- /dev/null +++ b/sysutils/conky/files/patch-src-tcp-portmon.h @@ -0,0 +1,11 @@ +--- src/tcp-portmon.h.orig ++++ src/tcp-portmon.h +@@ -40,7 +40,7 @@ struct text_object; + + int tcp_portmon_init(struct text_object *, const char *); + int tcp_portmon_action(struct text_object *, char *, int); +-void tcp_portmon_update(void); ++int tcp_portmon_update(void); + int tcp_portmon_clear(void); + int tcp_portmon_set_max_connections(int); + void tcp_portmon_free(struct text_object *); diff --git a/sysutils/conky/files/patch-src-text_object.h b/sysutils/conky/files/patch-src-text_object.h new file mode 100644 index 000000000000..df2f413a06e3 --- /dev/null +++ b/sysutils/conky/files/patch-src-text_object.h @@ -0,0 +1,10 @@ +--- src/text_object.h.orig ++++ src/text_object.h +@@ -230,6 +230,7 @@ enum text_object_type { + #endif /* X11 */ + OBJ_nameserver, + OBJ_nodename, ++ OBJ_nodename_short, + OBJ_nvidia, + OBJ_pre_exec, + OBJ_cmdline_to_pid, diff --git a/sysutils/conky/files/patch-src-top.c b/sysutils/conky/files/patch-src-top.c new file mode 100644 index 000000000000..8ec3c84553e4 --- /dev/null +++ b/sysutils/conky/files/patch-src-top.c @@ -0,0 +1,25 @@ +--- src/top.c.orig ++++ src/top.c +@@ -880,16 +880,22 @@ int parse_top_args(const char *s, const char *arg, struct text_object *obj) + #else /* IOSTATS */ + NORM_ERR("must be one of: name, cpu, pid, mem, time, mem_res, mem_vsize"); + #endif /* IOSTATS */ ++ free(td->s); ++ free(obj->data.opaque); + return 0; + } + if (n < 1 || n > 10) { + NORM_ERR("invalid num arg for top. Must be between 1 and 10."); ++ free(td->s); ++ free(obj->data.opaque); + return 0; + } else { + td->num = n - 1; + } + } else { + NORM_ERR("invalid argument count for top"); ++ free(td->s); ++ free(obj->data.opaque); + return 0; + } + return 1; diff --git a/sysutils/conky/files/patch-src-users.c b/sysutils/conky/files/patch-src-users.c new file mode 100644 index 000000000000..e7d10dd80335 --- /dev/null +++ b/sysutils/conky/files/patch-src-users.c @@ -0,0 +1,17 @@ +--- src/users.c.orig ++++ src/users.c +@@ -157,7 +157,7 @@ void update_user_time(char *tty) + } + } + +-void update_users(void) ++int update_users(void) + { + struct information *current_info = &info; + char temp[BUFLEN] = ""; +@@ -221,4 +221,5 @@ void update_users(void) + current_info->users.times = malloc(text_buffer_size); + strncpy(current_info->users.times, "broken", text_buffer_size); + } ++ return 0; + } diff --git a/sysutils/conky/files/patch-src-x11.c b/sysutils/conky/files/patch-src-x11.c new file mode 100644 index 000000000000..c251f8642b1a --- /dev/null +++ b/sysutils/conky/files/patch-src-x11.c @@ -0,0 +1,37 @@ +--- src/x11.c.orig ++++ src/x11.c +@@ -44,7 +44,7 @@ + + #ifdef XFT + #include <X11/Xft/Xft.h> +-int use_xft = 0; ++int use_xft; + #endif + + #ifdef HAVE_XDBE +@@ -336,7 +336,7 @@ void init_window(int own_window, int w, int h, int set_trans, int back_colour, + XClassHint classHint; + XWMHints wmHint; + Atom xa; +- ++ + #ifdef USE_ARGB + if (have_argb_visual) { + attrs.colormap = window.colourmap; +@@ -775,13 +775,14 @@ void get_x11_desktop_info(Display *current_display, Atom atom) + } + } + +-void update_x11info(void) ++int update_x11info(void) + { + struct information *current_info = &info; + if (x_initialised != YES) +- return; ++ return 0; + current_info->x11.monitor.number = XScreenCount(display); + current_info->x11.monitor.current = XDefaultScreen(display); ++ return 0; + } + + #ifdef OWN_WINDOW |