From owner-svn-ports-all@freebsd.org Tue Apr 26 11:32:22 2016 Return-Path: Delivered-To: svn-ports-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 909F6B1B48E; Tue, 26 Apr 2016 11:32:22 +0000 (UTC) (envelope-from lme@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5B24E1F85; Tue, 26 Apr 2016 11:32:22 +0000 (UTC) (envelope-from lme@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3QBWLBB069634; Tue, 26 Apr 2016 11:32:21 GMT (envelope-from lme@FreeBSD.org) Received: (from lme@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3QBWL2w069627; Tue, 26 Apr 2016 11:32:21 GMT (envelope-from lme@FreeBSD.org) Message-Id: <201604261132.u3QBWL2w069627@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lme set sender to lme@FreeBSD.org using -f From: Lars Engels Date: Tue, 26 Apr 2016 11:32:21 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r414044 - in head/sysutils/conky: . files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2016 11:32:22 -0000 Author: lme Date: Tue Apr 26 11:32:20 2016 New Revision: 414044 URL: https://svnweb.freebsd.org/changeset/ports/414044 Log: - Fix battery percentage calculation and add support for ${battery_short} and ${battery_bar} [1] - Remove a bogus __FreeBSD_kernel__ check in freebsd.c - Re-gen patches with "make makepatch" - Bump PORTREVISION PR: 208651 [1] Submitted by: Helge Oldach Approved by: maintainer timeout (17 days) MFH: 2016Q2 Modified: head/sysutils/conky/Makefile head/sysutils/conky/files/patch-configure head/sysutils/conky/files/patch-lua-cairo.pkg head/sysutils/conky/files/patch-src-conky.c head/sysutils/conky/files/patch-src-freebsd.c head/sysutils/conky/files/patch-src-freebsd.h head/sysutils/conky/files/patch-src-fs.c Modified: head/sysutils/conky/Makefile ============================================================================== --- head/sysutils/conky/Makefile Tue Apr 26 10:27:24 2016 (r414043) +++ head/sysutils/conky/Makefile Tue Apr 26 11:32:20 2016 (r414044) @@ -3,7 +3,7 @@ PORTNAME= conky PORTVERSION= 1.9.0 -PORTREVISION= 5 +PORTREVISION= 6 CATEGORIES= sysutils MASTER_SITES= SF Modified: head/sysutils/conky/files/patch-configure ============================================================================== --- head/sysutils/conky/files/patch-configure Tue Apr 26 10:27:24 2016 (r414043) +++ head/sysutils/conky/files/patch-configure Tue Apr 26 11:32:20 2016 (r414044) @@ -1,6 +1,6 @@ ---- configure.orig 2012-05-04 00:47:40.000000000 +0300 -+++ configure 2012-12-06 04:26:37.000000000 +0200 -@@ -895,6 +895,7 @@ +--- configure.orig 2012-05-03 21:47:40 UTC ++++ configure +@@ -895,6 +895,7 @@ enable_xdamage enable_xft enable_nvidia enable_alsa @@ -8,7 +8,7 @@ enable_debug enable_testing enable_profiling -@@ -1620,6 +1621,7 @@ +@@ -1620,6 +1621,7 @@ Optional Features: --enable-nvidia enable if you want nvidia support [default=no] --disable-alsa disable if you do not want ALSA support [default=yes] @@ -16,7 +16,7 @@ --enable-debug compile with debug symbols [default=no] --enable-testing use strict compiler flags for testing [default=no] --enable-profiling specify compiler flags for use with gprof and gcov -@@ -11930,7 +11932,11 @@ +@@ -11930,7 +11932,11 @@ case $uname in Linux*) WANT_SYSINFO=yes ;; @@ -29,7 +29,207 @@ WANT_KVM=yes WANT_DEVSTAT=yes WANT_OPTRESET=yes -@@ -16998,18 +17004,63 @@ +@@ -14046,12 +14052,12 @@ if test -n "$PKG_CONFIG"; then + pkg_cv_LUA51_CFLAGS="$LUA51_CFLAGS" + else + if test -n "$PKG_CONFIG" && \ +- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua5.1 >= 5.1\""; } >&5 +- ($PKG_CONFIG --exists --print-errors "lua5.1 >= 5.1") 2>&5 ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua-5.1 >= 5.1\""; } >&5 ++ ($PKG_CONFIG --exists --print-errors "lua-5.1 >= 5.1") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then +- pkg_cv_LUA51_CFLAGS=`$PKG_CONFIG --cflags "lua5.1 >= 5.1" 2>/dev/null` ++ pkg_cv_LUA51_CFLAGS=`$PKG_CONFIG --cflags "lua-5.1 >= 5.1" 2>/dev/null` + else + pkg_failed=yes + fi +@@ -14064,12 +14070,12 @@ if test -n "$PKG_CONFIG"; then + pkg_cv_LUA51_LIBS="$LUA51_LIBS" + else + if test -n "$PKG_CONFIG" && \ +- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua5.1 >= 5.1\""; } >&5 +- ($PKG_CONFIG --exists --print-errors "lua5.1 >= 5.1") 2>&5 ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua-5.1 >= 5.1\""; } >&5 ++ ($PKG_CONFIG --exists --print-errors "lua-5.1 >= 5.1") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then +- pkg_cv_LUA51_LIBS=`$PKG_CONFIG --libs "lua5.1 >= 5.1" 2>/dev/null` ++ pkg_cv_LUA51_LIBS=`$PKG_CONFIG --libs "lua-5.1 >= 5.1" 2>/dev/null` + else + pkg_failed=yes + fi +@@ -14088,14 +14094,14 @@ else + _pkg_short_errors_supported=no + fi + if test $_pkg_short_errors_supported = yes; then +- LUA51_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "lua5.1 >= 5.1"` ++ LUA51_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "lua-5.1 >= 5.1"` + else +- LUA51_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "lua5.1 >= 5.1"` ++ LUA51_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "lua-5.1 >= 5.1"` + fi + # Put the nasty error message in config.log where it belongs + echo "$LUA51_PKG_ERRORS" >&5 + +- as_fn_error $? "Package requirements (lua5.1 >= 5.1) were not met: ++ as_fn_error $? "Package requirements (lua-5.1 >= 5.1) were not met: + + $LUA51_PKG_ERRORS + +@@ -14139,12 +14145,12 @@ if test -n "$PKG_CONFIG"; then + pkg_cv_LUA51_CFLAGS="$LUA51_CFLAGS" + else + if test -n "$PKG_CONFIG" && \ +- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua5.1 >= 5.1\""; } >&5 +- ($PKG_CONFIG --exists --print-errors "lua5.1 >= 5.1") 2>&5 ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua-5.1 >= 5.1\""; } >&5 ++ ($PKG_CONFIG --exists --print-errors "lua-5.1 >= 5.1") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then +- pkg_cv_LUA51_CFLAGS=`$PKG_CONFIG --cflags "lua5.1 >= 5.1" 2>/dev/null` ++ pkg_cv_LUA51_CFLAGS=`$PKG_CONFIG --cflags "lua-5.1 >= 5.1" 2>/dev/null` + else + pkg_failed=yes + fi +@@ -14157,12 +14163,12 @@ if test -n "$PKG_CONFIG"; then + pkg_cv_LUA51_LIBS="$LUA51_LIBS" + else + if test -n "$PKG_CONFIG" && \ +- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua5.1 >= 5.1\""; } >&5 +- ($PKG_CONFIG --exists --print-errors "lua5.1 >= 5.1") 2>&5 ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua-5.1 >= 5.1\""; } >&5 ++ ($PKG_CONFIG --exists --print-errors "lua-5.1 >= 5.1") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then +- pkg_cv_LUA51_LIBS=`$PKG_CONFIG --libs "lua5.1 >= 5.1" 2>/dev/null` ++ pkg_cv_LUA51_LIBS=`$PKG_CONFIG --libs "lua-5.1 >= 5.1" 2>/dev/null` + else + pkg_failed=yes + fi +@@ -14181,14 +14187,14 @@ else + _pkg_short_errors_supported=no + fi + if test $_pkg_short_errors_supported = yes; then +- LUA51_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "lua5.1 >= 5.1"` ++ LUA51_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "lua-5.1 >= 5.1"` + else +- LUA51_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "lua5.1 >= 5.1"` ++ LUA51_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "lua-5.1 >= 5.1"` + fi + # Put the nasty error message in config.log where it belongs + echo "$LUA51_PKG_ERRORS" >&5 + +- as_fn_error $? "Package requirements (lua5.1 >= 5.1) were not met: ++ as_fn_error $? "Package requirements (lua-5.1 >= 5.1) were not met: + + $LUA51_PKG_ERRORS + +@@ -14302,12 +14308,12 @@ if test -n "$PKG_CONFIG"; then + pkg_cv_LUA51_CFLAGS="$LUA51_CFLAGS" + else + if test -n "$PKG_CONFIG" && \ +- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua5.1 >= 5.1\""; } >&5 +- ($PKG_CONFIG --exists --print-errors "lua5.1 >= 5.1") 2>&5 ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua-5.1 >= 5.1\""; } >&5 ++ ($PKG_CONFIG --exists --print-errors "lua-5.1 >= 5.1") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then +- pkg_cv_LUA51_CFLAGS=`$PKG_CONFIG --cflags "lua5.1 >= 5.1" 2>/dev/null` ++ pkg_cv_LUA51_CFLAGS=`$PKG_CONFIG --cflags "lua-5.1 >= 5.1" 2>/dev/null` + else + pkg_failed=yes + fi +@@ -14320,12 +14326,12 @@ if test -n "$PKG_CONFIG"; then + pkg_cv_LUA51_LIBS="$LUA51_LIBS" + else + if test -n "$PKG_CONFIG" && \ +- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua5.1 >= 5.1\""; } >&5 +- ($PKG_CONFIG --exists --print-errors "lua5.1 >= 5.1") 2>&5 ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua-5.1 >= 5.1\""; } >&5 ++ ($PKG_CONFIG --exists --print-errors "lua-5.1 >= 5.1") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then +- pkg_cv_LUA51_LIBS=`$PKG_CONFIG --libs "lua5.1 >= 5.1" 2>/dev/null` ++ pkg_cv_LUA51_LIBS=`$PKG_CONFIG --libs "lua-5.1 >= 5.1" 2>/dev/null` + else + pkg_failed=yes + fi +@@ -14344,14 +14350,14 @@ else + _pkg_short_errors_supported=no + fi + if test $_pkg_short_errors_supported = yes; then +- LUA51_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "lua5.1 >= 5.1"` ++ LUA51_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "lua-5.1 >= 5.1"` + else +- LUA51_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "lua5.1 >= 5.1"` ++ LUA51_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "lua-5.1 >= 5.1"` + fi + # Put the nasty error message in config.log where it belongs + echo "$LUA51_PKG_ERRORS" >&5 + +- as_fn_error $? "Package requirements (lua5.1 >= 5.1) were not met: ++ as_fn_error $? "Package requirements (lua-5.1 >= 5.1) were not met: + + $LUA51_PKG_ERRORS + +@@ -14395,12 +14401,12 @@ if test -n "$PKG_CONFIG"; then + pkg_cv_LUA51_CFLAGS="$LUA51_CFLAGS" + else + if test -n "$PKG_CONFIG" && \ +- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua5.1 >= 5.1\""; } >&5 +- ($PKG_CONFIG --exists --print-errors "lua5.1 >= 5.1") 2>&5 ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua-5.1 >= 5.1\""; } >&5 ++ ($PKG_CONFIG --exists --print-errors "lua-5.1 >= 5.1") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then +- pkg_cv_LUA51_CFLAGS=`$PKG_CONFIG --cflags "lua5.1 >= 5.1" 2>/dev/null` ++ pkg_cv_LUA51_CFLAGS=`$PKG_CONFIG --cflags "lua-5.1 >= 5.1" 2>/dev/null` + else + pkg_failed=yes + fi +@@ -14413,12 +14419,12 @@ if test -n "$PKG_CONFIG"; then + pkg_cv_LUA51_LIBS="$LUA51_LIBS" + else + if test -n "$PKG_CONFIG" && \ +- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua5.1 >= 5.1\""; } >&5 +- ($PKG_CONFIG --exists --print-errors "lua5.1 >= 5.1") 2>&5 ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lua-5.1 >= 5.1\""; } >&5 ++ ($PKG_CONFIG --exists --print-errors "lua-5.1 >= 5.1") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then +- pkg_cv_LUA51_LIBS=`$PKG_CONFIG --libs "lua5.1 >= 5.1" 2>/dev/null` ++ pkg_cv_LUA51_LIBS=`$PKG_CONFIG --libs "lua-5.1 >= 5.1" 2>/dev/null` + else + pkg_failed=yes + fi +@@ -14437,14 +14443,14 @@ else + _pkg_short_errors_supported=no + fi + if test $_pkg_short_errors_supported = yes; then +- LUA51_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "lua5.1 >= 5.1"` ++ LUA51_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "lua-5.1 >= 5.1"` + else +- LUA51_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "lua5.1 >= 5.1"` ++ LUA51_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "lua-5.1 >= 5.1"` + fi + # Put the nasty error message in config.log where it belongs + echo "$LUA51_PKG_ERRORS" >&5 + +- as_fn_error $? "Package requirements (lua5.1 >= 5.1) were not met: ++ as_fn_error $? "Package requirements (lua-5.1 >= 5.1) were not met: + + $LUA51_PKG_ERRORS + +@@ -16998,18 +17004,63 @@ fi done @@ -55,8 +255,8 @@ +else + want_inotify=no +fi - - fi ++ ++fi +if test x$want_inotify = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inotify_init in -linotify" >&5 +$as_echo_n "checking for inotify_init in -linotify... " >&6; } @@ -67,10 +267,9 @@ +LIBS="-linotify $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - --done -+#include + ++#include + +char inotify_init (); +int +main () @@ -95,8 +294,9 @@ + conky_LIBS="$conky_LIBS -linotify" +else + want_inotify=yes -+fi -+ + fi + +-done +fi Modified: head/sysutils/conky/files/patch-lua-cairo.pkg ============================================================================== --- head/sysutils/conky/files/patch-lua-cairo.pkg Tue Apr 26 10:27:24 2016 (r414043) +++ head/sysutils/conky/files/patch-lua-cairo.pkg Tue Apr 26 11:32:20 2016 (r414044) @@ -1,6 +1,6 @@ ---- lua/cairo.pkg.orig +--- lua/cairo.pkg.orig 2012-05-03 21:08:27 UTC +++ lua/cairo.pkg -@@ -4,6 +4,7 @@ +@@ -4,6 +4,7 @@ $#include $#include $#include $#include "libcairo-helper.h" Modified: head/sysutils/conky/files/patch-src-conky.c ============================================================================== --- head/sysutils/conky/files/patch-src-conky.c Tue Apr 26 10:27:24 2016 (r414043) +++ head/sysutils/conky/files/patch-src-conky.c Tue Apr 26 11:32:20 2016 (r414044) @@ -1,5 +1,5 @@ ---- src/conky.c.orig 2012-05-04 00:22:21.000000000 +0300 -+++ src/conky.c 2012-12-04 11:09:20.000000000 +0200 +--- src/conky.c.orig 2012-05-03 21:22:21 UTC ++++ src/conky.c @@ -119,7 +119,7 @@ #include "openbsd.h" #endif @@ -9,7 +9,7 @@ #include #endif -@@ -4292,7 +4292,8 @@ +@@ -4292,7 +4292,8 @@ static void set_default_configurations(v free_templates(); @@ -19,7 +19,7 @@ { char buf[256]; -@@ -5662,6 +5663,7 @@ +@@ -5662,6 +5663,7 @@ void initialisation(int argc, char **arg current_mail_spool = strndup(buf, text_buffer_size); } } @@ -27,7 +27,7 @@ #endif /* handle other command line arguments */ -@@ -5971,7 +5973,7 @@ +@@ -5971,7 +5973,7 @@ int main(int argc, char **argv) void alarm_handler(void) { if(childpid > 0) { Modified: head/sysutils/conky/files/patch-src-freebsd.c ============================================================================== --- head/sysutils/conky/files/patch-src-freebsd.c Tue Apr 26 10:27:24 2016 (r414043) +++ head/sysutils/conky/files/patch-src-freebsd.c Tue Apr 26 11:32:20 2016 (r414044) @@ -1,64 +1,71 @@ ---- src/freebsd.c.orig 2012-05-04 06:08:27.000000000 +0900 -+++ src/freebsd.c 2013-08-05 09:02:37.000000000 +0900 -@@ -38,6 +38,11 @@ - #include - #include - -+#if defined(__FreeBSD__) && (!defined(__FreeBSD_kernel__) || !(__FreeBSD_kernel__ + 0)) -+# undef __FreeBSD_kernel__ -+# define __FreeBSD_kernel__ __FreeBSD__ -+#endif -+ - #include - #include - #include -@@ -283,7 +288,7 @@ +--- src/freebsd.c.orig 2012-05-03 21:08:27 UTC ++++ src/freebsd.c +@@ -283,11 +283,7 @@ int update_running_processes(void) pthread_mutex_lock(&kvm_proc_mutex); p = kvm_getprocs(kd, KERN_PROC_ALL, 0, &n_processes); for (i = 0; i < n_processes; i++) { -#if (__FreeBSD__ < 5) && (__FreeBSD_kernel__ < 5) -+#if (defined(__FreeBSD__) && (__FreeBSD__ < 5)) || (defined(__FreeBSD_kernel__) && (__FreeBSD_kernel__ < 5)) - if (p[i].kp_proc.p_stat == SRUN) { - #else +- if (p[i].kp_proc.p_stat == SRUN) { +-#else if (p[i].ki_stat == SRUN) { -@@ -300,7 +305,9 @@ - void get_cpu_count(void) - { - int cpu_count = 0; -- size_t cpu_count_len = sizeof(cpu_count); -+ /* add check for !info.cpu_usage since that mem is freed on a SIGUSR1 */ -+ if ((cpu_setup == 1) && (info.cpu_usage)) -+ return; - - if (GETSYSCTL("hw.ncpu", cpu_count) == 0) { - info.cpu_count = cpu_count; -@@ -313,6 +320,7 @@ - if (info.cpu_usage == NULL) { - CRIT_ERR(NULL, NULL, "malloc"); +-#endif + cnt++; + } } -+ cpu_setup = 1; - } - - struct cpu_info { -@@ -330,11 +338,7 @@ - unsigned int malloc_cpu_size = 0; - extern void* global_cpu; +@@ -464,7 +460,7 @@ void get_battery_stuff(char *buf, unsign + break; + case BATTERY_STATUS: + if (batstate == 1) // Discharging +- snprintf(buf, n, "remaining %d%%", batcapacity); ++ snprintf(buf, n, "remaining (%d%%)", batcapacity); + else + snprintf(buf, n, batstate == 2 ? "charging (%d%%)" : + (batstate == 7 ? "absent/on AC" : "charged (%d%%)"), +@@ -497,26 +493,10 @@ static int check_bat(const char *bat) -- /* add check for !info.cpu_usage since that mem is freed on a SIGUSR1 */ -- if ((cpu_setup == 0) || (!info.cpu_usage)) { -- get_cpu_count(); -- cpu_setup = 1; + int get_battery_perct(const char *bat) + { +- union acpi_battery_ioctl_arg battio; +- int batnum, acpifd; +- int designcap, lastfulcap, batperct; ++ int batcapacity; + +- if ((battio.unit = batnum = check_bat(bat)) < 0) +- return 0; +- if ((acpifd = open("/dev/acpi", O_RDONLY)) < 0) { +- fprintf(stderr, "Can't open ACPI device\n"); +- return 0; +- } +- if (ioctl(acpifd, ACPIIO_BATT_GET_BIF, &battio) == -1) { +- fprintf(stderr, "Unable to get info for battery unit %d\n", batnum); +- return 0; - } -+ get_cpu_count(); +- close(acpifd); +- designcap = battio.bif.dcap; +- lastfulcap = battio.bif.lfcap; +- batperct = (designcap > 0 && lastfulcap > 0) ? +- (int) (((float) lastfulcap / designcap) * 100) : 0; +- return batperct > 100 ? 100 : batperct; ++ get_battery_stats(NULL, &batcapacity, NULL, NULL); ++ return batcapacity; + } - if (!global_cpu) { - malloc_cpu_size = (info.cpu_count + 1) * sizeof(struct cpu_info); -@@ -702,7 +706,7 @@ - free(dev_select); + int get_battery_perct_bar(const char *bar) +@@ -970,11 +950,14 @@ void get_battery_short_status(char *buff + if (0 == strncmp("charging", buffer, 8)) { + buffer[0] = 'C'; + memmove(buffer + 1, buffer + 8, n - 8); +- } else if (0 == strncmp("discharging", buffer, 11)) { ++ } else if (0 == strncmp("remaining", buffer, 9)) { + buffer[0] = 'D'; +- memmove(buffer + 1, buffer + 11, n - 11); ++ memmove(buffer + 1, buffer + 9, n - 9); ++ } else if (0 == strncmp("charged", buffer, 7)) { ++ buffer[0] = 'F'; ++ memmove(buffer + 1, buffer + 7, n - 7); + } else if (0 == strncmp("absent/on AC", buffer, 12)) { +- buffer[0] = 'A'; ++ buffer[0] = 'N'; + memmove(buffer + 1, buffer + 12, n - 12); } - -- free(statinfo_cur.dinfo); -+ free(statinfo_cur.dinfo->mem_ptr); - return 0; } - Modified: head/sysutils/conky/files/patch-src-freebsd.h ============================================================================== --- head/sysutils/conky/files/patch-src-freebsd.h Tue Apr 26 10:27:24 2016 (r414043) +++ head/sysutils/conky/files/patch-src-freebsd.h Tue Apr 26 11:32:20 2016 (r414044) @@ -1,5 +1,5 @@ ---- src/freebsd.h.orig 2012-12-04 04:24:41.000000000 +0200 -+++ src/freebsd.h 2012-12-04 04:24:52.000000000 +0200 +--- src/freebsd.h.orig 2012-05-03 21:08:27 UTC ++++ src/freebsd.h @@ -10,6 +10,7 @@ #include #include Modified: head/sysutils/conky/files/patch-src-fs.c ============================================================================== --- head/sysutils/conky/files/patch-src-fs.c Tue Apr 26 10:27:24 2016 (r414043) +++ head/sysutils/conky/files/patch-src-fs.c Tue Apr 26 11:32:20 2016 (r414044) @@ -1,6 +1,6 @@ ---- src/fs.c.orig 2012-05-04 00:08:27.000000000 +0300 -+++ src/fs.c 2012-07-18 20:24:10.000000000 +0300 -@@ -118,9 +118,15 @@ +--- src/fs.c.orig 2012-05-03 21:08:27 UTC ++++ src/fs.c +@@ -118,9 +118,15 @@ struct fs_stat *prepare_fs_stat(const ch static void update_fs_stat(struct fs_stat *fs) {