1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-25 12:10:03 +00:00

svn merge -rHEAD:918 .

git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@921 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Philip Kovacs 2007-08-13 19:09:33 +00:00
parent 9c447a19df
commit f72122bd06
85 changed files with 0 additions and 31422 deletions

View File

@ -1,248 +0,0 @@
# $Id$
Authors of conky in alphapetical order (please, send mail if I forgot
somebody or email address / name is wrong):
adi <razorbladeworks at yahoo dot com>
Outline stuff
ACPI fan & adapter
Adi Zaimi
original top code
Alex <godexsoft at bk dot ru>
Iconv patch
affinity <affy at users dot sourceforge dot net>
X-Mozilla-Status support
akash <akash at users dot sourceforge dot net>
battery_percent and battery_bar
Blondak <blondak_nesercz at users dot sourceforge dot net>
diskio read & write patch
Bobby Beckmann <bbeckmann at users dot sourceforge dot net>
Interface IP and Wireless Quality patch
David Carter <boojit at pundo dot com>
CPU usage being reported incorrectly by top
Brenden Matthews <brenden at rty dot ca>
project maintainer
Bruce Merry <bmerry at cs dot uct dot ac dot za>
Xdbe (double buffering)
btlee
linkstatus patch (http://forums.gentoo.org/viewtopic-p-2765647.html#2765647)
calmar <mac at calmar dot ws>
mboxscan
cromka <cromka at users dot sourceforge dot net>
if_existing patch for string matching
dan-h <dan-h at users dot sourceforge dot net>
adt746x fix
Dan Piponi <dan at tanelorn dot demon dot co dot uk>
original top code
Dave Clark <clarkd at skynet dot ca>
original top code
David McCabe
utime
Ram Yalamanchili
tztime
Daniel Thiele <dthiele at gmx dot net>
APM support for FreeBSD
Denis <d-st at users dot sourceforge dot net>
WM_CLASS patch
statfs patch
Dennis Frommknecht
NVCtrl, temperature monitoring for nvdia-based graphics cards
Dennis Kaandorp <addict at quicknet dot nl>
adt746x stuff
Elisey O. Savateev <bio3k at softboard dot ru>
Fixed if_mounted on FreeBSD
Egor(knick_)
Iconv patch
Erik Scharwaechter <erik at diozaka dot org>
$if_empty patch
Falk Feuersenger <lumberjack at users dot sourceforge dot net>
I2C divisor from a file
Fanat1k
Iconv patch
flitsch <flitsch at users dot sourceforge dot net>
hwmon support
fow <facadedewalls at yahoo dot com>
mpd_title max length
Gwenhael LE MOINE <cycojesus at yahoo dot fr>
Manual setting of the position
WM_CLASS for window when drawing to own window
Hannu Saransaari <hipo at users dot sourceforge dot net>
Main code
Jason Mitchell <jason.mitchell03 at saintleo dot edu>
developer
UTF8 fix
Source clean up
Jason Tan <jtan325 at users dot sourceforge dot net>
developer
debian package maintainer
Joe Myre - <joemyre at users dot sourceforge dot net>
developer
jack_mort - gentoo forums
$tab patch
Jarmo Hekkanen
SETI stuff
Jeremy Burch <ascii021 at yahoo dot com>
$cached and $buffers
JL Farinacci
pad_percents
Johannes Winkelmann <jw at tks6 dot net>
disk I/O on linux
more consistent cpu freq handling on linux
capitalize Hertz in cpu frequeny
jolapache <jolapache at free dot fr>
maildir format
Joshua Gerrish <jgerrish at users dot sourceforge dot net>
mpd password patch
Jørgen P. Tjernø <daxxar at mental dot mine dot nu>
Restores default settings before loading new config file in SIGHUP
Some cleaning and commenting apparently :)
SIGHUP config file reload
killfire
fs_used_perc and fs_bar_free patch
Lassi Selander <sleipner at users dot sourceforge dot net>
XMMS2 patch
Lauri Hakkarainen <b10nik at users dot sourceforge dot net>
Some translating, web and other stuff
Leszek Krupiñski <leszek at wafel dot com>
Battery number for ACPI battery
Load average bug fix
Lucas Brutschy <lbrutschy at users dot sourceforge dot net>
MLDonkey patch
if constructs patch
Michal Januszewski <spock at gentoo dot org>
hddtemp support
Moncelier Camille <pixdamix at users dot sourceforge dot net>
METAR patch
Nattfodd <Nattfodd@gmail.com>
Fixed top_mem dupes
nathanj439 <nathanj439 at users dot sourceforge dot net>
MPD time fix
Pascal Eberhard <pascal dor eberhard at gmail dot com>
graph and bar fix for right alignment
Peter Tarjan <ptarjan at citromail dot hu>
IBM acpi support patch
SMP support for freq stuff
CPU voltage patch
Petr Holub <hopet@users.sourceforge.net>
fix autotools on FreeBSD in autogen.sh
Improved battery readout on FreeBSD
Philip Kovacs <pkovacs at users dot sourceforge dot net>
tcp port monitor with hashing functionality
Audacious, Xmms, BMP, Infopipe stuff
Various Xlib changes, e.g. own_window hints, etc.
Phil <n0-1 at users dot sourceforge dot net>
multiple batteries support
Psychon <psychon at users dot sourceforge dot net>
a bunch of code cleanups
roiban adi <adiroiban at users dot sourceforge dot net>
hex colour patch
Rui Paulo <rpaulo at netbsd-pt dot org>
NetBSD support
Roman Bogorodskiy <novel at clublife dot ru>
FreeBSD support
BMPx support
Ryan Twitchell <tryan2 at rochester dot rr dot com>
head/tail rewrite patch
Mikko Sysikaski <sisu at users dot sourceforge dot net>
prss.c and prss.h
Stepan Zastupov <redchrom at gmail dot com>
WiFi signal level detection support on FreeBSD
Szymon Boniecki
Reads current LC_TIME
Thomas Cort
CPU frequency patch for alpha
Toni <bleach at users dot sourceforge dot net>
exec*/tail/head output evalution
Toni Spets hifi <spets at users dot sourceforge dot net>
OpenBSD support
Linux wifi code
RSS code (created with Mikko Sysikaski)
tyir <tyir at users dot sourceforge dot net>
MPD features patch 1319461
Vivenzio Pagliari <vivenzio@web.de>
Some useful patches for port monitoring
PowerBook battery patch
Walt Nelson <wnelsonjr at comcast dot net>
$freq fix
Warren Dukes <warren dot dukes at gmail dot com>
libmpdclient
William DiPlacido <bimbasaari at yahoo dot com>
Frequency from /proc/cpuinfo
Some other SETI stuff
zimba-tm <zimba-tm at users dot sourceforge dot net>
alignment none patch
zotrix <zotrix at users dot sourceforge dot net>
FreeBSD patch for <10 procs

View File

@ -1,9 +0,0 @@
Any original torsmo code is licensed under the BSD license (see LICENSE.BSD
for a copy)
All code written since the fork of torsmo is licensed under the GPL (see
LICENSE.GPL for a copy)
Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
Copyright (c) 2005-2007 Brenden Matthews, Philip Kovacs, et. al. (see AUTHORS)
All rights reserved.

View File

@ -1,837 +0,0 @@
# $Id$
2007-08-12
* Added var $platform which is similar to $i2c and accommodates the conversion
of many devices from /sys/bus/i2c/devices to /sys/bus/platform/devices.
* Removed config item post_21_kernel since it forced all i2c device lookups
to go to /sys/bus/platform/devices and some people may need a mix of both
i2c and platform devices.
2007-08-10
* Clarifying licensing
2007-08-08
* RSS support
* Wireless support for Linux
2007-08-05
* Conky 1.4.6 released
* Updated to libmpdclient 0.13.0
* Added 'post_21_kernel' config param to specify kernels 2.6.22 and newer
so i2c works properly
2007-08-04
* Fixed potential issue on FreeBSD when nprocs < 10 (thanks zotrix)
* Added support for multiple batteries when using acpi (thanks Phil)
* a bunch of code cleanups (thanks Psychon)
* added max length paramater to mpd_title (thinks fow)
* a number of small bug fixes
2007-07-15
* Fix PID display, patch #1753934. thanks sohalt.
* Fix displaying 4 GB traffic after reloading network driver,
patch #1754260. thanks sohalt.
2007-06-21
* Right-justify top/top_mem vars (pid/cpu/mem} so they align on the decimal.
2007-04-25
* Added color[0-9] variable patch (thanks jieryn)
2007-04-05
* Added if_empty patch (thanks Erik)
* Added if_existing patch for string matching (thanks cromka)
* Added hwmon support (thanks flitsch)
* Some xmms2 updates (thanks sleipner)
* Added $battery_percent and $battery_bar (thanks akash)
2007-02-25
* OpenBSD support added to Conky (thanks hifi)
* Updated mboxscan stuff (thanks calmar)
2007-02-25
* Created branch/1.5 copy of trunk/conky1. Removing all experimental
network code from trunk/conky1.
2007-02-14
* Include missing mboxscan.h in conky.h.
* Fixed signedness warnings in conky.c.
2007-02-11
* Added buffer_text_size option to change the size of the buffer for
things like $exec, $tail, et cetera
* Added $mboxscan which lets you display the Subject and From fields
from recent email in an mbox file
* Disambiguated (is that a word?) $cpu docs
2007-01-14
* Fallback to gettimeofday() when clock_gettime () not available (mac os).
2007-01-09
* API change (timing in milliseconds) for dexter_timedsampler_new ().
2007-01-07
* Add config.rpath (created by gettextize -copy) to distribution
to satisfy AM_ICONV.
* Clean up some warnings; remove ftp.[ch] from src/Makefile.am.
2006-12-29
* Update svn ebuild to new sourceforge url scheme.
- requires deletion of existing wc: rm -rf /usr/portage/distfile/svn-src/conky/
* Added head/tail rewrite patch (thanks Ryan Twitchell)
* Added diskio read/write sf.net patch 1542880 (thanks Blondak)
2006-12-26
* Clear conky vars on disconnect/failure to open files.
2006-12-23
* Updated to libmpdclient 0.12.0
2006-12-22
* client/server infrastructure and prototype for linux only (so far):
- requires libdexter (http://sourceforge.net/projects/libdexter)
and the dxt-sysinfo plugin (svn only at the moment).
* new config items:
- dexter_client yes/no
- dexter_server yes/no
- dexter_config /path/to/libdexter/config (default: $HOME/.dexterrc)
- own_window_class <WM Class Name> (default: Conky)
- replaces wm_class_name
- own_window_title <Window Title> (default: <hostname> - conky)
* removed config items:
- wm_class_name (use own_window_class, same function)
* configure changes:
--disable-network (default=yes) with auto-detection for libdexter.
- remove useless --enable-proc-uptime (PROC_UPTIME never referenced).
HAVE_SYSINFO and others determine if /proc/uptime is used.
- silently disable xft, double-buffer and xdamage if no x11.
- change enable/disable labels to reflect defaults accurately.
- simplified compile-based checks for sysinfo/getloadavg and by moving
them into AC_CHECK_FUNCS.
* allow decorated, own_window=yes windows to be given input focus by WM:
- do not pass button clicks through to desktop in this scenario as conky
immediately loses focus.
2006-12-13
* Clarify LGPL license on timed_thread modules.
* Update NEWS files.
2006-12-12
* Split battery variable into two:
battery, e.g. "charging 75%" and
battery_time, e.g. "3h 15m".
* Conky 1.4.5 released.
2006-12-11
* Close pop3/imap sockets.
* Fix outstanding battery issues.
2006-12-10
* Fix peek table bug with new portmon code.
2006-12-09
* Replaced hash module used by libtcp-portmon with GLib's GHashTable,
due to licensing issue noted by Fedora Core packagers.
* Eliminated config items:
min_port_monitors,
min_port_monitor_connections
* Added config item:
max_port_monitor_connections
2006-11-30
* Added $entropy_avail, $entropy_poolsize and $entropy_bar
for the crypto freaks. Idea suggested by Perttu Luukko
<nuteater@users.sourceforge.net> in feature request 1497050.
* Added max length specifier to audacious_title. Closes
feature request #1600631.
2006-11-28
* Rearrange retry attempts in pop3 and imap code, removing sleep()
calls which cause the whole process to sleep, not just the thread.
2006-11-22
* Added max_specials config item with default 512. This should
close bug #1574523 for real this time. Thanks to John Harrigan
<jfharrigan@fedex.com> for this one.
2006-11-21
* Changed autotools for subversion versioning.
* Updated svn ebuild for gentoo.
* Documentation updates for clarity, i.e. close bug #1599041.
2006-11-20
* fix compile error with --disable-xdamage when Xdamage.h not present.
2006-11-18
* fix bug where present rate var was not being read from acpi battery
state file: /proc/acpi/battery/%s/state.
2006-11-15
* Change linkstatus display for use_spacer. Closes bug #1577580.
2006-11-14
* Fix compile error with --disable-x11.
* Add new timed thread abstraction routines.
* Convert thread activity to timed threads, including
texeci, imap, pop3, audacious.
* Change memory vars from unsigned long to unsigned long long
to fix reported overflow, e.g. swapmax >= 4Gb.
2006-11-13
* Use pthread_cond_timedwait() instead of sleep() in audacious
thread. Will convert all worker threads to this timing method.
2006-11-12
* Fix freebsd build error.
* Minor changes to syntax files.
* Conky 1.4.4 released.
2006-11-11
* Add max_user_text to documentation.
* Fixed BadWindow bugs (#1568366, #1588384).
2006-11-10
* Remove on_bottom and xmms_player completely.
* Closed ibm_temps bug #1591609.
* Conky 1.4.3 released.
2006-11-09
* Updated vim and nano syntax coloring scripts.
* Added extras/ dir with syntax stuff to distribution tarball.
2006-11-08
* Added new config item 'max_user_text' with default 16384,
twice as large as previous hard-coded default of 8192 bytes.
Increase as needed to accomodate large config files with a
great deal of text. This closes SF bug #1574523.
2006-11-07
* Changes to configure.ac for pkg-config on x11/xext/xdamage,
with fallback to conventional checks.
* Fixed segmentation fault on SUGUSR1 bug.
* Commented out Imlib2 from configure.ac since it's only partially
implemented.
2006-11-04
* Removed broken mldonkey and seti support.
* Added Hellf[i]re's nano syntax coloring script to svn.
2006-11-03
* Removed support for Xmms, BMP and Infopipe from conky.
The Xmms and Bmp players are projects are dead and distros such
as Gentoo are slating them for removal.
* Added support for Audacious using new audacious vars.
2006-10-18
* Implement WiFi signal level detection on FreeBSD (patch
by Stepan Zastupov)
2006-10-04
* Fix buffer overflow in parsing LC_ALL, LC_CTYPE and LANG
environment variables and fix crash for users with locale
name longer than 10 chars (repored by Michael Schwendt)
2006-09-30
* --enable-debug added.
* prevent libtool from adding its default CFLAGS
2006-09-28
* Use pkg-config instead of xft-config.
* Fix last line bug which had required padding text with extra blank line
to see text on last line.
2006-09-01
* Fix type-punning and "differ in signedness" warnings seen with
gcc-4.1 -O2.
2006-08-27
* Fix compilation errors when building with --diable-x11; bug #1547164
2006-08-12
* Make configure script print summary info
* Make `conky -v` show compiled-in features
2006-08-10
* Added Spock's patches, adding hddtemp, goto and tab variables.
2006-07-13
* Added tztime patch to show time in arbitrary time zones (thanks Ram
Yalamanchili)
2006-06-07
* Small battery fix (thanks Nexox, sf.net patch 1500014)
* Fixed order of variables/objects in docs (thanks Peter Tarjan)
2006-05-27
* Fixed a bug with $font
2006-05-24
* Xdamage support for composite and pals
2006-05-23
* CPU voltage support via $voltage_mv and $voltage_v (thanks to Peter
Tarjan for the patch)
2006-05-21
* SMP support for $freq and $freq_g (thanks to Peter Tarjan for the
patch)
2006-05-17
* Fixed issue with graphs not reaching all the way to the borders
(sf.net bug 1470480)
* Cleaned up units
2006-05-15
* Conky 1.4.2 released
2006-05-13
* GNU Iconv support added, new objects $iconv_start and $iconv_stop
* Added some safety to the threading code
2006-05-09
* Changed $font behavior so that the font persists past the next
newline. It can be set back to the default with $font with no args.
(closes bug 1478676 on sf.net)
2006-05-08
* Added simple POP3/IMAP mail clients
2006-04-23
* Added support for PowerBook batteries
* Fixed broken $if/$else stuff
2006-04-15
* Added patch from Peter Tarjan to add support for IBM ACPI
* Added xmms2 patch from Lassi Selander (sf.net patch 1469523)
2006-04-11
* Removed sa_restorer crap (may fix some compile errors for some
people)
2006-04-07
* Added patch for adt746x fan/cpu speed for kernel >=2.6.12
2006-03-30
* Added patch to support new port monitor REMOTESERVICE peekable.
2006-03-29
* Scan port numbers as short. Fixes debian bug# 359974.
2006-03-25
* Added XMMS2 patch 1456203 from Lassi Selander
* Added FreeBSD battery patch 1456008 from Petr Holub
2006-03-21
* Fixed ${top(_mem)} related code on FreeBSD (with help of Petr
Holub <hopet@users.sourceforge.net>)
2006-03-15
* Removed bmp-infopipe dependency from 1.4.1 and 1.9999 ebuilds for Gentoo
(Gentoo bug# 125226).
* Fixed subversion ebuild for conky1 (1.9999) so it pulls the new trunk
path for conky1.
2006-03-12
* FreeBSD cpu info patch
* Conky 1.4.1 released
2006-03-07
* Fixed issue where some WM's don't control conky own_window windows.
* Added newly-updated vim file detection and syntax hilighting files to svn.
* Fixed issue with graphs resetting colours (sf.net bug #1420473)
2006-03-06
* Fixed battery problems when charged
* MPD code handles broken pipe now, instead of just killing conky
* Switch from CVS to SVN. Thanks SourceForge.
2006-03-05
* Added patch to make $cpu stuff work on alpha (thanks Thomas Cort)
http://bugs.gentoo.org/show_bug.cgi?id=122637#c3
* Stop using override_redirect true -- conky back under WM control
when using 'own_window yes'.
* Fixed texeci breakage when forking to background is on
2006-02-14
* Drastically simplified own_window=yes window creation code.
* on_bottom and wm_class_name deprecated (they do nothing)
2006-02-13
* Fixed typo bug in portmon code that caused incorrect monitor data
to be displayed.
2006-02-12
* Conky 1.4.0 released
2006-01-27
* Cleaned up texeci code
2006-01-26
* Added freedesktop.org extended window manager hints (EWMH)
for window type NORMAL and state's STICKY/SKIP_PAGER/SKIP_TASKBAR.
Fixes stacking order issues with freedesktop-compliant wm's,
such as XFCE4+.
2006-01-25
* Fixed stupid graph code (it still sucks) sf.net bug 1372962
* Fixed $if_* stuff, sf.net bug 1401338 and 1400854
* Fixed xmms.c code to load glib 1.2 shared object lib.
2006-01-11
* Added xmms version 1 support.
* Added bmp through 0.9.7.1 support.
* Added config item xmms_player: none, xmms, bmp, audacious or
infopipe.
2006-01-07
* Added Audacious media player support.
2006-01-06
* Fixed infopipe bug (select() affects timer as a side effect on
Linux!)
2006-01-05
* Added draw_graph_borders option
* Added XMMS/BMP InfoPipe plugin support
2006-01-01
* Conky 1.3.5 released
2005-12-31
* Fixed bug with use_xft causing ignorance of font selection (sf.net
bug 1387564)
* Fixed issue with parsing of hex values for colours
2005-12-30
* Added BMPx (http://beep-media-player.org/) support
2005-12-14
* Fixed issues with execi stuff
2005-12-10
* Added sf.net patch 1374576
2005-12-05
* Fixed sf.net bug 1367745
2005-11-30
* Fixed sf.net bugs 1369607, 1367735 and gentoo bug 113921,
all variations of the same array out of bounds issue.
* "Fixed" code in fs.c and conky.c to make fs stats match those displayed by df (affects reporting against ext3 filesystems only)
2005-11-27
* new code in linux.c and top.c to calculate CPU % correctly on 2.6 kernels.
2005-11-24
* Fixed gentoo bug# 113219
2005-11-23
* Added #define/#undef SIGNAL_BLOCKING in conky.c for experimenting
with synchronous signal processing. set to #undef for previous behavior.
* Use POSIX signal api's, not the ANSI signal().
2005-11-22
* Fixed IP address bug (sf.net bug 1359055)
2005-11-16
* Conky 1.3.4 released
2005-11-12
* Replaced bitwise copy of tcp_connection_t with function
copy_tcp_connection().
* Changed call interfaces for get_acpi_fan(), get_acpi_ac_adapter(),
get_freq(), get_freq_dynamic(), get_adt746x_cpu(), get_adt746x_fan(),
eliminating all mallocs. pkovacs. See bug 1355470.
2005-11-11
* moved hash sizing code into portmon lib, where it belongs
* More mem leaks fixed.
2005-11-10
* Added config items min_port_monitors / min_port_monitor_connections
2005-11-09
* Cleaned up top code, bug fixes
* Fixed some memory leaks
2005-11-08
* Fix bug# 1351686. Patch by boojit.
* Fixed 1331576 (I think) with bad cpu usage reporting
2005-11-01
* Documentation updates for compiling and port monitoring
* Removed cairo stuff (it's useless)
2005-10-31
* Added statfs sf.net patch 1344493
2005-10-30
* Added tcp port monitor support (pkovacs)
2005-10-28
* Added WM_CLASS patch from sf.net patch 1340825
2005-10-21
* acpi segfault should be fixed (sf.net bug 1330893)
* SIGUSR1 bug fixed? (sf.net bug 1330914)
2005-10-17
* Ugly MPD mem leak fixed
* Other mem leaks fixed
* Fixed thing where conky exits if LC_ALL and friends isn't set
* Conky 1.3.3 released
2005-10-13
* Conky 1.3.2 released
2005-10-10
* More MPD objects (sf.net patch 1319461)
2005-10-07
* fixed mldonkey bug? sf.net bug 1316531
2005-09-30
* Linkstatus patch from btlee on f.g.o (see
http://forums.gentoo.org/viewtopic-p-2765647.html#2765647)
2005-09-29
* Fixed build on FreeBSD for non-i386
* Made it so top_mem doesn't show all the forks of one process
2005-09-27
* Fixed small bug in config parsing (thanks robgrady, bug 1306032)
2005-09-24
* Fixed bug where graphs/bars don't show when maximum_width is enabled
2005-09-15
* Fixed right-alignment bug thanks to Pascal Eberhard
* Applied patch 1291420 from sf.net
* Fixed issue with whack graph data
* Fixed issue with Conky quitting when a file fails to load
2005-09-11
* Fixed bug with xft and double buffer in own window
* 1.3.1 released
2005-09-04
* Misc small bug fixes
2005-09-03
* MPD patch (sf.net patch 1281108)
* Fixed graph width bug
2005-08-31
* FreeBSD support was added
* 1.3.0 released
2005-08-27
* added threaded execi, $texeci
* feature freeze
2005-08-26
* Fixed slight vertical misalignment of bars/graphs (sf.net 1273994)
* Diskio fixes (sf.net 1274140)
* $alignr and $alignc now have 25% more goodness! (sf.net bug 1273905)
* Far better SMP support
* Added support for i8k kernel driver, parsing information for dell inspiron laptops found in /proc/i8k (sf.net request 1256058)
2005-08-25
* More own_window fixes
* applied disk io patch (sf.net patch 1271691)
* applied $freq fixes patch, adds new $freq_dyn (sf.net patch 1271633)
* removed units from $freq* output
* fix for graph config parsing
* Added $head, fixed mem leak with $tail
2005-08-24
* More configure and makefile updates
* Added scale arg for net graphs
* Fixed bug in own_window stuff--amazing fake transparency now works
properly
* added own_window_colour, own_window_transparent
2005-08-23
* Added maximum_width
2005-08-22
* Added $execibar and $execigraph
2005-08-21
* Moved source into src/, moved docs into doc/
* Updated makefiles
2005-08-20
* Applied patch from zimba-tm, closes patch 1260225
* Fixed ugly gradient bug. closes bug 1255608
* Added $voffset
* Removed metar code. It sucked.
* Added $acpitempf for amooricans
* $tail fixes
2005-08-12
* Multiple unit additions and modifications
2005-08-07
* mpd password patch from Joshua Gerrish
* conky can run without X now, use --disable-x11 when configuring
=========================================================================
=========================================================================
2005-08-06
* Conky 1.2 released
2005-08-05
* small fixes
* added CVS ebuild, huge thanks to Hopeless for this
2005-08-04
* special thanks to Citizen_X and his patience
* Citizen_X pwns
* keep shakin' those big 'ol titties
* Citizen_X
* Citizen_X
* Citizen_X
* Citizen_X
2005-08-03
* many small fixes, thanks to those who reported problems
2005-08-02
* dramatically improved how conky handles fonts
* fixed issues with graph args
* fixed shades and outlines
2005-08-01
* stabilized code
* added gradients to graphs (very pretty)
* things
* added $font, yay
* feature freeze; only bugfixes now
2005-07-30
* finalized graphing code, see $cpugraph, $memgraph, $execgraph,
$downspeedgraph, and $upspeedgraph
* added override_utf8_locale option
* poop
* $tab patch from jack_mort on f.g.o
2005-07-28
* Added new graphing code, such as $cpugraph
* small fixes all round
* stuff
* things
* added more mpd objects
2005-07-24
* Conky now has UTF-8 support
* Fixed $freq for those with CPU scaling
* Fixed the problem with total_run_times
* Fixed alignment of bars and lines and stuff
* Reduced conky's memory usage (yay!)
* Removed top_sort_cpu, added top_mem which sorts by mem usage instead
of cpu
2005-07-17
* Fixed a pile of bugs in configure script
* Added proper checking for headers in configure script
* Made METAR shit threaded so it would stop being retarded, also made
it try more then once to update
* Added $metar_tempf and ${i2c tempf} for americans
2005-07-16
* Added option for Conky to update N times and quit, see
total_run_times in conkyrc.sample
* Added metar code for weather info, thanks to somebody on sf.net
* Added $alignr and $alignc for right and centre alignment
* Added wireless info and IP addr patch, thanks Bobby Beckmann,
options $addr and $linkstatus (please test!), as well as fixed a mem
leak in this patch
* adt746x fix, thanks to dan-h on sf.net
* Added mldonkey support patch, thanks Lucas Brutschy on sf.net
* Added patch to allow hex colour values, thanks roiban adi on sf.net
* Added if constructs patch, thanks Lucas Brutschy on sf.net
* Fixed bug in tab code (hopefully for the last time)
* Added option to sort by cpu or memory for top, see top_sort_cpu
2005-07-12
* Added fix for battery charged state (thanks to Lukas Zapletal
<lzap@seznam.cz>)
=========================================================================
=========================================================================
2005-07-05
* Conky 1.1 released
2005-07-03
* Added $mpd_bar and $mpd_bitrate
* Some minor code cleanups prior to release
* Fixed problem with Conky not compiling when XFT disabled
* Fixed configure.in problems with Xdbe
2005-07-01
* Fixed memory leak in MPD code
* Added new $tail object (see conkyrc.sample) which loves to suck CPU
and memory
* Fixed more mem leaks
2005-06-30
* Added use_spacer to config
* Added $mpd_status
* Added small fix for i2c from Filedil on forums.gentoo.org
2005-06-28
* Made it possible to use tabs to right-justify (just add a bunch)
* Added ${execbar} (see conkyrc.sample)
2005-06-26
* Added memory % to top output
* Added initial cairo backend (it's really quite useless at this stage actually, and I'm not sure if there is even any point to it)
2005-06-25
* Conky now recognizes the tab character correctly
* Added simple config option to print to stdout (out_to_console
<yes/no>)
2005-06-23
* Added top output. Check the sample config.
* Cleaned up code.
2005-06-22
* Finished MPD support ($mpd_title, $mpd_artist, $mpd_album, $mpd_vol)
* Removed NVCtrl code
* Added noswap and i2c patches
=========================================================================
=========================================================================
2005-06-21
* Version 1.0. Conky is born from the ashes of torsmo. Main site:
http://conky.sf.net/
* Added xwin patch
* Added new feature for sample averaging of CPU and net info
2004-12-22
* Version 0.18 released
2004-12-21
* Fixed some double buffer + Xft stuff
* Applied X-Mozilla-Status patch (thanks affinity)
* Applied NVCtrl patch and modified it a bit (temperature monitoring
for nvdia-based graphics cards) (I couldn't test this so it may or
may not work or even compile) (thanks Dennis Frommknecht)
* Applied fs_used_perc and fs_bar_free patch (thanks killfire [send me
mail, I didn't catch your name from sourceforge])
* Applied patch that supports mailbox that is in some 'maildir' format
(thanks jolapache [send mail, I didn't catch your name from
sourceforge])
* min -> m
* Applied pad_percents patch (thanks JL Farinacci)
* Fixed some stuff in acpi fan and acpi ac adapter
* Optional XFT even when compiled in
2004-11-30
* Applied utime patch (UTC time) (thanks David McCabe)
2004-11-29
* Applied Xdbe patch, this includes double_buffer configuration and
-b command line option (thanks Bruce Merry)
* Applied some other seti patch, not tested (thanks William DiPlacido)
2004-08-25
* Applied netbsd patch (thanks Rui Paulo)
* Applied cpu frequency patch (thanks William DiPlacido)
* Applied adt746x patch (thanks Dennis Kaandorp)
* Applied some other FreeBSD patch by the same guy
2004-07-31
* Applied FreeBSD patch (thanks Roman Bogorodskiy)
2004-07-25
* Xft support and xftfont configuration
* rewrote some stuff, there might be some new bugs in old places
2004-07-24
* I2C divisor from a file (thanks Falk Feuersenger)
2004-07-20
* changed battery thing to ${battery <filename in
/proc/acpi/battery/>}
* SETI@Home stuff (thanks Jarski)
2004-07-05
* changed signal for config file reloading to SIGUSR1
* mixer stuff, $mixer, $mixerl, $mixerr, $mixerbar, $mixerlbar,
$mixerrbar
2004-06-03
* maybe fixed acpi battery thing when "present rate" isn't known
2004-06-01
* fixed width for all bars, use like ${cpubar 4,50}
2004-05-25
* Version 0.17 released
2004-05-23
* battery number for ACPI battery (thanks Leszek Krupiñski)
* default battery is now BAT0 instead of BAT1, set ${battery 1} if
the old battery thing worked
* bug fix on load average reporting (thanks Leszek Krupiñski)
* outlines to text, draw_outline and default_outline_color
configurations and $outlinecolor (thanks adi)
* $acpifan, $acpiacadapter, $uptime_short (thanks adi)
2004-05-19
* fixed a bug when starting after Opera (and some other programs)
* sticky window
* minimum_size
2004-05-18
* added border_width configuration
2004-05-16
* fixed zero length bar bug
2004-05-15
* file system stats, $fs_bar, $fs_free, $fs_free_perc, $fs_size,
$fs_used
* leaves ACPI temperature file open (faster)
* -a option to change alignment on command line
2004-05-14
* fixed ACPI temperature bug
* border_margin configuration
* ${execi <interval> <command>}, execute with specific interval
* added possibility to manually set the position (-x and -y options)
(thanks to Gwenhael LE MOINE)
* $buffers and $cached (thanks to Jeremy Burch)
* WM_CLASS when drawing to own window (thanks to Gwenhael LE MOINE)
2004-05-14
* Version 0.16 released
2004-05-13
* $pre_exec, execute a shell command one time
* preparsing of text (faster but more memory usage)
* less system calls (faster)
* APM things to $battery (untested)
2004-05-12
* added $new_mails changed $mails to tell total mail count
2004-05-11
* transparent window, own_window configuration, -o cmdline option
* $exec, execute a shell command
* $acpitemp, $battery - acpi stuff (not really tested)
2004-05-10
* $loadavg, load average
* $mails, unread local mails, mail_spool configuration
2004-05-09
* Version 0.15 released
2004-05-06
* SIGHUP reloads config file (thanks Jørgen P. Tjernø)
* Some other stuff

View File

@ -1,244 +0,0 @@
<?xml version = '1.0'?>
<kdevelop>
<general>
<author>Brenden Matthews</author>
<email>brenden@rty.ca</email>
<version>$VERSION$</version>
<projectmanagement>KDevAutoProject</projectmanagement>
<primarylanguage>C</primarylanguage>
<ignoreparts/>
<projectdirectory>.</projectdirectory>
<absoluteprojectpath>false</absoluteprojectpath>
<description/>
<versioncontrol/>
</general>
<kdevautoproject>
<general>
<activetarget>conky</activetarget>
<useconfiguration>debug</useconfiguration>
</general>
<run>
<mainprogram>conky</mainprogram>
<directoryradio>build</directoryradio>
<customdirectory>/</customdirectory>
<programargs/>
<terminal>false</terminal>
<autocompile>true</autocompile>
<envvars/>
<runarguments>
<conky/>
</runarguments>
</run>
<configurations>
<optimized>
<builddir>optimized</builddir>
<ccompiler>kdevgccoptions</ccompiler>
<cxxcompiler>kdevgppoptions</cxxcompiler>
<f77compiler>kdevpgf77options</f77compiler>
<cflags>-fomit-frame-pointer -O2 -fexceptions</cflags>
<envvars/>
<configargs>--prefix=/usr --enable-mpd --enable-xft --enable-seti --enable-double-buffer --enable-own-window --enable-metar --enable-mldonkey</configargs>
<topsourcedir/>
<cppflags/>
<ldflags/>
<ccompilerbinary/>
<cxxcompilerbinary/>
<f77compilerbinary/>
<cxxflags/>
<f77flags/>
</optimized>
<debug>
<configargs>--enable-debug=full --prefix=/usr --enable-mpd --enable-xft --enable-seti --enable-double-buffer --enable-own-window --enable-metar --enable-mldonkey --enable-x11</configargs>
<builddir>debug</builddir>
<ccompiler>kdevgccoptions</ccompiler>
<cxxcompiler>kdevgppoptions</cxxcompiler>
<f77compiler>kdevpgf77options</f77compiler>
<cflags>-O2 -Wall -fexceptions -fomit-frame-pointer -fshort-enums -ggdb</cflags>
<envvars/>
<topsourcedir/>
<cppflags/>
<ldflags/>
<ccompilerbinary/>
<cxxcompilerbinary/>
<f77compilerbinary/>
<cxxflags/>
<f77flags/>
</debug>
<debug-no-x>
<envvars/>
<configargs>--enable-debug=full --prefix=/usr --enable-mpd --enable-xft --enable-seti --enable-double-buffer --enable-own-window --enable-metar --enable-mldonkey --disable-x11 --without-x</configargs>
<builddir>debug-no-x</builddir>
<topsourcedir/>
<cppflags/>
<ldflags/>
<ccompiler>kdevgccoptions</ccompiler>
<cxxcompiler>kdevgppoptions</cxxcompiler>
<f77compiler>kdevpgf77options</f77compiler>
<ccompilerbinary/>
<cxxcompilerbinary/>
<f77compilerbinary/>
<cflags>-O2 -Wall -fexceptions -fomit-frame-pointer -fshort-enums -ggdb</cflags>
<cxxflags/>
<f77flags/>
</debug-no-x>
</configurations>
<make>
<envvars>
<envvar value="1" name="WANT_AUTOCONF_2_5" />
<envvar value="1" name="WANT_AUTOMAKE_1_6" />
</envvars>
<abortonerror>true</abortonerror>
<numberofjobs>1</numberofjobs>
<dontact>false</dontact>
<makebin/>
<prio>0</prio>
</make>
</kdevautoproject>
<kdevdebugger>
<general>
<dbgshell>/usr/bin/libtool</dbgshell>
<programargs/>
<gdbpath>/usr/bin/</gdbpath>
<configGdbScript/>
<runShellScript/>
<runGdbScript/>
<breakonloadinglibs>true</breakonloadinglibs>
<separatetty>false</separatetty>
<floatingtoolbar>false</floatingtoolbar>
</general>
<display>
<staticmembers>false</staticmembers>
<demanglenames>true</demanglenames>
<outputradix>10</outputradix>
</display>
</kdevdebugger>
<kdevdoctreeview>
<ignoretocs>
<toc>ada</toc>
<toc>ada_bugs_gcc</toc>
<toc>bash</toc>
<toc>bash_bugs</toc>
<toc>clanlib</toc>
<toc>fortran_bugs_gcc</toc>
<toc>gnome1</toc>
<toc>gnustep</toc>
<toc>gtk</toc>
<toc>gtk_bugs</toc>
<toc>haskell</toc>
<toc>haskell_bugs_ghc</toc>
<toc>java_bugs_gcc</toc>
<toc>java_bugs_sun</toc>
<toc>kde2book</toc>
<toc>libstdc++</toc>
<toc>opengl</toc>
<toc>pascal_bugs_fp</toc>
<toc>php</toc>
<toc>php_bugs</toc>
<toc>perl</toc>
<toc>perl_bugs</toc>
<toc>python</toc>
<toc>python_bugs</toc>
<toc>qt-kdev3</toc>
<toc>ruby</toc>
<toc>ruby_bugs</toc>
<toc>sdl</toc>
<toc>stl</toc>
<toc>sw</toc>
<toc>w3c-dom-level2-html</toc>
<toc>w3c-svg</toc>
<toc>w3c-uaag10</toc>
<toc>wxwidgets_bugs</toc>
</ignoretocs>
<ignoreqt_xml>
<toc>Guide to the Qt Translation Tools</toc>
<toc>Qt Assistant Manual</toc>
<toc>Qt Designer Manual</toc>
<toc>Qt Reference Documentation</toc>
<toc>qmake User Guide</toc>
</ignoreqt_xml>
<ignoredoxygen>
<toc>KDE Libraries (Doxygen)</toc>
</ignoredoxygen>
</kdevdoctreeview>
<kdevfilecreate>
<filetypes/>
<useglobaltypes>
<type ext="c" />
<type ext="h" />
</useglobaltypes>
</kdevfilecreate>
<kdevcppsupport>
<references/>
<codecompletion>
<includeGlobalFunctions>true</includeGlobalFunctions>
<includeTypes>true</includeTypes>
<includeEnums>true</includeEnums>
<includeTypedefs>false</includeTypedefs>
<automaticCodeCompletion>true</automaticCodeCompletion>
<automaticArgumentsHint>true</automaticArgumentsHint>
<automaticHeaderCompletion>true</automaticHeaderCompletion>
<codeCompletionDelay>250</codeCompletionDelay>
<argumentsHintDelay>400</argumentsHintDelay>
<headerCompletionDelay>250</headerCompletionDelay>
</codecompletion>
<creategettersetter>
<prefixGet/>
<prefixSet>set</prefixSet>
<prefixVariable>m_,_</prefixVariable>
<parameterName>theValue</parameterName>
<inlineGet>true</inlineGet>
<inlineSet>true</inlineSet>
</creategettersetter>
</kdevcppsupport>
<kdevfileview>
<groups>
<hidenonprojectfiles>false</hidenonprojectfiles>
<hidenonlocation>false</hidenonlocation>
</groups>
<tree>
<hidepatterns>*.o,*.lo,CVS</hidepatterns>
<hidenonprojectfiles>false</hidenonprojectfiles>
</tree>
</kdevfileview>
<cppsupportpart>
<filetemplates>
<interfacesuffix>.h</interfacesuffix>
<implementationsuffix>.cpp</implementationsuffix>
</filetemplates>
</cppsupportpart>
<kdevdocumentation>
<projectdoc>
<docsystem/>
<docurl/>
<usermanualurl/>
</projectdoc>
</kdevdocumentation>
<ctagspart>
<customArguments/>
<customTagfilePath/>
</ctagspart>
<dist>
<custom>false</custom>
<bzip>false</bzip>
<archname/>
<appname>Conky.kdevelop</appname>
<version>$VERSION$</version>
<release/>
<vendor/>
<licence/>
<summary/>
<group/>
<packager/>
<description/>
<changelog/>
<devpackage>false</devpackage>
<docspackage>false</docspackage>
<appicon>false</appicon>
<arch>0</arch>
<genHTML>false</genHTML>
<useRPM>false</useRPM>
<ftpkde>false</ftpkde>
<appskde>false</appskde>
<url/>
</dist>
</kdevelop>

View File

@ -1,184 +0,0 @@
Basic Installation
==================
These are generic installation instructions.
NOTE: If you use Gentoo, see the README about using the included ebuild.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If at some point `config.cache'
contains results you don't want to keep, you may remove or edit it.
The file `configure.in' is used to create `configure' by a program
called `autoconf'. You only need `configure.in' if you want to change
it or regenerate `configure' using a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. You can give `configure'
initial values for variables by setting them in the environment. Using
a Bourne-compatible shell, you can do that on the command line like
this:
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
Or on systems that have the `env' program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not supports the `VPATH'
variable, you have to compile the package for one architecture at a time
in the source code directory. After you have installed the package for
one architecture, use `make distclean' before reconfiguring for another
architecture.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=PATH' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' can not figure out
automatically, but needs to determine by the type of host the package
will run on. Usually `configure' can figure that out, but if it prints
a message saying it can not guess the host type, give it the
`--host=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
CPU-COMPANY-SYSTEM
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the host type.
If you are building compiler tools for cross-compiling, you can also
use the `--target=TYPE' option to select the type of system they will
produce code for and the `--build=TYPE' option to select the type of
system on which you are compiling the package.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Operation Controls
==================
`configure' recognizes the following options to control how it
operates.
`--cache-file=FILE'
Use and save the results of the tests in FILE instead of
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
debugging `configure'.
`--help'
Print a summary of the options to `configure', and exit.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--version'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`configure' also accepts some other, not widely useful, options.

View File

@ -1,27 +0,0 @@
Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
Copyright (c) 2005-2007 Brenden Matthews, Philip Kovacs, et. al. (see AUTHORS)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the <ORGANIZATION> nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

View File

@ -1,674 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View File

@ -1,25 +0,0 @@
SUBDIRS = \
src \
doc
AUTOMAKE_OPTIONS = \
1.8 \
dist-bzip2
EXTRA_DIST = \
autogen.sh \
configure.ac.in \
config.rpath \
extras/nano/README \
extras/nano/conky.nanorc \
extras/vim/README \
extras/vim/ftdetect/conkyrc.vim \
extras/vim/syntax/conkyrc.vim
DISTCLEANFILES = \
configure.ac
distclean-local:
/bin/rm -rf *.cache *~
# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:

View File

@ -1,97 +0,0 @@
Summary of changes for Conky release 1.4.5:
-------------------------------------------
Added config items:
- max_specials
- max_port_monitor_connections
Removed config items:
- min_port_monitors
- min_port_monitor_connections
Added variables:
- entropy_avail
- entropy_poolsize
- entropy_bar
Added length specifier to audacious_title.
Split battery var into:
- battery and battery_time
Fixed broken texeci variable.
Fixed build error with --disable-x11.
Fixed build error with --disable-xdamage.
Fixed acpi battery issues.
Fixed mem var overflows when >= 4GB.
Close pop3/imap sockets properly.
Improved internal thread handling.
Converted tcp_portmon internal hash to GLib
for GPL compatibility.
Summary of changes for Conky release 1.4.4:
-------------------------------------------
* fix build error for freebsd.
* fix BadWindow errors when using own_window_type override or desktop.
* minor documentation updates
* minor wifi code changes for freebsd.
Summary of changes for Conky release 1.4.3:
-------------------------------------------
* Removed support for dead projects: Xmms 1, Beep Media Player (BMP) and the Infopipe plugin.
- Removed the following related configuration items:
- xmms_player
- Removed the following related variables:
- xmms_bar
- xmms_bitrate
- xmms_channels
- xmms_filename
- xmms_frequency
- xmms_length
- xmms_length_seconds
- xmms_playlist_position
- xmms_playlist_length
- xmms_position
- xmms_position_seconds
- xmms_status
- xmms_title
* Removed configuration item:
- on_bottom: please use 'own_window_hints below' instead.
* Added support for Audacious music player: http://audacious-media-player.org
- Added the following related variables:
- audacious_bar
- audacious_bitrate
- audacious_channels
- audacious_filename
- audacious_frequency
- audacious_length
- audacious_length_seconds
- audacious_playlist_position
- audacious_playlist_length
- audacious_position
- audacious_position_seconds
- audacious_status
- audacious_title
* Added new configuration item:
- max_user_text <bytes> [default: 16384]: specifies the maximum buffer size for user text
in the .conkyrc file. Useful for people with enormous config files who were running
up against the hard-coded default of 8192 bytes.
* Added new variables:
- tztime: Local time for specified timezone
- hddtemp: interface to hddtemp hard disk temp monitor: http://www.guzu.net/linux/hddtemp.php
- goto and tab: additional alignment control
- voltage_mv and voltage_v: CPU voltages
* Other changes:
- added SMP support for $freq and $freq_g
- added WiFi signal level detection on FreeBSD
- added Xdamage support for X11
- added verbose configuration information to conky -v
- added extras directory to tarball with nano and vim syntax coloring scripts.
- fixed as many bugs as we could :]

File diff suppressed because it is too large Load Diff

View File

@ -1,29 +0,0 @@
THESE INSTRUCTIONS ARE ONLY IF "sh autogen.sh" DOESN'T WORK!!!
First, read the README. This contains instructions specific to building conky
fresh from a CVS checkout:
* As the README says, you need to have the X development libraries installed.
This should be a package along the lines of libx11-dev or xorg-x11-dev .
* Conky requires three "auto-tools", with at least the specific version numbers.
Make sure these are installed:
aclocal-1.9
automake-1.9
autoconf-2.59
* In the directory where you checked out conky from CVS,
run "aclocal", "automake", and then "autoconf".
Make sure you run those commands with the latest versions...
it is very possible that older versions are installed, and
plain "automake" really means automake-1.4, not what we want,
but "automake-1.9" instead.
Use the "--version" option to check the program version, i.e.
"autoconf --version".
* After that, it's the familiar
./configure
make
make install
You might have to do the last step as root.

View File

@ -1,8 +0,0 @@
# $Id$
1.x - implement _XROOTPMAP_ID and ESETROOT_PMAP_ID alterative for pseudo-transperency.
2.0.0 - schedule TBD
* rewrite core of Conky in C++
* implement new features like a cairo backend, network transparency, and whatever else
* distributed functionality

View File

@ -1,103 +0,0 @@
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header$
inherit eutils
DESCRIPTION="Conky is an advanced, highly configurable system monitor for X"
HOMEPAGE="http://conky.sf.net"
SRC_URI="mirror://sourceforge/conky/${P}.tar.bz2"
LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~x86 ~alpha"
IUSE="truetype X ipv6 bmpx bmp xmms infopipe audacious"
DEPEND_COMMON="
virtual/libc
X? (
|| ( ( x11-libs/libICE
x11-libs/libXext
x11-libs/libX11
x11-libs/libSM
x11-libs/libXrender
x11-libs/libXft
)
virtual/x11
)
truetype? ( >=media-libs/freetype-2 )
bmpx? ( media-sound/bmpx
>=sys-apps/dbus-0.35
)
bmp? ( media-sound/beep-media-player )
audacious? ( media-sound/audacious )
infopipe? ( || ( media-plugins/xmms-infopipe media-plugins/bmp-infopipe ) )
xmms? ( media-sound/xmms )
)"
RDEPEND="${DEPEND_COMMON}"
DEPEND="
${DEPEND_COMMON}
X? (
|| ( ( x11-libs/libXt
x11-proto/xextproto
x11-proto/xproto
)
virtual/x11
)
)
sys-apps/grep
sys-apps/sed"
src_compile() {
local mymake
if useq ipv6 ; then
ewarn
ewarn "You have the ipv6 USE flag enabled. Please note that"
ewarn "using the ipv6 USE flag with Conky disables the port"
ewarn "monitor."
ewarn
epause
else
mymake="MPD_NO_IPV6=noipv6"
fi
local myconf
myconf="--enable-double-buffer --enable-own-window --enable-proc-uptime \
--enable-mpd --enable-mldonkey"
econf \
${myconf} \
$(use_enable truetype xft) \
$(use_enable X x11) \
$(use_enable bmpx) \
$(use_enable bmp) \
$(use_enable xmms) \
$(use_enable audacious) \
$(use_enable infopipe) \
$(use_enable !ipv6 portmon) || die "econf failed"
emake ${mymake} || die "compile failed"
}
src_install() {
emake DESTDIR=${D} install || die "make install failed"
dodoc ChangeLog AUTHORS README doc/conkyrc.sample doc/variables.html
dodoc doc/docs.html doc/config_settings.html
}
pkg_postinst() {
einfo 'Default configuration file is "~/.conkyrc"'
einfo "you can find a sample configuration file in"
einfo "/usr/share/doc/${PF}/conkyrc.sample.gz"
einfo
einfo "For more info on Conky's new features,"
einfo "please look at the README and ChangeLog:"
einfo "/usr/share/doc/${PF}/README.gz"
einfo "/usr/share/doc/${PF}/ChangeLog.gz"
einfo "There are also pretty html docs available"
einfo "on Conky's site or in /usr/share/doc/${PF}"
einfo
einfo "Check out app-vim/conky-syntax for conkyrc"
einfo "syntax highlighting in Vim"
einfo
}

View File

@ -1,109 +0,0 @@
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header$
inherit eutils
DESCRIPTION="Conky is an advanced, highly configurable system monitor for X"
HOMEPAGE="http://conky.sf.net"
SRC_URI="mirror://sourceforge/conky/${P}.tar.bz2"
LICENSE="BSD"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~ppc ~ppc64 ~sparc ~x86"
IUSE="truetype X ipv6 bmpx bmp xmms infopipe audacious"
DEPEND_COMMON="
virtual/libc
X? (
|| ( ( x11-libs/libICE
x11-libs/libXext
x11-libs/libX11
x11-libs/libSM
x11-libs/libXrender
x11-libs/libXft
)
virtual/x11
)
truetype? ( >=media-libs/freetype-2 )
bmpx? ( media-sound/bmpx
>=sys-apps/dbus-0.35
)
bmp? ( media-sound/beep-media-player )
audacious? ( media-sound/audacious )
infopipe? ( media-plugins/xmms-infopipe )
xmms? ( media-sound/xmms )
)"
RDEPEND="${DEPEND_COMMON}"
DEPEND="
${DEPEND_COMMON}
X? (
|| ( ( x11-libs/libXt
x11-proto/xextproto
x11-proto/xproto
)
virtual/x11
)
)
sys-apps/grep
sys-apps/sed"
src_unpack() {
unpack ${A}
cd ${S}
epatch ${FILESDIR}/conky-sigaction.patch
}
src_compile() {
local mymake
if useq ipv6 ; then
ewarn
ewarn "You have the ipv6 USE flag enabled. Please note that"
ewarn "using the ipv6 USE flag with Conky disables the port"
ewarn "monitor."
ewarn
epause
else
mymake="MPD_NO_IPV6=noipv6"
fi
local myconf
myconf="--enable-double-buffer --enable-own-window --enable-proc-uptime \
--enable-mpd --enable-mldonkey"
econf \
${myconf} \
$(use_enable truetype xft) \
$(use_enable X x11) \
$(use_enable bmpx) \
$(use_enable bmp) \
$(use_enable xmms) \
$(use_enable audacious) \
$(use_enable infopipe) \
$(use_enable !ipv6 portmon) || die "econf failed"
emake ${mymake} || die "compile failed"
}
src_install() {
emake DESTDIR=${D} install || die "make install failed"
dodoc ChangeLog AUTHORS README doc/conkyrc.sample doc/variables.html
dodoc doc/docs.html doc/config_settings.html
}
pkg_postinst() {
einfo 'Default configuration file is "~/.conkyrc"'
einfo "you can find a sample configuration file in"
einfo "/usr/share/doc/${PF}/conkyrc.sample.gz"
einfo
einfo "For more info on Conky's new features,"
einfo "please look at the README and ChangeLog:"
einfo "/usr/share/doc/${PF}/README.gz"
einfo "/usr/share/doc/${PF}/ChangeLog.gz"
einfo "There are also pretty html docs available"
einfo "on Conky's site or in /usr/share/doc/${PF}"
einfo
einfo "Check out app-vim/conky-syntax for conkyrc"
einfo "syntax highlighting in Vim"
einfo
}

View File

@ -1,104 +0,0 @@
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header$
inherit eutils
DESCRIPTION="Conky is an advanced, highly configurable system monitor for X"
HOMEPAGE="http://conky.sf.net"
SRC_URI="mirror://sourceforge/conky/${P}.tar.bz2"
LICENSE="BSD"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~ppc ~ppc64 ~sparc ~x86"
IUSE="truetype X ipv6 bmpx bmp xmms xmms2 infopipe audacious"
DEPEND_COMMON="
virtual/libc
X? (
|| ( ( x11-libs/libICE
x11-libs/libXext
x11-libs/libX11
x11-libs/libSM
x11-libs/libXrender
x11-libs/libXft
)
virtual/x11
)
truetype? ( >=media-libs/freetype-2 )
bmpx? ( media-sound/bmpx
>=sys-apps/dbus-0.35
)
bmp? ( media-sound/beep-media-player )
audacious? ( media-sound/audacious )
infopipe? ( media-plugins/xmms-infopipe )
xmms? ( media-sound/xmms )
xmms2? ( media-sound/xmms2 )
)"
RDEPEND="${DEPEND_COMMON}"
DEPEND="
${DEPEND_COMMON}
X? (
|| ( ( x11-libs/libXt
x11-proto/xextproto
x11-proto/xproto
)
virtual/x11
)
)
sys-apps/grep
sys-apps/sed"
src_compile() {
local mymake
if useq ipv6 ; then
ewarn
ewarn "You have the ipv6 USE flag enabled. Please note that"
ewarn "using the ipv6 USE flag with Conky disables the port"
ewarn "monitor."
ewarn
epause
else
mymake="MPD_NO_IPV6=noipv6"
fi
local myconf
myconf="--enable-double-buffer --enable-own-window --enable-proc-uptime \
--enable-mpd --enable-mldonkey"
econf \
${myconf} \
$(use_enable truetype xft) \
$(use_enable X x11) \
$(use_enable bmpx) \
$(use_enable bmp) \
$(use_enable xmms) \
$(use_enable xmms2) \
$(use_enable audacious) \
$(use_enable infopipe) \
$(use_enable !ipv6 portmon) || die "econf failed"
emake ${mymake} || die "compile failed"
}
src_install() {
make DESTDIR=${D} install || die "make install failed"
dodoc ChangeLog AUTHORS README doc/conkyrc.sample
dohtml doc/variables.html doc/docs.html doc/config_settings.html
}
pkg_postinst() {
einfo 'Default configuration file is "~/.conkyrc"'
einfo "you can find a sample configuration file in"
einfo "/usr/share/doc/${PF}/conkyrc.sample.gz"
einfo
einfo "For more info on Conky's new features,"
einfo "please look at the README and ChangeLog:"
einfo "/usr/share/doc/${PF}/README.gz"
einfo "/usr/share/doc/${PF}/ChangeLog.gz"
einfo "There are also pretty html docs available"
einfo "on Conky's site or in /usr/share/doc/${PF}"
einfo
einfo "Check out app-vim/conky-syntax for conkyrc"
einfo "syntax highlighting in Vim"
einfo
}

View File

@ -1,102 +0,0 @@
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
inherit eutils
DESCRIPTION="Conky is an advanced, highly configurable system monitor for X"
HOMEPAGE="http://conky.sf.net"
SRC_URI="mirror://sourceforge/conky/${P}.tar.bz2"
LICENSE="BSD"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~ppc ~ppc64 ~sparc ~x86"
IUSE="truetype X ipv6 audacious bmpx hddtemp mpd vim-syntax"
DEPEND_COMMON="
virtual/libc
X? (
|| ( ( x11-libs/libICE
x11-libs/libXext
x11-libs/libX11
x11-libs/libSM
x11-libs/libXrender
x11-libs/libXdamage
x11-libs/libXft
)
virtual/x11
)
truetype? ( >=media-libs/freetype-2 )
audacious? ( >=media-sound/audacious-0.1 )
bmpx? ( media-sound/bmpx
>=sys-apps/dbus-0.35
)
)"
RDEPEND="${DEPEND_COMMON}
hddtemp? ( app-admin/hddtemp )
mpd? ( media-sound/mpd )"
DEPEND="
${DEPEND_COMMON}
X? (
|| ( ( x11-libs/libXt
x11-proto/xextproto
x11-proto/xproto
)
virtual/x11
)
)
sys-apps/grep
sys-apps/sed"
PDEPEND="vim-syntax? ( app-vim/conky-syntax )"
src_compile() {
local mymake
if useq ipv6 ; then
ewarn
ewarn "You have the ipv6 USE flag enabled. Please note that using"
ewarn "the ipv6 USE flag with Conky disables the port monitor."
epause
else
mymake="MPD_NO_IPV6=noipv6"
fi
local myconf
myconf="--enable-own-window --enable-proc-uptime"
use X && myconf="${myconf} --enable-x11 --enable-double-buffer --enable-xdamage"
econf \
${myconf} \
$(use_enable truetype xft) \
$(use_enable audacious) \
$(use_enable bmpx) \
$(use_enable hddtemp ) \
$(use_enable mpd) \
$(use_enable !ipv6 portmon) || die "econf failed"
emake ${mymake} || die "compile failed"
}
src_install() {
emake DESTDIR=${D} install || die "make install failed"
dodoc ChangeLog AUTHORS README doc/conkyrc.sample
dohtml doc/docs.html doc/config_settings.html doc/variables.html
}
pkg_postinst() {
einfo 'Default configuration file is "~/.conkyrc"'
einfo "You can find a sample configuration file in"
einfo "/usr/share/doc/${PF}/conkyrc.sample.gz"
einfo
einfo "For more info on Conky's new features,"
einfo "please look at the README and ChangeLog:"
einfo "/usr/share/doc/${PF}/README.gz"
einfo "/usr/share/doc/${PF}/ChangeLog.gz"
einfo "There are also pretty html docs available"
einfo "on Conky's site or in /usr/share/doc/${PF}"
einfo
einfo "Also see http://www.gentoo.org/doc/en/conky-howto.xml"
einfo
einfo "Check out app-vim/conky-syntax for conkyrc"
einfo "syntax highlighting in Vim"
einfo
}

View File

@ -1,109 +0,0 @@
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
inherit eutils
# used for epause
DESCRIPTION="Conky is an advanced, highly configurable system monitor for X"
HOMEPAGE="http://conky.sf.net"
SRC_URI="mirror://sourceforge/conky/${P}.tar.bz2"
LICENSE="BSD"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~ppc ~ppc64 ~sparc ~x86"
IUSE="truetype X ipv6 audacious bmpx hddtemp mpd vim-syntax"
DEPEND_COMMON="
virtual/libc
X? (
|| ( ( x11-libs/libICE
x11-libs/libXext
x11-libs/libX11
x11-libs/libSM
x11-libs/libXrender
x11-libs/libXdamage
x11-libs/libXft
)
virtual/x11
)
truetype? ( >=media-libs/freetype-2 )
audacious? ( >=media-sound/audacious-0.1 )
bmpx? ( media-sound/bmpx
>=sys-apps/dbus-0.35
)
)"
RDEPEND="${DEPEND_COMMON}
hddtemp? ( app-admin/hddtemp )
mpd? ( media-sound/mpd )
vim-syntax? ( || ( app-editors/vim
app-editors/gvim ) )"
DEPEND="
${DEPEND_COMMON}
X? (
|| ( ( x11-libs/libXt
x11-proto/xextproto
x11-proto/xproto
)
virtual/x11
)
)"
src_compile() {
local mymake
if useq ipv6 ; then
ewarn
ewarn "You have the ipv6 USE flag enabled. Please note that using"
ewarn "the ipv6 USE flag with Conky disables the port monitor."
epause
else
mymake="MPD_NO_IPV6=noipv6"
fi
local myconf
myconf="--enable-own-window --enable-proc-uptime"
use X && myconf="${myconf} --enable-x11 --enable-double-buffer --enable-xdamage"
econf \
${myconf} \
$(use_enable truetype xft) \
$(use_enable audacious) \
$(use_enable bmpx) \
$(use_enable hddtemp ) \
$(use_enable mpd) \
$(use_enable !ipv6 portmon) || die "econf failed"
emake ${mymake} || die "compile failed"
}
src_install() {
emake DESTDIR="${D}" install || die "make install failed"
dodoc ChangeLog AUTHORS README doc/conkyrc.sample
dohtml doc/docs.html doc/config_settings.html doc/variables.html
if use vim-syntax; then
insinto /usr/share/vim/vimfiles/ftdetect
doins "${S}"/extras/vim/ftdetect/conkyrc.vim
insinto /usr/share/vim/vimfiles/syntax
doins "${S}"/extras/vim/syntax/conkyrc.vim
fi
}
pkg_postinst() {
einfo 'Default configuration file is "~/.conkyrc"'
einfo "You can find a sample configuration file in"
einfo "/usr/share/doc/${PF}/conkyrc.sample.gz"
einfo
einfo "For more info on Conky's new features,"
einfo "please look at the README and ChangeLog:"
einfo "/usr/share/doc/${PF}/README.gz"
einfo "/usr/share/doc/${PF}/ChangeLog.gz"
einfo "There are also pretty html docs available"
einfo "on Conky's site or in /usr/share/doc/${PF}"
einfo
einfo "Also see http://www.gentoo.org/doc/en/conky-howto.xml"
einfo
einfo "Vim syntax highlighting for conkyrc now enabled with"
einfo "USE=vim-syntax"
einfo
}

View File

@ -1,108 +0,0 @@
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-admin/conky/conky-1.4.5.ebuild,v 1.11 2007/07/22 08:19:13 omp Exp $
inherit eutils
# used for epause
DESCRIPTION="Conky is an advanced, highly configurable system monitor for X"
HOMEPAGE="http://conky.sf.net"
SRC_URI="mirror://sourceforge/conky/${P}.tar.bz2"
LICENSE="BSD"
SLOT="0"
KEYWORDS="~alpha amd64 ppc ppc64 sparc x86"
IUSE="truetype X ipv6 audacious bmpx hddtemp mpd vim-syntax"
DEPEND_COMMON="
virtual/libc
X? (
x11-libs/libICE
x11-libs/libXext
x11-libs/libX11
x11-libs/libSM
x11-libs/libXrender
x11-libs/libXdamage
x11-libs/libXft
truetype? ( >=media-libs/freetype-2 )
audacious? ( >=media-sound/audacious-0.1 )
bmpx? ( media-sound/bmpx
>=sys-apps/dbus-0.35
)
)
!ipv6? ( >=dev-libs/glib-2.0 )"
RDEPEND="${DEPEND_COMMON}
hddtemp? ( app-admin/hddtemp )
mpd? ( media-sound/mpd )
vim-syntax? ( || ( app-editors/vim
app-editors/gvim ) )"
DEPEND="
${DEPEND_COMMON}
X? (
x11-libs/libXt
x11-proto/xextproto
x11-proto/xproto
)"
src_compile() {
local mymake
if useq ipv6 ; then
ewarn
ewarn "You have the ipv6 USE flag enabled. Please note that using"
ewarn "the ipv6 USE flag with Conky disables the port monitor."
epause
else
mymake="MPD_NO_IPV6=noipv6"
fi
local myconf
myconf="--enable-proc-uptime"
if useq X; then
myconf="${myconf} --enable-x11 --enable-double-buffer --enable-xdamage --enable-own-window"
myconf="${myconf} $(use_enable truetype xft)"
else
myconf="${myconf} --disable-x11 --disable-double-buffer --disable-xdamage --disable-own-window"
myconf="${myconf} --disable-xft"
fi
econf \
${myconf} \
$(use_enable audacious) \
$(use_enable bmpx) \
$(use_enable hddtemp ) \
$(use_enable mpd) \
$(use_enable !ipv6 portmon) || die "econf failed"
emake ${mymake} || die "compile failed"
}
src_install() {
emake DESTDIR="${D}" install || die "make install failed"
dodoc ChangeLog AUTHORS README doc/conkyrc.sample
dohtml doc/docs.html doc/config_settings.html doc/variables.html
if use vim-syntax; then
insinto /usr/share/vim/vimfiles/ftdetect
doins "${S}"/extras/vim/ftdetect/conkyrc.vim
insinto /usr/share/vim/vimfiles/syntax
doins "${S}"/extras/vim/syntax/conkyrc.vim
fi
}
pkg_postinst() {
elog 'Default configuration file is "~/.conkyrc"'
elog "You can find a sample configuration file in"
elog "/usr/share/doc/${PF}/conkyrc.sample.gz"
elog
elog "For more info on Conky's new features,"
elog "please look at the README and ChangeLog:"
elog "/usr/share/doc/${PF}/README.gz"
elog "/usr/share/doc/${PF}/ChangeLog.gz"
elog "There are also pretty html docs available"
elog "on Conky's site or in /usr/share/doc/${PF}"
elog
elog "Also see http://www.gentoo.org/doc/en/conky-howto.xml"
elog
elog "Vim syntax highlighting for conkyrc now enabled with"
elog "USE=vim-syntax"
elog
}

View File

@ -1,107 +0,0 @@
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-admin/conky/conky-1.4.5.ebuild,v 1.11 2007/07/22 08:19:13 omp Exp $
inherit eutils
# used for epause
DESCRIPTION="Conky is an advanced, highly configurable system monitor for X"
HOMEPAGE="http://conky.sf.net"
SRC_URI="mirror://sourceforge/conky/${P}.tar.bz2"
LICENSE="BSD"
SLOT="0"
KEYWORDS="~alpha amd64 ppc ppc64 sparc x86"
IUSE="truetype X ipv6 audacious bmpx hddtemp mpd vim-syntax"
DEPEND_COMMON="
virtual/libc
X? (
x11-libs/libICE
x11-libs/libXext
x11-libs/libX11
x11-libs/libSM
x11-libs/libXrender
x11-libs/libXdamage
x11-libs/libXft
truetype? ( >=media-libs/freetype-2 )
audacious? ( >=media-sound/audacious-0.1 )
bmpx? ( media-sound/bmpx
>=sys-apps/dbus-0.35
)
)
!ipv6? ( >=dev-libs/glib-2.0 )"
RDEPEND="${DEPEND_COMMON}
hddtemp? ( app-admin/hddtemp )
vim-syntax? ( || ( app-editors/vim
app-editors/gvim ) )"
DEPEND="
${DEPEND_COMMON}
X? (
x11-libs/libXt
x11-proto/xextproto
x11-proto/xproto
)"
src_compile() {
local mymake
if useq ipv6 ; then
ewarn
ewarn "You have the ipv6 USE flag enabled. Please note that using"
ewarn "the ipv6 USE flag with Conky disables the port monitor."
epause
else
mymake="MPD_NO_IPV6=noipv6"
fi
local myconf
myconf="--enable-proc-uptime"
if useq X; then
myconf="${myconf} --enable-x11 --enable-double-buffer --enable-xdamage --enable-own-window"
myconf="${myconf} $(use_enable truetype xft)"
else
myconf="${myconf} --disable-x11 --disable-double-buffer --disable-xdamage --disable-own-window"
myconf="${myconf} --disable-xft"
fi
econf \
${myconf} \
$(use_enable audacious) \
$(use_enable bmpx) \
$(use_enable hddtemp ) \
$(use_enable mpd) \
$(use_enable !ipv6 portmon) || die "econf failed"
emake ${mymake} || die "compile failed"
}
src_install() {
emake DESTDIR="${D}" install || die "make install failed"
dodoc ChangeLog AUTHORS README doc/conkyrc.sample
dohtml doc/docs.html doc/config_settings.html doc/variables.html
if use vim-syntax; then
insinto /usr/share/vim/vimfiles/ftdetect
doins "${S}"/extras/vim/ftdetect/conkyrc.vim
insinto /usr/share/vim/vimfiles/syntax
doins "${S}"/extras/vim/syntax/conkyrc.vim
fi
}
pkg_postinst() {
elog 'Default configuration file is "~/.conkyrc"'
elog "You can find a sample configuration file in"
elog "/usr/share/doc/${PF}/conkyrc.sample.gz"
elog
elog "For more info on Conky's new features,"
elog "please look at the README and ChangeLog:"
elog "/usr/share/doc/${PF}/README.gz"
elog "/usr/share/doc/${PF}/ChangeLog.gz"
elog "There are also pretty html docs available"
elog "on Conky's site or in /usr/share/doc/${PF}"
elog
elog "Also see http://www.gentoo.org/doc/en/conky-howto.xml"
elog
elog "Vim syntax highlighting for conkyrc now enabled with"
elog "USE=vim-syntax"
elog
}

View File

@ -1,118 +0,0 @@
# Subversion repository ebuild for conky by drphibes
# $Header: $
ESVN_REPO_URI="https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1"
ESVN_PROJECT="conky1"
inherit subversion
DESCRIPTION="Conky is an advanced, highly configurable system monitor for X"
HOMEPAGE="http://conky.sf.net"
LICENSE="BSD"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~ppc ~ppc64 ~sparc ~x86"
IUSE="truetype X ipv6 audacious bmpx hddtemp mpd vim-syntax"
DEPEND_COMMON="
virtual/libc
X? (
|| ( ( x11-libs/libICE
x11-libs/libXext
x11-libs/libX11
x11-libs/libSM
x11-libs/libXrender
x11-libs/libXdamage
x11-libs/libXft
)
virtual/x11
)
truetype? ( >=media-libs/freetype-2 )
audacious? ( >=media-sound/audacious-0.1 )
bmpx? ( media-sound/bmpx
>=sys-apps/dbus-0.35
)
!ipv6? ( >=dev-libs/glib-2.0 )
)"
RDEPEND="${DEPEND_COMMON}
hddtemp? ( app-admin/hddtemp )
mpd? ( media-sound/mpd )
vim-syntax? ( || ( app-editors/vim
app-editors/gvim ) )"
DEPEND="
${DEPEND_COMMON}
X? (
|| ( ( x11-libs/libXt
x11-proto/xextproto
x11-proto/xproto
)
virtual/x11
)
)"
S=${WORKDIR}/conky
src_compile() {
./autogen.sh ${ESVN_STORE_DIR}/${ESVN_PROJECT}/conky1
local mymake
if useq ipv6 ; then
ewarn
ewarn "You have the ipv6 USE flag enabled. Please note that using"
ewarn "the ipv6 USE flag with Conky disables the port monitor."
epause
else
mymake="MPD_NO_IPV6=noipv6"
fi
local myconf
myconf="--enable-proc-uptime"
if useq X; then
myconf="${myconf} --enable-x11 --enable-double-buffer --enable-xdamage --enable-own-window"
myconf="${myconf} $(use_enable truetype xft)"
else
myconf="${myconf} --disable-x11 --disable-double-buffer --disable-xdamage --disable-own-window"
myconf="${myconf} --disable-xft"
fi
econf \
${myconf} \
$(use_enable audacious) \
$(use_enable bmpx) \
$(use_enable hddtemp ) \
$(use_enable mpd) \
$(use_enable !ipv6 portmon) || die "econf failed"
emake ${mymake} || die "compile failed"
}
src_install() {
emake DESTDIR="${D}" install || die "make install failed"
dodoc ChangeLog AUTHORS README doc/conkyrc.sample
dohtml doc/docs.html doc/config_settings.html doc/variables.html
if use vim-syntax; then
insinto /usr/share/vim/vimfiles/ftdetect
doins "${S}"/extras/vim/ftdetect/conkyrc.vim
insinto /usr/share/vim/vimfiles/syntax
doins "${S}"/extras/vim/syntax/conkyrc.vim
fi
}
pkg_postinst() {
einfo 'Default configuration file is "~/.conkyrc"'
einfo "You can find a sample configuration file in"
einfo "/usr/share/doc/${PF}/conkyrc.sample.gz"
einfo
einfo "For more info on Conky's new features,"
einfo "please look at the README and ChangeLog:"
einfo "/usr/share/doc/${PF}/README.gz"
einfo "/usr/share/doc/${PF}/ChangeLog.gz"
einfo "There are also pretty html docs available"
einfo "on Conky's site or in /usr/share/doc/${PF}"
einfo
einfo "Also see http://www.gentoo.org/doc/en/conky-howto.xml"
einfo
einfo "Vim syntax highlighting for conkyrc now enabled with"
einfo "USE=vim-syntax"
einfo
}

View File

@ -1,27 +0,0 @@
#!/bin/sh
# $Id$
# autogen.sh
# optional $1 = full path to svn working copy or "clean"
AUTOCONF=${AUTOCONF:-autoconf}
AUTOMAKE=${AUTOMAKE:-automake}
ACLOCAL=${ACLOCAL:-aclocal}
AUTOHEADER=${AUTOHEADER:-autoheader}
LIBTOOLIZE=${LIBTOOLIZE:-libtoolize}
if [ "$1" = "clean" ]; then
/bin/rm -f configure.ac
exit 0
fi
# substitute svn revision
revision=`LC_ALL=C svn info $1 | awk '/^Revision: / {printf "%05d\n", $2}'`
sed -e "s/@REVISION@/${revision}/g" \
< "configure.ac.in" > "configure.ac"
echo Running $ACLOCAL ... && $ACLOCAL
echo Running $LIBTOOLIZE --force --copy ... && $LIBTOOLIZE --force --copy
echo Running $AUTOHEADER ... && $AUTOHEADER
echo Running $AUTOMAKE --add-missing --copy --gnu ... && $AUTOMAKE --add-missing --copy --gnu
echo Running $AUTOCONF ... && $AUTOCONF

View File

@ -1,16 +0,0 @@
#!/bin/sh
rm -rf ../conky-1.3.4* ../conky_*
make distclean
sh autogen.sh
./configure
make dist
cp -f conky-1.3.4.tar.gz ../conky_1.3.3.orig.tar.gz
cd ..
tar xvzf conky_1.3.4.orig.tar.gz
cd conky-1.3.4
#dh_make -s
cp -r ../conky/debian .
rm -rf debian/CVS
debuild
#dpkg-buildpackage -rfakeroot -S -k<private key id>

View File

@ -1,30 +0,0 @@
#!/usr/bin/env python
import sys
if len(sys.argv) <= 1:
print >> sys.stderr, "Usage: ./changelog2html.py [changelog file]"
sys.exit(1)
f = sys.argv[1]
blah = 0
for i in open(f).read().splitlines():
# ignore empty lines
if i and i[0].isspace():
if not '*' in i:
print ' ' + i.strip()
else:
s = i.split('*', 1)[1].strip()
print ' <LI>' + s.replace('<', '&lt;').replace('>', '&gt;')
else:
if blah:
print '</UL>'
print '<H3>%s</H3>' % i.strip()
print '<UL>'
blah = 1
if blah:
print '</UL>'

View File

@ -1,614 +0,0 @@
#! /bin/sh
# Output a system dependent set of variables, describing how to set the
# run time search path of shared libraries in an executable.
#
# Copyright 1996-2006 Free Software Foundation, Inc.
# Taken from GNU libtool, 2001
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# The first argument passed to this file is the canonical host specification,
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
# or
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
# should be set by the caller.
#
# The set of defined variables is at the end of this script.
# Known limitations:
# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
# than 256 bytes, otherwise the compiler driver will dump core. The only
# known workaround is to choose shorter directory names for the build
# directory and/or the installation directory.
# All known linkers require a `.a' archive for static linking (except MSVC,
# which needs '.lib').
libext=a
shrext=.so
host="$1"
host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
# Code taken from libtool.m4's _LT_CC_BASENAME.
for cc_temp in $CC""; do
case $cc_temp in
compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
\-*) ;;
*) break;;
esac
done
cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
wl=
if test "$GCC" = yes; then
wl='-Wl,'
else
case "$host_os" in
aix*)
wl='-Wl,'
;;
darwin*)
case $cc_basename in
xlc*)
wl='-Wl,'
;;
esac
;;
mingw* | pw32* | os2*)
;;
hpux9* | hpux10* | hpux11*)
wl='-Wl,'
;;
irix5* | irix6* | nonstopux*)
wl='-Wl,'
;;
newsos6)
;;
linux*)
case $cc_basename in
icc* | ecc*)
wl='-Wl,'
;;
pgcc | pgf77 | pgf90)
wl='-Wl,'
;;
ccc*)
wl='-Wl,'
;;
como)
wl='-lopt='
;;
*)
case `$CC -V 2>&1 | sed 5q` in
*Sun\ C*)
wl='-Wl,'
;;
esac
;;
esac
;;
osf3* | osf4* | osf5*)
wl='-Wl,'
;;
sco3.2v5*)
;;
solaris*)
wl='-Wl,'
;;
sunos4*)
wl='-Qoption ld '
;;
sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
wl='-Wl,'
;;
sysv4*MP*)
;;
unicos*)
wl='-Wl,'
;;
uts4*)
;;
esac
fi
# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
hardcode_libdir_flag_spec=
hardcode_libdir_separator=
hardcode_direct=no
hardcode_minus_L=no
case "$host_os" in
cygwin* | mingw* | pw32*)
# FIXME: the MSVC++ port hasn't been tested in a loooong time
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
if test "$GCC" != yes; then
with_gnu_ld=no
fi
;;
interix*)
# we just hope/assume this is gcc and not c89 (= MSVC++)
with_gnu_ld=yes
;;
openbsd*)
with_gnu_ld=no
;;
esac
ld_shlibs=yes
if test "$with_gnu_ld" = yes; then
# Set some defaults for GNU ld with shared library support. These
# are reset later if shared libraries are not supported. Putting them
# here allows them to be overridden if necessary.
# Unlike libtool, we use -rpath here, not --rpath, since the documented
# option of GNU ld is called -rpath, not --rpath.
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
case "$host_os" in
aix3* | aix4* | aix5*)
# On AIX/PPC, the GNU linker is very broken
if test "$host_cpu" != ia64; then
ld_shlibs=no
fi
;;
amigaos*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
# Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
# that the semantics of dynamic libraries on AmigaOS, at least up
# to version 4, is to share data among multiple programs linked
# with the same dynamic library. Since this doesn't match the
# behavior of shared libraries on other platforms, we cannot use
# them.
ld_shlibs=no
;;
beos*)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
cygwin* | mingw* | pw32*)
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
hardcode_libdir_flag_spec='-L$libdir'
if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
interix3*)
hardcode_direct=no
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
;;
linux*)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
netbsd*)
;;
solaris*)
if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
ld_shlibs=no
elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
case `$LD -v 2>&1` in
*\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
ld_shlibs=no
;;
*)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
else
ld_shlibs=no
fi
;;
esac
;;
sunos4*)
hardcode_direct=yes
;;
*)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
esac
if test "$ld_shlibs" = no; then
hardcode_libdir_flag_spec=
fi
else
case "$host_os" in
aix3*)
# Note: this linker hardcodes the directories in LIBPATH if there
# are no directories specified by -L.
hardcode_minus_L=yes
if test "$GCC" = yes; then
# Neither direct hardcoding nor static linking is supported with a
# broken collect2.
hardcode_direct=unsupported
fi
;;
aix4* | aix5*)
if test "$host_cpu" = ia64; then
# On IA64, the linker does run time linking by default, so we don't
# have to do anything special.
aix_use_runtimelinking=no
else
aix_use_runtimelinking=no
# Test if we are trying to use run time linking or normal
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
# need to do runtime linking.
case $host_os in aix4.[23]|aix4.[23].*|aix5*)
for ld_flag in $LDFLAGS; do
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
aix_use_runtimelinking=yes
break
fi
done
;;
esac
fi
hardcode_direct=yes
hardcode_libdir_separator=':'
if test "$GCC" = yes; then
case $host_os in aix4.[012]|aix4.[012].*)
collect2name=`${CC} -print-prog-name=collect2`
if test -f "$collect2name" && \
strings "$collect2name" | grep resolve_lib_name >/dev/null
then
# We have reworked collect2
hardcode_direct=yes
else
# We have old collect2
hardcode_direct=unsupported
hardcode_minus_L=yes
hardcode_libdir_flag_spec='-L$libdir'
hardcode_libdir_separator=
fi
;;
esac
fi
# Begin _LT_AC_SYS_LIBPATH_AIX.
echo 'int main () { return 0; }' > conftest.c
${CC} ${LDFLAGS} conftest.c -o conftest
aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
}'`
if test -z "$aix_libpath"; then
aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
}'`
fi
if test -z "$aix_libpath"; then
aix_libpath="/usr/lib:/lib"
fi
rm -f conftest.c conftest
# End _LT_AC_SYS_LIBPATH_AIX.
if test "$aix_use_runtimelinking" = yes; then
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
else
if test "$host_cpu" = ia64; then
hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
else
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
fi
fi
;;
amigaos*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
# see comment about different semantics on the GNU ld section
ld_shlibs=no
;;
bsdi[45]*)
;;
cygwin* | mingw* | pw32*)
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
hardcode_libdir_flag_spec=' '
libext=lib
;;
darwin* | rhapsody*)
hardcode_direct=no
if test "$GCC" = yes ; then
:
else
case $cc_basename in
xlc*)
;;
*)
ld_shlibs=no
;;
esac
fi
;;
dgux*)
hardcode_libdir_flag_spec='-L$libdir'
;;
freebsd1*)
ld_shlibs=no
;;
freebsd2.2*)
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
;;
freebsd2*)
hardcode_direct=yes
hardcode_minus_L=yes
;;
freebsd* | kfreebsd*-gnu | dragonfly*)
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
;;
hpux9*)
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
hardcode_direct=yes
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
hardcode_minus_L=yes
;;
hpux10*)
if test "$with_gnu_ld" = no; then
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
hardcode_direct=yes
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
hardcode_minus_L=yes
fi
;;
hpux11*)
if test "$with_gnu_ld" = no; then
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
case $host_cpu in
hppa*64*|ia64*)
hardcode_direct=no
;;
*)
hardcode_direct=yes
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
hardcode_minus_L=yes
;;
esac
fi
;;
irix5* | irix6* | nonstopux*)
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
netbsd*)
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
;;
newsos6)
hardcode_direct=yes
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
openbsd*)
hardcode_direct=yes
if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
else
case "$host_os" in
openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
hardcode_libdir_flag_spec='-R$libdir'
;;
*)
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
;;
esac
fi
;;
os2*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
;;
osf3*)
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
osf4* | osf5*)
if test "$GCC" = yes; then
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
else
# Both cc and cxx compiler support -rpath directly
hardcode_libdir_flag_spec='-rpath $libdir'
fi
hardcode_libdir_separator=:
;;
solaris*)
hardcode_libdir_flag_spec='-R$libdir'
;;
sunos4*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_direct=yes
hardcode_minus_L=yes
;;
sysv4)
case $host_vendor in
sni)
hardcode_direct=yes # is this really true???
;;
siemens)
hardcode_direct=no
;;
motorola)
hardcode_direct=no #Motorola manual says yes, but my tests say they lie
;;
esac
;;
sysv4.3*)
;;
sysv4*MP*)
if test -d /usr/nec; then
ld_shlibs=yes
fi
;;
sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*)
;;
sysv5* | sco3.2v5* | sco5v6*)
hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
hardcode_libdir_separator=':'
;;
uts4*)
hardcode_libdir_flag_spec='-L$libdir'
;;
*)
ld_shlibs=no
;;
esac
fi
# Check dynamic linker characteristics
# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
libname_spec='lib$name'
case "$host_os" in
aix3*)
;;
aix4* | aix5*)
;;
amigaos*)
;;
beos*)
;;
bsdi[45]*)
;;
cygwin* | mingw* | pw32*)
shrext=.dll
;;
darwin* | rhapsody*)
shrext=.dylib
;;
dgux*)
;;
freebsd1*)
;;
kfreebsd*-gnu)
;;
freebsd* | dragonfly*)
;;
gnu*)
;;
hpux9* | hpux10* | hpux11*)
case $host_cpu in
ia64*)
shrext=.so
;;
hppa*64*)
shrext=.sl
;;
*)
shrext=.sl
;;
esac
;;
interix3*)
;;
irix5* | irix6* | nonstopux*)
case "$host_os" in
irix5* | nonstopux*)
libsuff= shlibsuff=
;;
*)
case $LD in
*-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
*-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
*-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
*) libsuff= shlibsuff= ;;
esac
;;
esac
;;
linux*oldld* | linux*aout* | linux*coff*)
;;
linux*)
;;
knetbsd*-gnu)
;;
netbsd*)
;;
newsos6)
;;
nto-qnx*)
;;
openbsd*)
;;
os2*)
libname_spec='$name'
shrext=.dll
;;
osf3* | osf4* | osf5*)
;;
solaris*)
;;
sunos4*)
;;
sysv4 | sysv4.3*)
;;
sysv4*MP*)
;;
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
;;
uts4*)
;;
esac
sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
# How to pass a linker flag through the compiler.
wl="$escaped_wl"
# Static library suffix (normally "a").
libext="$libext"
# Shared library suffix (normally "so").
shlibext="$shlibext"
# Flag to hardcode \$libdir into a binary during linking.
# This must work even if \$libdir does not exist.
hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
# Whether we need a single -rpath flag with a separated argument.
hardcode_libdir_separator="$hardcode_libdir_separator"
# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
# resulting binary.
hardcode_direct="$hardcode_direct"
# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
# resulting binary.
hardcode_minus_L="$hardcode_minus_L"
EOF

View File

@ -1,562 +0,0 @@
dnl $Id$
dnl major, minor and micro version macros.
m4_define([conky_version_major], [1])
m4_define([conky_version_minor], [4])
m4_define([conky_version_micro], [7])
m4_define([conky_version_tag], [svn]) dnl [] for releases
m4_define([conky_version_revision],[r@REVISION@])
m4_define([conky_version],
[conky_version_major().conky_version_minor().conky_version_micro()ifelse(
conky_version_tag(), [svn],
[-conky_version_tag()-conky_version_revision()],
[ifelse(conky_version_tag(), [], [], [-conky_version_tag()])])])
AC_INIT([Conky], [conky_version()], [brenden1@users.sourceforge.net])
AM_INIT_AUTOMAKE(conky, conky_version())
AM_CONFIG_HEADER(src/config.h)
dnl prevent libtool setting LTCFLAGS to default of -g -O2 when CFLAGS unset.
dnl libtool must be deleted with make distclean to see this fix.
if test x"$CFLAGS" = x""; then
AC_SUBST(CFLAGS, [ ])
fi
dnl
dnl Tools
dnl
AC_PROG_CC
AC_PROG_LD
AC_PROG_INSTALL
AC_PROG_LIBTOOL
AC_CHECK_PROG(HAVE_PKGCONFIG, pkg-config, yes, no)
if test x"$HAVE_PKGCONFIG" = x"no"; then
AC_MSG_ERROR([pkg-config is required!])
fi
PKG_PROG_PKG_CONFIG([0.17.2])
AC_CONFIG_FILES(
Makefile
doc/Makefile
src/Makefile
src/build.h
)
uname=`uname`
case $uname in
Linux*)
WANT_SYSINFO=yes
;;
FreeBSD*)
WANT_KVM=yes
WANT_DEVSTAT=yes
;;
# NetBSD*)
# WANT_KVM=yes
# WANT_OSSLIB=yes
# ;;
OpenBSD*)
WANT_KVM=yes
WANT_OSSLIB=yes
;;
# Solaris doesn't work at all right now
# SunOS*)
# WANT_KSTAT=yes
# ;;
*)
echo "Your operating system $uname isn't supported"
echo "Feel free to help. :P"
exit 1
;;
esac
AM_CONDITIONAL(BUILD_LINUX, test x$uname = xLinux)
#AM_CONDITIONAL(BUILD_SOLARIS, test x$uname = xSunOS)
AM_CONDITIONAL(BUILD_FREEBSD, test x$uname = xFreeBSD)
#AM_CONDITIONAL(BUILD_NETBSD, test x$uname = xNetBSD)
AM_CONDITIONAL(BUILD_OPENBSD, test x$uname = xOpenBSD)
BUILD_DATE=$(LANG=en_US LC_ALL=en_US LOCALE=en_US date)
BUILD_ARCH="$(uname -sr) ($(uname -m))"
AC_SUBST(BUILD_DATE)
AC_SUBST(BUILD_ARCH)
dnl
dnl OWN_WINDOW option
dnl
AC_ARG_ENABLE([own_window],
AC_HELP_STRING([--disable-own-window],
[disable if you do not want support for creating own window @<:@default=yes@:>@]),
[dah="$enableval"], [dah=yes])
if test $dah != "no"; then
AC_DEFINE(OWN_WINDOW, 1, [Define if you want support for window creating])
fi
dnl
dnl Audacious Media Player
dnl
AC_ARG_ENABLE([audacious],
AC_HELP_STRING([--enable-audacious], [enable audacious player support @<:@default=no@:>@]),
[want_audacious="$enableval"], [want_audacious=no])
AM_CONDITIONAL(BUILD_AUDACIOUS, test x$want_audacious = xyes)
if test x$want_audacious = xyes; then
PKG_CHECK_MODULES([AUDACIOUS], [audacious >= 0.1])
CFLAGS="$CFLAGS $AUDACIOUS_CFLAGS"
LIBS="$LIBS $AUDACIOUS_LIBS"
AC_DEFINE(AUDACIOUS, 1, [Define for Audacious support])
fi
dnl
dnl BMPx
dnl
AC_ARG_ENABLE([bmpx],
AC_HELP_STRING([--enable-bmpx], [enable if you want BMPx support @<:@default=no@:>@]),
[want_bmpx="$enableval"], [want_bmpx=no])
AM_CONDITIONAL(BUILD_BMPX, test x$want_bmpx = xyes)
if test x$want_bmpx = xyes; then
PKG_CHECK_MODULES([BMPX], [bmp-2.0 >= 0.14.0])
CFLAGS="$CFLAGS $BMPX_CFLAGS"
LIBS="$LIBS $BMPX_LIBS"
AC_DEFINE(BMPX, 1, [Define if you want BMPx support])
fi
dnl
dnl Hddtemp
dnl
AC_ARG_ENABLE([hddtemp],
AC_HELP_STRING([--disable-hddtemp],
[disable if you do not want hddtemp support @<:@default=yes@:>@]),
[want_hddtemp="$enableval"], [want_hddtemp=yes])
AM_CONDITIONAL(BUILD_HDDTEMP, test x$want_hddtemp = xyes)
if test x$want_hddtemp = xyes; then
AC_DEFINE(HDDTEMP, 1, [Define if you want hddtemp support])
fi
dnl
dnl MPD
dnl
AC_ARG_ENABLE([mpd],
AC_HELP_STRING([--disable-mpd], [disable if you do not want MPD support @<:@default=yes@:>@]),
[want_mpd="$enableval"], [want_mpd=yes])
AM_CONDITIONAL(BUILD_MPD, test x$want_mpd = xyes)
if test x$want_mpd = xyes; then
AC_DEFINE(MPD, 1, [Define if you want MPD support])
fi
dnl
dnl XMMS2
dnl
AC_ARG_ENABLE([xmms2],
AC_HELP_STRING([--enable-xmms2], [enable if you want XMMS2 support @<:@default=no@:>@]),
[want_xmms2="$enableval"], [want_xmms2=no])
AM_CONDITIONAL(BUILD_XMMS2, test x$want_xmms2 = xyes)
if test x$want_xmms2 = xyes; then
PKG_CHECK_MODULES([XMMS2], [xmms2-client])
CFLAGS="$CFLAGS $XMMS2_CFLAGS"
LIBS="$LIBS $XMMS2_LIBS"
AC_DEFINE(XMMS2, 1, [Define if you want XMMS2 support])
fi
dnl
dnl RSS
dnl
AC_ARG_ENABLE([rss],
AC_HELP_STRING([--enable-rss], [enable if you want rss support @<:@default=no@:>@]),
[want_rss="$enableval"], [want_rss=no])
#
AM_CONDITIONAL(BUILD_RSS, test x$want_rss = xyes)
if test x$want_rss = xyes; then
WANT_GLIB=yes
PKG_CHECK_MODULES(RSS, libxml-2.0 libcurl,,exit)
CFLAGS="$CFLAGS $RSS_CFLAGS"
LIBS="$LIBS $RSS_LIBS"
AC_DEFINE(RSS, 1, [Define if you want rss support])
fi
dnl
dnl Wireless extensions
dnl
AC_ARG_ENABLE([wlan],
AC_HELP_STRING([--enable-wlan], [enable if you want wireless support @<:@default=no@:>@]),
[want_wlan="$enableval"], [want_wlan=no])
#
AM_CONDITIONAL(BUILD_WLAN, test x$want_wlan = xyes)
if test x$want_wlan = xyes; then
AC_CHECK_HEADERS([iwlib.h], [], AC_MSG_ERROR([iwlib.h header not found]))
AC_CHECK_LIB([iw], [iw_sockets_open], [LIBS="$LIBS -liw"], AC_MSG_ERROR([iw_sockets_open not found]))
AC_DEFINE(HAVE_IWLIB, 1, [Define if you want wireless support])
fi
dnl
dnl IMLIB2
dnl
dnl --commented out until brenden finishes it --
dnl AC_ARG_ENABLE([imlib2],
dnl AC_HELP_STRING([--enable-imlib2], [enable if you want Imlib2 support [[default=no]]]),
dnl [want_imlib2="$enableval"], [want_imlib2=no])
dnl
dnl AM_CONDITIONAL(BUILD_IMLIB2, test x$want_imlib2 = xyes)
dnl if test x$want_imlib2 = xyes; then
dnl PKG_CHECK_MODULES([Imlib2], [imlib2])
dnl CFLAGS="$CFLAGS $Imlib2_CFLAGS"
dnl LIBS="$LIBS $Imlib2_LIBS"
dnl AC_DEFINE(IMLIB2, 1, [Define if you want Imlib2 support])
dnl fi
dnl
dnl PORT_MONITORS
dnl
AC_ARG_ENABLE([portmon],
AC_HELP_STRING([--disable-portmon],
[disable if you do not want tcp (ip4) port monitoring @<:@default=yes@:>@]),
[want_portmon="$enableval"], [want_portmon=yes])
if test x"$want_portmon" = xyes; then
if test x"$uname" != xLinux; then
AC_MSG_NOTICE([port monitors not supported on $uname... disabling])
want_portmon=no
else
AC_CHECK_HEADERS([netdb.h netinet/in.h netinet/tcp.h sys/socket.h arpa/inet.h], [],
[PORT_MONITORS_MISSING=yes])
if test x"$PORT_MONITORS_MISSING" = xyes; then
AC_MSG_ERROR([missing a needed network header for port monitoring])
fi
WANT_GLIB=yes
AC_DEFINE(TCP_PORT_MONITOR, 1, [Define if you want tcp port monitoring support])
fi
fi
AM_CONDITIONAL(BUILD_PORT_MONITORS, test x"$want_portmon" = xyes)
dnl
dnl ICONV
dnl
AM_ICONV
if test "$am_cv_func_iconv" != yes; then
AC_MSG_WARN([Could not find libiconv])
else
LIBS="$LIBS $LIBICONV"
fi
dnl
dnl debug
dnl
AC_ARG_ENABLE([debug],
AC_HELP_STRING([--enable-debug], [compile with debug symbols @<:@default=no@:>@]),
[want_debug="$enableval"], [want_debug=no])
if test "x$want_debug" = "xyes" -a $ac_cv_c_compiler_gnu != no; then
CFLAGS="$CFLAGS -g3"
AC_DEFINE([DEBUG], [], [Define for debugging])
fi
dnl
dnl X11
dnl
AC_ARG_ENABLE([x11],
AC_HELP_STRING([--disable-x11], [disable if you do not want X11 support @<:@default=yes@:>@]),
[want_x11="$enableval"], [want_x11=yes])
AM_CONDITIONAL(BUILD_X11, test x$want_x11 = xyes)
if test "x$want_x11" = "xyes"; then
if $PKG_CONFIG --exists x11; then
PKG_CHECK_MODULES([X11], [x11])
CFLAGS="$CFLAGS $X11_CFLAGS"
LIBS="$LIBS $X11_LIBS"
else
dnl non-modular X11 installations
AC_PATH_X
AC_PATH_XTRA
CFLAGS="$CFLAGS $X_CFLAGS"
LIBS="$LIBS $X_LIBS"
LDFLAGS="$LDFLAGS $LIBS $X_PRE_LIBS"
if test "x$no_x" = "xyes"; then
AC_MSG_ERROR([Can't locate your X11 installation])
fi
AC_CHECK_LIB([X11], [XOpenDisplay], [], AC_MSG_ERROR([Could not find XOpenDisplay in -lX11]))
fi
AC_DEFINE(X11, 1, [Define if you want to use X11])
fi
dnl
dnl Xext Double-buffering Extension
dnl
AC_ARG_ENABLE([double_buffer],
AC_HELP_STRING([--disable-double-buffer],
[disable for no Xdbe double-buffering support @<:@default=yes@:>@]),
[want_double_buffer="$enableval"], [want_double_buffer=yes])
if test "x$want_double_buffer" = "xyes"; then
if test "x$want_x11" != "xyes"; then
dnl silently disable if no x11
want_double_buffer=no
else
if $PKG_CONFIG --exists xext; then
PKG_CHECK_MODULES([XEXT],[xext])
CFLAGS="$CFLAGS $XEXT_CFLAGS"
LIBS="$LIBS $XEXT_LIBS"
else
dnl non-modular X11 installation
AC_CHECK_LIB([Xext], [XdbeQueryExtension], [LIBS="$LIBS -lXext"],
AC_MSG_ERROR([Could not find XdbeQueryExtension in -lXext]))
fi
AC_DEFINE(HAVE_XDBE, 1, [Define for X11 double-buffering])
fi
fi
dnl
dnl Xdamage Extension
dnl
AC_ARG_ENABLE([xdamage],
AC_HELP_STRING([--disable-xdamage],
[disable if you do not want Xdamage support @<:@default=yes@:>@]),
[want_xdamage="$enableval"], [want_xdamage=yes])
if test "x$want_xdamage" = "xyes"; then
if test "x$want_x11" != "xyes"; then
dnl silently disable if no x11
want_xdamage=no
else
if $PKG_CONFIG --exists xdamage; then
PKG_CHECK_MODULES([XDAMAGE],[xdamage])
CFLAGS="$CFLAGS $XDAMAGE_CFLAGS"
LIBS="$LIBS $XDAMAGE_LIBS"
else
dnl non-modular X11 installation
AC_CHECK_LIB([Xdamage], [XDamageQueryExtension], [LIBS="$LIBS -lXdamage"],
AC_MSG_ERROR([Could not find XDamageQueryExtension in -lXdamage]))
fi
AC_DEFINE(HAVE_XDAMAGE, 1, [Define for X11 Xdamage extension])
fi
fi
dnl
dnl Xft
dnl
AC_ARG_ENABLE([xft],
AC_HELP_STRING([--disable-xft], [disable if you do not want to use Xft @<:@default=yes@:>@]),
[want_xft="$enableval"], [want_xft=yes])
if test x$want_xft = "xyes"; then
if test "x$want_x11" != "xyes"; then
dnl silently disable if no x11
want_xft=no
else
PKG_CHECK_MODULES(XFT, [xft])
CFLAGS="$CFLAGS $XFT_CFLAGS"
LIBS="$LIBS $XFT_LIBS"
AC_DEFINE(XFT, 1, [Define for Xft support])
fi
fi
dnl
dnl GLIB
dnl
if test x$WANT_GLIB = xyes; then
PKG_CHECK_MODULES([GLIB], [glib-2.0])
CFLAGS="$CFLAGS $GLIB_CFLAGS"
LIBS="$LIBS $GLIB_LIBS"
fi
dnl
dnl KVM
dnl
if test x$WANT_KVM = xyes; then
AC_CHECK_LIB(kvm, kvm_open,
LIBS="$LIBS -lkvm",
AC_MSG_ERROR([Could not find kvm_open in -lkvm.])
)
fi
dnl
dnl devstat
dnl
if test x$WANT_DEVSTAT = xyes; then
AC_CHECK_LIB(devstat, devstat_getversion,
LIBS="$LIBS -ldevstat",
AC_MSG_ERROR([Cound not find devstat_getversion in -ldevstat.])
)
fi
dnl
dnl OSSLIB for NetBSD/OpenBSD
dnl
if test x$WANT_OSSLIB = xyes; then
AC_CHECK_LIB(ossaudio, _oss_ioctl,
LIBS="$LIBS -lossaudio",
AC_MSG_ERROR([Could not find oss_ioctl in -lossaudio.])
)
fi
dnl
dnl Some headers
dnl
AC_CHECK_HEADERS([signal.h unistd.h sys/utsname.h sys/stat.h linux/soundcard.h dirent.h mcheck.h \
sys/statfs.h sys/param.h pthread.h assert.h errno.h time.h])
AC_CHECK_HEADERS([sys/mount.h], [], [],
[#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
])
AC_DEFINE([_GNU_SOURCE], [], [Define for GNU source and extensions])
dnl
dnl Some functions
dnl
AC_CHECK_FUNCS([calloc malloc free popen sysinfo getloadavg memrchr])
AC_SEARCH_LIBS(clock_gettime, [rt],
[AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if you have clock_gettime()])],
[AC_CHECK_FUNCS([gettimeofday], [], [AC_MSG_ERROR([gettimeofday() not available!])])], [])
dnl
dnl Check for zlib
dnl
AC_CHECK_HEADER(zlib.h,
[],
[AC_MSG_ERROR([zlib is missing; please install the headers first])])
dnl
dnl Check doc stuff
dnl
AC_CHECK_PROGS(db2x_xsltproc_cmd, db2x_xsltproc)
AC_CHECK_PROGS(db2x_manxml_cmd, db2x_manxml)
AC_CHECK_PROGS(xsltproc_cmd, xsltproc)
if test x$db2x_xsltproc_cmd = "x" -o x$xsltproc_cmd = "x"; then
AM_CONDITIONAL(HAVE_DOCSTUFF, false)
else
AM_CONDITIONAL(HAVE_DOCSTUFF, true)
fi
dnl
dnl kstat in Solaris
dnl
if test x$WANT_KSTAT = xyes; then
dah=no
AC_CHECK_LIB([kstat], [kstat_open], [dah=yes], [])
if test x$dah = xyes; then
AC_DEFINE(HAVE_KSTAT, 1, [Define if you have kstat (Solaris)])
LDFLAGS="$LDFLAGS -lkstat"
fi
fi
AC_DEFUN([AM_LANGINFO_CODESET],
[
AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
[AC_TRY_LINK([#include <langinfo.h>],
[char* cs = nl_langinfo(CODESET);],
am_cv_langinfo_codeset=yes,
am_cv_langinfo_codeset=no)
])
if test $am_cv_langinfo_codeset = yes; then
AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
[Define if you have <langinfo.h> and nl_langinfo(CODESET).])
fi
])
dnl ************************
dnl * Linker optimizations *
dnl ************************
AC_MSG_CHECKING([if $LD accepts -O1])
case `$LD -O1 -v 2>&1 </dev/null` in
*GNU* | *BSD*)
LDFLAGS="$LDFLAGS -Wl,-O1"
AC_MSG_RESULT([yes])
;;
*)
AC_MSG_RESULT([no])
;;
esac
dnl
dnl Da.
dnl
CFLAGS="$CFLAGS -Wall -W"
AC_SUBST(CFLAGS)
AC_SUBST(X11_LIBS)
AC_OUTPUT
dnl
dnl Print summary
dnl
cat << EOF
$PACKAGE $VERSION configured successfully:
Installing into: $prefix
C compiler flags: $CFLAGS
Linker flags: $LDFLAGS
Libraries: $LIBS
* x11:
x11 support: $want_x11
xdamage support: $want_xdamage
xdbe support: $want_double_buffer
xft support: $want_xft
* music detection:
audacious: $want_audacious
bmpx: $want_bmpx
mpd: $want_mpd
xmms2: $want_xmms2
* general:
hddtemp: $want_hddtemp
portmon: $want_portmon
RSS: $want_rss
wireless: $want_wlan
EOF

View File

@ -1,34 +0,0 @@
conky (1.4.0-1) unstable; urgency=low
* New upstream release
-- Brenden Matthews <brenden@rty.ca> Wed Feb 15 04:34:46 UTC 2006
conky (1.3.4-1) unstable; urgency=low
* New upstream release
-- Brenden Matthews <brenden@rty.ca> Wed, 16 Nov 2005 17:13:53 -0700
conky (1.3.3-1) unstable; urgency=low
* New upstream release
* Removed ml_* variables from documentation (closes: #335543)
* Removed i2c line from sample config (closes: #329396)
-- Jason Tan <jtan325@gmail.com> Tue, 25 Oct 2005 07:34:54 -0700
conky (1.3.1-1) unstable; urgency=low
* New upstream release
* Added libxt-dev to build-depends in debian/control (closes: #327306)
* Fixed the double BSD-license in debian/copyright (closes: #327135)
-- Jason Tan <jtan325@gmail.com> Sat, 10 Sep 2005 22:45:51 -0700
conky (1.3.0-1) unstable; urgency=low
* Initial Release. (closes: #320978)
-- Jason Tan <jtan325@gmail.com> Wed, 24 Aug 2005 00:10:49 -0700

View File

@ -1 +0,0 @@
4

View File

@ -1,18 +0,0 @@
Source: conky
Section: utils
Priority: optional
Maintainer: Brenden Matthews <brenden@rty.ca>
Build-Depends: cdbs, debhelper (>= 4.1.0), xlibs-dev, libxt-dev
Standards-Version: 3.6.2
Package: conky
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: highly configurable system monitor for X based on torsmo
Conky is a system monitor for X originally based on the torsmo code.
Since its original conception, Conky has changed a fair bit from its
predecessor. Conky can display just about anything, either on your
root desktop or in its own window. Conky has many built-in objects,
as well as the ability to execute programs and scripts, then display
the output from stdout. See http://conky.sf.net for more info.

View File

@ -1,12 +0,0 @@
This package was debianized by Jason Tan <jtan325@gmail.com> on
Wed, 24 Aug 2005 00:10:49 -0700.
It was downloaded from http://www.sourceforge.net/projects/conky
Copyright: This software is copyright (c) 2004-2005 by Brenden Matthews.
Upstream Author: Brenden Matthews <brenden@rty.ca>
You are free to distribute this software under the terms of the BSD License.
On Debian systems, the complete text of the BSD License can be found in the
file `/usr/share/common-licenses/BSD'.

View File

@ -1,6 +0,0 @@
README
TODO
doc/docs.html
doc/variables.html
doc/config_settings.html
doc/conkyrc.sample

View File

@ -1,2 +0,0 @@
?package(conky):needs="text" section="Apps/Tools"\
title="Conky" command="/usr/bin/conky"

View File

@ -1,5 +0,0 @@
#!/usr/bin/make -f
include /usr/share/cdbs/1/class/autotools.mk
include /usr/share/cdbs/1/rules/debhelper.mk
DEB_CONFIGURE_EXTRA_FLAGS := --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info --enable-double-buffer --enable-own-window --enable-proc-uptime --enable-mpd --enable-xft --enable-seti --enable-portmon --enable-mldonkey

View File

@ -1,29 +0,0 @@
if HAVE_DOCSTUFF
DOCS = conky.1 docs.html variables.html config_settings.html
clean-am: clean-generic mostlyclean-am
rm -f docs.mxml
rm -f conky.1
rm -f variables.html
rm -f config_settings.html
conky.1: command_options.xml config_settings.xml docs.xml variables.xml
${db2x_xsltproc_cmd} -s man ${srcdir}/docs.xml -o docs.mxml
${db2x_manxml_cmd} docs.mxml
${xsltproc_cmd} http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl ${srcdir}/docs.xml > docs.html
man ./conky.1 | col -b > README
mv README ${top_srcdir}
xsltproc ${srcdir}/variables.xsl ${srcdir}/variables.xml > variables.html
xsltproc ${srcdir}/config_settings.xsl ${srcdir}/config_settings.xml > config_settings.html
else
conky.1:
endif
man_MANS = conky.1
EXTRA_DIST = $(DOCS) conkyrc.sample command_options.xml config_settings.xml docgen.sh docs.xml variables.xml variables.xsl config_settings.xsl
# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:

View File

@ -1,41 +0,0 @@
DA DOCS. YO.
============
The main file that contains the bulk of our documentation is docs.xml .
We use the DocBook format, which is a really kickass xml-based way of
writing documentation, heavily oriented towards programming and computer
stuff. There are tags like <command> and <option> that marks up your
content without actually having to mark it up, which is why something
that's of the <command> shows up in some cool style regardless of
whether it's in a man page or a web page. DocBook has been around for
10 years, and there's TONS of resources online about the different
tags and the stuff that can be done.
FILE ORGANIZATION
=================
For the sake of making things readable and organized,
docs.xml "includes" three other files, as of 8/18/05.
These are config_settings.xml, command_options.xml, and variables.xml .
Their names are pretty self-explanatory, and what the "include" essentially
does is stick their contents into docs.xml at the appropriate locations
when it's time to produce a man page or html file. So if you wanted to
add a variable or explain a command line option better, you'd look in
variables.xml and command_options.xml. If you wanted to change the authors
or something, look in docs.xml
BUILDING DA DOCS
================
(NOTE that the docs are now built automatically via doc/Makefile.am, but it requires that you have docbook2x and xsltproc installed)
making the html is easy. xsltproc should more than likely already be on your system:
xsltproc http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl docs.xml > docs.html
==============================================================================================================
making the man page is pretty easy, it uses a program called docbook2x, which you might or might not have.
docbook2x-man docs.xml (produces a conky.1 file)
gzip conky.1
conky.1.gz can be viewed in man-form by doing "man -l conky.1.gz"
==============================================================================================================
making the README (text-only) file is just some simple unix:
man -l conky.1.gz | col -b > README

View File

@ -1,93 +0,0 @@
<variablelist>
<varlistentry>
<term><command><option>-v | -V</option></command></term>
<listitem>
Prints version and exits
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>-a </option></command><option>ALIGNMENT</option></term>
<listitem>
Text alignment on screen, {top,bottom}_{left,right} or none
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>-b</option></command></term>
<listitem>
Use double buffering (eliminates "flicker")
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>-c </option></command><option>FILE</option></term>
<listitem>
Config file to load instead of $HOME/.conkyrc
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>-d</option></command></term>
<listitem>
Daemonize Conky, aka fork to background
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>-f </option></command><option>FONT</option></term>
<listitem>
Font to use
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>-h</option></command></term>
<listitem>
Prints command line help and exits
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>-o</option></command></term>
<listitem>
Create own window to draw
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>-t </option></command><option>TEXT</option></term>
<listitem>
Text to render, remember single quotes, like -t &apos; $uptime &apos;
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>-u </option></command><option>SECONDS</option></term>
<listitem>
Update interval
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>-w </option></command><option>WIN_ID</option></term>
<listitem>
Window id to draw
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>-x </option></command><option>X_COORDINATE</option></term>
<listitem>
X position
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>-y </option></command><option>Y_COORDINATE</option></term>
<listitem>
Y position
<para></para></listitem>
</varlistentry>
</variablelist>

View File

@ -1,437 +0,0 @@
<variablelist>
<varlistentry>
<term><command><option>alignment</option></command></term>
<listitem>
Aligned position on screen, may be top_left, top_right, bottom_left, bottom_right, or none
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>background</option></command></term>
<listitem>
Boolean value, if true, Conky will be forked to background when started
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>border_margin</option></command></term>
<listitem>
Border margin in pixels
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>border_width</option></command></term>
<listitem>
Border width in pixels
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>color0</option></command></term>
<listitem>
A color variable for use inside TEXT segments
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>color1</option></command></term>
<listitem>
A color variable for use inside TEXT segments
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>color2</option></command></term>
<listitem>
A color variable for use inside TEXT segments
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>color3</option></command></term>
<listitem>
A color variable for use inside TEXT segments
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>color4</option></command></term>
<listitem>
A color variable for use inside TEXT segments
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>color5</option></command></term>
<listitem>
A color variable for use inside TEXT segments
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>color6</option></command></term>
<listitem>
A color variable for use inside TEXT segments
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>color7</option></command></term>
<listitem>
A color variable for use inside TEXT segments
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>color8</option></command></term>
<listitem>
A color variable for use inside TEXT segments
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>color9</option></command></term>
<listitem>
A color variable for use inside TEXT segments
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>cpu_avg_samples</option></command></term>
<listitem>
The number of samples to average for CPU monitoring
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>default_color</option></command></term>
<listitem>
Default color and border color
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>default_outline_color</option></command></term>
<listitem>
Default outline color
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>default_shade_color</option></command></term>
<listitem>
Default shading color and border's shading color
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>double_buffer</option></command></term>
<listitem>
Use the Xdbe extension? (eliminates flicker) It is highly recommended to use own window with this one so double buffer won't be so big.
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>draw_borders</option></command></term>
<listitem>
Draw borders around text?
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>draw_graph_borders</option></command></term>
<listitem>
Draw borders around graphs?
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>draw_outline</option></command></term>
<listitem>
Draw outlines?
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>draw_shades</option></command></term>
<listitem>
Draw shades?
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>font</option></command></term>
<listitem>
Font name in X, xfontsel can be used to get a nice font
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>gap_x</option></command></term>
<listitem>
Gap, in pixels, between right or left border of screen, same as passing -x at command line,
e.g. gap_x 10
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>gap_y</option></command></term>
<listitem>
Gap, in pixels, between top or bottom border of screen, same as passing -y at command line,
e.g. gap_y 10.
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>imap</option></command></term>
<listitem>
Default global IMAP server. Arguments are: "host user pass [-i interval] [-f folder] [-p port] [-e command]". Default port is 143, default folder is 'INBOX', default interval is 5 minutes. If the password is supplied as '*', you will be prompted to enter the password when Conky starts.
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>mail_spool</option></command></term>
<listitem>
Mail spool for mail checking
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>max_port_monitor_connections</option></command></term>
<listitem>
Allow each port monitor to track at most this many connections (if 0 or not set, default is 256)
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>max_specials</option></command></term>
<listitem>
Maximum number of special things, e.g. fonts, offsets, aligns, etc. (default is 512)
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>max_user_text</option></command>
<option>bytes</option>
</term>
<listitem>
Maximum size of user text buffer, i.e. layout below TEXT line in config file
(default is 16384 bytes)
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>text_buffer_size</option></command>
<option>bytes</option>
</term>
<listitem>
Size of the standard text buffer (default is 1280 bytes).
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>maximum_width</option></command>
<option>pixels</option>
</term>
<listitem>
Maximum width of window
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>minimum_size</option></command>
<option>width (height)</option>
</term>
<listitem>
Minimum size of window
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>mpd_host</option></command></term>
<listitem>
Host of MPD server
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>mpd_port</option></command></term>
<listitem>
Port of MPD server
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>mpd_password</option></command></term>
<listitem>
MPD server password
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>net_avg_samples</option></command></term>
<listitem>
The number of samples to average for net data
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>no_buffers</option></command></term>
<listitem>
Substract (file system) buffers from used memory?
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>override_utf8_locale</option></command></term>
<listitem>
Force UTF8? requires XFT
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>own_window</option></command></term>
<listitem>
Boolean, create own window to draw?
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>own_window_class</option></command></term>
<listitem>
Manually set the WM_CLASS name. Defaults to "Conky".
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>own_window_colour</option></command>
<option>colour</option>
</term>
<listitem>
If own_window_transparent no, set a specified background colour (defaults to black). Takes either a hex value (#ffffff) or a valid RGB name (see /usr/lib/X11/rgb.txt)
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>own_window_hints</option></command>
<option>undecorated,below,above,sticky,skip_taskbar,skip_pager</option>
</term>
<listitem>
If own_window is yes, you may use these window manager hints to affect the way Conky displays.
Notes: Use own_window_type desktop as another way to implement many of these hints implicitly.
If you use own_window_type override, window manager hints have no meaning and are ignored.
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>own_window_title</option></command></term>
<listitem>
Manually set the window name. Defaults to "&lt;hostname&gt; - conky".
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>own_window_transparent</option></command></term>
<listitem>
Boolean, set pseudo-transparency?
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>own_window_type</option></command></term>
<listitem>
if own_window is yes, you may specify type normal, desktop or override (default: normal).
Desktop windows are special windows that have no window decorations; are always visible
on your desktop; do not appear in your pager or taskbar; and are sticky across all workspaces.
Override windows are not under the control of the window manager. Hints are ignored. This type
of window can be useful for certain situations.
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>out_to_console</option></command>
</term>
<listitem>
Print text to stdout.
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>pad_percents</option></command></term>
<listitem>
Pad percentages to this many decimals (0 = no padding)
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>pop3</option></command></term>
<listitem>
Default global POP3 server. Arguments are: "host user pass [-i interval] [-p port] [-e command]". Default port is 110, default interval is 5 minutes. If the password is supplied as '*', you will be prompted to enter the password when Conky starts.
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>stippled_borders</option></command></term>
<listitem>
Border stippling (dashing) in pixels
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>total_run_times</option></command></term>
<listitem>
Total number of times for Conky to update before quitting. Zero makes Conky run forever
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>update_interval</option></command></term>
<listitem>
Update interval in seconds
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>uppercase</option></command></term>
<listitem>
Boolean value, if true, text is rendered in upper case
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>use_spacer</option></command></term>
<listitem>
Adds spaces after certain objects to stop them from moving other things around. Note that this only helps if you are using a mono font, such as Bitstream Vera Sans Mono.
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>use_xft</option></command></term>
<listitem>
Use Xft (anti-aliased font and stuff)
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>xftalpha</option></command></term>
<listitem>
Alpha of Xft font. Must be a value at or between 1 and 0.
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>xftfont</option></command></term>
<listitem>
Xft font to use.
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>TEXT</option></command></term>
<listitem>
After this begins text to be formatted on screen
<para></para></listitem>
</varlistentry>
</variablelist>

View File

@ -1,46 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!--jtan325 created this-->
<xsl:output method="html"/>
<xsl:template match="/">
<html>
<head>
<title>~/.conkyrc settings</title>
</head>
<body bgcolor="#FFFFFF">
<xsl:apply-templates />
</body>
</html>
</xsl:template>
<xsl:template match="variablelist" >
<table cellpadding="3">
<tr bgcolor = "#eecfa1">
<th>Variable</th>
<th>Explanation</th>
</tr>
<xsl:for-each select="varlistentry">
<xsl:variable name="row_bg">
<xsl:choose>
<xsl:when test="position() mod 2 = 1">#fffafa</xsl:when>
<xsl:otherwise>#b4cdcd</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<tr bgcolor = "{$row_bg}">
<td align="center">
<xsl:value-of select="term/command/option" />
</td>
<td>
<xsl:value-of select="listitem" />
</td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>

View File

@ -1,142 +0,0 @@
<?xml version='1.0' encoding="UTF-8"?>
<!DOCTYPE guide SYSTEM "http://www.gentoo.org/dtd/guide.dtd">
<guide link="/doc/en/conky-howto.xml">
<title>Gentoo Linux Conky Howto</title>
<author title="Author">
<mail link="admin@sdesign.us">Bill Woodford</mail>
</author>
<author title="Editor">
<mail link="brenden@rty.ca">Brenden Matthews</mail>
</author>
<abstract>
This document describes how to install and configure the system monitor known
as Conky.
</abstract>
<!-- The content of this document is licensed under the CC-BY-SA license -->
<!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
<license/>
<version>1.0</version>
<date>2006-02-22</date>
<chapter>
<title>Background</title>
<section>
<title>Introduction to Conky</title>
<body>
<p>
So you have a Gentoo machine, and have already learned 30 different commands to monitor different aspects of what your computer is doing at the current moment. What do you do from here? Isn't there an easier way to monitor system performance and see what its doing, as well as the resources its using to perform all those tasks? This is what a system monitor, such as Conky, provides.
</p>
</body>
</section>
<section>
<title>What it does</title>
<body>
<p>
Unlike other system monitors such as top, Conky can run as a window in an X session, or by drawing to the root window (there is also an option to have Conky display information to stdout, but we won't discuss that here). It displays the information it has gathered through the use of both text, progress bars, and graphs. Also unlike top, the way it is formatted is completely user-configurable. In addition to monitoring the system itself, Conky can also give you information about several music players (such as XMMS, BMPx, Music Player Daemon, and Audacious Media Player), tell you how many new messages are in your mail spool, and plenty more. If the functionality you require isn't in Conky yet, it is a simple matter of writing a script to get the information you would like - some examples of this, which have already been done are RSS feeds, POP3 e-mail message count, local weather, boinc status, and even the status of portage.
</p>
</body>
</section>
</chapter>
<chapter>
<title>Installing Conky</title>
<section>
<title>Base install</title>
<body>
<p>
Gentoo provides an ebuild to quickly and easily install Conky. Pay particular attention to the the USE flags. You'll most likely want X11 support (<c>X</c>), and make sure you select the USE flags for any music players (other than MPD) which you want. XMMS (<c>xmms</c>), Audacious (<c>audacious</c>), BMPx (<c>bmpx</c>), or XMMS support via the xmms-infopipe plugin (<c>infopipe</c>). If you want to use the TCP port monitor, be SURE to disable the <c>ipv6</c> use flag, as the port monitor is for ipv4 systems only.
</p>
<pre caption="/etc/portage/package.use">
<comment># Example line to append to /etc/portage/package.use if you don't want the default USE flags.</comment>
<i>app-admin/conky xmms infopipe -ipv6</i>
</pre>
<p>
In addition, the <c>truetype</c> USE flag compiles support for TrueType fonts with the use of Xft. Most users will want this as well.
</p>
<p>
Once you have your USE flags correctly set up, it's time to install Conky!
</p>
<pre caption="Installing Conky">
<i>emerge -av conky</i>
</pre>
<p>
You can test Conky to see how it will look by running the command <c>conky</c> in a terminal. This will likely give you a good reference to how it will look and what you want to change, add or even remove.
</p>
<pre caption="Running Conky for the first time">
$ <i>conky</i>
</pre>
<p>
Once you have an idea of how Conky looks, you can now move on to configuring it!
</p>
</body>
</section>
<section>
<title>Configuring Conky</title>
<body>
<p>
By default, Conky will look for a configuration file in the users home directory located at <path>~/.conkyrc</path> This file contains all the configuration options, and the static text, colors and other variables which control what data is shown to the user. Conky also provides a great sample configuration, located at <path>/usr/share/doc/conky-version/Conkyrc.sample.gz</path> Make sure to replace "version" with the specific version of Conky you have installed.
</p>
<pre caption="Copying the sample configuration to your home directory">
$ <i>zcat /usr/share/conky-1.6.0/conkyrc.sample.gz >> ~/.conkyrc</i>
</pre>
<note>
Make sure to replace "1.6.0" with the specific version of Conky you have installed.
</note>
<p>
Now, open up the sample configuration in the text editor of your choice. You may notice that there are two seperate sections of the configuration file. The first section of the file, contains the programs configuration options and controls how it acts. This includes things such as the <c>update_interval</c>, or how often Conky will update the information on the screen. The second section contains the actual text, graphs, and variables which are rendered on the screen. This includes things such as the system uptime (<c>$uptime</c>), cpu usage (<c>$cpu</c>) and anything else you want to be shown. The first section of the file starts right from the beginning, the second section is comprised of everything after the line which says "<c>TEXT</c>". Comments in the file start with <c>#</c>, but keep in mind that even if a line is commented out in the second section of the file, the text will still be rendered to the screen.
</p>
<p>
Lists of all the available configuration options and variables are kept at <uri>http://conky.sourceforge.net/config_settings.html</uri> and <uri>http://conky.sourceforge.net/variables.html</uri>. Also, there's a few great sample configurations and screenshots of working configurations at <uri>http://conky.sourceforge.net/screenshots.html</uri>.
</p>
</body>
</section>
</chapter>
<chapter>
<title>Extending Conky</title>
<section>
<title>Beyond the built-in variables</title>
<body>
<p>
So you've gotten this far, and have scoured the Conky documentation for that extra variable which Conky just doesn't seem to have... You're in luck! Conky provides several variables for just this reason! <c>$exec</c> Will run a command every time Conky updates, <c>$execi</c> will run a command at a specified interval and <c>$texeci</c> will run a command in it's own thread at a specified interval.
</p>
<pre caption="Scripting examples">
<i>${exec grep 'sudo' /var/log/messages | tail -n 4}</i>
<i>${execi 30 ~/scripts/emerge-status.sh</i>
<i>${texeci 600 ~/scripts/gmail.pl}</i>
</pre>
<note>
While any command which works in a command shell will work in any of these variables, it is important to keep in mind that the commands must exit. This means that commands like <c>tail -f</c> which keep running will NOT work properly.
</note>
</body>
</section>
</chapter>
</guide>

File diff suppressed because it is too large Load Diff

View File

@ -1,192 +0,0 @@
# Conky sample configuration
#
# the list of variables has been removed from this file in favour
# of keeping the documentation more maintainable.
# Check http://conky.sf.net for an up-to-date-list.
# set to yes if you want Conky to be forked in the background
background no
# X font when Xft is disabled, you can pick one with program xfontsel
#font 5x7
#font 6x10
#font 7x13
#font 8x13
#font 9x15
#font *mintsmild.se*
#font -*-*-*-*-*-*-34-*-*-*-*-*-*-*
# Use Xft?
use_xft yes
# Xft font when Xft is enabled
xftfont Bitstream Vera Sans Mono:size=8
# Text alpha when using Xft
xftalpha 0.8
# Print everything to stdout?
# out_to_console no
# MPD host/port
# mpd_host localhost
# mpd_port 6600
# mpd_password tinker_bell
# Print everything to console?
# out_to_console no
# mail spool
mail_spool $MAIL
# Update interval in seconds
update_interval 5.0
# This is the number of times Conky will update before quitting.
# Set to zero to run forever.
total_run_times 0
# Create own window instead of using desktop (required in nautilus)
own_window yes
# If own_window is yes, you may use type normal, desktop or override
own_window_type normal
# Use pseudo transparency with own_window?
own_window_transparent yes
# If own_window_transparent is set to no, you can set the background colour here
own_window_colour hotpink
# If own_window is yes, these window manager hints may be used
#own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes
# Minimum size of text area
minimum_size 280 5
# Draw shades?
draw_shades yes
# Draw outlines?
draw_outline no
# Draw borders around text
draw_borders yes
# Draw borders around graphs
draw_graph_borders yes
# Stippled borders?
stippled_borders 8
# border margins
border_margin 4
# border width
border_width 1
# Default colors and also border colors
default_color white
default_shade_color black
default_outline_color black
dexter_client no
dexter_server no
# config file for libdexter (default search path: $HOME/.dexterrc; /etc/libdexter/dexter.conf)
dexter_config
# Text alignment, other possible values are commented
#alignment top_left
#alignment top_right
alignment bottom_left
#alignment bottom_right
#alignment none
# Gap between borders of screen and text
# same thing as passing -x at command line
gap_x 12
gap_y 12
# Subtract file system buffers from used memory?
no_buffers yes
# set to yes if you want all text to be in uppercase
uppercase no
# number of cpu samples to average
# set to 1 to disable averaging
cpu_avg_samples 2
# number of net samples to average
# set to 1 to disable averaging
net_avg_samples 2
# Force UTF8? note that UTF8 support required XFT
override_utf8_locale no
# Add spaces to keep things from moving about? This only affects certain objects.
use_spacer no
# Allow each port monitor to track at most this many connections (if 0 or not set, default is 256)
#max_port_monitor_connections 256
# Maximum number of special things, e.g. fonts, offsets, aligns, etc.
#max_specials 512
# Maximum size of buffer for user text, i.e. below TEXT line.
#max_user_text 16384
# variable is given either in format $variable or in ${variable}. Latter
# allows characters right after the variable and must be used in network
# stuff because of an argument
# stuff after 'TEXT' will be formatted on screen
TEXT
$nodename - $sysname $kernel on $machine
$stippled_hr
${color lightgrey}Uptime:$color $uptime ${color lightgrey}- Load:$color $loadavg
${color lightgrey}CPU Usage:${color #cc2222} $cpu% ${cpubar}
${color red}${cpugraph 0000ff 00ff00}
${color lightgrey}RAM Usage:$color $mem/$memmax - $memperc% ${membar}
${color lightgrey}Swap Usage:$color $swap/$swapmax - $swapperc% ${swapbar}
${color lightgrey}Processes:$color $processes ${color grey}Running:$color $running_processes
$color$stippled_hr
${color lightgrey}Networking:
Down:${color #8844ee} ${downspeed eth0} k/s${color lightgrey} ${offset 80}Up:${color #22ccff} ${upspeed eth0} k/s
${color #0000ff}${downspeedgraph eth0 32,150 ff0000 0000ff} ${color #22ccff}${upspeedgraph eth0 32,150 0000ff ff0000}
${color lightgrey}File systems:
/ $color${fs_used /}/${fs_size /} ${fs_bar /}
${color #88aadd}MPD: ${alignc}$mpd_artist - $mpd_title
${color #88aadd}$mpd_bar
${color #88aadd}${alignc}$mpd_status
${color}Name PID CPU% MEM%
${color #ddaa00} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}
${color lightgrey} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}
${color lightgrey} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}
${color lightgrey} ${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4}
${color}Mem usage
${color #ddaa00} ${top_mem name 1} ${top_mem pid 1} ${top_mem cpu 1} ${top_mem mem 1}
${color lightgrey} ${top_mem name 2} ${top_mem pid 2} ${top_mem cpu 2} ${top_mem mem 2}
${color lightgrey} ${top_mem name 3} ${top_mem pid 3} ${top_mem cpu 3} ${top_mem mem 3}
${tail /var/log/Xorg.0.log 3 30}
$stippled_hr
${color #ddaa00}Port(s)${alignr}#Connections
$color Inbound: ${tcp_portmon 1 32767 count} Outbound: ${tcp_portmon 32768 61000 count}${alignr}ALL: ${tcp_portmon 1 65535 count}
${color #ddaa00}Inbound Connection ${alignr} Local Service/Port$color
${tcp_portmon 1 32767 rhost 0} ${alignr} ${tcp_portmon 1 32767 lservice 0}
${tcp_portmon 1 32767 rhost 1} ${alignr} ${tcp_portmon 1 32767 lservice 1}
${tcp_portmon 1 32767 rhost 2} ${alignr} ${tcp_portmon 1 32767 lservice 2}
${tcp_portmon 1 32767 rhost 3} ${alignr} ${tcp_portmon 1 32767 lservice 3}
${tcp_portmon 1 32767 rhost 4} ${alignr} ${tcp_portmon 1 32767 lservice 4}
${tcp_portmon 1 32767 rhost 5} ${alignr} ${tcp_portmon 1 32767 lservice 5}
${color #ddaa00}Outbound Connection ${alignr} Remote Service/Port$color
${tcp_portmon 32768 61000 rhost 0} ${alignr} ${tcp_portmon 32768 61000 rservice 0}
${tcp_portmon 32768 61000 rhost 1} ${alignr} ${tcp_portmon 32768 61000 rservice 1}
${tcp_portmon 32768 61000 rhost 2} ${alignr} ${tcp_portmon 32768 61000 rservice 2}
${tcp_portmon 32768 61000 rhost 3} ${alignr} ${tcp_portmon 32768 61000 rservice 3}
${tcp_portmon 32768 61000 rhost 4} ${alignr} ${tcp_portmon 32768 61000 rservice 4}
${tcp_portmon 32768 61000 rhost 5} ${alignr} ${tcp_portmon 32768 61000 rservice 5}

View File

@ -1,12 +0,0 @@
#!/bin/sh
# $Id$
xsltproc http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl docs.xml > docs.html
db2x_xsltproc -s man docs.xml -o docs.mxml
db2x_manxml docs.mxml
{ echo ".TH CONKY 1 \"August 2005\" \"conky compiled August 2005\" \"User Commands\""; sed 1d < conky.1; } > conky.2
mv conky.2 conky.1
#gzip --best --stdout conky.1 > conky.1.gz
man ./conky.1 | col -b > README
mv README ../

View File

@ -1,235 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
<!ENTITY testtable SYSTEM "test.xml">
<!ENTITY command_options SYSTEM "command_options.xml">
<!ENTITY config_settings SYSTEM "config_settings.xml">
<!ENTITY variables SYSTEM "variables.xml">
]>
<refentry>
<refentryinfo>
<address>
<email>brenden1@users.sourceforge.net</email>
</address>
<author>
<firstname>Brenden</firstname>
<surname>Matthews</surname>
</author>
<date>2007-08-08</date>
</refentryinfo>
<refmeta>
<refentrytitle>conky</refentrytitle>
<manvolnum>1</manvolnum>
</refmeta>
<refnamediv>
<refname>conky</refname>
<refpurpose>A system monitor for X originally based on the torsmo code, but more kickass. It just keeps on given'er. Yeah.</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>conky</command>
<arg><replaceable>options</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
Conky is a system monitor for X originally based on the torsmo code.
Since it's original conception, Conky has changed a fair bit from it's predecessor.
Conky can display just about anything, either on your root desktop or in it's own window.
Conky has many built-in objects, as well as the ability to execute programs and scripts,
then display the output from stdout.
</para>
<para>
We are always looking for help, and anyone interested in becoming a developer is welcome.
Please use the facilities at SourceForge to make bug reports, feature requests, and submit patches.
</para>
<para>
Thanks for your interest in Conky.
</para>
</refsect1>
<refsect1>
<title>Compiling</title>
<para>
For users compiling from source, make sure you have the X development libraries installed.
This should be a package along the lines of "libx11-dev or xorg-x11-dev".
</para>
<para>
Gentoo users -- Conky is in Gentoo's Portage... simply use "emerge app-admin/conky" for installation.
There is also usually an up-to-date ebuild within Conky's package or in Svn.
</para>
<para>
Debian,etc. users -- Conky will be in Debian's repositories soon (by mid-September, hopefully), and then
Ubuntu shortly thereafter. Until then, "dpkg -i" the .deb package to install.
</para>
<para>
Example to compile and run Conky with all optional components (note that some configure options may differ for your system):
</para>
<variablelist>
<varlistentry>
<term>
<command><option>sh autogen.sh</option></command> <option># Only required if building from Svn</option>
</term>
</varlistentry>
<varlistentry>
<term>
<command><option>./configure </option></command><option>--prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --disable-own-window --enable-audacious --enable-bmpx --disable-hddtemp --disable-mpd --enable-xmms2 --disable-portmon --disable-network --enable-debug --disable-x11 --disable-double-buffer --disable-xdamage --disable-xft</option>
</term>
</varlistentry>
<varlistentry>
<term>
<command><option>make</option></command>
</term>
</varlistentry>
<varlistentry>
<term>
<command><option>make install</option></command> <option># Optional</option>
</term>
</varlistentry>
<varlistentry>
<term>
<command><option>src/conky</option></command>
</term>
</varlistentry>
</variablelist>
<para>
Conky probably doesn't compile with compilers other than gcc and icc.
It doesn't compile with C89 compiler and not even with pure C99.
It uses a few things that might not exist: strdup(), strcasecmp(), strncasecmp(),
optarg variable with getopt() and long long (not in C89). Crashes in file system
statistics stuff when compiled with icc, I don't know exactly why.
</para>
<para>
You can disable 'drawing to own window' feature in case you don't need it by passing
--disable-own-window to configure -script.
</para>
<para>
</para>
</refsect1>
<refsect1>
<title>You Should Know</title>
<para>
Conky is generally very good on resources. However, certain objects in
Conky are harder on resources then others. In particular, the $tail,
$top, $font, and $graph objects are quite costly in comparison to the rest of Conky.
</para>
<para>
If you do use them, please do not complain about memory or CPU usage,
unless you think something's seriously wrong (mem leak, etc.).
</para>
<para>
An easy way to force Conky to reload your ~/.conkyrc: "killall -SIGUSR1 conky".
Saves you the trouble of having to kill and then restart.
</para>
<para>
IMPORTANT: For previous Conky users, Conky 1.3 no longer supports the metar stuff.
mdsplib was causing way too many problems. Hopefully there'll be a better solution in Conky 2.x...
</para>
</refsect1>
<refsect1>
<title>Options</title>
<para>Command line options override configurations defined in configuration file.</para>
&command_options;
</refsect1>
<refsect1>
<title>Configuration Settings</title>
<para>
Default configuration file is $HOME/.conkyrc (can be changed from
conky.c among other things). See conkyrc.sample. If installing from Debian package,
this should be in /usr/share/doc/conky/examples ("gunzip conkyrc.sample.gz" to get conkyrc.sample).
</para>
<para>
You might want to copy it to $HOME/.conkyrc and then start modifying it.
Other configs can be found at http://conky.sf.net
</para>
&config_settings;
</refsect1>
<refsect1>
<title>Variables</title>
<para>
Colors are parsed using XParsecolor(), there might be a list of them:
/usr/X11R6/lib/X11/rgb.txt. Also, <ulink url="http://sedition.com/perl/rgb.html">
http://sedition.com/perl/rgb.html</ulink>.
Color can be also in #rrggbb format (hex).
Note that when displaying bytes, power is 1024 and not 1000 so 1M really
means 1024*1024 bytes and not 1000*1000.
</para>
&variables;
</refsect1>
<refsect1>
<title>Examples</title>
<variablelist>
<varlistentry>
<term><varname>conky </varname><option>-t &apos;${time %D %H:%m}&apos; -o -u 30</option></term>
<listitem>Start Conky in its own window with date and clock as text and 30 sec update interval.</listitem>
</varlistentry>
<varlistentry>
<term><varname>conky </varname><option>-a top_left -x 5 -y 500 -d</option></term>
<listitem>Start Conky to background at coordinates (5, 500).</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Files</title>
<filename>~/.conkyrc</filename> default configuration file
</refsect1>
<refsect1>
<title>Bugs</title>
<para>
Drawing to root or some other desktop window directly doesn't work with
all window managers. Especially doesn't work well with Gnome and it has
been reported that it doesn't work with KDE either. Nautilus can be
disabled from drawing to desktop with program gconf-editor. Uncheck
show_desktop in /apps/nautilus/preferences/. There is -w switch in Conky
to set some specific window id. You might find xwininfo -tree useful to
find the window to draw to. You can also use -o argument which makes
Conky to create its own window.
</para>
</refsect1>
<refsect1>
<title>See Also</title>
<para><ulink url="http://conky.sourceforge.net">
http://conky.sourceforge.net</ulink></para>
<para><ulink url="http://www.sourceforge.net/projects/conky">
http://www.sourceforge.net/projects/conky</ulink></para>
<para>
#conky on irc.freenode.net
</para>
</refsect1>
<refsect1>
<title>Authors</title>
<para>
The Conky dev team. What's up now!
</para>
</refsect1>
</refentry>

File diff suppressed because it is too large Load Diff

View File

@ -1,50 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!--jtan325 created this-->
<xsl:output method="html"/>
<xsl:template match="/">
<html>
<head>
<title>Conky Variables</title>
</head>
<body bgcolor="#FFFFFF">
<xsl:apply-templates />
</body>
</html>
</xsl:template>
<xsl:template match="variablelist" >
<table cellpadding="3">
<tr bgcolor = "#eecfa1">
<th>Variable</th>
<th>Arguments () = optional</th>
<th>Explanation</th>
</tr>
<xsl:for-each select="varlistentry">
<xsl:variable name="row_bg">
<xsl:choose>
<xsl:when test="position() mod 2 = 1">#fffafa</xsl:when>
<xsl:otherwise>#b4cdcd</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<tr bgcolor = "{$row_bg}">
<td align="center">
<xsl:value-of select="term/command/option" />
</td>
<td align="center">
<xsl:value-of select="term/option" />
</td>
<td>
<xsl:value-of select="listitem" />
</td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>

View File

@ -1,2 +0,0 @@
Append the contents of conky.nanorc to your $HOME/.nanorc for nano
syntax coloring of your $HOME/.conkyrc file.

View File

@ -1,18 +0,0 @@
##
## Syntax highlighting for conky .rc files.
##
## $Id$
##
syntax "conky" "\.*conkyrc.*$"
## Configuration items
color green "\<(alignment|background|border_margin|border_width|cpu_avg_samples|default_color|default_shade_color|default_outline_color|dexter_client|dexter_config|dexter_server|double_buffer|draw_borders|draw_graph_borders|draw_shades|draw_outline|font|gap_x|gap_y|imap|mail_spool|max_port_monitor_connections|max_specials|max_user_text|maximum_width|minimum_size|mpd_host|mpd_port|mpd_password|net_avg_samples|no_buffers|out_to_console|override_utf8_locale|own_window|own_window_class|own_window_colour|own_window_hints|own_window_title|own_window_transparent|own_window_type|pad_percents|pop3|stippled_borders|total_run_times|update_interval|uppercase|use_spacer|use_xft|xftalpha|xftfont)\>"
## Variables
color brightblue "\<(acpiacadapter|acpifan|acpitemp|acpitempf|addr|adt746xcpu|adt746xfan|align|alignr|apm_adapter|apm_battery_life|apm_battery_time|audacious_bar|audacious_bitrate|audacious_channels|audacious_filename|audacious_frequency|audacious_length|audacious_length_seconds|audacious_playlist_length|audacious_playlist_position|audacious_position|audacious_position_seconds|audacious_status|audacious_title|battery|battery_time|bmpx_album|bmpx_artist|bmpx_bitrate|bmpx_title|bmpx_track|bmpx_uri|buffers|cached|color|colour|cpu|cpubar|diskio|downspeed|downspeedf|else|entropy_avail|entropy_bar|entropy_poolsize|exec|execbar|execgraph|execi|execibar|execigraph|font|freq|freq_dyn|freq_dyn_g|freq_g|fs_bar|fs_free|fs_free_perc|fs_size|fs_used|goto|hddtemp|head|hr|i2c|i8k_ac_status|i8k_bios|i8k_buttons_status|i8k_cpu_temp|i8k_cpu_tempf|i8k_left_fan_rpm|i8k_left_fan_status|i8k_right_fan_rpm|i8k_right_fan_status|i8k_serial|i8k_version|if_existing|if_running|if_mounted|kernel|linkstatus|loadavg|machine|mails|mem|membar|memmax|memperc|mpd_album|mpd_artist|mpd_bar|mpd_bitrate|mpd_elapsed|mpd_file|mpd_length|mpd_name|mpd_percent|mpd_smart|mpd_status|mpd_title|mpd_vol|new_mails|nodename|offset|outlinecolor|pre_exec|processes|running_processes|shadecolor|stippled_hr|swap|swapbar|swapmax|swapperc|sysname|tab|tail|tcp_portmon|texeci|time|top|top_mem|totaldown|totalup|tztime|updates|upspeed|upspeedf|upspeedgraph|uptime|uptime_short|voffset|voltage_mv|voltage_v)\>"
color brightblue "\$\{?[0-9A-Z_!@#$*?-]+\}?"
color cyan "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)"
color brightred "^TEXT$"
## Values
color yellow "\<(above|below|bottom_left|bottom_right|desktop|no|none|normal|override|skip_pager|skip_taskbar|sticky|top_left|top_right|undecorated|yes)\>"

View File

@ -1,9 +0,0 @@
Vim filetype detection and syntax highlighting scripts for conky.
Individual users can place them your personal .vim directory:
~/.vim/ftdetect/conkyrc.vim
~/.vim/syntax/conkyrc.vim
Refer to your vim site documentation for system-wide installation.

View File

@ -1,5 +0,0 @@
" Vim filetype detection file for Conky config files
"
" $Id$
au BufNewFile,BufRead *conkyrc set filetype=conkyrc

View File

@ -1,247 +0,0 @@
" Vim syntax file
" Language: conkyrc
" Author: Ciaran McCreesh <ciaranm@gentoo.org>
" Version: 20060307
" Copyright: Copyright (c) 2005 Ciaran McCreesh
" Licence: You may redistribute this under the same terms as Vim itself
"
" $Id$
if exists("b:current_syntax")
finish
endif
syn region ConkyrcComment start=/^\s*#/ end=/$/
syn keyword ConkyrcSetting
\ alignment
\ background
\ border_margin
\ border_width
\ cpu_avg_samples
\ default_color
\ default_outline_color
\ default_shade_color
\ dexter_client
\ dexter_config
\ dexter_server
\ double_buffer
\ draw_borders
\ draw_graph_borders
\ draw_outline
\ draw_shades
\ font
\ gap_x
\ gap_y
\ imap
\ mail_spool
\ max_port_monitor_connections
\ max_specials
\ max_user_text
\ maximum_width
\ minimum_size
\ mpd_host
\ mpd_password
\ mpd_port
\ net_avg_samples
\ no_buffers
\ out_to_console
\ override_utf8_locale
\ own_window
\ own_window_class
\ own_window_colour
\ own_window_hints
\ own_window_title
\ own_window_transparent
\ own_window_type
\ pad_percents
\ pop3
\ stippled_borders
\ total_run_times
\ update_interval
\ uppercase
\ use_spacer
\ use_xft
\ wm_class_name
\ xftalpha
\ xftfont
syn keyword ConkyrcConstant
\ above
\ below
\ bottom_left
\ bottom_right
\ desktop
\ no
\ none
\ normal
\ override
\ skip_pager
\ skip_taskbar
\ sticky
\ top_left
\ top_right
\ undecorated
\ yes
syn match ConkyrcNumber /\S\@<!\d\+\(\.\d\+\)\?\(\S\@!\|}\@=\)/
\ nextgroup=ConkyrcNumber,ConkyrcColour skipwhite
syn match ConkyrcColour /\S\@<!#[a-fA-F0-9]\{6\}\(\S\@!\|}\@=\)/
\ nextgroup=ConkyrcNumber,ConkyrcColour skipwhite
syn region ConkyrcText start=/^TEXT$/ end=/\%$/ contains=ConkyrcVar
syn region ConkyrcVar start=/\${/ end=/}/ contained contains=ConkyrcVarStuff
syn region ConkyrcVar start=/\$\w\@=/ end=/\W\@=\|$/ contained contains=ConkyrcVarName
syn match ConkyrcVarStuff /{\@<=/ms=s contained nextgroup=ConkyrcVarName
syn keyword ConkyrcVarName contained nextgroup=ConkyrcNumber,ConkyrcColour skipwhite
\ acpiacadapter
\ acpifan
\ acpitemp
\ acpitempf
\ addr
\ adt746xcpu
\ adt746xfan
\ alignc
\ alignr
\ apm_adapter
\ apm_battery_life
\ apm_battery_time
\ audacious_bar
\ audacious_bitrate
\ audacious_channels
\ audacious_filename
\ audacious_frequency
\ audacious_length
\ audacious_length_seconds
\ audacious_playlist_length
\ audacious_playlist_position
\ audacious_position
\ audacious_position_seconds
\ audacious_status
\ audacious_title
\ battery
\ battery_time
\ bmpx_album
\ bmpx_artist
\ bmpx_bitrate
\ bmpx_title
\ bmpx_track
\ bmpx_uri
\ buffers
\ cached
\ color
\ colour
\ cpu
\ cpubar
\ diskio
\ downspeed
\ downspeedf
\ else
\ entropy_avail
\ entropy_bar
\ entropy_poolsize
\ exec
\ execbar
\ execgraph
\ execi
\ execibar
\ execigraph
\ font
\ freq
\ freq_dyn
\ freq_dyn_g
\ freq_g
\ fs_bar
\ fs_free
\ fs_free_perc
\ fs_size
\ fs_used
\ goto
\ hddtemp
\ head
\ hr
\ i2c
\ i8k_ac_status
\ i8k_bios
\ i8k_buttons_status
\ i8k_cpu_temp
\ i8k_cpu_tempf
\ i8k_left_fan_rpm
\ i8k_left_fan_status
\ i8k_right_fan_rpm
\ i8k_right_fan_status
\ i8k_serial
\ i8k_version
\ if_existing
\ if_mounted
\ if_running
\ kernel
\ linkstatus
\ loadavg
\ machine
\ mails
\ mem
\ membar
\ memmax
\ memperc
\ mpd_album
\ mpd_artist
\ mpd_bar
\ mpd_bitrate
\ mpd_elapsed
\ mpd_file
\ mpd_length
\ mpd_name
\ mpd_percent
\ mpd_smart
\ mpd_status
\ mpd_title
\ mpd_vol
\ new_mails
\ nodename
\ offset
\ outlinecolor
\ pre_exec
\ processes
\ running_processes
\ shadecolor
\ stippled_hr
\ swap
\ swapbar
\ swapmax
\ swapperc
\ sysname
\ tab
\ tail
\ tcp_portmon
\ texeci
\ time
\ top
\ top_mem
\ totaldown
\ totalup
\ tztime
\ updates
\ upspeed
\ upspeedf
\ upspeedgraph
\ uptime
\ uptime_short
\ voffset
\ voltage_mv
\ voltage_v
hi def link ConkyrcComment Comment
hi def link ConkyrcSetting Keyword
hi def link ConkyrcConstant Constant
hi def link ConkyrcNumber Number
hi def link ConkyrcColour Special
hi def link ConkyrcText String
hi def link ConkyrcVar Identifier
hi def link ConkyrcVarName Keyword
let b:current_syntax = "conkyrc"

View File

@ -1,104 +0,0 @@
bin_PROGRAMS = conky
if BUILD_AUDACIOUS
audacious = audacious.c audacious.h
endif
if BUILD_BMPX
bmpx = bmpx.c
endif
if BUILD_MPD
mpd = mpd.c libmpdclient.c
endif
if BUILD_XMMS2
xmms2 = xmms2.c
endif
if BUILD_LINUX
linux = linux.c top.c
PTHREAD_LIBS = -lpthread
endif
#if BUILD_SOLARIS
#solaris = solaris.c
#endif
if BUILD_FREEBSD
freebsd = freebsd.c
PTHREAD_LIBS = -pthread
endif
#if BUILD_NETBSD
#netbsd = netbsd.c
#endif
if BUILD_OPENBSD
openbsd = openbsd.c
PTHREAD_LIBS = -pthread
endif
if BUILD_PORT_MONITORS
port_monitors = libtcp-portmon.h libtcp-portmon.c
endif
if BUILD_X11
x11 = x11.c
endif
if BUILD_HDDTEMP
hddtemp = hddtemp.c
endif
if BUILD_RSS
rss = rss.c prss.c
endif
conky_SOURCES = \
$(audacious) \
$(bmpx) \
common.c \
conky.c \
conky.h \
$(freebsd) \
fs.c \
$(hddtemp) \
$(linux) \
mail.c \
mixer.c \
$(mpd) \
$(netbsd) \
$(openbsd) \
$(port_monitors) \
$(rss) \
$(solaris) \
timed_thread.c \
timed_thread.h \
mboxscan.c \
mboxscan.h \
$(x11) \
$(xmms2)
AM_LDFLAGS = $(PTHREAD_LIBS) -lm
EXTRA_DIST = \
audacious.c \
audacious.h \
bmpx.c \
freebsd.c \
hddtemp.c \
linux.c \
libmpdclient.c \
libmpdclient.h \
libtcp-portmon.c \
libtcp-portmon.h \
mpd.c \
netbsd.c \
openbsd.c \
solaris.c \
top.h \
x11.c \
xmms2.c
# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:

View File

@ -1,187 +0,0 @@
/* $Id$ */
/*
* audacious.c: conky support for audacious music player
*
* Copyright (C) 2005-2007 Philip Kovacs pkovacs@users.sourceforge.net
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
* USA.
*
*/
#include <stdio.h>
#include <string.h>
#include <glib.h>
#include <audacious/beepctrl.h>
#include "config.h"
#include "conky.h"
#include "audacious.h"
#include "timed_thread.h"
/* access to this item array is synchronized */
static audacious_t audacious_items;
/* -----------------------------------------
* Conky update function for audacious data.
* ----------------------------------------- */
void update_audacious(void)
{
/*
The worker thread is updating audacious_items array asynchronously to the main
conky thread. We merely copy the audacious_items array into the main thread's
info structure when the main thread's update cycle fires.
*/
if (!info.audacious.p_timed_thread)
return;
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);
}
/* ------------------------------------------------------------
* Create a worker thread for audacious media player status.
*
* Returns 0 on success, -1 on error.
* ------------------------------------------------------------*/
int create_audacious_thread(void)
{
if (!info.audacious.p_timed_thread)
info.audacious.p_timed_thread = timed_thread_create (audacious_thread_func, NULL, 1000000);
if (!info.audacious.p_timed_thread)
return (-1);
return 0;
}
/* ------------------------------------------------
* Destroy audacious player status thread.
*
* Returns 0 on success, -1 on error.
* ------------------------------------------------ */
int destroy_audacious_thread(void)
{
/* Is a worker is thread running? If not, no error. */
if (!info.audacious.p_timed_thread)
return(0);
timed_thread_destroy (info.audacious.p_timed_thread, &info.audacious.p_timed_thread);
return 0;
}
/* ---------------------------------------------------
* Worker thread function for audacious data sampling.
* --------------------------------------------------- */
void *audacious_thread_func(void *pvoid)
{
static audacious_t items;
gint session,playpos,frames,length;
gint rate,freq,chans;
gchar *psong,*pfilename;
pvoid=(void *)pvoid; /* avoid warning */
session=0;
psong=NULL;
pfilename=NULL;
/* Loop until the main thread sets the runnable signal to 0i via timed_thread_destroy. */
while (1) {
if (!xmms_remote_is_running (session))
{
memset(&items,0,sizeof(items));
strcpy(items[AUDACIOUS_STATUS],"Not running");
goto next_iter;
}
/* Player status */
if (xmms_remote_is_paused (session))
strcpy(items[AUDACIOUS_STATUS],"Paused");
else if (xmms_remote_is_playing (session))
strcpy(items[AUDACIOUS_STATUS],"Playing");
else
strcpy(items[AUDACIOUS_STATUS],"Stopped");
/* Current song title */
playpos = xmms_remote_get_playlist_pos (session);
psong = xmms_remote_get_playlist_title (session, playpos);
if (psong)
{
strncpy(items[AUDACIOUS_TITLE],psong,sizeof(items[AUDACIOUS_TITLE])-1);
g_free (psong);
psong=NULL;
}
/* Current song length as MM:SS */
frames = xmms_remote_get_playlist_time (session,playpos);
length = frames / 1000;
snprintf(items[AUDACIOUS_LENGTH],sizeof(items[AUDACIOUS_LENGTH])-1, "%d:%.2d", length / 60, length % 60);
/* Current song length in seconds */
snprintf(items[AUDACIOUS_LENGTH_SECONDS],sizeof(items[AUDACIOUS_LENGTH_SECONDS])-1, "%d", length);
/* Current song position as MM:SS */
frames = xmms_remote_get_output_time (session);
length = frames / 1000;
snprintf(items[AUDACIOUS_POSITION],sizeof(items[AUDACIOUS_POSITION])-1,
"%d:%.2d", length / 60, length % 60);
/* Current song position in seconds */
snprintf(items[AUDACIOUS_POSITION_SECONDS],sizeof(items[AUDACIOUS_POSITION_SECONDS])-1, "%d", length);
/* Current song bitrate */
xmms_remote_get_info (session, &rate, &freq, &chans);
snprintf(items[AUDACIOUS_BITRATE],sizeof(items[AUDACIOUS_BITRATE])-1, "%d", rate);
/* Current song frequency */
snprintf(items[AUDACIOUS_FREQUENCY],sizeof(items[AUDACIOUS_FREQUENCY])-1, "%d", freq);
/* Current song channels */
snprintf(items[AUDACIOUS_CHANNELS],sizeof(items[AUDACIOUS_CHANNELS])-1, "%d", chans);
/* Current song filename */
pfilename = xmms_remote_get_playlist_file (session,playpos);
if (pfilename)
{
strncpy(items[AUDACIOUS_FILENAME],pfilename,sizeof(items[AUDACIOUS_FILENAME])-1);
g_free (pfilename);
pfilename=NULL;
}
/* Length of the Playlist (number of songs) */
length = xmms_remote_get_playlist_length (session);
snprintf(items[AUDACIOUS_PLAYLIST_LENGTH],sizeof(items[AUDACIOUS_PLAYLIST_LENGTH])-1, "%d", length);
/* Playlist position (index of song) */
snprintf(items[AUDACIOUS_PLAYLIST_POSITION],sizeof(items[AUDACIOUS_PLAYLIST_POSITION])-1,
"%d", playpos+1);
next_iter:
/* Deliver the refreshed items array to audacious_items. */
timed_thread_lock (info.audacious.p_timed_thread);
memcpy(&audacious_items,items,sizeof(items));
timed_thread_unlock (info.audacious.p_timed_thread);
if (timed_thread_test (info.audacious.p_timed_thread))
timed_thread_exit (info.audacious.p_timed_thread);
}
}

View File

@ -1,58 +0,0 @@
/* $Id$ */
/*
* audacious.h: conky support for audacious music player
*
* Copyright (C) 2005-2007 Philip Kovacs pkovacs@users.sourceforge.net
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
* USA.
*
*/
#ifndef AUDACIOUS_H
#define AUDACIOUS_H
enum _audacious_items {
AUDACIOUS_STATUS=0,
AUDACIOUS_TITLE,
AUDACIOUS_LENGTH,
AUDACIOUS_LENGTH_SECONDS,
AUDACIOUS_POSITION,
AUDACIOUS_POSITION_SECONDS,
AUDACIOUS_BITRATE,
AUDACIOUS_FREQUENCY,
AUDACIOUS_CHANNELS,
AUDACIOUS_FILENAME,
AUDACIOUS_PLAYLIST_LENGTH,
AUDACIOUS_PLAYLIST_POSITION,
};
/* 12 slots for the audacious values */
typedef char audacious_t[12][128];
/* create a worker thread for audacious media player status */
int create_audacious_thread(void);
/* destroy audacious media player worker thread */
int destroy_audacious_thread(void);
/* Service routine for the conky main thread */
void update_audacious(void);
/* Thread functions */
void *audacious_thread_func(void *);
#endif

View File

@ -1,134 +0,0 @@
/*
* Conky, a system monitor, based on torsmo
*
* Any original torsmo code is licensed under the BSD license
*
* All code written since the fork of torsmo is licensed under the GPL
*
* Please see COPYING for details
*
* Copyright (c) 2005-2007 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/>.
*
* $Id$
*/
#include <bmp/dbus.hh>
#include <dbus/dbus-glib.h>
#include <stdio.h>
#include <string.h>
#include "conky.h"
#define DBUS_TYPE_G_STRING_VALUE_HASHTABLE (dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE))
static DBusGConnection *bus;
static DBusGProxy *remote_object;
static int connected = 0;
static char *unknown = "unknown";
void update_bmpx()
{
GError *error = NULL;
struct information *current_info = &info;
gint current_track;
GHashTable *metadata;
if (connected == 0) {
g_type_init();
dbus_g_type_specialized_init();
bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
if (bus == NULL) {
ERR("BMPx error 1: %s\n", error->message);
goto fail;
}
remote_object = dbus_g_proxy_new_for_name(bus,
BMP_DBUS_SERVICE,
BMP_DBUS_PATH,
BMP_DBUS_INTERFACE);
if (!remote_object) {
ERR("BMPx error 2: %s\n", error->message);
goto fail;
}
connected = 1;
}
if (connected == 1) {
if (dbus_g_proxy_call(remote_object, "GetCurrentTrack", &error,
G_TYPE_INVALID,
G_TYPE_INT, &current_track, G_TYPE_INVALID)) {
} else {
ERR("BMPx error 3: %s\n", error->message);
goto fail;
}
if (dbus_g_proxy_call(remote_object, "GetMetadataForListItem", &error,
G_TYPE_INT,
current_track,
G_TYPE_INVALID,
DBUS_TYPE_G_STRING_VALUE_HASHTABLE,
&metadata,
G_TYPE_INVALID)) {
if (current_info->bmpx.title) {
free(current_info->bmpx.title);
current_info->bmpx.title = 0;
}
if (current_info->bmpx.artist) {
free(current_info->bmpx.artist);
current_info->bmpx.artist = 0;
}
if (current_info->bmpx.album) {
free(current_info->bmpx.album);
current_info->bmpx.album = 0;
}
current_info->bmpx.title = g_value_dup_string(g_hash_table_lookup(metadata, "title"));
current_info->bmpx.artist = g_value_dup_string(g_hash_table_lookup(metadata, "artist"));
current_info->bmpx.album = g_value_dup_string(g_hash_table_lookup(metadata, "album"));
current_info->bmpx.bitrate = g_value_get_int(g_hash_table_lookup(metadata, "bitrate"));
current_info->bmpx.track = g_value_get_int(g_hash_table_lookup(metadata, "track-number"));
current_info->bmpx.uri = g_value_get_string(g_hash_table_lookup(metadata, "location"));
} else {
ERR("BMPx error 4: %s\n", error->message);
goto fail;
}
g_hash_table_destroy(metadata);
} else {
fail:
if (error)
g_error_free(error);
if (current_info->bmpx.title) {
g_free(current_info->bmpx.title);
current_info->bmpx.title = 0;
}
if (current_info->bmpx.artist) {
g_free(current_info->bmpx.artist);
current_info->bmpx.artist = 0;
}
if (current_info->bmpx.album) {
g_free(current_info->bmpx.album);
current_info->bmpx.album = 0;
}
current_info->bmpx.title = unknown;
current_info->bmpx.artist = unknown;
current_info->bmpx.album = unknown;
current_info->bmpx.bitrate = 0;
current_info->bmpx.track = 0;
}
}

View File

@ -1,9 +0,0 @@
#ifndef __BUILD_H
#define __BUILD_H
/* Conky build info */
#define BUILD_DATE "@BUILD_DATE@"
#define BUILD_ARCH "@BUILD_ARCH@"
#endif /* __BUILD_H */

View File

@ -1,290 +0,0 @@
/*
* Conky, a system monitor, based on torsmo
*
* Any original torsmo code is licensed under the BSD license
*
* All code written since the fork of torsmo is licensed under the GPL
*
* Please see COPYING for details
*
* Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
* Copyright (c) 2005-2007 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/>.
*
* $Id$
*/
#include "conky.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <sys/time.h>
struct information info;
void update_uname()
{
uname(&info.uname_s);
}
double get_time()
{
struct timeval tv;
gettimeofday(&tv, 0);
return tv.tv_sec + (tv.tv_usec / 1000000.0);
}
FILE *open_file(const char *file, int *reported)
{
FILE *fp = fopen(file, "r");
if (!fp) {
if (!reported || *reported == 0) {
ERR("can't open %s: %s", file, strerror(errno));
if (reported)
*reported = 1;
}
return 0;
}
return fp;
}
void variable_substitute(const char *s, char *dest, unsigned int n)
{
while (*s && n > 1) {
if (*s == '$') {
s++;
if (*s != '$') {
char buf[256];
const char *a, *var;
unsigned int len;
/* variable is either $foo or ${foo} */
if (*s == '{') {
s++;
a = s;
while (*s && *s != '}')
s++;
} else {
a = s;
while (*s && (isalnum((int) *s)
|| *s == '_'))
s++;
}
/* copy variable to buffer and look it up */
len = (s - a > 255) ? 255 : (s - a);
strncpy(buf, a, len);
buf[len] = '\0';
if (*s == '}')
s++;
var = getenv(buf);
if (var) {
/* add var to dest */
len = strlen(var);
if (len >= n)
len = n - 1;
strncpy(dest, var, len);
dest += len;
n -= len;
}
continue;
}
}
*dest++ = *s++;
n--;
}
*dest = '\0';
}
/* network interface stuff */
static struct net_stat netstats[16];
struct net_stat *get_net_stat(const char *dev)
{
unsigned int i;
if (!dev)
return 0;
/* find interface stat */
for (i = 0; i < 16; i++) {
if (netstats[i].dev && strcmp(netstats[i].dev, dev) == 0)
return &netstats[i];
}
/* wasn't found? add it */
if (i == 16) {
for (i = 0; i < 16; i++) {
if (netstats[i].dev == 0) {
netstats[i].dev = strdup(dev);
return &netstats[i];
}
}
}
CRIT_ERR("too many interfaces used (limit is 16)");
return 0;
}
void clear_net_stats (void)
{
memset (netstats, 0, sizeof(netstats));
}
void format_seconds(char *buf, unsigned int n, long t)
{
if (t >= 24 * 60 * 60) /* hours necessary when there are days? */
snprintf(buf, n, "%ldd %ldh %ldm", t / 60 / 60 / 24,
(t / 60 / 60) % 24, (t / 60) % 60);
else if (t >= 60 * 60)
snprintf(buf, n, "%ldh %ldm", (t / 60 / 60) % 24,
(t / 60) % 60);
else
snprintf(buf, n, "%ldm %lds", t / 60, t % 60);
}
void format_seconds_short(char *buf, unsigned int n, long t)
{
if (t >= 24 * 60 * 60)
snprintf(buf, n, "%ldd %ldh", t / 60 / 60 / 24,
(t / 60 / 60) % 24);
else if (t >= 60 * 60)
snprintf(buf, n, "%ldh %ldm", (t / 60 / 60) % 24,
(t / 60) % 60);
else
snprintf(buf, n, "%ldm", t / 60);
}
static double last_meminfo_update;
static double last_fs_update;
unsigned long long need_mask;
#define NEED(a) ((need_mask & (1 << a)) && ((info.mask & (1 << a)) == 0))
void update_stuff()
{
unsigned int i;
info.mask = 0;
if (no_buffers)
need_mask |= 1 << INFO_BUFFERS;
/* clear speeds and up status in case device was removed and doesn't get
updated */
for (i = 0; i < 16; i++) {
if (netstats[i].dev) {
netstats[i].up = 0;
netstats[i].recv_speed = 0.0;
netstats[i].trans_speed = 0.0;
}
}
prepare_update();
if (NEED(INFO_UPTIME))
update_uptime();
if (NEED(INFO_PROCS))
update_total_processes();
if (NEED(INFO_RUN_PROCS))
update_running_processes();
if (NEED(INFO_CPU))
update_cpu_usage();
if (NEED(INFO_NET))
update_net_stats();
if (NEED(INFO_DISKIO))
update_diskio();
if (NEED(INFO_MAIL))
update_mail_count();
#if defined(__linux__)
if (NEED(INFO_I8K))
update_i8k();
#endif /* __linux__ */
#ifdef MPD
if (NEED(INFO_MPD))
update_mpd();
#endif
#ifdef XMMS2
if (NEED(INFO_XMMS2))
update_xmms2();
#endif
#ifdef AUDACIOUS
if (NEED(INFO_AUDACIOUS))
update_audacious();
#endif
#ifdef BMPX
if (NEED(INFO_BMPX))
update_bmpx();
#endif
if (NEED(INFO_LOADAVG))
update_load_average();
if ((NEED(INFO_MEM) || NEED(INFO_BUFFERS) || NEED(INFO_TOP)) &&
current_update_time - last_meminfo_update > 6.9) {
update_meminfo();
if (no_buffers) {
info.mem -= info.bufmem;
}
last_meminfo_update = current_update_time;
}
if (NEED(INFO_TOP))
update_top();
/* update_fs_stat() won't do anything if there aren't fs -things */
if (NEED(INFO_FS) && current_update_time - last_fs_update > 12.9) {
update_fs_stats();
last_fs_update = current_update_time;
}
#ifdef TCP_PORT_MONITOR
if (NEED(INFO_TCP_PORT_MONITOR))
update_tcp_port_monitor_collection( info.p_tcp_port_monitor_collection );
#endif
if (NEED(INFO_ENTROPY))
update_entropy();
}
int round_to_int(float f)
{
int intval = (int)f;
double delta = f - intval;
if (!(delta < 0.5)) {
++intval;
}
return intval;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,644 +0,0 @@
/*
* Conky, a system monitor, based on torsmo
*
* Any original torsmo code is licensed under the BSD license
*
* All code written since the fork of torsmo is licensed under the GPL
*
* Please see COPYING for details
*
* Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
* Copyright (c) 2005-2007 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/>.
*
* $Id$
*/
#ifndef _conky_h_
#define _conky_h_
#if defined(HAS_MCHECK_H)
#include <mcheck.h>
#endif /* HAS_MCHECK_H */
#include "config.h"
#include <sys/utsname.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <locale.h>
#include <langinfo.h>
#include <wchar.h>
#include <sys/param.h>
#if defined(__FreeBSD__)
#include <sys/mount.h>
#include <sys/ucred.h>
#include <fcntl.h>
#include <kvm.h>
#endif /* __FreeBSD__ */
#if defined(__FreeBSD__) && (defined(i386) || defined(__i386__))
#include <machine/apm_bios.h>
#endif /* __FreeBSD__ */
#if defined(__OpenBSD__)
#include <sys/sysctl.h>
#include <sys/sensors.h>
#include <machine/apmvar.h>
#endif /* __OpenBSD__ */
#ifdef AUDACIOUS
#include "audacious.h"
#endif
#ifdef XMMS2
#include <xmmsclient/xmmsclient.h>
#endif
#ifdef RSS
#include "prss.h"
#endif
#include "mboxscan.h"
#include "timed_thread.h"
#define TOP_CPU 1
#define TOP_NAME 2
#define TOP_PID 3
#define TOP_MEM 4
#define TEXT_BUFFER_SIZE 1280
#define P_MAX_SIZE ((TEXT_BUFFER_SIZE * 4) - 2)
extern unsigned int text_buffer_size;
/* maximum number of special things, e.g. fonts, offsets, aligns, etc. */
#define MAX_SPECIALS_DEFAULT 512
/* maximum size of config TEXT buffer, i.e. below TEXT line. */
#define MAX_USER_TEXT_DEFAULT 16384
#include <sys/socket.h>
#define ERR(s, varargs...) \
fprintf(stderr, "Conky: " s "\n", ##varargs)
/* critical error */
#define CRIT_ERR(s, varargs...) \
{ fprintf(stderr, "Conky: " s "\n", ##varargs); exit(EXIT_FAILURE); }
struct i8k_struct {
char *version;
char *bios;
char *serial;
char *cpu_temp;
char *left_fan_status;
char *right_fan_status;
char *left_fan_rpm;
char *right_fan_rpm;
char *ac_status;
char *buttons_status;
};
struct i8k_struct i8k;
struct net_stat {
const char *dev;
int up;
long long last_read_recv, last_read_trans;
long long recv, trans;
double recv_speed, trans_speed;
struct sockaddr addr;
double net_rec[15], net_trans[15];
// wireless extensions
char essid[32];
char bitrate[16];
char mode[16];
char ap[18];
int link_qual;
int link_qual_max;
};
unsigned int diskio_value;
unsigned int diskio_read_value;
unsigned int diskio_write_value;
struct fs_stat {
char *path;
long long size;
long long avail;
long long free;
};
struct mail_s { // for imap and pop3
unsigned long unseen;
unsigned long messages;
unsigned long used;
unsigned long quota;
unsigned long port;
float interval;
double last_update;
char host[128];
char user[128];
char pass[128];
char command[1024];
char folder[128];
char secure;
timed_thread *p_timed_thread;
} mail;
/*struct cpu_stat {
unsigned int user, nice, system, idle, iowait, irq, softirq;
int cpu_avg_samples;
};*/
#ifdef MPD
struct mpd_s {
char *title;
char *artist;
char *album;
char *status;
char *random;
char *repeat;
char *track;
char *name;
char *file;
int volume;
unsigned int port;
char host[128];
char password[128];
float progress;
int bitrate;
int length;
int elapsed;
int max_title_len; /* e.g. ${mpd_title 50} */
};
#endif
#ifdef XMMS2
struct xmms2_s {
char* artist;
char* album;
char* title;
char* genre;
char* comment;
char* decoder;
char* transport;
char* url;
char* date;
int tracknr;
int bitrate;
unsigned int id;
int duration;
int elapsed;
float size;
float progress;
char* status;
};
#endif
#ifdef AUDACIOUS
struct audacious_s {
audacious_t items; /* e.g. items[AUDACIOUS_STATUS] */
int max_title_len; /* e.g. ${audacious_title 50} */
timed_thread *p_timed_thread;
};
#endif
#ifdef BMPX
void update_bmpx();
struct bmpx_s {
char *title;
char *artist;
char *album;
char *uri;
int bitrate;
int track;
};
#endif
void update_entropy();
struct entropy_s {
unsigned int entropy_avail;
unsigned int poolsize;
};
#ifdef TCP_PORT_MONITOR
#include "libtcp-portmon.h"
#define MAX_PORT_MONITOR_CONNECTIONS_DEFAULT 256
#endif
enum {
INFO_CPU = 0,
INFO_MAIL = 1,
INFO_MEM = 2,
INFO_NET = 3,
INFO_PROCS = 4,
INFO_RUN_PROCS = 5,
INFO_UPTIME = 6,
INFO_BUFFERS = 7,
INFO_FS = 8,
INFO_I2C = 9,
INFO_MIXER = 10,
INFO_LOADAVG = 11,
INFO_UNAME = 12,
INFO_FREQ = 13,
#ifdef MPD
INFO_MPD = 14,
#endif
INFO_TOP = 15,
INFO_WIFI = 16,
INFO_DISKIO = 17,
INFO_I8K = 18,
#ifdef TCP_PORT_MONITOR
INFO_TCP_PORT_MONITOR = 19,
#endif
#ifdef AUDACIOUS
INFO_AUDACIOUS = 20,
#endif
#ifdef BMPX
INFO_BMPX = 21,
#endif
#ifdef XMMS2
INFO_XMMS2 = 22,
#endif
INFO_ENTROPY = 23,
#ifdef RSS
INFO_RSS = 24,
#endif
INFO_PLATFORM = 25
};
/* get_battery_stuff() item selector */
enum {
BATTERY_STATUS,
BATTERY_TIME
};
#ifdef MPD
#include "libmpdclient.h"
#endif
/* Update interval */
double update_interval;
volatile int g_signal_pending;
struct information {
unsigned int mask;
struct utsname uname_s;
char freq[10];
double uptime;
/* memory information in kilobytes */
unsigned long long mem, memmax, swap, swapmax;
unsigned long long bufmem, buffers, cached;
unsigned short procs;
unsigned short run_procs;
float *cpu_usage;
/* struct cpu_stat cpu_summed; what the hell is this? */
unsigned int cpu_count;
unsigned int cpu_avg_samples;
unsigned int net_avg_samples;
float loadavg[3];
int new_mail_count, mail_count;
struct mail_s* mail;
int mail_running;
#ifdef MPD
struct mpd_s mpd;
mpd_Connection *conn;
#endif
#ifdef XMMS2
struct xmms2_s xmms2;
int xmms2_conn_state;
xmms_socket_t xmms2_fd;
fd_set xmms2_fdset;
xmmsc_connection_t *xmms2_conn;
#endif
#ifdef AUDACIOUS
struct audacious_s audacious;
#endif
#ifdef BMPX
struct bmpx_s bmpx;
#endif
struct process *cpu[10];
struct process *memu[10];
struct process *first_process;
unsigned long looped;
#ifdef TCP_PORT_MONITOR
tcp_port_monitor_collection_t * p_tcp_port_monitor_collection;
#endif
short kflags; /* kernel settings, see enum KFLAG */
struct entropy_s entropy;
};
enum {
KFLAG_IS_LONGSTAT = 0x01, /* set to true if kernel uses "long" format for /proc/stats */
KFLAG_PROC_IS_THREADS=0x02 /* set to true if kernel shows # of threads for the proc value in sysinfo() call */
/* KFLAG_NEXT_ONE=0x04 bits 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 available for future use */
};
#define KFLAG_SETON(a) info.kflags |= a
#define KFLAG_SETOFF(a) info.kflags &= (~a)
#define KFLAG_FLIP(a) info.kflags ^= a
#define KFLAG_ISSET(a) info.kflags & a
int out_to_console;
int top_cpu;
int top_mem;
int use_spacer;
char tmpstring1[TEXT_BUFFER_SIZE];
char tmpstring2[TEXT_BUFFER_SIZE];
#ifdef X11
/* in x11.c */
#include <X11/Xlib.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#ifdef XFT
#include <X11/Xft/Xft.h>
#endif
#ifdef HAVE_XDBE
#include <X11/extensions/Xdbe.h>
#endif
#define ATOM(a) XInternAtom(display, #a, False)
#ifdef OWN_WINDOW
enum _window_type {
TYPE_NORMAL = 0,
TYPE_DESKTOP,
TYPE_OVERRIDE
};
enum _window_hints {
HINT_UNDECORATED = 0,
HINT_BELOW,
HINT_ABOVE,
HINT_STICKY,
HINT_SKIP_TASKBAR,
HINT_SKIP_PAGER
};
#define SET_HINT(mask,hint) (mask |= (1<<hint))
#define TEST_HINT(mask,hint) (mask & (1<<hint))
#endif
struct conky_window {
Window root,window,desktop;
Drawable drawable;
GC gc;
#ifdef HAVE_XDBE
XdbeBackBuffer back_buffer;
#endif
#ifdef XFT
XftDraw *xftdraw;
#endif
int width;
int height;
#ifdef OWN_WINDOW
char class_name[256];
char title[256];
int x;
int y;
unsigned int type;
unsigned long hints;
#endif
};
#ifdef HAVE_XDBE
extern int use_xdbe;
#endif
#ifdef XFT
extern int use_xft;
#endif
extern Display *display;
extern int display_width;
extern int display_height;
extern int screen;
extern int workarea[4];
extern struct conky_window window;
void init_X11();
void init_window(int use_own_window, int width, int height, int set_trans, int back_colour,
char **argv, int argc);
void create_gc();
void set_transparent_background(Window win);
long get_x11_color(const char *);
#endif /* X11 */
/* in common.c */
/* struct that has all info */
struct information info;
void signal_handler(int);
void reload_config(void);
void clean_up(void);
void update_uname();
double get_time(void);
FILE *open_file(const char *file, int *reported);
void variable_substitute(const char *s, char *dest, unsigned int n);
void format_seconds(char *buf, unsigned int n, long t);
void format_seconds_short(char *buf, unsigned int n, long t);
struct net_stat *get_net_stat(const char *dev);
void clear_net_stats(void);
void update_stuff();
int round_to_int(float f);
#define SET_NEED(a) need_mask |= 1 << (a)
extern unsigned long long need_mask;
extern double current_update_time, last_update_time;
extern int no_buffers;
/* system dependant (in linux.c) */
int check_mount(char *s);
void update_diskio(void);
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_running_processes(void);
void update_i8k(void);
char get_freq( char *, size_t, char *, int, unsigned int );
void get_freq_dynamic( char *, size_t, char *, int );
char get_voltage(char *, size_t, char *, int, unsigned int ); /* ptarjan */
void update_load_average();
int open_sysbus_sensor(const char *dir, const char *dev, const char *type, int n, int *div, char *devtype);
#define open_i2c_sensor(dev,type,n,div,devtype) \
open_sysbus_sensor("/sys/bus/i2c/devices/",dev,type,n,div,devtype)
#define open_platform_sensor(dev,type,n,div,devtype) \
open_sysbus_sensor("/sys/bus/platform/devices/",dev,type,n,div,devtype)
double get_sysbus_info(int *fd, int arg, char *devtype, char *type);
void get_adt746x_cpu( char *, size_t );
void get_adt746x_fan( char *, size_t );
unsigned int get_diskio(void);
int open_acpi_temperature(const char *name);
double get_acpi_temperature(int fd);
void get_acpi_ac_adapter( char *, size_t );
void get_acpi_fan( char *, size_t );
void get_battery_stuff(char *buf, unsigned int n, const char *bat, int item);
int get_battery_perct(const char *bat);
int get_battery_perct_bar(const char *bat);
void get_ibm_acpi_fan(char *buf, size_t client_buffer_size);
void get_ibm_acpi_temps(void);
void get_ibm_acpi_volume(char *buf, size_t client_buffer_size);
void get_ibm_acpi_brightness(char *buf, size_t client_buffer_size);
void get_cpu_count();
struct ibm_acpi_struct {
unsigned int temps[8];
};
struct ibm_acpi_struct ibm_acpi;
#if defined(__OpenBSD__)
void update_obsd_sensors(void);
void get_obsd_vendor(char *buf, size_t client_buffer_size);
void get_obsd_product(char *buf, size_t client_buffer_size);
#define OBSD_MAX_SENSORS 256
struct obsd_sensors_struct {
int device;
float temp[MAXSENSORDEVICES][OBSD_MAX_SENSORS];
unsigned int fan[MAXSENSORDEVICES][OBSD_MAX_SENSORS];
float volt[MAXSENSORDEVICES][OBSD_MAX_SENSORS];
};
struct obsd_sensors_struct obsd_sensors;
#endif /* __OpenBSD__ */
enum { PB_BATT_STATUS, PB_BATT_PERCENT, PB_BATT_TIME};
void get_powerbook_batt_info(char*, size_t, int);
struct process {
struct process *next;
struct process *previous;
pid_t pid;
char *name;
float amount;
unsigned long user_time;
unsigned long total;
unsigned long kernel_time;
unsigned long previous_user_time;
unsigned long previous_kernel_time;
unsigned int vsize;
unsigned int rss;
unsigned int time_stamp;
unsigned int counted;
unsigned int changed;
float totalmem;
};
void update_top();
void free_all_processes();
struct process *get_first_process();
/* fs-stuff is possibly system dependant (in fs.c) */
void update_fs_stats(void);
struct fs_stat *prepare_fs_stat(const char *path);
void clear_fs_stats(void);
/* in mixer.c */
int mixer_init(const char *);
int mixer_get_avg(int);
int mixer_get_left(int);
int mixer_get_right(int);
/* in mail.c */
extern char *current_mail_spool;
void update_mail_count();
/* in freebsd.c */
#if defined(__FreeBSD__)
kvm_t *kd;
#endif
#if (defined(__FreeBSD__) || defined(__OpenBSD__)) && (defined(i386) || defined(__i386__))
#ifdef __OpenBSD__
typedef struct apm_power_info *apm_info_t;
#endif
int apm_getinfo(int fd, apm_info_t aip);
char *get_apm_adapter(void);
char *get_apm_battery_life(void);
char *get_apm_battery_time(void);
#endif
/* in mpd.c */
#ifdef MPD
void update_mpd();
#endif
/* in xmms2.c */
#ifdef XMMS2
void update_xmms2();
#endif
/* in hddtemp.c */
#ifdef HDDTEMP
int scan_hddtemp(const char *arg, char **dev, char **addr, int *port);
char *get_hddtemp_info(char *dev, char *addr, int port, char *unit);
#endif /* HDDTEMP */
/* in rss.c */
#ifdef RSS
PRSS* get_rss_info(char *uri, int delay);
void init_rss_info();
void free_rss_info();
#endif /* RSS */
/* in linux.c */
#endif

View File

@ -1,977 +0,0 @@
/*
* Conky, a system monitor, based on torsmo
*
* Any original torsmo code is licensed under the BSD license
*
* All code written since the fork of torsmo is licensed under the GPL
*
* Please see COPYING for details
*
* Copyright (c) 2005-2007 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/>.
*
* $Id$
*/
#include <sys/dkstat.h>
#include <sys/param.h>
#include <sys/resource.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/vmmeter.h>
#include <sys/user.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <net/if_mib.h>
#include <net/if_media.h>
#include <net/if_var.h>
#include <netinet/in.h>
#include <devstat.h>
#include <fcntl.h>
#include <ifaddrs.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <dev/wi/if_wavelan_ieee.h>
#include "conky.h"
#define GETSYSCTL(name, var) getsysctl(name, &(var), sizeof (var))
#define KELVTOC(x) ((x - 2732) / 10.0)
#define MAXSHOWDEVS 16
#if 0
#define FREEBSD_DEBUG
#endif
inline void proc_find_top(struct process **cpu, struct process **mem);
u_int64_t diskio_prev = 0;
static short cpu_setup = 0;
static short diskio_setup = 0;
static int getsysctl(char *name, void *ptr, size_t len)
{
size_t nlen = len;
if (sysctlbyname(name, ptr, &nlen, NULL, 0) == -1) {
return (-1);
}
if (nlen != len) {
return (-1);
}
return (0);
}
struct ifmibdata *data = NULL;
size_t len = 0;
static int swapmode(int *retavail, int *retfree)
{
int n;
int pagesize = getpagesize();
struct kvm_swap swapary[1];
*retavail = 0;
*retfree = 0;
#define CONVERT(v) ((quad_t)(v) * pagesize / 1024)
n = kvm_getswapinfo(kd, swapary, 1, 0);
if (n < 0 || swapary[0].ksw_total == 0)
return (0);
*retavail = CONVERT(swapary[0].ksw_total);
*retfree = CONVERT(swapary[0].ksw_total - swapary[0].ksw_used);
n = (int) ((double) swapary[0].ksw_used * 100.0 /
(double) swapary[0].ksw_total);
return (n);
}
void
prepare_update()
{
}
void
update_uptime()
{
int mib[2] = { CTL_KERN, KERN_BOOTTIME };
struct timeval boottime;
time_t now;
size_t size = sizeof (boottime);
if ((sysctl(mib, 2, &boottime, &size, NULL, 0) != -1) &&
(boottime.tv_sec != 0)) {
time(&now);
info.uptime = now - boottime.tv_sec;
} else {
fprintf(stderr, "Could not get uptime\n");
info.uptime = 0;
}
}
int check_mount(char *s)
{
struct statfs *mntbuf;
int i, mntsize;
mntsize = getmntinfo(&mntbuf, MNT_NOWAIT);
for (i = mntsize - 1; i >= 0; i--)
if (strcmp(mntbuf[i].f_mntonname, s) == 0)
return 1;
return 0;
}
void
update_meminfo()
{
int total_pages, inactive_pages, free_pages;
int swap_avail, swap_free;
int pagesize = getpagesize();
if (GETSYSCTL("vm.stats.vm.v_page_count", total_pages))
fprintf(stderr,
"Cannot read sysctl \"vm.stats.vm.v_page_count\"");
if (GETSYSCTL("vm.stats.vm.v_free_count", free_pages))
fprintf(stderr,
"Cannot read sysctl \"vm.stats.vm.v_free_count\"");
if (GETSYSCTL("vm.stats.vm.v_inactive_count", inactive_pages))
fprintf(stderr,
"Cannot read sysctl \"vm.stats.vm.v_inactive_count\"");
info.memmax = (total_pages * pagesize) >> 10;
info.mem =
((total_pages - free_pages - inactive_pages) * pagesize) >> 10;
if ((swapmode(&swap_avail, &swap_free)) >= 0) {
info.swapmax = swap_avail;
info.swap = (swap_avail - swap_free);
} else {
info.swapmax = 0;
info.swap = 0;
}
}
void
update_net_stats()
{
struct net_stat *ns;
double delta;
long long r, t, last_recv, last_trans;
struct ifaddrs *ifap, *ifa;
struct if_data *ifd;
/* get delta */
delta = current_update_time - last_update_time;
if (delta <= 0.0001)
return;
if (getifaddrs(&ifap) < 0)
return;
for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
ns = get_net_stat((const char *) ifa->ifa_name);
if (ifa->ifa_flags & IFF_UP) {
struct ifaddrs *iftmp;
ns->up = 1;
last_recv = ns->recv;
last_trans = ns->trans;
if (ifa->ifa_addr->sa_family != AF_LINK)
continue;
for (iftmp = ifa->ifa_next; iftmp != NULL &&
strcmp(ifa->ifa_name, iftmp->ifa_name) == 0;
iftmp = iftmp->ifa_next)
if (iftmp->ifa_addr->sa_family == AF_INET)
memcpy(&(ns->addr), iftmp->ifa_addr,
iftmp->ifa_addr->sa_len);
ifd = (struct if_data *) ifa->ifa_data;
r = ifd->ifi_ibytes;
t = ifd->ifi_obytes;
if (r < ns->last_read_recv)
ns->recv +=
((long long) 4294967295U -
ns->last_read_recv) + r;
else
ns->recv += (r - ns->last_read_recv);
ns->last_read_recv = r;
if (t < ns->last_read_trans)
ns->trans +=
((long long) 4294967295U -
ns->last_read_trans) + t;
else
ns->trans += (t - ns->last_read_trans);
ns->last_read_trans = t;
/* calculate speeds */
ns->recv_speed = (ns->recv - last_recv) / delta;
ns->trans_speed = (ns->trans - last_trans) / delta;
} else {
ns->up = 0;
}
}
freeifaddrs(ifap);
}
void
update_total_processes()
{
int n_processes;
kvm_getprocs(kd, KERN_PROC_ALL, 0, &n_processes);
info.procs = n_processes;
}
void
update_running_processes()
{
struct kinfo_proc *p;
int n_processes;
int i, cnt = 0;
p = kvm_getprocs(kd, KERN_PROC_ALL, 0, &n_processes);
for (i = 0; i < n_processes; i++) {
#if __FreeBSD__ < 5
if (p[i].kp_proc.p_stat == SRUN)
#else
if (p[i].ki_stat == SRUN)
#endif
cnt++;
}
info.run_procs = cnt;
}
struct cpu_load_struct {
unsigned long load[5];
};
struct cpu_load_struct fresh = { {0, 0, 0, 0, 0} };
long cpu_used, oldtotal, oldused;
void
get_cpu_count()
{
/* int cpu_count = 0; */
/*
* XXX
* FreeBSD doesn't allow to get per CPU load stats
* on SMP machines. It's possible to get a CPU count,
* but as we fulfil only info.cpu_usage[0], it's better
* to report there's only one CPU. It should fix some bugs
* (e.g. cpugraph)
*/
#if 0
if (GETSYSCTL("hw.ncpu", cpu_count) == 0)
info.cpu_count = cpu_count;
#endif
info.cpu_count = 1;
info.cpu_usage = malloc(info.cpu_count * sizeof (float));
if (info.cpu_usage == NULL)
CRIT_ERR("malloc");
}
/* XXX: SMP support */
void
update_cpu_usage()
{
long used, total;
long cp_time[CPUSTATES];
size_t len = sizeof (cp_time);
/* 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;
}
if (sysctlbyname("kern.cp_time", &cp_time, &len, NULL, 0) < 0) {
(void) fprintf(stderr, "Cannot get kern.cp_time");
}
fresh.load[0] = cp_time[CP_USER];
fresh.load[1] = cp_time[CP_NICE];
fresh.load[2] = cp_time[CP_SYS];
fresh.load[3] = cp_time[CP_IDLE];
fresh.load[4] = cp_time[CP_IDLE];
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);
} else {
info.cpu_usage[0] = 0;
}
oldused = used;
oldtotal = total;
}
double
get_sysbus_info(int *fd, int arg, char *devtype, char *type)
{
return (0);
}
void
update_load_average()
{
double v[3];
getloadavg(v, 3);
info.loadavg[0] = (float) v[0];
info.loadavg[1] = (float) v[1];
info.loadavg[2] = (float) v[2];
}
double
get_acpi_temperature(int fd)
{
int temp;
if (GETSYSCTL("hw.acpi.thermal.tz0.temperature", temp)) {
fprintf(stderr,
"Cannot read sysctl \"hw.acpi.thermal.tz0.temperature\"\n");
return (0.0);
}
return (KELVTOC(temp));
}
void
get_battery_stuff(char *buf, unsigned int n, const char *bat, int item)
{
int battime, batcapacity, batstate, ac;
char battery_status[64];
char battery_time[64];
if (GETSYSCTL("hw.acpi.battery.time", battime))
(void) fprintf(stderr,
"Cannot read sysctl \"hw.acpi.battery.time\"\n");
if (GETSYSCTL("hw.acpi.battery.life", batcapacity))
(void) fprintf(stderr,
"Cannot read sysctl \"hw.acpi.battery.life\"\n");
if (GETSYSCTL("hw.acpi.battery.state", batstate))
(void) fprintf(stderr,
"Cannot read sysctl \"hw.acpi.battery.state\"\n");
if (GETSYSCTL("hw.acpi.acline", ac))
(void) fprintf(stderr,
"Cannot read sysctl \"hw.acpi.acline\"\n");
if (batstate == 1) {
if (battime != -1) {
snprintf (battery_status, sizeof(battery_status)-1,
"remaining %d%%", batcapacity);
snprintf (battery_time, sizeof(battery_time)-1,
"%d:%2.2d", battime / 60, battime % 60);
/*
snprintf(buf, n, "remaining %d%% (%d:%2.2d)",
batcapacity, battime / 60, battime % 60);
*/
}
else
/* no time estimate available yet */
snprintf(battery_status, sizeof(battery_status)-1,
"remaining %d%%", batcapacity);
/*
snprintf(buf, n, "remaining %d%%",
batcapacity);
*/
if (ac == 1)
(void) fprintf(stderr, "Discharging while on AC!\n");
} else {
snprintf (battery_status, sizeof(battery_status)-1,
batstate == 2 ? "charging (%d%%)" : "charged (%d%%)", batcapacity);
/*
snprintf(buf, n, batstate == 2 ? "charging (%d%%)" : "charged (%d%%)", batcapacity);
*/
if (batstate != 2 && batstate != 0)
(void) fprintf(stderr, "Unknown battery state %d!\n", batstate);
if (ac == 0)
(void) fprintf(stderr, "Charging while not on AC!\n");
}
switch (item) {
case BATTERY_STATUS:
{
snprintf(buf, n, "%s", battery_status);
break;
}
case BATTERY_TIME:
{
snprintf(buf, n, "%s", battery_time);
break;
}
default:
break;
}
return;
}
int
get_battery_perct(const char *bat)
{
/* not implemented */
return (0);
}
int
get_battery_perct_bar(const char *bar)
{
/* not implemented */
return (0);
}
int
open_sysbus_sensor(const char *dir, const char *dev, const char *type, int n, int *div, char *devtype)
{
return (0);
}
int
open_acpi_temperature(const char *name)
{
return (0);
}
void
get_acpi_ac_adapter(char *p_client_buffer, size_t client_buffer_size)
{
int state;
if (!p_client_buffer || client_buffer_size <= 0)
return;
if (GETSYSCTL("hw.acpi.acline", state)) {
fprintf(stderr,
"Cannot read sysctl \"hw.acpi.acline\"\n");
return;
}
if (state)
strncpy(p_client_buffer, "Running on AC Power",
client_buffer_size);
else
strncpy(p_client_buffer, "Running on battery",
client_buffer_size);
}
void
get_acpi_fan(char *p_client_buffer, size_t client_buffer_size)
{
if (!p_client_buffer || client_buffer_size <= 0)
return;
/* not implemented */
memset(p_client_buffer, 0, client_buffer_size);
}
void
get_adt746x_cpu(char *p_client_buffer, size_t client_buffer_size)
{
if (!p_client_buffer || client_buffer_size <= 0)
return;
/* not implemented */
memset(p_client_buffer, 0, client_buffer_size);
}
void
get_adt746x_fan(char *p_client_buffer, size_t client_buffer_size)
{
if (!p_client_buffer || client_buffer_size <= 0)
return;
/* not implemented */
memset(p_client_buffer, 0, client_buffer_size);
}
/* rdtsc() and get_freq_dynamic() copied from linux.c */
#if defined(__i386) || defined(__x86_64)
__inline__ unsigned long long int
rdtsc()
{
unsigned long long int x;
__asm__ volatile(".byte 0x0f, 0x31":"=A" (x));
return (x);
}
#endif
/* return system frequency in MHz (use divisor=1) or GHz (use divisor=1000) */
void
get_freq_dynamic(char *p_client_buffer, size_t client_buffer_size,
char *p_format, int divisor)
{
#if defined(__i386) || defined(__x86_64)
struct timezone tz;
struct timeval tvstart, tvstop;
unsigned long long cycles[2]; /* gotta be 64 bit */
unsigned int microseconds; /* total time taken */
memset(&tz, 0, sizeof (tz));
/* get this function in cached memory */
gettimeofday(&tvstart, &tz);
cycles[0] = rdtsc();
gettimeofday(&tvstart, &tz);
/* we don't trust that this is any specific length of time */
usleep(100);
cycles[1] = rdtsc();
gettimeofday(&tvstop, &tz);
microseconds = ((tvstop.tv_sec - tvstart.tv_sec) * 1000000) +
(tvstop.tv_usec - tvstart.tv_usec);
snprintf(p_client_buffer, client_buffer_size, p_format,
(float)((cycles[1] - cycles[0]) / microseconds) / divisor);
#else
get_freq(p_client_buffer, client_buffer_size, p_format, divisor, 1);
#endif
}
/*void*/
char
get_freq(char *p_client_buffer, size_t client_buffer_size,
char *p_format, int divisor, unsigned int cpu)
{
int freq;
char *freq_sysctl;
freq_sysctl = (char *)calloc(16, sizeof(char));
if (freq_sysctl == NULL)
exit(-1);
snprintf(freq_sysctl, 16, "dev.cpu.%d.freq", (cpu - 1));
if (!p_client_buffer || client_buffer_size <= 0 ||
!p_format || divisor <= 0)
return 0;
if (GETSYSCTL(freq_sysctl, freq) == 0)
snprintf(p_client_buffer, client_buffer_size,
p_format, (float)freq/divisor);
else
snprintf(p_client_buffer, client_buffer_size, p_format, 0.0f);
free(freq_sysctl);
return 1;
}
void
update_top()
{
proc_find_top(info.cpu, info.memu);
}
#if 0
void
update_wifi_stats()
{
struct ifreq ifr; /* interface stats */
struct wi_req wireq;
struct net_stat * ns;
struct ifaddrs *ifap, *ifa;
struct ifmediareq ifmr;
int s;
/*
* Get iface table
*/
if (getifaddrs(&ifap) < 0)
return;
for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
ns = get_net_stat((const char *) ifa->ifa_name);
s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
/* Get media type */
bzero(&ifmr, sizeof(ifmr));
strlcpy(ifmr.ifm_name, ifa->ifa_name, IFNAMSIZ);
if (ioctl(s, SIOCGIFMEDIA, (caddr_t) &ifmr) < 0)
goto cleanup;
/*
* We can monitor only wireless interfaces
* which not in hostap mode
*/
if ((ifmr.ifm_active & IFM_IEEE80211) &&
!(ifmr.ifm_active & IFM_IEEE80211_HOSTAP)) {
/* Get wi status */
bzero(&ifr, sizeof(ifr));
strlcpy(ifr.ifr_name, ifa->ifa_name, IFNAMSIZ);
wireq.wi_type = WI_RID_COMMS_QUALITY;
wireq.wi_len = WI_MAX_DATALEN;
ifr.ifr_data = (void *) &wireq;
if (ioctl(s, SIOCGWAVELAN, (caddr_t) &ifr) < 0) {
perror("ioctl (getting wi status)");
exit(1);
}
/*
* wi_val[0] = quality
* wi_val[1] = signal
* wi_val[2] = noise
*/
ns->linkstatus = (int) wireq.wi_val[1];
}
cleanup:
close(s);
}
}
#endif
void
update_diskio()
{
int devs_count,
num_selected,
num_selections;
struct device_selection *dev_select = NULL;
long select_generation;
int dn;
static struct statinfo statinfo_cur;
u_int64_t diskio_current = 0;
bzero(&statinfo_cur, sizeof (statinfo_cur));
statinfo_cur.dinfo = (struct devinfo *)malloc(sizeof (struct devinfo));
bzero(statinfo_cur.dinfo, sizeof (struct devinfo));
if (devstat_getdevs(NULL, &statinfo_cur) < 0)
return;
devs_count = statinfo_cur.dinfo->numdevs;
if (devstat_selectdevs(&dev_select, &num_selected, &num_selections,
&select_generation, statinfo_cur.dinfo->generation,
statinfo_cur.dinfo->devices, devs_count, NULL, 0,
NULL, 0, DS_SELECT_ONLY, MAXSHOWDEVS, 1) >= 0) {
for (dn = 0; dn < devs_count; ++dn) {
int di;
struct devstat *dev;
di = dev_select[dn].position;
dev = &statinfo_cur.dinfo->devices[di];
diskio_current += dev->bytes[DEVSTAT_READ] +
dev->bytes[DEVSTAT_WRITE];
}
free(dev_select);
}
/*
* Since we return (diskio_total_current - diskio_total_old), first
* frame will be way too high (it will be equal to
* diskio_total_current, i.e. all disk I/O since boot). That's why
* it is better to return 0 first time;
*/
if (diskio_setup == 0) {
diskio_setup = 1;
diskio_value = 0;
} else
diskio_value = (unsigned int)((diskio_current - diskio_prev)/
1024);
diskio_prev = diskio_current;
free(statinfo_cur.dinfo);
}
/*
* While topless is obviously better, top is also not bad.
*/
int
comparecpu(const void *a, const void *b)
{
if (((struct process *)a)->amount > ((struct process *)b)->amount)
return (-1);
if (((struct process *)a)->amount < ((struct process *)b)->amount)
return (1);
return (0);
}
int
comparemem(const void *a, const void *b)
{
if (((struct process *)a)->totalmem > ((struct process *)b)->totalmem)
return (-1);
if (((struct process *)a)->totalmem < ((struct process *)b)->totalmem)
return (1);
return (0);
}
inline void
proc_find_top(struct process **cpu, struct process **mem)
{
struct kinfo_proc *p;
int n_processes;
int i, j = 0;
struct process *processes;
int total_pages;
/* we get total pages count again to be sure it is up to date */
if (GETSYSCTL("vm.stats.vm.v_page_count", total_pages) != 0)
CRIT_ERR("Cannot read sysctl"
"\"vm.stats.vm.v_page_count\"");
p = kvm_getprocs(kd, KERN_PROC_PROC, 0, &n_processes);
processes = malloc(n_processes * sizeof (struct process));
for (i = 0; i < n_processes; i++) {
if (!((p[i].ki_flag & P_SYSTEM)) &&
p[i].ki_comm != NULL) {
processes[j].pid = p[i].ki_pid;
processes[j].name = strdup(p[i].ki_comm);
processes[j].amount = 100.0 *
p[i].ki_pctcpu / FSCALE;
processes[j].totalmem = (float)(p[i].ki_rssize /
(float)total_pages) * 100.0;
j++;
}
}
qsort(processes, j - 1, sizeof (struct process), comparemem);
for (i = 0; i < 10 && i < n_processes; i++) {
struct process *tmp, *ttmp;
tmp = malloc(sizeof (struct process));
tmp->pid = processes[i].pid;
tmp->amount = processes[i].amount;
tmp->totalmem = processes[i].totalmem;
tmp->name = strdup(processes[i].name);
ttmp = mem[i];
mem[i] = tmp;
if (ttmp != NULL) {
free(ttmp->name);
free(ttmp);
}
}
qsort(processes, j - 1, sizeof (struct process), comparecpu);
for (i = 0; i < 10 && i < n_processes; i++) {
struct process *tmp, *ttmp;
tmp = malloc(sizeof (struct process));
tmp->pid = processes[i].pid;
tmp->amount = processes[i].amount;
tmp->totalmem = processes[i].totalmem;
tmp->name = strdup(processes[i].name);
ttmp = cpu[i];
cpu[i] = tmp;
if (ttmp != NULL) {
free(ttmp->name);
free(ttmp);
}
}
#if defined(FREEBSD_DEBUG)
printf("=====\nmem\n");
for (i = 0; i < 10; i++) {
printf("%d: %s(%d) %.2f\n", i, mem[i]->name,
mem[i]->pid, mem[i]->totalmem);
}
#endif
for (i = 0; i < j; free(processes[i++].name));
free(processes);
}
#if defined(i386) || defined(__i386__)
#define APMDEV "/dev/apm"
#define APM_UNKNOWN 255
int
apm_getinfo(int fd, apm_info_t aip)
{
if (ioctl(fd, APMIO_GETINFO, aip) == -1)
return (-1);
return (0);
}
char
*get_apm_adapter()
{
int fd;
struct apm_info info;
out = (char *)calloc(16, sizeof (char));
fd = open(APMDEV, O_RDONLY);
if (fd < 0) {
strncpy(out, "ERR", 16);
return (out);
}
if (apm_getinfo(fd, &info) != 0) {
close(fd);
strncpy(out, "ERR", 16);
return (out);
}
close(fd);
switch (info.ai_acline) {
case 0:
strncpy(out, "off-line", 16);
return (out);
break;
case 1:
if (info.ai_batt_stat == 3) {
strncpy(out, "charging", 16);
return (out);
} else {
strncpy(out, "on-line", 16);
return (out);
}
break;
default:
strncpy(out, "unknown", 16);
return (out);
break;
}
}
char
*get_apm_battery_life()
{
int fd;
u_int batt_life;
struct apm_info info;
char *out;
out = (char *)calloc(16, sizeof (char));
fd = open(APMDEV, O_RDONLY);
if (fd < 0) {
strncpy(out, "ERR", 16);
return (out);
}
if (apm_getinfo(fd, &info) != 0) {
close(fd);
strncpy(out, "ERR", 16);
return (out);
}
close(fd);
batt_life = info.ai_batt_life;
if (batt_life == APM_UNKNOWN)
strncpy(out, "unknown", 16);
else if (batt_life <= 100) {
snprintf(out, 16, "%d%%", batt_life);
return (out);
} else
strncpy(out, "ERR", 16);
return (out);
}
char
*get_apm_battery_time()
{
int fd;
int batt_time;
int h, m, s;
struct apm_info info;
char *out;
out = (char *)calloc(16, sizeof (char));
fd = open(APMDEV, O_RDONLY);
if (fd < 0) {
strncpy(out, "ERR", 16);
return (out);
}
if (apm_getinfo(fd, &info) != 0) {
close(fd);
strncpy(out, "ERR", 16);
return (out);
}
close(fd);
batt_time = info.ai_batt_time;
if (batt_time == -1)
strncpy(out, "unknown", 16);
else {
h = batt_time;
s = h % 60;
h /= 60;
m = h % 60;
h /= 60;
snprintf(out, 16, "%2d:%02d:%02d", h, m, s);
}
return (out);
}
#endif
void update_entropy (void)
{
/* mirrorbox: can you do anything equivalent in freebsd? -drphibes. */
}
/* empty stub so conky links */
void
free_all_processes(void)
{
}

View File

@ -1,112 +0,0 @@
/*
* Conky, a system monitor, based on torsmo
*
* Any original torsmo code is licensed under the BSD license
*
* All code written since the fork of torsmo is licensed under the GPL
*
* Please see COPYING for details
*
* Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
* Copyright (c) 2005-2007 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/>.
*
* $Id$
*/
#include "conky.h"
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <fcntl.h>
/* linux */
#ifdef HAVE_SYS_STATFS_H
#include <sys/statfs.h>
#endif
/* freebsd && netbsd */
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifdef HAVE_SYS_MOUNT_H
#include <sys/mount.h>
#endif
#define MAX_FS_STATS 64
static struct fs_stat fs_stats_[MAX_FS_STATS];
struct fs_stat *fs_stats = fs_stats_;
static void update_fs_stat(struct fs_stat* fs);
void update_fs_stats()
{
unsigned i;
for(i=0; i<MAX_FS_STATS; ++i)
if(fs_stats[i].path)
update_fs_stat(&fs_stats[i]);
}
void clear_fs_stats()
{
unsigned i;
for(i=0; i<MAX_FS_STATS; ++i)
if(fs_stats[i].path) {
free(fs_stats[i].path);
fs_stats[i].path = 0;
}
}
struct fs_stat *prepare_fs_stat(const char *s)
{
struct fs_stat* new = 0;
unsigned i;
/* lookup existing or get new */
for(i=0; i<MAX_FS_STATS; ++i) {
if(fs_stats[i].path) {
if(strcmp(fs_stats[i].path, s) == 0)
return &fs_stats[i];
} else
new = &fs_stats[i];
}
/* new path */
if(!new) {
ERR("too many fs stats");
return 0;
}
new->path = strdup(s);
update_fs_stat(new);
return new;
}
static
void update_fs_stat(struct fs_stat* fs)
{
struct statfs s;
if(statfs(fs->path, &s) == 0) {
fs->size = (long long) s.f_blocks * s.f_bsize;
/* bfree (root) or bavail (non-roots) ? */
fs->avail = (long long) s.f_bavail* s.f_bsize;
fs->free = (long long) s.f_bfree * s.f_bsize;;
} else {
fs->size = 0;
fs->avail = 0;
fs->free = 0;
ERR("statfs '%s': %s", fs->path, strerror(errno));
}
}

View File

@ -1,179 +0,0 @@
/*
* Conky, a system monitor, based on torsmo
*
* Any original torsmo code is licensed under the BSD license
*
* All code written since the fork of torsmo is licensed under the GPL
*
* Please see COPYING for details
*
* Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
* Copyright (c) 2005-2007 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/>.
*
* $Id$
*/
#include "conky.h"
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <netdb.h>
#include <sys/select.h>
#include <sys/socket.h>
#include <netinet/in.h>
#define BUFLEN 512
#define PORT 7634
char buf[BUFLEN];
int scan_hddtemp(const char *arg, char **dev, char **addr, int *port)
{
char buf1[32], buf2[64];
int n, ret;
ret = sscanf(arg, "%31s %63s %d", buf1, buf2, &n);
if (ret < 1)
return -1;
*dev = strdup(buf1);
if (ret >= 2)
*addr = strdup(buf2);
else
*addr = strdup("127.0.0.1");
if (ret == 3)
*port = n;
else
*port = PORT;
return 0;
}
char *get_hddtemp_info(char *dev, char *hostaddr, int port, char *unit)
{
int sockfd = 0;
struct hostent *he;
struct sockaddr_in addr;
struct timeval tv;
fd_set rfds;
int len, i, devlen = strlen(dev);
char sep;
char *p, *out, *r = NULL;
if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
perror("socket");
return NULL;
}
he = gethostbyname(hostaddr);
if (!he) {
perror("gethostbyname");
goto out;
}
addr.sin_family = AF_INET;
addr.sin_port = htons(port);
addr.sin_addr = *((struct in_addr *)he->h_addr);
memset(&(addr.sin_zero), 0, 8);
if (connect(sockfd, (struct sockaddr *)&addr, sizeof(struct sockaddr)) == -1) {
perror("connect");
goto out;
}
FD_ZERO(&rfds);
FD_SET(sockfd, &rfds);
/* We're going to wait up to a quarter a second to see whether
* there's any data available. Polling with timeout set to 0
* doesn't seem to work with hddtemp. */
tv.tv_sec = 0;
tv.tv_usec = 250000;
i = select(sockfd+1, &rfds, NULL, NULL, &tv);
if (i == -1)
{
if (errno == EINTR) /* silently ignore interrupted system call */
goto out;
else
perror("select");
}
/* No data available */
if (i <= 0)
goto out;
p = buf;
len = 0;
do {
i = recv(sockfd, p, BUFLEN - (p-buf), 0);
if (i < 0) {
perror("recv");
goto out;
}
len += i;
p += i;
} while (i > 0 && p < buf + BUFLEN - 1);
if (len < 2) {
goto out;
}
buf[len] = 0;
/* The first character read is the separator. */
sep = buf[0];
p = buf+1;
while (*p) {
if (!strncmp(p, dev, devlen)) {
p += devlen + 1;
p = strchr(p, sep);
if (!p)
goto out;
p++;
out = p;
p = strchr(p, sep);
if (!p)
goto out;
*p = '\0';
p++;
*unit = *p;
if (!strncmp(out, "NA", 2)) {
strcpy(buf, "N/A");
r = buf;
} else {
r = out;
}
goto out;
} else {
for (i = 0; i < 5; i++) {
p = strchr(p, sep);
if (!p)
goto out;
p++;
}
}
}
out: close(sockfd);
return r;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,670 +0,0 @@
/* libmpdclient
(c)2003-2006 by Warren Dukes (warren.dukes@gmail.com)
This project's homepage is: http://www.musicpd.org
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Music Player Daemon nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef LIBMPDCLIENT_H
#define LIBMPDCLIENT_H
#ifdef WIN32
# define __W32API_USE_DLLIMPORT__ 1
#endif
#include <sys/time.h>
#include <stdarg.h>
#define MPD_BUFFER_MAX_LENGTH 50000
#define MPD_ERRORSTR_MAX_LENGTH 1000
#define MPD_WELCOME_MESSAGE "OK MPD "
#define MPD_ERROR_TIMEOUT 10 /* timeout trying to talk to mpd */
#define MPD_ERROR_SYSTEM 11 /* system error */
#define MPD_ERROR_UNKHOST 12 /* unknown host */
#define MPD_ERROR_CONNPORT 13 /* problems connecting to port on host */
#define MPD_ERROR_NOTMPD 14 /* mpd not running on port at host */
#define MPD_ERROR_NORESPONSE 15 /* no response on attempting to connect */
#define MPD_ERROR_SENDING 16 /* error sending command */
#define MPD_ERROR_CONNCLOSED 17 /* connection closed by mpd */
#define MPD_ERROR_ACK 18 /* ACK returned! */
#define MPD_ERROR_BUFFEROVERRUN 19 /* Buffer was overrun! */
#define MPD_ACK_ERROR_UNK -1
#define MPD_ERROR_AT_UNK -1
#define MPD_ACK_ERROR_NOT_LIST 1
#define MPD_ACK_ERROR_ARG 2
#define MPD_ACK_ERROR_PASSWORD 3
#define MPD_ACK_ERROR_PERMISSION 4
#define MPD_ACK_ERROR_UNKNOWN_CMD 5
#define MPD_ACK_ERROR_NO_EXIST 50
#define MPD_ACK_ERROR_PLAYLIST_MAX 51
#define MPD_ACK_ERROR_SYSTEM 52
#define MPD_ACK_ERROR_PLAYLIST_LOAD 53
#define MPD_ACK_ERROR_UPDATE_ALREADY 54
#define MPD_ACK_ERROR_PLAYER_SYNC 55
#define MPD_ACK_ERROR_EXIST 56
#ifdef __cplusplus
extern "C" {
#endif
typedef enum mpd_TagItems
{
MPD_TAG_ITEM_ARTIST,
MPD_TAG_ITEM_ALBUM,
MPD_TAG_ITEM_TITLE,
MPD_TAG_ITEM_TRACK,
MPD_TAG_ITEM_NAME,
MPD_TAG_ITEM_GENRE,
MPD_TAG_ITEM_DATE,
MPD_TAG_ITEM_COMPOSER,
MPD_TAG_ITEM_PERFORMER,
MPD_TAG_ITEM_COMMENT,
MPD_TAG_ITEM_DISC,
MPD_TAG_ITEM_FILENAME,
MPD_TAG_ITEM_ANY,
MPD_TAG_NUM_OF_ITEM_TYPES
} mpd_TagItems;
extern char * mpdTagItemKeys[MPD_TAG_NUM_OF_ITEM_TYPES];
/* internal stuff don't touch this struct */
typedef struct _mpd_ReturnElement {
char * name;
char * value;
} mpd_ReturnElement;
/* mpd_Connection
* holds info about connection to mpd
* use error, and errorStr to detect errors
*/
typedef struct _mpd_Connection {
/* use this to check the version of mpd */
int version[3];
/* IMPORTANT, you want to get the error messages from here */
char errorStr[MPD_ERRORSTR_MAX_LENGTH+1];
int errorCode;
int errorAt;
/* this will be set to MPD_ERROR_* if there is an error, 0 if not */
int error;
/* DON'T TOUCH any of the rest of this stuff */
int sock;
char buffer[MPD_BUFFER_MAX_LENGTH+1];
int buflen;
int bufstart;
int doneProcessing;
int listOks;
int doneListOk;
int commandList;
mpd_ReturnElement * returnElement;
struct timeval timeout;
char *request;
} mpd_Connection;
/* mpd_newConnection
* use this to open a new connection
* you should use mpd_closeConnection, when your done with the connection,
* even if an error has occurred
* _timeout_ is the connection timeout period in seconds
*/
mpd_Connection * mpd_newConnection(const char * host, int port, float timeout);
void mpd_setConnectionTimeout(mpd_Connection * connection, float timeout);
/* mpd_closeConnection
* use this to close a connection and free'ing subsequent memory
*/
void mpd_closeConnection(mpd_Connection * connection);
/* mpd_clearError
* clears error
*/
void mpd_clearError(mpd_Connection * connection);
/* STATUS STUFF */
/* use these with status.state to determine what state the player is in */
#define MPD_STATUS_STATE_UNKNOWN 0
#define MPD_STATUS_STATE_STOP 1
#define MPD_STATUS_STATE_PLAY 2
#define MPD_STATUS_STATE_PAUSE 3
/* us this with status.volume to determine if mpd has volume support */
#define MPD_STATUS_NO_VOLUME -1
/* mpd_Status
* holds info return from status command
*/
typedef struct mpd_Status {
/* 0-100, or MPD_STATUS_NO_VOLUME when there is no volume support */
int volume;
/* 1 if repeat is on, 0 otherwise */
int repeat;
/* 1 if random is on, 0 otherwise */
int random;
/* playlist length */
int playlistLength;
/* playlist, use this to determine when the playlist has changed */
long long playlist;
/* use with MPD_STATUS_STATE_* to determine state of player */
int state;
/* crossfade setting in seconds */
int crossfade;
/* if a song is currently selected (always the case when state is
* PLAY or PAUSE), this is the position of the currently
* playing song in the playlist, beginning with 0
*/
int song;
/* Song ID of the currently selected song */
int songid;
/* time in seconds that have elapsed in the currently playing/paused
* song
*/
int elapsedTime;
/* length in seconds of the currently playing/paused song */
int totalTime;
/* current bit rate in kbs */
int bitRate;
/* audio sample rate */
unsigned int sampleRate;
/* audio bits */
int bits;
/* audio channels */
int channels;
/* 1 if mpd is updating, 0 otherwise */
int updatingDb;
/* error */
char * error;
} mpd_Status;
void mpd_sendStatusCommand(mpd_Connection * connection);
/* mpd_getStatus
* returns status info, be sure to free it with mpd_freeStatus()
* call this after mpd_sendStatusCommand()
*/
mpd_Status * mpd_getStatus(mpd_Connection * connection);
/* mpd_freeStatus
* free's status info malloc'd and returned by mpd_getStatus
*/
void mpd_freeStatus(mpd_Status * status);
typedef struct _mpd_Stats {
int numberOfArtists;
int numberOfAlbums;
int numberOfSongs;
unsigned long uptime;
unsigned long dbUpdateTime;
unsigned long playTime;
unsigned long dbPlayTime;
} mpd_Stats;
typedef struct _mpd_SearchStats {
int numberOfSongs;
unsigned long playTime;
} mpd_SearchStats;
void mpd_sendStatsCommand(mpd_Connection * connection);
mpd_Stats * mpd_getStats(mpd_Connection * connection);
void mpd_freeStats(mpd_Stats * stats);
mpd_SearchStats * mpd_getSearchStats(mpd_Connection * connection);
void mpd_freeSearchStats(mpd_SearchStats * stats);
/* SONG STUFF */
#define MPD_SONG_NO_TIME -1
#define MPD_SONG_NO_NUM -1
#define MPD_SONG_NO_ID -1
/* mpd_Song
* for storing song info returned by mpd
*/
typedef struct _mpd_Song {
/* filename of song */
char * file;
/* artist, maybe NULL if there is no tag */
char * artist;
/* title, maybe NULL if there is no tag */
char * title;
/* album, maybe NULL if there is no tag */
char * album;
/* track, maybe NULL if there is no tag */
char * track;
/* name, maybe NULL if there is no tag; it's the name of the current
* song, f.e. the icyName of the stream */
char * name;
/* date */
char *date;
/* added by qball */
/* Genre */
char *genre;
/* Composer */
char *composer;
/* Performer */
char *performer;
/* Disc */
char *disc;
/* Comment */
char *comment;
/* length of song in seconds, check that it is not MPD_SONG_NO_TIME */
int time;
/* if plchanges/playlistinfo/playlistid used, is the position of the
* song in the playlist */
int pos;
/* song id for a song in the playlist */
int id;
} mpd_Song;
/* mpd_newSong
* use to allocate memory for a new mpd_Song
* file, artist, etc all initialized to NULL
* if your going to assign values to file, artist, etc
* be sure to malloc or strdup the memory
* use mpd_freeSong to free the memory for the mpd_Song, it will also
* free memory for file, artist, etc, so don't do it yourself
*/
mpd_Song * mpd_newSong(void);
/* mpd_freeSong
* use to free memory allocated by mpd_newSong
* also it will free memory pointed to by file, artist, etc, so be careful
*/
void mpd_freeSong(mpd_Song * song);
/* mpd_songDup
* works like strDup, but for a mpd_Song
*/
mpd_Song * mpd_songDup(mpd_Song * song);
/* DIRECTORY STUFF */
/* mpd_Directory
* used to store info fro directory (right now that just the path)
*/
typedef struct _mpd_Directory {
char * path;
} mpd_Directory;
/* mpd_newDirectory
* allocates memory for a new directory
* use mpd_freeDirectory to free this memory
*/
mpd_Directory * mpd_newDirectory(void);
/* mpd_freeDirectory
* used to free memory allocated with mpd_newDirectory, and it frees
* path of mpd_Directory, so be careful
*/
void mpd_freeDirectory(mpd_Directory * directory);
/* mpd_directoryDup
* works like strdup, but for mpd_Directory
*/
mpd_Directory * mpd_directoryDup(mpd_Directory * directory);
/* PLAYLISTFILE STUFF */
/* mpd_PlaylistFile
* stores info about playlist file returned by lsinfo
*/
typedef struct _mpd_PlaylistFile {
char * path;
} mpd_PlaylistFile;
/* mpd_newPlaylistFile
* allocates memory for new mpd_PlaylistFile, path is set to NULL
* free this memory with mpd_freePlaylistFile
*/
mpd_PlaylistFile * mpd_newPlaylistFile(void);
/* mpd_freePlaylist
* free memory allocated for freePlaylistFile, will also free
* path, so be careful
*/
void mpd_freePlaylistFile(mpd_PlaylistFile * playlist);
/* mpd_playlistFileDup
* works like strdup, but for mpd_PlaylistFile
*/
mpd_PlaylistFile * mpd_playlistFileDup(mpd_PlaylistFile * playlist);
/* INFO ENTITY STUFF */
/* the type of entity returned from one of the commands that generates info
* use in conjunction with mpd_InfoEntity.type
*/
#define MPD_INFO_ENTITY_TYPE_DIRECTORY 0
#define MPD_INFO_ENTITY_TYPE_SONG 1
#define MPD_INFO_ENTITY_TYPE_PLAYLISTFILE 2
/* mpd_InfoEntity
* stores info on stuff returned info commands
*/
typedef struct mpd_InfoEntity {
/* the type of entity, use with MPD_INFO_ENTITY_TYPE_* to determine
* what this entity is (song, directory, etc...)
*/
int type;
/* the actual data you want, mpd_Song, mpd_Directory, etc */
union {
mpd_Directory * directory;
mpd_Song * song;
mpd_PlaylistFile * playlistFile;
} info;
} mpd_InfoEntity;
mpd_InfoEntity * mpd_newInfoEntity(void);
void mpd_freeInfoEntity(mpd_InfoEntity * entity);
/* INFO COMMANDS AND STUFF */
/* use this function to loop over after calling Info/Listall functions */
mpd_InfoEntity * mpd_getNextInfoEntity(mpd_Connection * connection);
/* fetches the currently seeletect song (the song referenced by status->song
* and status->songid*/
void mpd_sendCurrentSongCommand(mpd_Connection * connection);
/* songNum of -1, means to display the whole list */
void mpd_sendPlaylistInfoCommand(mpd_Connection * connection, int songNum);
/* songId of -1, means to display the whole list */
void mpd_sendPlaylistIdCommand(mpd_Connection * connection, int songId);
/* use this to get the changes in the playlist since version _playlist_ */
void mpd_sendPlChangesCommand(mpd_Connection * connection, long long playlist);
/**
* @param connection: A valid and connected mpd_Connection.
* @param playlist: The playlist version you want the diff with.
* A more bandwidth efficient version of the mpd_sendPlChangesCommand.
* It only returns the pos+id of the changes song.
*/
void mpd_sendPlChangesPosIdCommand(mpd_Connection * connection, long long playlist);
/* recursivel fetches all songs/dir/playlists in "dir* (no metadata is
* returned) */
void mpd_sendListallCommand(mpd_Connection * connection, const char * dir);
/* same as sendListallCommand, but also metadata is returned */
void mpd_sendListallInfoCommand(mpd_Connection * connection, const char * dir);
/* non-recursive version of ListallInfo */
void mpd_sendLsInfoCommand(mpd_Connection * connection, const char * dir);
#define MPD_TABLE_ARTIST MPD_TAG_ITEM_ARTIST
#define MPD_TABLE_ALBUM MPD_TAG_ITEM_ALBUM
#define MPD_TABLE_TITLE MPD_TAG_ITEM_TITLE
#define MPD_TABLE_FILENAME MPD_TAG_ITEM_FILENAME
void mpd_sendSearchCommand(mpd_Connection * connection, int table,
const char * str);
void mpd_sendFindCommand(mpd_Connection * connection, int table,
const char * str);
/* LIST TAG COMMANDS */
/* use this function fetch next artist entry, be sure to free the returned
* string. NULL means there are no more. Best used with sendListArtists
*/
char * mpd_getNextArtist(mpd_Connection * connection);
char * mpd_getNextAlbum(mpd_Connection * connection);
char * mpd_getNextTag(mpd_Connection *connection, int type);
/* list artist or albums by artist, arg1 should be set to the artist if
* listing albums by a artist, otherwise NULL for listing all artists or albums
*/
void mpd_sendListCommand(mpd_Connection * connection, int table,
const char * arg1);
/* SIMPLE COMMANDS */
void mpd_sendAddCommand(mpd_Connection * connection, const char * file);
int mpd_sendAddIdCommand(mpd_Connection *connection, const char *file);
void mpd_sendDeleteCommand(mpd_Connection * connection, int songNum);
void mpd_sendDeleteIdCommand(mpd_Connection * connection, int songNum);
void mpd_sendSaveCommand(mpd_Connection * connection, const char * name);
void mpd_sendLoadCommand(mpd_Connection * connection, const char * name);
void mpd_sendRmCommand(mpd_Connection * connection, const char * name);
void mpd_sendRenameCommand(mpd_Connection *connection, const char *from,
const char *to);
void mpd_sendShuffleCommand(mpd_Connection * connection);
void mpd_sendClearCommand(mpd_Connection * connection);
/* use this to start playing at the beginning, useful when in random mode */
#define MPD_PLAY_AT_BEGINNING -1
void mpd_sendPlayCommand(mpd_Connection * connection, int songNum);
void mpd_sendPlayIdCommand(mpd_Connection * connection, int songNum);
void mpd_sendStopCommand(mpd_Connection * connection);
void mpd_sendPauseCommand(mpd_Connection * connection, int pauseMode);
void mpd_sendNextCommand(mpd_Connection * connection);
void mpd_sendPrevCommand(mpd_Connection * connection);
void mpd_sendMoveCommand(mpd_Connection * connection, int from, int to);
void mpd_sendMoveIdCommand(mpd_Connection * connection, int from, int to);
void mpd_sendSwapCommand(mpd_Connection * connection, int song1, int song2);
void mpd_sendSwapIdCommand(mpd_Connection * connection, int song1, int song2);
void mpd_sendSeekCommand(mpd_Connection * connection, int song, int time);
void mpd_sendSeekIdCommand(mpd_Connection * connection, int song, int time);
void mpd_sendRepeatCommand(mpd_Connection * connection, int repeatMode);
void mpd_sendRandomCommand(mpd_Connection * connection, int randomMode);
void mpd_sendSetvolCommand(mpd_Connection * connection, int volumeChange);
/* WARNING: don't use volume command, its depreacted */
void mpd_sendVolumeCommand(mpd_Connection * connection, int volumeChange);
void mpd_sendCrossfadeCommand(mpd_Connection * connection, int seconds);
void mpd_sendUpdateCommand(mpd_Connection * connection, char * path);
/* returns the update job id, call this after a update command*/
int mpd_getUpdateId(mpd_Connection * connection);
void mpd_sendPasswordCommand(mpd_Connection * connection, const char * pass);
/* after executing a command, when your done with it to get its status
* (you want to check connection->error for an error)
*/
void mpd_finishCommand(mpd_Connection * connection);
/* command list stuff, use this to do things like add files very quickly */
void mpd_sendCommandListBegin(mpd_Connection * connection);
void mpd_sendCommandListOkBegin(mpd_Connection * connection);
void mpd_sendCommandListEnd(mpd_Connection * connection);
/* advance to the next listOk
* returns 0 if advanced to the next list_OK,
* returns -1 if it advanced to an OK or ACK */
int mpd_nextListOkCommand(mpd_Connection * connection);
typedef struct _mpd_OutputEntity {
int id;
char * name;
int enabled;
} mpd_OutputEntity;
void mpd_sendOutputsCommand(mpd_Connection * connection);
mpd_OutputEntity * mpd_getNextOutput(mpd_Connection * connection);
void mpd_sendEnableOutputCommand(mpd_Connection * connection, int outputId);
void mpd_sendDisableOutputCommand(mpd_Connection * connection, int outputId);
void mpd_freeOutputElement(mpd_OutputEntity * output);
/**
* @param connection a #mpd_Connection
*
* Queries mpd for the allowed commands
*/
void mpd_sendCommandsCommand(mpd_Connection * connection);
/**
* @param connection a #mpd_Connection
*
* Queries mpd for the not allowed commands
*/
void mpd_sendNotCommandsCommand(mpd_Connection * connection);
/**
* @param connection a #mpd_Connection
*
* returns the next supported command.
*
* @returns a string, needs to be free'ed
*/
char *mpd_getNextCommand(mpd_Connection *connection);
void mpd_sendUrlHandlersCommand(mpd_Connection * connection);
char *mpd_getNextHandler(mpd_Connection * connection);
void mpd_sendTagTypesCommand(mpd_Connection * connection);
char *mpd_getNextTagType(mpd_Connection * connection);
/**
* @param connection a MpdConnection
* @param path the path to the playlist.
*
* List the content, with full metadata, of a stored playlist.
*
*/
void mpd_sendListPlaylistInfoCommand(mpd_Connection *connection, char *path);
/**
* @param connection a MpdConnection
* @param path the path to the playlist.
*
* List the content of a stored playlist.
*
*/
void mpd_sendListPlaylistCommand(mpd_Connection *connection, char *path);
/**
* @param connection a #mpd_Connection
* @param exact if to match exact
*
* starts a search, use mpd_addConstraintSearch to add
* a constraint to the search, and mpd_commitSearch to do the actual search
*/
void mpd_startSearch(mpd_Connection *connection, int exact);
/**
* @param connection a #mpd_Connection
* @param type
* @param name
*/
void mpd_addConstraintSearch(mpd_Connection *connection, int type, const char *name);
/**
* @param connection a #mpd_Connection
*/
void mpd_commitSearch(mpd_Connection *connection);
/**
* @param connection a #mpd_Connection
* @param type The type to search for
*
* starts a search for fields... f.e. get a list of artists would be:
* @code
* mpd_startFieldSearch(connection, MPD_TAG_ITEM_ARTIST);
* mpd_commitSearch(connection);
* @endcode
*
* or get a list of artist in genre "jazz" would be:
* @code
* mpd_startFieldSearch(connection, MPD_TAG_ITEM_ARTIST);
* mpd_addConstraintSearch(connection, MPD_TAG_ITEM_GENRE, "jazz")
* mpd_commitSearch(connection);
* @endcode
*
* mpd_startSearch will return a list of songs (and you need mpd_getNextInfoEntity)
* this one will return a list of only one field (the one specified with type) and you need
* mpd_getNextTag to get the results
*/
void mpd_startFieldSearch(mpd_Connection *connection, int type);
void mpd_startPlaylistSearch(mpd_Connection *connection, int exact);
void mpd_startStatsSearch(mpd_Connection *connection);
void mpd_sendPlaylistClearCommand(mpd_Connection *connection, char *path);
void mpd_sendPlaylistAddCommand(mpd_Connection *connection,
char *playlist, char *path);
void mpd_sendPlaylistMoveCommand(mpd_Connection *connection,
char *playlist, int from, int to);
void mpd_sendPlaylistDeleteCommand(mpd_Connection *connection,
char *playlist, int pos);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,648 +0,0 @@
/* $Id$ */
/*
* libtcp-portmon.c: tcp port monitoring library.
*
* Copyright (C) 2005-2007 Philip Kovacs pkovacs@users.sourceforge.net
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
* USA.
*
*/
#include <glib/gprintf.h>
#include "libtcp-portmon.h"
/* -------------------------------------------------------------------
* IMPLEMENTATION INTERFACE
*
* Implementation-specific interface begins here. Clients should not
* manipulate these structures directly, nor call the defined helper
* functions. Use the "Client interface" functions defined at bottom.
* ------------------------------------------------------------------- */
/* ----------------------------------
* Copy a tcp_connection_t
*
* Returns 0 on success, -1 otherwise.
* ----------------------------------*/
int copy_tcp_connection(
tcp_connection_t * p_dest_connection,
const tcp_connection_t * p_source_connection
)
{
if ( !p_dest_connection || !p_source_connection )
return (-1);
g_strlcpy (p_dest_connection->key, p_source_connection->key, sizeof(p_dest_connection->key));
p_dest_connection->local_addr = p_source_connection->local_addr;
p_dest_connection->local_port = p_source_connection->local_port;
p_dest_connection->remote_addr = p_source_connection->remote_addr;
p_dest_connection->remote_port = p_source_connection->remote_port;
p_dest_connection->age = p_source_connection->age;
return 0;
}
/* ---------------------------------------------------------------------------
* Port monitor utility functions implementing tcp_port_monitor_function_ptr_t
* ---------------------------------------------------------------------------*/
void destroy_tcp_port_monitor(
tcp_port_monitor_t * p_monitor,
void * p_void
)
{
tcp_connection_node_t *p_node, *p_temp;
if ( !p_monitor || p_void ) /* p_void should be NULL in this context */
return;
/* destroy the monitor's peek array */
free( p_monitor->p_peek );
/* destroy the monitor's connection list */
for ( p_node=p_monitor->connection_list.p_head; p_node!=NULL; )
{
/* p_temp is for the next iteration */
p_temp = p_node->p_next;
free( p_node );
p_node = p_temp;
}
/* destroy the monitor's hash */
g_hash_table_destroy (p_monitor->hash);
p_monitor->hash=NULL;
/* destroy the monitor */
free( p_monitor );
p_monitor=NULL;
}
void age_tcp_port_monitor(
tcp_port_monitor_t * p_monitor,
void * p_void
)
{
/* Run through the monitor's connections and decrement the age variable.
* If the age goes negative, we remove the connection from the monitor.
* Function takes O(n) time on the number of connections. */
tcp_connection_node_t *p_node, *p_temp;
tcp_connection_t *p_conn;
if ( !p_monitor || p_void ) /* p_void should be NULL in this context */
return;
if ( !p_monitor->p_peek )
return;
for ( p_node = p_monitor->connection_list.p_head; p_node; )
{
if ( --p_node->connection.age >= 0 ) {
p_node = p_node->p_next;
continue;
}
/* connection on p_node is old. remove connection from the hash. */
p_conn = &p_node->connection;
#ifdef HASH_DEBUG
fprintf (stderr, "monitor hash removal of connection [%s]", p_conn->key);
if ( !g_hash_table_remove (p_monitor->hash, (gconstpointer)p_conn->key) ) {
fprintf (stderr, " - ERROR NOT FOUND\n");
return;
}
fprintf (stderr, " - OK\n");
#else
if ( !g_hash_table_remove (p_monitor->hash, (gconstpointer)p_conn->key) )
return;
#endif
/* splice p_node out of the connection_list */
if ( p_node->p_prev != NULL )
p_node->p_prev->p_next = p_node->p_next;
if ( p_node->p_next != NULL )
p_node->p_next->p_prev = p_node->p_prev;
/* correct the list head and tail if necessary */
if ( p_monitor->connection_list.p_head == p_node )
p_monitor->connection_list.p_head = p_node->p_next;
if ( p_monitor->connection_list.p_tail == p_node )
p_monitor->connection_list.p_tail = p_node->p_prev;
/* p_temp is for the next iteration */
p_temp = p_node->p_next;
/* destroy the node */
free( p_node );
p_node = p_temp;
}
}
void rebuild_tcp_port_monitor_peek_table(
tcp_port_monitor_t * p_monitor,
void * p_void
)
{
/* Run through the monitor's connections and rebuild the peek table
* of connection pointers. This is done so peeking into the monitor
* can be done in O(1) time instead of O(n) time for each peek. */
tcp_connection_node_t *p_node;
int i = 0;
if ( !p_monitor || p_void ) /* p_void should be NULL in this context */
return;
/* zero out the peek array */
memset( p_monitor->p_peek, 0, p_monitor->max_port_monitor_connections * sizeof(tcp_connection_t *) );
for ( p_node=p_monitor->connection_list.p_head; p_node!=NULL; p_node=p_node->p_next, i++ )
{
p_monitor->p_peek[i] = &p_node->connection;
}
}
void show_connection_to_tcp_port_monitor(
tcp_port_monitor_t * p_monitor,
void * p_void
)
{
/* The monitor gets to look at each connection to see if it falls within
* the monitor's port range of interest. Connections of interest are first
* looked up in the hash to see if they are already there. If they are, we
* reset the age of the connection so it is not deleted. If the connection
* is not in the hash, we add it, but only if we haven't exceeded the maximum
* connection limit for the monitor. The function takes O(1) time. */
tcp_connection_node_t *p_node;
tcp_connection_t *p_connection, *p_conn_hash;
if ( !p_monitor || !p_void )
return;
/* This p_connection is on caller's stack and not the heap. If we are interested,
* we will create a copy of the connection (on the heap) and add it to our list. */
p_connection = (tcp_connection_t *)p_void;
/* inspect the local port number of the connection to see if we're interested. */
if ( (p_monitor->port_range_begin <= p_connection->local_port) &&
(p_connection->local_port <= p_monitor->port_range_end) )
{
/* the connection is in the range of the monitor. */
/* first check the hash to see if the connection is already there. */
if ( (p_conn_hash = g_hash_table_lookup (p_monitor->hash, (gconstpointer)p_connection->key)) )
{
/* it's already in the hash. reset the age of the connection. */
p_conn_hash->age = TCP_CONNECTION_STARTING_AGE;
return;
}
/* Connection is not yet in the hash. Add it if max_connections not exceeded. */
if (g_hash_table_size (p_monitor->hash) >= p_monitor->max_port_monitor_connections)
return;
/* create a new connection node */
if ( (p_node = (tcp_connection_node_t *) calloc(1, sizeof(tcp_connection_node_t))) == NULL )
return;
/* copy the connection data */
if ( copy_tcp_connection( &p_node->connection, p_connection ) != 0 )
{
/* error copying the connection data. deallocate p_node to avoid leaks and return. */
free( p_node );
return;
}
p_node->connection.age = TCP_CONNECTION_STARTING_AGE;
p_node->p_next = NULL;
/* insert it into the monitor's hash table */
#ifdef HASH_DEBUG
fprintf (stderr, "monitor hash insert of connection [%s]\n", p_node->connection.key);
#endif
g_hash_table_insert( p_monitor->hash,
(gpointer)p_node->connection.key,
(gpointer)&p_node->connection);
/* append the node to the monitor's connection list */
if ( p_monitor->connection_list.p_tail == NULL ) /* assume p_head is NULL too */
{
p_monitor->connection_list.p_head = p_node;
p_monitor->connection_list.p_tail = p_node;
p_node->p_prev = NULL;
}
else
{
p_monitor->connection_list.p_tail->p_next = p_node;
p_node->p_prev = p_monitor->connection_list.p_tail;
p_monitor->connection_list.p_tail = p_node;
}
}
}
/* ---------------------------------------------------------------------------------------
* Apply a tcp_port_monitor_function_ptr_t function to each port monitor in the collection.
* ---------------------------------------------------------------------------------------*/
void for_each_tcp_port_monitor_in_collection(
tcp_port_monitor_collection_t * p_collection,
tcp_port_monitor_function_ptr_t p_function,
void * p_function_args
)
{
tcp_port_monitor_node_t * p_current_node, * p_next_node;
if ( !p_collection || !p_function )
return;
/* for each monitor in the collection */
for ( p_current_node = p_collection->monitor_list.p_head; p_current_node != NULL; )
{
p_next_node = p_current_node->p_next; /* do this first! */
if ( p_current_node->p_monitor )
{
/* apply the function with the given arguments */
(*p_function)( p_current_node->p_monitor, p_function_args );
}
p_current_node = p_next_node;
}
}
/* ----------------------------------------------------------------------
* CLIENT INTERFACE
*
* Clients should call only those functions below this line.
* ---------------------------------------------------------------------- */
/* ----------------------------------
* Client operations on port monitors
* ---------------------------------- */
/* Clients should first try to "find_tcp_port_monitor" before creating one
so that there are no redundant monitors. */
tcp_port_monitor_t * create_tcp_port_monitor(
in_port_t port_range_begin,
in_port_t port_range_end,
tcp_port_monitor_args_t * p_creation_args
)
{
tcp_port_monitor_t * p_monitor;
/* create the monitor */
p_monitor = (tcp_port_monitor_t *) calloc(1, sizeof(tcp_port_monitor_t) );
if ( !p_monitor )
return NULL;
p_monitor->max_port_monitor_connections = p_creation_args->max_port_monitor_connections;
/* build the monitor key for the collection hash */
g_sprintf (p_monitor->key, ":%04X :%04X", port_range_begin, port_range_end);
/* create the monitor's connection hash */
if ( (p_monitor->hash = g_hash_table_new (g_str_hash, g_str_equal)) == NULL)
{
/* we failed to create the hash, so destroy the monitor completely so we don't leak */
destroy_tcp_port_monitor(p_monitor,NULL);
return NULL;
}
/* create the monitor's peek array */
if ( (p_monitor->p_peek = (tcp_connection_t **) calloc (p_monitor->max_port_monitor_connections,
sizeof(tcp_connection_t *))) == NULL )
{
/* we failed to create the peek array, so destroy the monitor completely, again, so we don't leak */
destroy_tcp_port_monitor(p_monitor,NULL);
return NULL ;
}
p_monitor->port_range_begin = port_range_begin;
p_monitor->port_range_end = port_range_end;
p_monitor->connection_list.p_head = NULL;
p_monitor->connection_list.p_tail = NULL;
return p_monitor;
}
/* Clients use this function to get connection data from the indicated port monitor.
The requested monitor value is copied into a client-supplied char buffer.
Returns 0 on success, -1 otherwise. */
int peek_tcp_port_monitor(
const tcp_port_monitor_t * p_monitor,
int item,
int connection_index,
char * p_buffer,
size_t buffer_size
)
{
struct hostent *p_hostent;
struct servent *p_servent;
struct in_addr net;
if ( !p_monitor || !p_buffer || connection_index < 0 )
return(-1);
memset(p_buffer, 0, buffer_size);
memset(&net, 0, sizeof(net));
/* if the connection index is out of range, we simply return with no error
* having first cleared the client-supplied buffer. */
if ( (item!=COUNT) && (connection_index > (int)g_hash_table_size (p_monitor->hash) - 1) )
return(0);
switch (item) {
case COUNT:
snprintf( p_buffer, buffer_size, "%d" , g_hash_table_size (p_monitor->hash) );
break;
case REMOTEIP:
net.s_addr = p_monitor->p_peek[ connection_index ]->remote_addr;
snprintf( p_buffer, buffer_size, "%s", inet_ntoa( net ) );
break;
case REMOTEHOST:
p_hostent = gethostbyaddr( (const void *)&p_monitor->p_peek[ connection_index ]->remote_addr,
sizeof(in_addr_t), AF_INET);
/* if no host name found, just use ip address. */
if ( !p_hostent || !p_hostent->h_name )
{
net.s_addr = p_monitor->p_peek[ connection_index ]->remote_addr;
snprintf( p_buffer, buffer_size, "%s", inet_ntoa( net ) );
break;
}
snprintf( p_buffer, buffer_size, "%s", p_hostent->h_name );
break;
case REMOTEPORT:
snprintf( p_buffer, buffer_size, "%d", p_monitor->p_peek[ connection_index ]->remote_port );
break;
case REMOTESERVICE:
p_servent = getservbyport( htons(p_monitor->p_peek[ connection_index ]->remote_port ), "tcp" );
/* if no service name found for the port, just use the port number. */
if ( !p_servent || !p_servent->s_name ) {
snprintf( p_buffer, buffer_size, "%d", p_monitor->p_peek[ connection_index ]->remote_port );
} else {
snprintf( p_buffer, buffer_size, "%s", p_servent->s_name );
}
break;
case LOCALIP:
net.s_addr = p_monitor->p_peek[ connection_index ]->local_addr;
snprintf( p_buffer, buffer_size, "%s", inet_ntoa( net ) );
break;
case LOCALHOST:
p_hostent = gethostbyaddr( (const void *)&p_monitor->p_peek[ connection_index ]->local_addr,
sizeof(in_addr_t), AF_INET);
/* if no host name found, just use ip address. */
if ( !p_hostent || !p_hostent->h_name )
{
net.s_addr = p_monitor->p_peek[ connection_index ]->local_addr;
snprintf( p_buffer, buffer_size, "%s", inet_ntoa( net ) );
break;
}
snprintf( p_buffer, buffer_size, "%s", p_hostent->h_name );
break;
case LOCALPORT:
snprintf( p_buffer, buffer_size, "%d", p_monitor->p_peek[ connection_index ]->local_port );
break;
case LOCALSERVICE:
p_servent = getservbyport( htons(p_monitor->p_peek[ connection_index ]->local_port ), "tcp" );
/* if no service name found for the port, just use the port number. */
if ( !p_servent || !p_servent->s_name )
{
snprintf( p_buffer, buffer_size, "%d", p_monitor->p_peek[ connection_index ]->local_port );
break;
}
snprintf( p_buffer, buffer_size, "%s", p_servent->s_name );
break;
default:
return(-1);
}
return(0);
}
/* --------------------------------
* Client operations on collections
* -------------------------------- */
/* Create a monitor collection. Do this one first. */
tcp_port_monitor_collection_t * create_tcp_port_monitor_collection (void)
{
tcp_port_monitor_collection_t * p_collection;
p_collection = (tcp_port_monitor_collection_t *) calloc( 1, sizeof( tcp_port_monitor_collection_t ) );
if ( !p_collection )
return NULL;
/* create the collection's monitor hash */
if ( (p_collection->hash = g_hash_table_new (g_str_hash, g_str_equal)) == NULL)
{
/* we failed to create the hash, so destroy the monitor completely so we don't leak */
destroy_tcp_port_monitor_collection(p_collection);
return NULL;
}
p_collection->monitor_list.p_head = NULL;
p_collection->monitor_list.p_tail = NULL;
return p_collection;
}
/* Destroy the monitor collection (and the monitors inside). Do this one last. */
void destroy_tcp_port_monitor_collection(
tcp_port_monitor_collection_t * p_collection
)
{
tcp_port_monitor_node_t * p_current_node, * p_next_node;
if ( !p_collection )
return;
/* destroy the monitors */
for_each_tcp_port_monitor_in_collection(
p_collection,
&destroy_tcp_port_monitor,
NULL
);
/* next destroy the empty monitor nodes */
for ( p_current_node = p_collection->monitor_list.p_head; p_current_node != NULL; )
{
p_next_node = p_current_node->p_next; /* do this first! */
free( p_current_node );
p_current_node = p_next_node;
}
/* destroy the collection's hash */
g_hash_table_destroy (p_collection->hash);
p_collection->hash = NULL;
free( p_collection );
p_collection=NULL;
}
/* Updates the tcp statistics for all monitors within a collection */
void update_tcp_port_monitor_collection(
tcp_port_monitor_collection_t * p_collection
)
{
FILE *fp;
char buf[256];
tcp_connection_t conn;
unsigned long inode,uid,state;
if ( !p_collection )
return;
/* age the connections in all port monitors. */
for_each_tcp_port_monitor_in_collection(
p_collection,
&age_tcp_port_monitor,
NULL
);
/* read tcp data from /proc/net/tcp */
if ( ( fp = fopen("/proc/net/tcp", "r" ) ) == NULL )
return;
/* ignore field name line */
fgets(buf, 255, fp);
/* read all tcp connections */
while (fgets (buf, sizeof (buf), fp) != NULL) {
if ( sscanf (buf, "%*d: %x:%hx %x:%hx %lx %*x:%*x %*x:%*x %*x %lu %*d %lu",
(unsigned int *)&conn.local_addr, &conn.local_port,
(unsigned int *)&conn.remote_addr, &conn.remote_port,
(unsigned long *)&state, (unsigned long *)&uid, (unsigned long *)&inode) != 7 )
fprintf( stderr, "/proc/net/tcp: bad file format\n" );
if ((inode == 0) || (state != TCP_ESTABLISHED)) continue;
/* build hash key */
g_sprintf (conn.key, "%08X:%04X %08X:%04X",
conn.local_addr, conn.local_port,
conn.remote_addr, conn.remote_port);
/* show the connection to each port monitor. */
for_each_tcp_port_monitor_in_collection(
p_collection,
&show_connection_to_tcp_port_monitor,
(void *) &conn
);
}
fclose(fp);
/* rebuild the connection peek tables of all monitors so clients can peek in O(1) time */
for_each_tcp_port_monitor_in_collection(
p_collection,
&rebuild_tcp_port_monitor_peek_table,
NULL
);
}
/* After clients create a monitor, use this to add it to the collection.
Returns 0 on success, -1 otherwise. */
int insert_tcp_port_monitor_into_collection(
tcp_port_monitor_collection_t * p_collection,
tcp_port_monitor_t * p_monitor
)
{
tcp_port_monitor_node_t * p_node;
if ( !p_collection || !p_monitor )
return (-1);
/* create a container node for this monitor */
p_node = (tcp_port_monitor_node_t *) calloc( 1, sizeof(tcp_port_monitor_node_t) );
if ( !p_node )
return (-1);
/* populate the node */
p_node->p_monitor = p_monitor;
p_node->p_next = NULL;
/* add a pointer to this monitor to the collection's hash */
#ifdef HASH_DEBUG
fprintf (stderr, "collection hash insert of monitor [%s]\n", p_monitor->key);
#endif
g_hash_table_insert (p_collection->hash, (gpointer)p_monitor->key, (gpointer)p_monitor);
/* tail of the container gets this node */
if ( !p_collection->monitor_list.p_tail )
p_collection->monitor_list.p_tail = p_node;
else
{
/* p_next of the tail better be NULL */
if ( p_collection->monitor_list.p_tail->p_next != NULL )
return (-1);
/* splice node onto tail */
p_collection->monitor_list.p_tail->p_next = p_node;
p_collection->monitor_list.p_tail = p_node;
}
/* if this was the first element added */
if ( !p_collection->monitor_list.p_head )
p_collection->monitor_list.p_head = p_collection->monitor_list.p_tail;
return 0;
}
/* Clients need a way to find monitors */
tcp_port_monitor_t * find_tcp_port_monitor(
const tcp_port_monitor_collection_t * p_collection,
in_port_t port_range_begin,
in_port_t port_range_end
)
{
tcp_port_monitor_t *p_monitor;
gchar key[12];
if ( !p_collection )
return NULL;
/* is monitor in hash? */
g_sprintf (key, ":%04X :%04X", port_range_begin, port_range_end);
p_monitor = g_hash_table_lookup( p_collection->hash, (gconstpointer)key);
return (p_monitor);
}

View File

@ -1,246 +0,0 @@
/* $Id$ */
/*
* libtcp-portmon.h: tcp port monitoring library.
*
* Copyright (C) 2005-2007 Philip Kovacs pkovacs@users.sourceforge.net
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
* USA.
*
*/
#ifndef LIBTCP_PORTMON_H
#define LIBTCP_PORTMON_H
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <math.h>
#include <netdb.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <glib.h>
#define TCP_CONNECTION_STARTING_AGE 1 /* connection deleted if unseen again after this # of refreshes */
#define TCP_CONNECTION_HASH_KEY_SIZE 28
#define TCP_PORT_MONITOR_HASH_KEY_SIZE 12
/* -------------------------------------------------------------------
* IMPLEMENTATION INTERFACE
*
* Implementation-specific interface begins here. Clients should not
* manipulate these structures directly, nor call the defined helper
* functions. Use the "Client interface" functions defined at bottom.
* ------------------------------------------------------------------- */
/* The inventory of peekable items within the port monitor. */
enum tcp_port_monitor_peekables {
COUNT=0,
REMOTEIP,
REMOTEHOST,
REMOTEPORT,
REMOTESERVICE,
LOCALIP,
LOCALHOST,
LOCALPORT,
LOCALSERVICE
};
/* ------------------------------------------------------------------------
* A single tcp connection
*
* The age variable provides the mechanism for removing connections if they
* are not seen again in subsequent update cycles.
* ------------------------------------------------------------------------ */
typedef struct _tcp_connection_t {
gchar key[TCP_CONNECTION_HASH_KEY_SIZE]; /* connection's key in monitor hash */
in_addr_t local_addr;
in_port_t local_port;
in_addr_t remote_addr;
in_port_t remote_port;
int age;
} tcp_connection_t;
/* ----------------------------------
* Copy a connection
*
* Returns 0 on success, -1 otherwise
* ----------------------------------*/
int copy_tcp_connection(
tcp_connection_t * /* p_dest_connection */,
const tcp_connection_t * /* p_source_connection */
);
/* ------------------------------------------------------------------------
* A tcp connection node/list
*
* Connections within each monitor are stored in a double-linked list.
* ------------------------------------------------------------------------ */
typedef struct _tcp_connection_node_t {
tcp_connection_t connection;
struct _tcp_connection_node_t * p_prev;
struct _tcp_connection_node_t * p_next;
} tcp_connection_node_t;
typedef struct _tcp_connection_list_t {
tcp_connection_node_t * p_head;
tcp_connection_node_t * p_tail;
} tcp_connection_list_t;
/* --------------
* A port monitor
* -------------- */
typedef struct _tcp_port_monitor_t {
gchar key[TCP_PORT_MONITOR_HASH_KEY_SIZE]; /* monitor's key in collection hash */
in_port_t port_range_begin; /* start of monitor port range */
in_port_t port_range_end; /* begin = end to monitor a single port */
tcp_connection_list_t connection_list; /* list of connections for this monitor */
GHashTable *hash; /* hash table of pointers into connection list */
tcp_connection_t **p_peek; /* array of connection pointers for O(1) peeking */
unsigned int max_port_monitor_connections; /* max number of connections */
} tcp_port_monitor_t;
/* ------------------------
* A port monitor node/list
* ------------------------ */
typedef struct _tcp_port_monitor_node_t {
tcp_port_monitor_t * p_monitor;
struct _tcp_port_monitor_node_t *p_next;
} tcp_port_monitor_node_t;
typedef struct __tcp_port_monitor_list_t {
tcp_port_monitor_node_t * p_head;
tcp_port_monitor_node_t * p_tail;
} tcp_port_monitor_list_t;
/* ---------------------------------------
* A port monitor utility function typedef
* ---------------------------------------*/
typedef void (*tcp_port_monitor_function_ptr_t)( tcp_port_monitor_t * /* p_monitor */, void * /* p_void */ );
/* ---------------------------------------------------------------------------
* Port monitor utility functions implementing tcp_port_monitor_function_ptr_t
* ---------------------------------------------------------------------------*/
void destroy_tcp_port_monitor(
tcp_port_monitor_t * /* p_monitor */,
void * /* p_void (use NULL for this function) */
);
void age_tcp_port_monitor(
tcp_port_monitor_t * /* p_monitor */,
void * /* p_void (use NULL for this function) */
);
void rebuild_tcp_port_monitor_peek_table(
tcp_port_monitor_t * /* p_monitor */,
void * /* p_void (use NULL for this function) */
);
void show_connection_to_tcp_port_monitor(
tcp_port_monitor_t * /* p_monitor */,
void * /* p_connection (client should cast) */
);
/* -----------------------------
* A tcp port monitor collection
* -----------------------------*/
typedef struct _tcp_port_monitor_collection_t {
tcp_port_monitor_list_t monitor_list; /* list of monitors for this collection */
GHashTable *hash; /* hash table of pointers into collection's monitor list */
} tcp_port_monitor_collection_t;
/* ---------------------------------------------------------------------------------------
* Apply a tcp_port_monitor_function_ptr_t function to each port monitor in the collection.
* ---------------------------------------------------------------------------------------*/
void for_each_tcp_port_monitor_in_collection(
tcp_port_monitor_collection_t * /* p_collection */,
tcp_port_monitor_function_ptr_t /* p_function */,
void * /* p_function_args (for user arguments) */
);
/* ----------------------------------------------------------------------
* CLIENT INTERFACE
*
* Clients should call only those functions below this line.
* ---------------------------------------------------------------------- */
/* struct to hold monitor creation arguments */
typedef struct _tcp_port_monitor_args_t {
int max_port_monitor_connections; /* monitor supports tracking at most this many connections */
} tcp_port_monitor_args_t;
/* ----------------------------------
* Client operations on port monitors
* ---------------------------------- */
/* Clients should first try to "find_tcp_port_monitor" before creating one
so that there are no redundant monitors. */
tcp_port_monitor_t * create_tcp_port_monitor(
in_port_t /* port_range_begin */,
in_port_t /* port_range_end */,
tcp_port_monitor_args_t * /* p_creation_args */
);
/* Clients use this function to get connection data from the indicated port monitor.
The requested monitor value is copied into a client-supplied char buffer.
Returns 0 on success, -1 otherwise. */
int peek_tcp_port_monitor(
const tcp_port_monitor_t * /* p_monitor */,
int /* item, ( item of interest, from tcp_port_monitor_peekables enum ) */,
int /* connection_index, ( 0 to number of connections in monitor - 1 )*/,
char * /* p_buffer, buffer to receive requested value */,
size_t /* buffer_size, size of p_buffer */
);
/* --------------------------------
* Client operations on collections
* -------------------------------- */
/* Create a monitor collection. Do this one first. */
tcp_port_monitor_collection_t * create_tcp_port_monitor_collection (void);
/* Destroy the monitor collection (and everything it contains). Do this one last. */
void destroy_tcp_port_monitor_collection(
tcp_port_monitor_collection_t * /* p_collection */
);
/* Updates the tcp statitics for all monitors within a collection */
void update_tcp_port_monitor_collection(
tcp_port_monitor_collection_t * /* p_collection */
);
/* After clients create a monitor, use this to add it to the collection.
Returns 0 on success, -1 otherwise. */
int insert_tcp_port_monitor_into_collection(
tcp_port_monitor_collection_t * /* p_collection */,
tcp_port_monitor_t * /* p_monitor */
);
/* Clients need a way to find monitors */
tcp_port_monitor_t * find_tcp_port_monitor(
const tcp_port_monitor_collection_t * /* p_collection */,
in_port_t /* port_range_begin */,
in_port_t /* port_range_end */
);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,198 +0,0 @@
/*
* Conky, a system monitor, based on torsmo
*
* Any original torsmo code is licensed under the BSD license
*
* All code written since the fork of torsmo is licensed under the GPL
*
* Please see COPYING for details
*
* Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
* Copyright (c) 2005-2007 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/>.
*
* $Id$
*/
#include <sys/stat.h>
#include <sys/time.h>
#include <dirent.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include "conky.h"
char *current_mail_spool;
static time_t last_mail_mtime;
static double last_mail_update;
void update_mail_count()
{
struct stat buf;
if (current_mail_spool == NULL)
return;
/* TODO: use that fine file modification notify on Linux 2.4 */
/* don't check mail so often (9.5s is minimum interval) */
if (current_update_time - last_mail_update < 9.5)
return;
else
last_mail_update = current_update_time;
if (stat(current_mail_spool, &buf)) {
static int rep;
if (!rep) {
ERR("can't stat %s: %s", current_mail_spool,
strerror(errno));
rep = 1;
}
return;
}
#if HAVE_DIRENT_H
/* maildir format */
if (S_ISDIR(buf.st_mode)) {
DIR *dir;
char *dirname;
struct dirent *dirent;
info.mail_count = 0;
info.new_mail_count = 0;
dirname =
(char *) malloc(sizeof(char) *
(strlen(current_mail_spool) + 5));
if (!dirname) {
ERR("malloc");
return;
}
strcpy(dirname, current_mail_spool);
strcat(dirname, "/");
/* checking the cur subdirectory */
strcat(dirname, "cur");
dir = opendir(dirname);
if (!dir) {
ERR("cannot open directory");
free(dirname);
return;
}
dirent = readdir(dir);
while (dirent) {
/* . and .. are skipped */
if (dirent->d_name[0] != '.') {
info.mail_count++;
}
dirent = readdir(dir);
}
closedir(dir);
dirname[strlen(dirname) - 3] = '\0';
strcat(dirname, "new");
dir = opendir(dirname);
if (!dir) {
ERR("cannot open directory");
free(dirname);
return;
}
dirent = readdir(dir);
while (dirent) {
/* . and .. are skipped */
if (dirent->d_name[0] != '.') {
info.new_mail_count++;
info.mail_count++;
}
dirent = readdir(dir);
}
closedir(dir);
free(dirname);
return;
}
#endif
/* mbox format */
if (buf.st_mtime != last_mail_mtime) {
/* yippee, modification time has changed, let's read mail count! */
static int rep;
FILE *fp;
int reading_status = 0;
/* could lock here but I don't think it's really worth it because
* this isn't going to write mail spool */
info.new_mail_count = 0;
info.mail_count = 0;
fp = open_file(current_mail_spool, &rep);
if (!fp)
return;
/* NOTE: adds mail as new if there isn't Status-field at all */
while (!feof(fp)) {
char buf[128];
if (fgets(buf, 128, fp) == NULL)
break;
if (strncmp(buf, "From ", 5) == 0) {
/* ignore MAILER-DAEMON */
if (strncmp(buf + 5, "MAILER-DAEMON ", 14)
!= 0) {
info.mail_count++;
if (reading_status)
info.new_mail_count++;
else
reading_status = 1;
}
} else {
if (reading_status
&& strncmp(buf, "X-Mozilla-Status:",
17) == 0) {
/* check that mail isn't already read */
if (strchr(buf + 21, '0'))
info.new_mail_count++;
reading_status = 0;
continue;
}
if (reading_status
&& strncmp(buf, "Status:", 7) == 0) {
/* check that mail isn't already read */
if (strchr(buf + 7, 'R') == NULL)
info.new_mail_count++;
reading_status = 0;
continue;
}
}
/* skip until \n */
while (strchr(buf, '\n') == NULL && !feof(fp))
fgets(buf, 128, fp);
}
fclose(fp);
if (reading_status)
info.new_mail_count++;
last_mail_mtime = buf.st_mtime;
}
}

View File

@ -1,364 +0,0 @@
/*
* Conky, a system monitor, based on torsmo
*
* Any original torsmo code is licensed under the BSD license
*
* All code written since the fork of torsmo is licensed under the GPL
*
* Please see COPYING for details
*
* Copyright (c) 2006 Marco Candrian <mac@calmar.ws>
* Copyright (c) 2005-2007 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/>.
*
* $Id$
*/
#include "conky.h"
#include <sys/stat.h>
#include <sys/time.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "mboxscan.h"
#define FROM_WIDTH 10
#define SUBJECT_WIDTH 22
#define PRINT_MAILS 5
#define TIME_DELAY 5
struct ring_list {
char *from;
char *subject;
struct ring_list *previous;
struct ring_list *next;
};
static time_t last_ctime; /* needed for mutt at least */
static time_t last_mtime; /* not sure what to test: testing both now */
static double last_update;
static int args_ok = 0;
static int from_width;
static int subject_width;
static int print_mails;
static int time_delay;
/*
* I don't know what to use: TEXT_BUFFER_SIZE or text_buffer_size
* text_buffer_size is the maximum output in chars
* TEXT_BUFFER_SIZE actually something like a allowed size
* for things in the config, below 'TEXT'. Or what is more probably
* max_user_text. Anyway, I used TEXT_BUFFER_SIZE for not 'output' things here
* -- calmar
*
* To clarify, TEXT_BUFFER_SIZE is used for buffers of fixed size, and
* text_buffer_size is used for buffers which can change in size.
* text_buffer_size is just defined as TEXT_BUFFER_SIZE to start,
* so its okay for most things, however if something is allocated
* with text_buffer_size and then text_buffer_size changes but
* the array doesn't, you might have some issues if you are using
* text_buffer_size to determine the size of the array.
* -- brenden
*/
static char mbox_mail_spool[TEXT_BUFFER_SIZE];
void mbox_scan(char *args, char *output, size_t max_len)
{
int i, u, flag;
int force_rescan = 0;
char buf[text_buffer_size];
struct stat statbuf;
/* output was set to 1 after malloc'ing in conky.c */
/* -> beeing able to test it here for catching SIGUSR1 */
if (output[0] == 1) {
force_rescan = 1;
output[0] = '\0';
}
if (!args_ok || force_rescan) {
char *substr = strstr(args, "-n");
if (substr) {
if (sscanf(substr, "-n %i", &print_mails) != 1) {
print_mails = PRINT_MAILS;
}
} else {
print_mails = PRINT_MAILS;
}
if (print_mails < 1)
print_mails = 1;
substr = strstr(args, "-t");
if (substr) {
if (sscanf(substr, "-t %i", &time_delay) != 1) {
time_delay = TIME_DELAY;
}
} else {
time_delay = TIME_DELAY;
}
substr = strstr(args, "-fw");
if (substr) {
if (sscanf(substr, "-fw %i", &from_width) != 1) {
from_width = FROM_WIDTH;
}
} else {
from_width = FROM_WIDTH;
}
substr = strstr(args, "-sw");
if (substr) {
if (sscanf(substr, "-sw %i", &subject_width) != 1) {
subject_width = SUBJECT_WIDTH;
}
} else {
subject_width = SUBJECT_WIDTH;
}
/* encapsulated with "'s find first occurrence of " */
if (args[strlen(args) - 1] == '"') {
strncpy(mbox_mail_spool, args, TEXT_BUFFER_SIZE);
char *start = strchr(mbox_mail_spool, '"') + 1;
start[(long)(strrchr(mbox_mail_spool, '"') - start)] = '\0';
strncpy(mbox_mail_spool, start, TEXT_BUFFER_SIZE);
} else {
char *copy_args = strdup(args);
char *tmp = strtok(copy_args, " ");
char *start = tmp;
while (tmp) {
tmp = strtok(NULL, " ");
if (tmp) {
start = tmp;
}
}
strncpy(mbox_mail_spool, start, TEXT_BUFFER_SIZE);
free(copy_args);
}
if (strlen(mbox_mail_spool) < 1) {
CRIT_ERR("Usage: ${mboxscan [-n <number of messages to print>] [-fw <from width>] [-sw <subject width>] [-t <delay in sec> mbox}");
}
/* allowing $MAIL in the config */
if (!strcmp(mbox_mail_spool, "$MAIL")) {
strcpy(mbox_mail_spool, current_mail_spool);
}
if (stat(mbox_mail_spool, &statbuf)) {
CRIT_ERR("can't stat %s: %s", mbox_mail_spool, strerror(errno));
}
args_ok = 1; /* args-computing necessary only once */
}
/* if time_delay not yet reached, then return */
if (current_update_time - last_update < time_delay && !force_rescan)
return;
last_update = current_update_time;
/* mbox still exists? and get stat-infos */
if (stat(mbox_mail_spool, &statbuf)) {
ERR("can't stat %s: %s", mbox_mail_spool, strerror(errno));
output[0] = '\0'; /* delete any output */
return;
}
/* modification time has not changed, so skip scanning the box */
if (statbuf.st_ctime == last_ctime && statbuf.st_mtime == last_mtime && !force_rescan) {
return;
}
last_ctime = statbuf.st_ctime;
last_mtime = statbuf.st_mtime;
/* build up double-linked ring-list to hold data, while scanning down * the mbox */
struct ring_list *curr = 0, *prev = 0, *startlist = 0;
for (i = 0; i < print_mails; i++) {
curr = (struct ring_list *)malloc(sizeof(struct ring_list));
curr->from = (char *)malloc(sizeof(char[from_width + 1]));
curr->subject = (char *)malloc(sizeof(char[subject_width + 1]));
curr->from[0] = '\0';
curr->subject[0] = '\0';
if (i == 0)
startlist = curr;
if (i > 0) {
curr->previous = prev;
prev->next = curr;
}
prev = curr;
}
/* connect end to start for an endless loop-ring */
startlist->previous = curr;
curr->next = startlist;
/* mbox */
FILE *fp;
fp = fopen(mbox_mail_spool, "r");
if (!fp) {
return;
}
flag = 1; /* first find a "From " to set it to 0 for header-sarchings */
while (!feof(fp)) {
if (fgets(buf, text_buffer_size, fp) == NULL)
break;
if (strncmp(buf, "From ", 5) == 0) {
curr = curr->next;
/* skip until \n */
while (strchr(buf, '\n') == NULL && !feof(fp))
fgets(buf, text_buffer_size, fp);
flag = 0; /* in the headers now */
continue;
}
if (flag == 1) { /* in the body, so skip */
continue;
}
if (buf[0] == '\n') {
/* beyond the headers now (empty line), skip until \n */
/* then search for new mail ("From ") */
while (strchr(buf, '\n') == NULL && !feof(fp))
fgets(buf, text_buffer_size, fp);
flag = 1; /* in the body now */
continue;
}
if ((strncmp(buf, "X-Status: ", 10) == 0)
|| (strncmp(buf, "Status: R", 9) == 0)) {
/* Mail was read or something, so skip that message */
flag = 1; /* search for next From */
curr->subject[0] = '\0';
curr->from[0] = '\0';
curr = curr->previous; /* (will get current again on new * 'From ' finding) */
/* Skip until \n */
while (strchr(buf, '\n') == NULL && !feof(fp))
fgets(buf, text_buffer_size, fp);
continue;
}
/* that covers ^From: and ^from: ^From:<tab> */
if (strncmp(buf + 1, "rom:", 4) == 0) {
i = 0;
u = 6; /* no "From: " string needed, so skip */
while (1) {
if (buf[u] == '"') { /* no quotes around names */
u++;
continue;
}
if (buf[u] == '<' && i > 1) { /* some are: From: * <foo@bar.com> */
curr->from[i] = '\0';
/* skip until \n */
while (strchr(buf, '\n') == NULL && !feof(fp))
fgets(buf, text_buffer_size, fp);
break;
}
if (buf[u] == '\n') {
curr->from[i] = '\0';
break;
}
if (buf[u] == '\0') {
curr->from[i] = '\0';
break;
}
if (i >= from_width) {
curr->from[i] = '\0';
/* skip until \n */
while (strchr(buf, '\n') == NULL && !feof(fp))
fgets(buf, text_buffer_size, fp);
break;
}
/* nothing special so just set it */
curr->from[i++] = buf[u++];
}
}
/* that covers ^Subject: and ^subject: and ^Subjec:<tab> */
if (strncmp(buf + 1, "ubject:", 7) == 0) {
i = 0;
u = 9; /* no "Subject: " string needed, so skip */
while (1) {
if (buf[u] == '\n') {
curr->subject[i] = '\0';
break;
}
if (buf[u] == '\0') {
curr->subject[i] = '\0';
break;
}
if (i >= subject_width) {
curr->subject[i] = '\0';
/* skip until \n */
while (strchr(buf, '\n') == NULL && !feof(fp))
fgets(buf, text_buffer_size, fp);
break;
}
/* nothing special so just set it */
curr->subject[i++] = buf[u++];
}
}
}
fclose(fp);
output[0] = '\0';
struct ring_list *tmp;
i = print_mails;
while (i) {
if (curr->from[0] != '\0') {
if (i != print_mails) {
snprintf(buf, text_buffer_size, "\nF: %-*s S: %-*s", from_width, curr->from, subject_width, curr->subject);
} else { /* first time - no \n in front */
snprintf(buf, text_buffer_size, "F: %-*s S: %-*s", from_width, curr->from, subject_width, curr->subject);
}
} else {
snprintf(buf, text_buffer_size, "\n");
}
strncat(output, buf, max_len - strlen(output));
tmp = curr;
curr = curr->previous;
free(tmp->from);
free(tmp->subject);
free(tmp);
i--;
}
}

View File

@ -1,34 +0,0 @@
/*
* Conky, a system monitor, based on torsmo
*
* Any original torsmo code is licensed under the BSD license
*
* All code written since the fork of torsmo is licensed under the GPL
*
* Please see COPYING for details
*
* Copyright (c) 2006 Marco Candrian <mac@calmar.ws>
* Copyright (c) 2005-2007 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/>.
*
* $Id$
*/
#ifndef _MBOXSCAN_H_
#define _MBOXSCAN_H_
void mbox_scan(char *args, char *output, size_t max_len);
#endif /* _MBOXSCAN_H_ */

View File

@ -1,109 +0,0 @@
/*
* Conky, a system monitor, based on torsmo
*
* Any original torsmo code is licensed under the BSD license
*
* All code written since the fork of torsmo is licensed under the GPL
*
* Please see COPYING for details
*
* Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
* Copyright (c) 2005-2007 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/>.
*
* $Id$
*/
#include <sys/ioctl.h>
#include <errno.h>
#include <fcntl.h>
#include <string.h>
#include <stdlib.h>
#include "conky.h"
#ifdef HAVE_LINUX_SOUNDCARD_H
#include <linux/soundcard.h>
#else
#ifdef __OpenBSD__
#include <soundcard.h>
#else
#include <sys/soundcard.h>
#endif /* __OpenBSD__ */
#endif /* HAVE_LINUX_SOUNDCARD_H */
#define MIXER_DEV "/dev/mixer"
static int mixer_fd;
static const char *devs[] = SOUND_DEVICE_NAMES;
int mixer_init(const char *name)
{
unsigned int i;
if (name == 0 || name[0] == '\0')
name = "vol";
/* open mixer */
if (mixer_fd <= 0) {
mixer_fd = open(MIXER_DEV, O_RDONLY);
if (mixer_fd == -1) {
ERR("can't open %s: %s", MIXER_DEV,
strerror(errno));
return -1;
}
}
for (i = 0; i < sizeof(devs) / sizeof(const char *); i++) {
if (strcasecmp(devs[i], name) == 0) {
return i;
}
}
return -1;
}
static int mixer_get(int i)
{
static char rep = 0;
int val = -1;
if (ioctl(mixer_fd, MIXER_READ(i), &val) == -1) {
if (!rep)
ERR("mixer ioctl: %s", strerror(errno));
rep = 1;
return 0;
}
rep = 0;
return val;
}
int mixer_get_avg(int i)
{
int v = mixer_get(i);
return ((v >> 8) + (v & 0xFF)) / 2;
}
int mixer_get_left(int i)
{
return mixer_get(i) >> 8;
}
int mixer_get_right(int i)
{
return mixer_get(i) & 0xFF;
}

View File

@ -1,228 +0,0 @@
/*
* Conky, a system monitor, based on torsmo
*
* Any original torsmo code is licensed under the BSD license
*
* All code written since the fork of torsmo is licensed under the GPL
*
* Please see COPYING for details
*
* Copyright (c) 2005-2007 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/>.
*
* $Id$
*/
#include "conky.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "libmpdclient.h"
static void clear_mpd_stats(struct information *current_info)
{
if (current_info->mpd.artist == NULL)
current_info->mpd.artist = malloc(TEXT_BUFFER_SIZE);
if (current_info->mpd.album == NULL)
current_info->mpd.album = malloc(TEXT_BUFFER_SIZE);
if (current_info->mpd.title == NULL)
current_info->mpd.title = malloc(TEXT_BUFFER_SIZE);
if (current_info->mpd.random == NULL)
current_info->mpd.random = malloc(TEXT_BUFFER_SIZE);
if (current_info->mpd.repeat == NULL)
current_info->mpd.repeat = malloc(TEXT_BUFFER_SIZE);
if (current_info->mpd.track == NULL)
current_info->mpd.track = malloc(TEXT_BUFFER_SIZE);
if (current_info->mpd.status == NULL)
current_info->mpd.status = malloc(TEXT_BUFFER_SIZE);
if (current_info->mpd.name == NULL)
current_info->mpd.name = malloc(TEXT_BUFFER_SIZE);
if (current_info->mpd.file == NULL)
current_info->mpd.file = malloc(TEXT_BUFFER_SIZE);
*current_info->mpd.name=0;
*current_info->mpd.file=0;
*current_info->mpd.artist=0;
*current_info->mpd.album=0;
*current_info->mpd.title=0;
*current_info->mpd.random=0;
*current_info->mpd.repeat=0;
*current_info->mpd.track=0;
current_info->mpd.bitrate = 0;
current_info->mpd.progress = 0;
current_info->mpd.elapsed = 0;
current_info->mpd.length = 0;
}
void update_mpd()
{
struct information *current_info = &info;
if (current_info->conn == NULL) {
current_info->conn = mpd_newConnection(current_info->mpd.host, current_info->mpd.port, 10);
}
if (strlen(current_info->mpd.password) > 1) {
mpd_sendPasswordCommand(current_info->conn,
current_info->mpd.password);
mpd_finishCommand(current_info->conn);
}
// This makes sure everything we need is malloc'ed and clear
clear_mpd_stats(current_info);
if (current_info->conn->error) {
//ERR("%MPD error: s\n", current_info->conn->errorStr);
mpd_closeConnection(current_info->conn);
current_info->conn = 0;
strncpy(current_info->mpd.status, "MPD not responding", TEXT_BUFFER_SIZE - 1);
return;
}
mpd_Status *status;
mpd_InfoEntity *entity;
mpd_sendCommandListOkBegin(current_info->conn);
mpd_sendStatusCommand(current_info->conn);
mpd_sendCurrentSongCommand(current_info->conn);
mpd_sendCommandListEnd(current_info->conn);
if ((status = mpd_getStatus(current_info->conn)) == NULL) {
//ERR("MPD error: %s\n", current_info->conn->errorStr);
mpd_closeConnection(current_info->conn);
current_info->conn = 0;
strncpy(current_info->mpd.status, "MPD not responding", TEXT_BUFFER_SIZE - 1);
return;
}
current_info->mpd.volume = status->volume;
//if (status->error)
//printf("error: %s\n", status->error);
if (status->state == MPD_STATUS_STATE_PLAY) {
strncpy(current_info->mpd.status, "Playing",
TEXT_BUFFER_SIZE - 1);
}
if (status->state == MPD_STATUS_STATE_STOP) {
strncpy(current_info->mpd.status, "Stopped",
TEXT_BUFFER_SIZE - 1);
}
if (status->state == MPD_STATUS_STATE_PAUSE) {
strncpy(current_info->mpd.status, "Paused",
TEXT_BUFFER_SIZE - 1);
}
if (status->state == MPD_STATUS_STATE_UNKNOWN) {
// current_info was already cleaned up by clear_mpd_stats()
}
if (status->state == MPD_STATUS_STATE_PLAY ||
status->state == MPD_STATUS_STATE_PAUSE) {
current_info->mpd.bitrate = status->bitRate;
current_info->mpd.progress =
(float) status->elapsedTime / status->totalTime;
current_info->mpd.elapsed = status->elapsedTime;
current_info->mpd.length = status->totalTime;
if (status->random == 0) {
strcpy(current_info->mpd.random, "Off");
} else if (status->random == 1) {
strcpy(current_info->mpd.random, "On");
} else {
*current_info->mpd.random=0;
}
if (status->repeat == 0) {
strcpy(current_info->mpd.repeat, "Off");
} else if (status->repeat == 1) {
strcpy(current_info->mpd.repeat, "On");
} else {
*current_info->mpd.repeat=0;
}
}
if (current_info->conn->error) {
//fprintf(stderr, "%s\n", current_info->conn->errorStr);
mpd_closeConnection(current_info->conn);
current_info->conn = 0;
return;
}
mpd_nextListOkCommand(current_info->conn);
while ((entity = mpd_getNextInfoEntity(current_info->conn))) {
mpd_Song *song = entity->info.song;
if (entity->type != MPD_INFO_ENTITY_TYPE_SONG) {
mpd_freeInfoEntity(entity);
continue;
}
if (song->artist) {
strncpy(current_info->mpd.artist, song->artist,
TEXT_BUFFER_SIZE - 1);
} else {
*current_info->mpd.artist=0;
}
if (song->album) {
strncpy(current_info->mpd.album, song->album,
TEXT_BUFFER_SIZE - 1);
} else {
*current_info->mpd.album=0;
}
if (song->title) {
strncpy(current_info->mpd.title, song->title,
TEXT_BUFFER_SIZE - 1);
} else {
*current_info->mpd.title=0;
}
if (song->track) {
strncpy(current_info->mpd.track, song->track,
TEXT_BUFFER_SIZE - 1);
} else {
*current_info->mpd.track=0;
}
if (song->name) {
strncpy(current_info->mpd.name, song->name,
TEXT_BUFFER_SIZE - 1);
} else {
*current_info->mpd.name=0;
}
if (song->file) {
strncpy(current_info->mpd.file,
song->file, TEXT_BUFFER_SIZE - 1);
} else {
*current_info->mpd.file=0;
}
if (entity != NULL) {
mpd_freeInfoEntity(entity);
entity = NULL;
}
}
if (entity != NULL) {
mpd_freeInfoEntity(entity);
entity = NULL;
}
if (current_info->conn->error) {
//fprintf(stderr, "%s\n", current_info->conn->errorStr);
mpd_closeConnection(current_info->conn);
current_info->conn = 0;
return;
}
mpd_finishCommand(current_info->conn);
if (current_info->conn->error) {
//fprintf(stderr, "%s\n", current_info->conn->errorStr);
mpd_closeConnection(current_info->conn);
current_info->conn = 0;
return;
}
mpd_freeStatus(status);
// mpd_closeConnection(current_info->conn);
}

View File

@ -1,402 +0,0 @@
/*
* Conky, a system monitor, based on torsmo
*
* Any original torsmo code is licensed under the BSD license
*
* All code written since the fork of torsmo is licensed under the GPL
*
* Please see COPYING for details
*
* Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
* Copyright (c) 2005-2007 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/>.
*
* $Id$
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <time.h>
#include <unistd.h>
#include <err.h>
#include <limits.h>
#include <paths.h>
#include <kvm.h>
#include <nlist.h>
#include <sys/time.h>
#include <sys/param.h>
#include <sys/sysctl.h>
#include <sys/types.h>
#include <sys/user.h>
#include <sys/socket.h>
#include <sys/swap.h>
#include <sys/sched.h>
#include <sys/envsys.h>
#include <net/if.h>
#include <uvm/uvm_extern.h>
#include <machine/param.h>
#include "conky.h"
static kvm_t *kd = NULL;
int kd_init = 0, nkd_init = 0;
u_int32_t sensvalue;
char errbuf[_POSIX2_LINE_MAX];
static int init_kvm(void)
{
if (kd_init)
return 0;
kd = kvm_openfiles(NULL, NULL, NULL, KVM_NO_FILES, errbuf);
if (kd == NULL) {
(void) warnx("cannot kvm_openfiles: %s", errbuf);
return -1;
}
kd_init = 1;
return 0;
}
static int swapmode(int *retavail, int *retfree)
{
int n;
struct swapent *sep;
*retavail = 0;
*retfree = 0;
n = swapctl(SWAP_NSWAP, 0, 0);
if (n < 1) {
(void) warn("could not get swap information");
return 0;
}
sep = (struct swapent *) malloc(n * (sizeof(*sep)));
if (sep == NULL) {
(void) warn("memory allocation failed");
return 0;
}
if (swapctl(SWAP_STATS, (void *) sep, n) < n) {
(void) warn("could not get swap stats");
return 0;
}
for (; n > 0; n--) {
*retavail += (int) dbtob(sep[n - 1].se_nblks);
*retfree +=
(int) dbtob(sep[n - 1].se_nblks - sep[n - 1].se_inuse);
}
*retavail = (int) (*retavail / 1024);
*retfree = (int) (*retfree / 1024);
return 1;
}
void prepare_update()
{
}
void update_uptime()
{
int mib[2] = { CTL_KERN, KERN_BOOTTIME };
struct timeval boottime;
time_t now;
int size = sizeof(boottime);
if ((sysctl(mib, 2, &boottime, &size, NULL, 0) != -1)
&& (boottime.tv_sec != 0)) {
(void) time(&now);
info.uptime = now - boottime.tv_sec;
} else {
(void) warn("could not get uptime");
info.uptime = 0;
}
}
int check_mount(char *s)
{
/* stub */
return 0;
}
void update_meminfo()
{
int mib[] = { CTL_VM, VM_UVMEXP2 };
int total_pages, inactive_pages, free_pages;
int swap_avail, swap_free;
const int pagesize = getpagesize();
struct uvmexp_sysctl uvmexp;
size_t size = sizeof(uvmexp);
info.memmax = info.mem = 0;
info.swapmax = info.swap = 0;
if (sysctl(mib, 2, &uvmexp, &size, NULL, 0) < 0) {
warn("could not get memory info");
return;
}
total_pages = uvmexp.npages;
free_pages = uvmexp.free;
inactive_pages = uvmexp.inactive;
info.memmax = (total_pages * pagesize) >> 10;
info.mem =
((total_pages - free_pages - inactive_pages) * pagesize) >> 10;
if (swapmode(&swap_avail, &swap_free) >= 0) {
info.swapmax = swap_avail;
info.swap = (swap_avail - swap_free);
}
}
void update_net_stats()
{
int i;
double delta;
struct ifnet ifnet;
struct ifnet_head ifhead; /* interfaces are in a tail queue */
u_long ifnetaddr;
static struct nlist namelist[] = {
{"_ifnet"},
{NULL},
};
static kvm_t *nkd;
if (!nkd_init) {
nkd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf);
if (nkd == NULL) {
(void) warnx("cannot kvm_openfiles: %s", errbuf);
(void)
warnx
("maybe you need to setgid kmem this program?");
return;
} else if (kvm_nlist(nkd, namelist) != 0) {
(void) warn("cannot kvm_nlist");
return;
} else
nkd_init = 1;
}
if (kvm_read(nkd, (u_long) namelist[0].n_value, (void *) &ifhead,
sizeof(ifhead)) < 0) {
(void) warn("cannot kvm_read");
return;
}
/* get delta */
delta = current_update_time - last_update_time;
if (delta <= 0.0001)
return;
for (i = 0, ifnetaddr = (u_long) ifhead.tqh_first;
ifnet.if_list.tqe_next && i < 16;
ifnetaddr = (u_long) ifnet.if_list.tqe_next, i++) {
struct net_stat *ns;
long long last_recv, last_trans;
(void) kvm_read(nkd, (u_long) ifnetaddr, (void *) &ifnet,
sizeof(ifnet));
ns = get_net_stat(ifnet.if_xname);
ns->up = 1;
last_recv = ns->recv;
last_trans = ns->trans;
if (ifnet.if_ibytes < ns->last_read_recv)
ns->recv +=
((long long) 4294967295U -
ns->last_read_recv) + ifnet.if_ibytes;
else
ns->recv += (ifnet.if_ibytes - ns->last_read_recv);
ns->last_read_recv = ifnet.if_ibytes;
if (ifnet.if_obytes < ns->last_read_trans)
ns->trans +=
((long long) 4294967295U -
ns->last_read_trans) + ifnet.if_obytes;
else
ns->trans +=
(ifnet.if_obytes - ns->last_read_trans);
ns->last_read_trans = ifnet.if_obytes;
ns->recv += (ifnet.if_ibytes - ns->last_read_recv);
ns->last_read_recv = ifnet.if_ibytes;
ns->trans += (ifnet.if_obytes - ns->last_read_trans);
ns->last_read_trans = ifnet.if_obytes;
ns->recv_speed = (ns->recv - last_recv) / delta;
ns->trans_speed = (ns->trans - last_trans) / delta;
}
}
void update_total_processes()
{
/* It's easier to use kvm here than sysctl */
int n_processes;
info.procs = 0;
if (init_kvm() < 0)
return;
else
kvm_getproc2(kd, KERN_PROC_ALL, 0,
sizeof(struct kinfo_proc2), &n_processes);
info.procs = n_processes;
}
void update_running_processes()
{
struct kinfo_proc2 *p;
int n_processes;
int i, cnt = 0;
info.run_procs = 0;
if (init_kvm() < 0)
return;
else {
p = kvm_getproc2(kd, KERN_PROC_ALL, 0,
sizeof(struct kinfo_proc2), &n_processes);
for (i = 0; i < n_processes; i++)
if (p[i].p_stat == LSRUN || p[i].p_stat == LSIDL ||
p[i].p_stat == LSONPROC)
cnt++;
}
info.run_procs = cnt;
}
struct cpu_load_struct {
unsigned long load[5];
};
struct cpu_load_struct fresh = {
{0, 0, 0, 0, 0}
};
long cpu_used, oldtotal, oldused;
void update_cpu_usage()
{
long used, total;
static u_int64_t cp_time[CPUSTATES];
size_t len = sizeof(cp_time);
info.cpu_usage = 0;
if (sysctlbyname("kern.cp_time", &cp_time, &len, NULL, 0) < 0)
(void) warn("cannot get kern.cp_time");
fresh.load[0] = cp_time[CP_USER];
fresh.load[1] = cp_time[CP_NICE];
fresh.load[2] = cp_time[CP_SYS];
fresh.load[3] = cp_time[CP_IDLE];
fresh.load[4] = cp_time[CP_IDLE];
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 =
((double) (used - oldused)) / (double) (total -
oldtotal);
else
info.cpu_usage = 0;
oldused = used;
oldtotal = total;
}
double get_sysbus_info(int *fd, int div, char *devtype)
{
return -1;
}
void update_load_average()
{
double v[3];
getloadavg(v, 3);
info.loadavg[0] = (float) v[0];
info.loadavg[1] = (float) v[1];
info.loadavg[2] = (float) v[2];
}
double get_acpi_temperature(int fd)
{
return -1;
}
void get_battery_stuff(char *buf, unsigned int n, const char *bat, int item)
{
}
int
open_sysbus_sensor(const char *dir, const char *dev, const char *type, int n, int *div, char *devtype)
{
return -1;
}
int open_acpi_temperature(const char *name)
{
return -1;
}
void get_acpi_ac_adapter( char * p_client_buffer, size_t client_buffer_size )
{
if ( !p_client_buffer || client_buffer_size <= 0 )
return;
/* not implemented */
memset(p_client_buffer,0,client_buffer_size);
return;
}
/*char *get_acpi_fan()*/
void get_acpi_fan( char * p_client_buffer, size_t client_buffer_size )
{
if ( !p_client_buffer || client_buffer_size <= 0 )
return;
/* not implemented */
memset(p_client_buffer,0,client_buffer_size);
return;
}
void update_entropy (void)
{
}

View File

@ -1,841 +0,0 @@
/*
* Conky, a system monitor, based on torsmo
*
* Any original torsmo code is licensed under the BSD license
*
* All code written since the fork of torsmo is licensed under the GPL
*
* Please see COPYING for details
*
* Copyright (c) 2007 Toni Spets
* Copyright (c) 2005-2007 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/>.
*
* $Id$
*/
#include <sys/dkstat.h>
#include <sys/param.h>
#include <sys/resource.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/vmmeter.h>
#include <sys/user.h>
#include <sys/ioctl.h>
#include <sys/sensors.h>
#include <sys/malloc.h>
#include <sys/swap.h>
#include <kvm.h>
#include <net/if.h>
#include <net/if_media.h>
#include <netinet/in.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <ifaddrs.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <machine/apmvar.h>
#include <net80211/ieee80211.h>
#include <net80211/ieee80211_ioctl.h>
#include "conky.h"
#define MAXSHOWDEVS 16
#define LOG1024 10
#define pagetok(size) ((size) << pageshift)
inline void proc_find_top(struct process **cpu, struct process **mem);
static short cpu_setup = 0;
static kvm_t *kd = 0;
struct ifmibdata *data = NULL;
size_t len = 0;
int init_kvm = 0;
int init_sensors = 0;
static int kvm_init()
{
if(init_kvm)
return 1;
kd = kvm_open(NULL, NULL, NULL, KVM_NO_FILES, NULL);
if(kd == NULL)
ERR("error opening kvm");
else init_kvm = 1;
return 1;
}
/* note: swapmode taken from 'top' source */
/*
* swapmode is rewritten by Tobias Weingartner <weingart@openbsd.org>
* to be based on the new swapctl(2) system call.
*/
static int
swapmode(int *used, int *total)
{
struct swapent *swdev;
int nswap, rnswap, i;
nswap = swapctl(SWAP_NSWAP, 0, 0);
if (nswap == 0)
return 0;
swdev = malloc(nswap * sizeof(*swdev));
if (swdev == NULL)
return 0;
rnswap = swapctl(SWAP_STATS, swdev, nswap);
if (rnswap == -1)
return 0;
/* if rnswap != nswap, then what? */
/* Total things up */
*total = *used = 0;
for (i = 0; i < nswap; i++) {
if (swdev[i].se_flags & SWF_ENABLE) {
*used += (swdev[i].se_inuse / (1024 / DEV_BSIZE));
*total += (swdev[i].se_nblks / (1024 / DEV_BSIZE));
}
}
free(swdev);
return 1;
}
int check_mount(char *s)
{
/* stub */
return 0;
}
void
update_uptime()
{
int mib[2] = { CTL_KERN, KERN_BOOTTIME };
struct timeval boottime;
time_t now;
size_t size = sizeof (boottime);
if ((sysctl(mib, 2, &boottime, &size, NULL, 0) != -1) &&
(boottime.tv_sec != 0)) {
time(&now);
info.uptime = now - boottime.tv_sec;
} else {
ERR("Could not get uptime");
info.uptime = 0;
}
}
void
update_meminfo()
{
static int mib[2] = {CTL_VM, VM_METER};
struct vmtotal vmtotal;
size_t size;
int pagesize, pageshift, swap_avail, swap_used;
pagesize = getpagesize();
pageshift = 0;
while (pagesize > 1) {
pageshift++;
pagesize >>= 1;
}
/* we only need the amount of log(2)1024 for our conversion */
pageshift -= LOG1024;
/* get total -- systemwide main memory usage structure */
size = sizeof(vmtotal);
if (sysctl(mib, 2, &vmtotal, &size, NULL, 0) < 0) {
warn("sysctl failed");
bzero(&vmtotal, sizeof(vmtotal));
}
info.memmax = pagetok(vmtotal.t_rm) + pagetok(vmtotal.t_free);
info.mem = pagetok(vmtotal.t_rm);
if ((swapmode(&swap_used, &swap_avail)) >= 0) {
info.swapmax = swap_avail;
info.swap = swap_used;
} else {
info.swapmax = 0;
info.swap = 0;
}
}
void
update_net_stats()
{
struct net_stat *ns;
double delta;
long long r, t, last_recv, last_trans;
struct ifaddrs *ifap, *ifa;
struct if_data *ifd;
/* get delta */
delta = current_update_time - last_update_time;
if (delta <= 0.0001)
return;
if (getifaddrs(&ifap) < 0)
return;
for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
ns = get_net_stat((const char *) ifa->ifa_name);
if (ifa->ifa_flags & IFF_UP) {
struct ifaddrs *iftmp;
ns->up = 1;
last_recv = ns->recv;
last_trans = ns->trans;
if (ifa->ifa_addr->sa_family != AF_LINK)
continue;
for (iftmp = ifa->ifa_next; iftmp != NULL &&
strcmp(ifa->ifa_name, iftmp->ifa_name) == 0;
iftmp = iftmp->ifa_next)
if (iftmp->ifa_addr->sa_family == AF_INET)
memcpy(&(ns->addr), iftmp->ifa_addr,
iftmp->ifa_addr->sa_len);
ifd = (struct if_data *) ifa->ifa_data;
r = ifd->ifi_ibytes;
t = ifd->ifi_obytes;
if (r < ns->last_read_recv)
ns->recv +=
((long long) 4294967295U -
ns->last_read_recv) + r;
else
ns->recv += (r - ns->last_read_recv);
ns->last_read_recv = r;
if (t < ns->last_read_trans)
ns->trans +=
((long long) 4294967295U -
ns->last_read_trans) + t;
else
ns->trans += (t - ns->last_read_trans);
ns->last_read_trans = t;
/* calculate speeds */
ns->recv_speed = (ns->recv - last_recv) / delta;
ns->trans_speed = (ns->trans - last_trans) / delta;
} else {
ns->up = 0;
}
}
freeifaddrs(ifap);
}
void
update_total_processes()
{
int n_processes;
kvm_init();
kvm_getprocs(kd, KERN_PROC_ALL, 0, &n_processes);
info.procs = n_processes;
}
void
update_running_processes()
{
struct kinfo_proc2 *p;
int n_processes;
int i, cnt = 0;
kvm_init();
int max_size = sizeof(struct kinfo_proc2);
p = kvm_getproc2(kd, KERN_PROC_ALL, 0, max_size, &n_processes);
for (i = 0; i < n_processes; i++) {
if (p[i].p_stat == SRUN)
cnt++;
}
info.run_procs = cnt;
}
struct cpu_load_struct {
unsigned long load[5];
};
struct cpu_load_struct fresh = { {0, 0, 0, 0, 0} };
long cpu_used, oldtotal, oldused;
void
get_cpu_count()
{
/*
* FIXME: is it possible to get per cpu stats with openbsd?
*/
#if 0
int cpu_count = 0;
int mib[2] = { CTL_HW, HW_NCPU };
size_t len = sizeof(cpu_count);
if (sysctl(mib, 2, &cpu_count, &len, NULL, 0) == 0)
info.cpu_count = cpu_count;
else /* last resort, 1 cpu */
#endif
info.cpu_count = 1;
info.cpu_usage = malloc(info.cpu_count * sizeof (float));
if (info.cpu_usage == NULL)
CRIT_ERR("malloc");
}
void
update_cpu_usage()
{
int mib[2] = { CTL_KERN, KERN_CPTIME };
long used, total;
long cp_time[CPUSTATES];
size_t len = sizeof (cp_time);
/* 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;
}
if (sysctl(mib, 2, &cp_time, &len, NULL, 0) < 0) {
ERR("Cannot get kern.cp_time");
}
fresh.load[0] = cp_time[CP_USER];
fresh.load[1] = cp_time[CP_NICE];
fresh.load[2] = cp_time[CP_SYS];
fresh.load[3] = cp_time[CP_IDLE];
fresh.load[4] = cp_time[CP_IDLE];
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);
} else {
info.cpu_usage[0] = 0;
}
oldused = used;
oldtotal = total;
}
void
update_load_average()
{
double v[3];
getloadavg(v, 3);
info.loadavg[0] = (float) v[0];
info.loadavg[1] = (float) v[1];
info.loadavg[2] = (float) v[2];
}
/* read sensors from sysctl */
void update_obsd_sensors()
{
int sensor_cnt, dev, numt, mib[5] = { CTL_HW, HW_SENSORS, 0, 0, 0 };
struct sensor sensor;
struct sensordev sensordev;
size_t slen,sdlen;
enum sensor_type type;
slen = sizeof(sensor);
sdlen = sizeof(sensordev);
sensor_cnt = 0;
dev = obsd_sensors.device; // FIXME: read more than one device
/* for (dev = 0; dev < MAXSENSORDEVICES; dev++) { */
mib[2] = dev;
if(sysctl(mib, 3, &sensordev, &sdlen, NULL, 0) == -1) {
if (errno != ENOENT)
warn("sysctl");
return;
//continue;
}
for (type = 0; type < SENSOR_MAX_TYPES; type++) {
mib[3] = type;
for (numt = 0; numt < sensordev.maxnumt[type]; numt++) {
mib[4] = numt;
if (sysctl(mib, 5, &sensor, &slen, NULL, 0)
== -1) {
if (errno != ENOENT)
warn("sysctl");
continue;
}
if (sensor.flags & SENSOR_FINVALID)
continue;
switch (type) {
case SENSOR_TEMP:
obsd_sensors.temp[dev][sensor.numt] = (sensor.value - 273150000) / 1000000.0;
break;
case SENSOR_FANRPM:
obsd_sensors.fan[dev][sensor.numt] = sensor.value;
break;
case SENSOR_VOLTS_DC:
obsd_sensors.volt[dev][sensor.numt] = sensor.value/1000000.0;
break;
default:
break;
}
sensor_cnt++;
}
}
/* } */
init_sensors = 1;
}
/* chipset vendor */
void get_obsd_vendor(char *buf, size_t client_buffer_size)
{
int mib[2];
mib[0] = CTL_HW;
mib[1] = HW_VENDOR;
char vendor[64];
size_t size = sizeof(vendor);
if(sysctl(mib, 2, vendor, &size, NULL, 0) == -1) {
ERR("error reading vendor");
snprintf(buf, client_buffer_size, "unknown");
} else {
snprintf(buf, client_buffer_size, "%s", vendor);
}
}
/* chipset name */
void get_obsd_product(char *buf, size_t client_buffer_size)
{
int mib[2];
mib[0] = CTL_HW;
mib[1] = HW_PRODUCT;
char product[64];
size_t size = sizeof(product);
if(sysctl(mib, 2, product, &size, NULL, 0) == -1) {
ERR("error reading product");
snprintf(buf, client_buffer_size, "unknown");
} else {
snprintf(buf, client_buffer_size, "%s", product);
}
}
/* rdtsc() and get_freq_dynamic() copied from linux.c */
#if defined(__i386) || defined(__x86_64)
__inline__ unsigned long long int
rdtsc()
{
unsigned long long int x;
__asm__ volatile(".byte 0x0f, 0x31":"=A" (x));
return (x);
}
#endif
/* return system frequency in MHz (use divisor=1) or GHz (use divisor=1000) */
void
get_freq_dynamic(char *p_client_buffer, size_t client_buffer_size,
char *p_format, int divisor)
{
#if defined(__i386) || defined(__x86_64)
struct timezone tz;
struct timeval tvstart, tvstop;
unsigned long long cycles[2]; /* gotta be 64 bit */
unsigned int microseconds; /* total time taken */
memset(&tz, 0, sizeof (tz));
/* get this function in cached memory */
gettimeofday(&tvstart, &tz);
cycles[0] = rdtsc();
gettimeofday(&tvstart, &tz);
/* we don't trust that this is any specific length of time */
usleep(100);
cycles[1] = rdtsc();
gettimeofday(&tvstop, &tz);
microseconds = ((tvstop.tv_sec - tvstart.tv_sec) * 1000000) +
(tvstop.tv_usec - tvstart.tv_usec);
snprintf(p_client_buffer, client_buffer_size, p_format,
(float)((cycles[1] - cycles[0]) / microseconds) / divisor);
#else
get_freq(p_client_buffer, client_buffer_size, p_format, divisor);
#endif
}
/*void*/
char
get_freq(char *p_client_buffer, size_t client_buffer_size,
char *p_format, int divisor, unsigned int cpu)
{
int freq = cpu;
int mib[2] = { CTL_HW, HW_CPUSPEED };
if (!p_client_buffer || client_buffer_size <= 0 ||
!p_format || divisor <= 0)
return 0;
size_t size = sizeof(freq);
if(sysctl(mib, 2, &freq, &size, NULL, 0) == 0)
snprintf(p_client_buffer, client_buffer_size,
p_format, (float)freq/divisor);
else
snprintf(p_client_buffer, client_buffer_size, p_format, 0.0f);
return 1;
}
void
update_top()
{
proc_find_top(info.cpu, info.memu);
}
#if 0
/* deprecated, will rewrite this soon in update_net_stats() -hifi */
void
update_wifi_stats()
{
struct net_stat * ns;
struct ifaddrs *ifap, *ifa;
struct ifmediareq ifmr;
struct ieee80211_nodereq nr;
struct ieee80211_bssid bssid;
int s,ibssid;
/*
* Get iface table
*/
if (getifaddrs(&ifap) < 0)
return;
for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
ns = get_net_stat((const char *) ifa->ifa_name);
s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
/* Get media type */
bzero(&ifmr, sizeof(ifmr));
strlcpy(ifmr.ifm_name, ifa->ifa_name, IFNAMSIZ);
if (ioctl(s, SIOCGIFMEDIA, (caddr_t) &ifmr) < 0)
goto cleanup;
/*
* We can monitor only wireless interfaces
* which not in hostap mode
*/
if ((ifmr.ifm_active & IFM_IEEE80211) &&
!(ifmr.ifm_active & IFM_IEEE80211_HOSTAP)) {
/* Get wi status */
memset(&bssid, 0, sizeof(bssid));
strlcpy(bssid.i_name, ifa->ifa_name, sizeof(bssid.i_name));
ibssid = ioctl(s, SIOCG80211BSSID, &bssid);
bzero(&nr, sizeof(nr));
bcopy(bssid.i_bssid, &nr.nr_macaddr, sizeof(nr.nr_macaddr));
strlcpy(nr.nr_ifname, ifa->ifa_name, sizeof(nr.nr_ifname));
if (ioctl(s, SIOCG80211NODE, &nr) == 0 && nr.nr_rssi)
ns->linkstatus = nr.nr_rssi;
}
cleanup:
close(s);
}
}
#endif
void
update_diskio()
{
return; /* XXX implement? hifi: not sure how */
}
/*
* While topless is obviously better, top is also not bad.
*/
int
comparecpu(const void *a, const void *b)
{
if (((struct process *)a)->amount > ((struct process *)b)->amount)
return (-1);
if (((struct process *)a)->amount < ((struct process *)b)->amount)
return (1);
return (0);
}
int
comparemem(const void *a, const void *b)
{
if (((struct process *)a)->totalmem > ((struct process *)b)->totalmem)
return (-1);
if (((struct process *)a)->totalmem < ((struct process *)b)->totalmem)
return (1);
return (0);
}
inline void
proc_find_top(struct process **cpu, struct process **mem)
{
struct kinfo_proc2 *p;
int n_processes;
int i, j = 0;
struct process *processes;
int mib[2];
int total_pages;
int pagesize = getpagesize();
/* we get total pages count again to be sure it is up to date */
mib[0] = CTL_HW;
mib[1] = HW_USERMEM;
size_t size = sizeof(total_pages);
if(sysctl(mib, 2, &total_pages, &size, NULL, 0) == -1)
ERR("error reading nmempages");
int max_size = sizeof(struct kinfo_proc2);
p = kvm_getproc2(kd, KERN_PROC_ALL, 0, max_size, &n_processes);
processes = malloc(n_processes * sizeof (struct process));
for (i = 0; i < n_processes; i++) {
if (!((p[i].p_flag & P_SYSTEM)) &&
p[i].p_comm != NULL) {
processes[j].pid = p[i].p_pid;
processes[j].name = strdup(p[i].p_comm);
processes[j].amount = 100.0 *
p[i].p_pctcpu / FSCALE;
processes[j].totalmem = (float)(p[i].p_vm_rssize * pagesize /
(float)total_pages) * 100.0;
j++;
}
}
qsort(processes, j - 1, sizeof (struct process), comparemem);
for (i = 0; i < 10; i++) {
struct process *tmp, *ttmp;
tmp = malloc(sizeof (struct process));
tmp->pid = processes[i].pid;
tmp->amount = processes[i].amount;
tmp->totalmem = processes[i].totalmem;
tmp->name = strdup(processes[i].name);
ttmp = mem[i];
mem[i] = tmp;
if (ttmp != NULL) {
free(ttmp->name);
free(ttmp);
}
}
qsort(processes, j - 1, sizeof (struct process), comparecpu);
for (i = 0; i < 10; i++) {
struct process *tmp, *ttmp;
tmp = malloc(sizeof (struct process));
tmp->pid = processes[i].pid;
tmp->amount = processes[i].amount;
tmp->totalmem = processes[i].totalmem;
tmp->name = strdup(processes[i].name);
ttmp = cpu[i];
cpu[i] = tmp;
if (ttmp != NULL) {
free(ttmp->name);
free(ttmp);
}
}
for (i = 0; i < j; free(processes[i++].name));
free(processes);
}
#if defined(i386) || defined(__i386__)
#define APMDEV "/dev/apm"
#define APM_UNKNOWN 255
int
apm_getinfo(int fd, apm_info_t aip)
{
if (ioctl(fd, APM_IOC_GETPOWER, aip) == -1)
return (-1);
return (0);
}
char
*get_apm_adapter()
{
int fd;
struct apm_power_info info;
char *out;
out = (char *)calloc(16, sizeof (char));
fd = open(APMDEV, O_RDONLY);
if (fd < 0) {
strncpy(out, "ERR", 16);
return (out);
}
if (apm_getinfo(fd, &info) != 0) {
close(fd);
strncpy(out, "ERR", 16);
return (out);
}
close(fd);
switch (info.ac_state) {
case APM_AC_OFF:
strncpy(out, "off-line", 16);
return (out);
break;
case APM_AC_ON:
if (info.battery_state == APM_BATT_CHARGING) {
strncpy(out, "charging", 16);
return (out);
} else {
strncpy(out, "on-line", 16);
return (out);
}
break;
default:
strncpy(out, "unknown", 16);
return (out);
break;
}
}
char
*get_apm_battery_life()
{
int fd;
u_int batt_life;
struct apm_power_info info;
char *out;
out = (char *)calloc(16, sizeof (char));
fd = open(APMDEV, O_RDONLY);
if (fd < 0) {
strncpy(out, "ERR", 16);
return (out);
}
if (apm_getinfo(fd, &info) != 0) {
close(fd);
strncpy(out, "ERR", 16);
return (out);
}
close(fd);
batt_life = info.battery_life;
if (batt_life <= 100) {
snprintf(out, 16, "%d%%", batt_life);
return (out);
} else
strncpy(out, "ERR", 16);
return (out);
}
char
*get_apm_battery_time()
{
int fd;
int batt_time;
int h, m;
struct apm_power_info info;
char *out;
out = (char *)calloc(16, sizeof (char));
fd = open(APMDEV, O_RDONLY);
if (fd < 0) {
strncpy(out, "ERR", 16);
return (out);
}
if (apm_getinfo(fd, &info) != 0) {
close(fd);
strncpy(out, "ERR", 16);
return (out);
}
close(fd);
batt_time = info.minutes_left;
if (batt_time == -1)
strncpy(out, "unknown", 16);
else {
h = batt_time / 60;
m = batt_time % 60;
snprintf(out, 16, "%2d:%02d", h, m);
}
return (out);
}
#endif
/* empty stubs so conky links */
void
prepare_update()
{
return;
}
void update_entropy (void)
{
return;
}
void
free_all_processes(void)
{
return;
}

View File

@ -1,225 +0,0 @@
/*
* $Id$
*
* Copyright (c) 2007 Mikko Sysikaski <mikko.sysikaski@gmail.com>
* Toni Spets <toni.spets@gmail.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "prss.h"
#include "config.h"
#ifndef PARSE_OPTIONS
#define PARSE_OPTIONS 0
#endif
PRSS* prss_parse_doc(xmlDocPtr doc);
PRSS* prss_parse_data(const char* xml_data)
{
xmlDocPtr doc = xmlReadMemory(xml_data, strlen(xml_data), "", NULL, PARSE_OPTIONS);
if (!doc)
return NULL;
return prss_parse_doc(doc);
}
PRSS* prss_parse_file(const char* xml_file)
{
xmlDocPtr doc = xmlReadFile(xml_file, NULL, PARSE_OPTIONS);
if (!doc)
return NULL;
return prss_parse_doc(doc);
}
void prss_free(PRSS* data)
{
if (!data)
return;
xmlFreeDoc(data->_data);
free(data->version);
free(data->items);
free(data);
}
static inline void prss_null(PRSS* p)
{
memset(p, 0, sizeof(PRSS));
}
static inline void prss_null_item(PRSS_Item* i)
{
memset(i, 0, sizeof(PRSS_Item));
}
static inline void read_item(PRSS_Item* res, xmlNodePtr data)
{
prss_null_item(res);
res->title = res->link = res->description = NULL;
for(; data; data = data->next) {
if (data->type != XML_ELEMENT_NODE)
continue;
xmlNodePtr child = data->children;
if (!child)
continue;
if (!strcasecmp((char*)data->name, "title")) {
res->title = (char*)child->content;
} else if (!strcasecmp((char*)data->name, "link")) {
res->link = (char*)child->content;
} else if (!strcasecmp((char*)data->name, "description")) {
res->description = (char*)child->content;
} else if (!strcasecmp((char*)data->name, "category")) {
res->category = (char*)child->content;
} else if (!strcasecmp((char*)data->name, "pubDate")) {
res->pubdate = (char*)child->content;
} else if (!strcasecmp((char*)data->name, "guid")) {
res->guid = (char*)child->content;
}
}
}
static inline void read_element(PRSS* res, xmlNodePtr n)
{
if (n->type != XML_ELEMENT_NODE)
return;
xmlNodePtr child = n->children;
if (!child)
return;
if (!strcasecmp((char*)n->name, "title")) {
res->title = (char*)child->content;
} else if (!strcasecmp((char*)n->name, "link")) {
res->link = (char*)child->content;
} else if (!strcasecmp((char*)n->name, "description")) {
res->description = (char*)child->content;
} else if (!strcasecmp((char*)n->name, "language")) {
res->language = (char*)child->content;
} else if (!strcasecmp((char*)n->name, "pubDate")) {
res->pubdate = (char*)child->content;
} else if (!strcasecmp((char*)n->name, "lastBuildDate")) {
res->lastbuilddate = (char*)child->content;
} else if (!strcasecmp((char*)n->name, "generator")) {
res->generator = (char*)child->content;
} else if (!strcasecmp((char*)n->name, "docs")) {
res->docs = (char*)child->content;
} else if (!strcasecmp((char*)n->name, "managingEditor")) {
res->managingeditor = (char*)child->content;
} else if (!strcasecmp((char*)n->name, "webMaster")) {
res->webmaster = (char*)child->content;
} else if (!strcasecmp((char*)n->name, "copyright")) {
res->copyright = (char*)child->content;
} else if (!strcasecmp((char*)n->name, "ttl")) {
res->ttl = (char*)child->content;
} else if (!strcasecmp((char*)n->name, "item")) {
read_item(&res->items[res->item_count++], n->children);
}
}
static inline int parse_rss_2_0(PRSS* res, xmlNodePtr root)
{
xmlNodePtr channel = root->children;
while(channel
&& (channel->type!=XML_ELEMENT_NODE
|| strcmp((char*)channel->name, "channel")))
channel = channel->next;
if (!channel)
return 0;
int items = 0;
xmlNodePtr n;
for(n = channel->children; n; n = n->next)
if (n->type==XML_ELEMENT_NODE && !strcmp((char*)n->name, "item"))
++items;
res->version = strdup("2.0");
res->items = malloc(items*sizeof(PRSS_Item));
res->item_count = 0;
for(n = channel->children; n; n = n->next) {
read_element(res, n);
}
return 1;
}
static inline int parse_rss_1_0(PRSS* res, xmlNodePtr root)
{
int items = 0;
xmlNodePtr n;
for(n = root->children; n; n = n->next) {
if (n->type==XML_ELEMENT_NODE) {
if (!strcmp((char*)n->name, "item"))
++items;
else if (!strcmp((char*)n->name, "channel")) {
xmlNodePtr i;
for(i = n->children; i; i = i->next) {
read_element(res, i);
}
}
}
}
res->version = strdup("1.0");
res->items = malloc(items*sizeof(PRSS_Item));
res->item_count = 0;
for(n = root->children; n; n = n->next) {
if (n->type==XML_ELEMENT_NODE && !strcmp((char*)n->name, "item"))
read_item(&res->items[res->item_count++], n->children);
}
return 1;
}
static inline int parse_rss_0_9x(PRSS* res, xmlNodePtr root)
{
// almost same...
return parse_rss_2_0(res, root);
}
PRSS* prss_parse_doc(xmlDocPtr doc)
{
// FIXME: doc shouldn't be freed after failure when called explicitly from program!
xmlNodePtr root = xmlDocGetRootElement(doc);
PRSS* result = malloc(sizeof(PRSS));
prss_null(result);
result->_data = doc;
do {
if (root->type == XML_ELEMENT_NODE) {
if (!strcmp((char*)root->name, "RDF")) {
// RSS 1.0 document
if (!parse_rss_1_0(result, root)) {
free(result);
xmlFreeDoc(doc);
return NULL;
}
return result;
} else if (!strcmp((char*)root->name, "rss")) {
// RSS 2.0 or <1.0 document
if (!parse_rss_2_0(result, root)) {
free(result);
xmlFreeDoc(doc);
return NULL;
}
return result;
}
}
root = root->next;
} while(root);
free(result);
return NULL;
}

View File

@ -1,67 +0,0 @@
/*
* $Id$
*
* Copyright (c) 2007 Mikko Sysikaski <mikko.sysikaski@gmail.com>
* Toni Spets <toni.spets@gmail.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef PRSS_H
#define PRSS_H
#include <libxml/parser.h>
typedef struct PRSS_Item_ {
char* title;
char* link;
char* description;
char* category;
char* pubdate;
char* guid;
} PRSS_Item;
typedef struct PRSS_ {
xmlDocPtr _data;
char* version;
char* title;
char* link;
char* description;
char* language;
char* generator;
char* managingeditor;
char* webmaster;
char* docs;
char* lastbuilddate;
char* pubdate;
char* copyright;
char* ttl;
PRSS_Item* items;
int item_count;
} PRSS;
/* Functions for parsing RSS-data */
PRSS* prss_parse_data(const char *xml_data);
PRSS* prss_parse_file(const char *xml_file);
// Works wrong currently when called from application!
//PRSS* prss_parse_doc(xmlDocPtr doc);
/* Frees the PRSS-stucture returned by prss_parse_*.
* The memory area pointed by data becomes invalid
* after call to this function. */
void prss_free(PRSS* data);
#endif // PRSS_H

View File

@ -1,175 +0,0 @@
/*
* Conky, a system monitor, based on torsmo
*
* Any original torsmo code is licensed under the BSD license
*
* All code written since the fork of torsmo is licensed under the GPL
*
* Please see COPYING for details
*
* Copyright (c) 2007 Toni Spets
* Copyright (c) 2005-2007 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/>.
*
* $Id$
*/
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <assert.h>
#include "prss.h"
#include <curl/curl.h>
#include <curl/types.h>
#include <curl/easy.h>
#include "conky.h"
#define MAX_FEEDS 16
struct MemoryStruct {
char *memory;
size_t size;
};
typedef struct feed_ {
char* uri;
int last_update;
PRSS* data;
} feed;
int num_feeds = 0;
feed feeds[MAX_FEEDS];
size_t
WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data)
{
size_t realsize = size * nmemb;
struct MemoryStruct *mem = (struct MemoryStruct *)data;
mem->memory = (char *)realloc(mem->memory, mem->size + realsize + 1);
if (mem->memory) {
memcpy(&(mem->memory[mem->size]), ptr, realsize);
mem->size += realsize;
mem->memory[mem->size] = 0;
}
return realsize;
}
int rss_delay(int *wait, int delay)
{
time_t now = time(NULL);
// make it minutes
if(delay < 1) delay = 1;
delay *= 60;
if(!*wait) {
*wait = now + delay;
return 1;
}
if(now >= *wait + delay) {
*wait = now + delay;
return 1;
}
return 0;
}
void init_rss_info()
{
int i;
for(i = 0; i < MAX_FEEDS; i++) {
feeds[i].uri = NULL;
feeds[i].data = NULL;
feeds[i].last_update = 0;
}
}
void free_rss_info()
{
int i;
for(i = 0; i < num_feeds; i++)
if(feeds[i].uri != NULL)
free(feeds[i].uri);
}
PRSS*
get_rss_info(char *uri, int delay)
{
CURL *curl = NULL;
CURLcode res;
// curl temps
struct MemoryStruct chunk;
chunk.memory = NULL;
chunk.size = 0;
// pointers to struct
feed *curfeed = NULL;
PRSS *curdata = NULL;
int *last_update = 0;
int i;
// first seek for the uri in list
for(i = 0; i < num_feeds; i++) {
if(feeds[i].uri != NULL)
if(!strcmp(feeds[i].uri, uri)) {
curfeed = &feeds[i];
break;
}
}
if(!curfeed) { // new feed
if(num_feeds == MAX_FEEDS-1) return NULL;
curfeed = &feeds[num_feeds];
curfeed->uri = strdup(uri);
num_feeds++;
}
last_update = &curfeed->last_update;
curdata = curfeed->data;
if(!rss_delay(last_update, delay))
return curdata; // wait for delay to pass
if(curdata != NULL) {
prss_free(curdata); // clean up old data
curdata = NULL;
}
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, uri);
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&chunk);
curl_easy_setopt(curl, CURLOPT_USERAGENT, "conky-rss/1.0");
res = curl_easy_perform(curl);
if(chunk.size) {
curdata = prss_parse_data(chunk.memory);
free(chunk.memory);
} else
ERR("No data from server");
curl_easy_cleanup(curl);
}
curfeed->data = curdata;
return curdata;
}

View File

@ -1,85 +0,0 @@
/*
* Conky, a system monitor, based on torsmo
*
* Any original torsmo code is licensed under the BSD license
*
* All code written since the fork of torsmo is licensed under the GPL
*
* Please see COPYING for details
*
* Copyright (c) 2005-2007 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/>.
*
* $Id$
*/
/* doesn't work, feel free to finish this */
#include "conky.h"
#include <kstat.h>
static kstat_ctl_t *kstat;
static int kstat_updated;
static void update_kstat()
{
if (kstat == NULL) {
kstat = kstat_open();
if (kstat == NULL) {
ERR("can't open kstat: %s", strerror(errno));
}
}
if (kstat_chain_update(kstat) == -1) {
perror("kstat_chain_update");
return;
}
}
void prepare_update()
{
kstat_updated = 0;
}
double get_uptime()
{
kstat_t *ksp;
update_kstat();
ksp = kstat_lookup(kstat, "unix", -1, "system_misc");
if (ksp != NULL) {
if (kstat_read(kstat, ksp, NULL) >= 0) {
kstat_named_t *knp;
knp =
(kstat_named_t *) kstat_data_lookup(ksp,
"boot_time");
if (knp != NULL) {
return get_time() -
(double) knp->value.ui32;
}
}
}
}
void update_meminfo()
{
/* TODO */
}
int check_mount(char *s)
{
/* stub */
return 0;
}

View File

@ -1,261 +0,0 @@
/* $Id$ */
/*
* timed_thread.c: Abstraction layer for timed threads
*
* Copyright (C) 2006-2007 Philip Kovacs pkovacs@users.sourceforge.net
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
* USA.
*
*/
#include <pthread.h>
#include <assert.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#ifndef HAVE_CLOCK_GETTIME
#include <sys/time.h>
#endif
#include "timed_thread.h"
/* Abstraction layer for timed threads */
/* private */
struct _timed_thread
{
pthread_t thread; /* thread itself */
pthread_attr_t thread_attr; /* thread attributes */
pthread_mutex_t cs_mutex; /* critical section mutex */
pthread_mutex_t runnable_mutex; /* only for the runnable_cond */
pthread_cond_t runnable_cond; /* signalled to stop the thread */
unsigned int interval_usecs; /* timed_thread_test() wait interval in microseconds */
};
/* linked list of created threads */
typedef struct _timed_thread_list
{
timed_thread *p_timed_thread;
timed_thread **addr_of_p_timed_thread;
struct _timed_thread_list *next;
} timed_thread_node, timed_thread_list;
static timed_thread_list *p_timed_thread_list_head = NULL;
static timed_thread_list *p_timed_thread_list_tail = NULL;
/* create a timed thread */
timed_thread*
timed_thread_create (void *(*start_routine)(void*), void *arg, unsigned int interval_usecs)
{
timed_thread *p_timed_thread;
assert ((start_routine != NULL) && (interval_usecs >= MINIMUM_INTERVAL_USECS));
if ((p_timed_thread = calloc (sizeof(timed_thread), 1)) == 0)
return NULL;
/* init attributes, e.g. joinable thread */
pthread_attr_init (&p_timed_thread->thread_attr);
pthread_attr_setdetachstate (&p_timed_thread->thread_attr, PTHREAD_CREATE_JOINABLE);
/* init mutexes */
pthread_mutex_init (&p_timed_thread->cs_mutex, NULL);
pthread_mutex_init (&p_timed_thread->runnable_mutex, NULL);
/* init cond */
pthread_cond_init (&p_timed_thread->runnable_cond, NULL);
p_timed_thread->interval_usecs = interval_usecs;
/* create thread */
if (pthread_create (&p_timed_thread->thread, &p_timed_thread->thread_attr, start_routine, arg))
{
timed_thread_destroy (p_timed_thread, NULL);
return NULL;
}
/*fprintf (stderr, "created timed thread 0x%08X\n", (unsigned)p_timed_thread);*/
return p_timed_thread;
}
/* destroy a timed thread.
* optional addr_of_p_timed_thread to set callers pointer to NULL as a convenience. */
void
timed_thread_destroy (timed_thread* p_timed_thread, timed_thread** addr_of_p_timed_thread)
{
assert (p_timed_thread != NULL);
assert ((addr_of_p_timed_thread == NULL) || (*addr_of_p_timed_thread == p_timed_thread));
/* signal thread to stop */
pthread_mutex_lock (&p_timed_thread->runnable_mutex);
pthread_cond_signal (&p_timed_thread->runnable_cond);
pthread_mutex_unlock (&p_timed_thread->runnable_mutex);
/* join the terminating thread */
pthread_join (p_timed_thread->thread, NULL);
/* clean up */
pthread_attr_destroy (&p_timed_thread->thread_attr);
pthread_mutex_destroy (&p_timed_thread->cs_mutex);
pthread_mutex_destroy (&p_timed_thread->runnable_mutex);
pthread_cond_destroy (&p_timed_thread->runnable_cond);
/*fprintf (stderr, "Conky: destroying thread 0x%08X\n", (unsigned)p_timed_thread);*/
free (p_timed_thread);
if (addr_of_p_timed_thread)
*addr_of_p_timed_thread = NULL;
}
/* lock a timed thread for critical section activity */
int
timed_thread_lock (timed_thread* p_timed_thread)
{
assert (p_timed_thread != NULL);
return pthread_mutex_lock (&p_timed_thread->cs_mutex);
}
/* unlock a timed thread after critical section activity */
int
timed_thread_unlock (timed_thread* p_timed_thread)
{
assert (p_timed_thread != NULL);
return pthread_mutex_unlock (&p_timed_thread->cs_mutex);
}
/* thread waits interval_usecs for runnable_cond to be signaled. returns 1 if signaled,
* -1 on error, and 0 otherwise. caller should call timed_thread_exit() on any non-zero
* return value. */
int
timed_thread_test (timed_thread* p_timed_thread)
{
struct timespec abstime, reltime;
int rc;
assert (p_timed_thread != NULL);
/* acquire runnable_cond mutex */
if (pthread_mutex_lock (&p_timed_thread->runnable_mutex))
return (-1); /* could not acquire runnable_cond mutex, so tell caller to exit thread */
/* get the absolute time in the future we stop waiting for condition to signal */
#ifdef HAVE_CLOCK_GETTIME
clock_gettime (CLOCK_REALTIME, &abstime);
#else
{
/* fallback to gettimeofday () */
struct timeval tv;
if (gettimeofday (&tv, NULL) != 0)
{
pthread_mutex_unlock (&p_timed_thread->runnable_mutex);
return (-1);
}
abstime.tv_sec = tv.tv_sec;
abstime.tv_nsec = tv.tv_usec * 1000;
}
#endif
/* seconds portion of the microseconds interval */
reltime.tv_sec = (time_t)(p_timed_thread->interval_usecs / 1000000);
/* remaining microseconds convert to nanoseconds */
reltime.tv_nsec = (long)((p_timed_thread->interval_usecs % 1000000) * 1000);
/* absolute future time */
abstime.tv_sec += reltime.tv_sec;
abstime.tv_nsec += reltime.tv_nsec;
/* release mutex and wait until future time for runnable_cond to signal */
rc = pthread_cond_timedwait (&p_timed_thread->runnable_cond,
&p_timed_thread->runnable_mutex,
&abstime);
/* mutex re-acquired, so release it */
pthread_mutex_unlock (&p_timed_thread->runnable_mutex);
if (rc==0)
return 1; /* runnable_cond was signaled, so tell caller to exit thread */
/* tell caller not to exit yet */
return 0;
}
/* exit a timed thread */
void
timed_thread_exit (timed_thread* p_timed_thread)
{
assert (p_timed_thread != NULL);
pthread_exit (NULL);
}
/* register a timed thread for future destruction via timed_thread_destroy_registered_threads() */
int
timed_thread_register (timed_thread* p_timed_thread, timed_thread** addr_of_p_timed_thread)
{
timed_thread_node *p_node;
assert (p_timed_thread != NULL);
assert ((addr_of_p_timed_thread == NULL) || (*addr_of_p_timed_thread == p_timed_thread));
if ((p_node = calloc (sizeof (timed_thread_node), 1)) == 0)
return 0;
p_node->p_timed_thread = p_timed_thread;
p_node->addr_of_p_timed_thread = addr_of_p_timed_thread;
p_node->next = NULL;
if (!p_timed_thread_list_tail)
{
/* first node of empty list */
p_timed_thread_list_tail = p_node;
p_timed_thread_list_head = p_node;
}
else
{
/* add node to tail of non-empty list */
p_timed_thread_list_tail->next = p_node;
p_timed_thread_list_tail = p_node;
}
return 0;
}
/* destroy all registered timed threads */
void
timed_thread_destroy_registered_threads (void)
{
timed_thread_node *p_node, *p_next;
for (p_node=p_timed_thread_list_head;
p_node;
p_node=p_next)
{
p_next = p_node->next;
timed_thread_destroy (p_node->p_timed_thread, p_node->addr_of_p_timed_thread);
free (p_node);
p_node = NULL;
}
p_timed_thread_list_head = NULL;
p_timed_thread_list_tail = NULL;
}

View File

@ -1,57 +0,0 @@
/* $Id$ */
/*
* timed_thread.h: Abstraction layer for timed threads
*
* Copyright (C) 2006-2007 Philip Kovacs pkovacs@users.sourceforge.net
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
* USA.
*
*/
#ifndef _TIMED_THREAD_H_
#define _TIMED_THREAD_H_
#define MINIMUM_INTERVAL_USECS 50000 /* 50000 microseconds = 50 ms = 0.05 sec */
/* opaque structure for clients */
typedef struct _timed_thread timed_thread;
/* create a timed thread */
timed_thread* timed_thread_create (void *(*start_routine)(void*), void *arg, unsigned int interval_usecs);
/* destroy a timed thread */
void timed_thread_destroy (timed_thread* p_timed_thread, timed_thread** addr_of_p_timed_thread);
/* lock a timed thread for critical section activity */
int timed_thread_lock (timed_thread* p_timed_thread);
/* unlock a timed thread after critical section activity */
int timed_thread_unlock (timed_thread* p_timed_thread);
/* waits required interval for termination signal and returns 1 if got it, 0 otherwise */
int timed_thread_test (timed_thread* p_timed_thread);
/* exit a timed thread */
void timed_thread_exit (timed_thread* p_timed_thread);
/* register a timed thread for future destruction via timed_thread_destroy_registered_threads() */
int timed_thread_register (timed_thread* p_timed_thread, timed_thread** addr_of_p_timed_thread);
/* destroy all registered timed threads */
void timed_thread_destroy_registered_threads (void);
#endif /* #ifdef _TIMED_THREAD_H_ */

View File

@ -1,568 +0,0 @@
/*
* Conky, a system monitor, based on torsmo
*
* Any original torsmo code is licensed under the BSD license
*
* All code written since the fork of torsmo is licensed under the GPL
*
* Please see COPYING for details
*
* Copyright (c) 2005 Adi Zaimi, Dan Piponi <dan@tanelorn.demon.co.uk>,
* Dave Clark <clarkd@skynet.ca>
* Copyright (c) 2005-2007 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/>.
*
* $Id$
*/
#include "top.h"
static unsigned long g_time = 0;
static unsigned long long previous_total = 0;
static struct process *first_process = 0;
struct process *get_first_process()
{
return first_process;
}
void free_all_processes()
{
struct process *next = NULL, *pr = first_process;
while (pr) {
next = pr->next;
if (pr->name) {
free(pr->name);
}
free(pr);
pr = next;
}
first_process = NULL;
}
static struct process *find_process(pid_t pid)
{
struct process *p = first_process;
while (p) {
if (p->pid == pid)
return p;
p = p->next;
}
return 0;
}
/*
* Create a new process object and insert it into the process list
*/
static struct process *new_process(int p)
{
struct process *process;
process = (struct process*)malloc(sizeof(struct process));
// clean up memory first
memset(process, 0, sizeof(struct process));
/*
* Do stitching necessary for doubly linked list
*/
process->name = 0;
process->previous = 0;
process->next = first_process;
if (process->next)
process->next->previous = process;
first_process = process;
process->pid = p;
process->time_stamp = 0;
process->previous_user_time = ULONG_MAX;
process->previous_kernel_time = ULONG_MAX;
process->counted = 1;
/* process_find_name(process); */
return process;
}
/******************************************/
/* Functions */
/******************************************/
static int process_parse_stat(struct process *);
static int update_process_table(void);
static int calculate_cpu(struct process *);
static void process_cleanup(void);
static void delete_process(struct process *);
/*inline void draw_processes(void);*/
static unsigned long long calc_cpu_total(void);
static void calc_cpu_each(unsigned long long);
/******************************************/
/* Extract information from /proc */
/******************************************/
/*
* These are the guts that extract information out of /proc.
* Anyone hoping to port wmtop should look here first.
*/
static int process_parse_stat(struct process *process)
{
struct information *cur;
cur = &info;
char line[BUFFER_LEN] = { 0 }, filename[BUFFER_LEN], procname[BUFFER_LEN];
int ps;
unsigned long user_time = 0;
unsigned long kernel_time = 0;
int rc;
char *r, *q;
char deparenthesised_name[BUFFER_LEN];
int endl;
int nice_val;
snprintf(filename, sizeof(filename), PROCFS_TEMPLATE,
process->pid);
ps = open(filename, O_RDONLY);
if (ps < 0)
/*
* The process must have finished in the last few jiffies!
*/
return 1;
/*
* Mark process as up-to-date.
*/
process->time_stamp = g_time;
rc = read(ps, line, sizeof(line));
close(ps);
if (rc < 0)
return 1;
/*
* Extract cpu times from data in /proc filesystem
*/
rc = sscanf(line,
"%*s %s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %lu %lu %*s %*s %*s %d %*s %*s %*s %d %d",
procname, &process->user_time, &process->kernel_time,
&nice_val, &process->vsize, &process->rss);
if (rc < 5)
return 1;
/*
* Remove parentheses from the process name stored in /proc/ under Linux...
*/
r = procname + 1;
/* remove any "kdeinit: " */
if (r == strstr(r, "kdeinit")) {
snprintf(filename, sizeof(filename),
PROCFS_CMDLINE_TEMPLATE, process->pid);
ps = open(filename, O_RDONLY);
if (ps < 0)
/*
* The process must have finished in the last few jiffies!
*/
return 1;
endl = read(ps, line, sizeof(line));
close(ps);
/* null terminate the input */
line[endl] = 0;
/* account for "kdeinit: " */
if ((char *) line == strstr(line, "kdeinit: "))
r = ((char *) line) + 9;
else
r = (char *) line;
q = deparenthesised_name;
/* stop at space */
while (*r && *r != ' ')
*q++ = *r++;
*q = 0;
} else {
q = deparenthesised_name;
while (*r && *r != ')')
*q++ = *r++;
*q = 0;
}
if (process->name) {
free(process->name);
}
process->name = strdup(deparenthesised_name);
process->rss *= getpagesize();
if (!cur->memmax)
update_total_processes();
process->totalmem = (float)(((float) process->rss / cur->memmax) / 10);
if (process->previous_user_time == ULONG_MAX)
process->previous_user_time = process->user_time;
if (process->previous_kernel_time == ULONG_MAX)
process->previous_kernel_time = process->kernel_time;
/* store the difference of the user_time */
user_time = process->user_time - process->previous_user_time;
kernel_time = process->kernel_time - process->previous_kernel_time;
/* backup the process->user_time for next time around */
process->previous_user_time = process->user_time;
process->previous_kernel_time = process->kernel_time;
/* store only the difference of the user_time here... */
process->user_time = user_time;
process->kernel_time = kernel_time;
return 0;
}
/******************************************/
/* Update process table */
/******************************************/
static int update_process_table()
{
DIR *dir;
struct dirent *entry;
if (!(dir = opendir("/proc")))
return 1;
++g_time;
/*
* Get list of processes from /proc directory
*/
while ((entry = readdir(dir))) {
pid_t pid;
if (!entry) {
/*
* Problem reading list of processes
*/
closedir(dir);
return 1;
}
if (sscanf(entry->d_name, "%d", &pid) > 0) {
struct process *p;
p = find_process(pid);
if (!p)
p = new_process(pid);
/* compute each process cpu usage */
calculate_cpu(p);
}
}
closedir(dir);
return 0;
}
/******************************************/
/* Get process structure for process pid */
/******************************************/
/*
* This function seems to hog all of the CPU time. I can't figure out why - it
* doesn't do much.
*/
static int calculate_cpu(struct process *process)
{
int rc;
/* compute each process cpu usage by reading /proc/<proc#>/stat */
rc = process_parse_stat(process);
if (rc)
return 1;
/*rc = process_parse_statm(process);
if (rc)
return 1; */
/*
* Check name against the exclusion list
*/
/* if (process->counted && exclusion_expression
&& !regexec(exclusion_expression, process->name, 0, 0, 0))
process->counted = 0;
*/
return 0;
}
/******************************************/
/* Strip dead process entries */
/******************************************/
static void process_cleanup()
{
struct process *p = first_process;
while (p) {
struct process *current = p;
#if defined(PARANOID)
assert(p->id == 0x0badfeed);
#endif /* defined(PARANOID) */
p = p->next;
/*
* Delete processes that have died
*/
if (current->time_stamp != g_time)
delete_process(current);
}
}
/******************************************/
/* Destroy and remove a process */
/******************************************/
static void delete_process(struct process *p)
{
#if defined(PARANOID)
assert(p->id == 0x0badfeed);
/*
* Ensure that deleted processes aren't reused.
*/
p->id = 0x007babe;
#endif /* defined(PARANOID) */
/*
* Maintain doubly linked list.
*/
if (p->next)
p->next->previous = p->previous;
if (p->previous)
p->previous->next = p->next;
else
first_process = p->next;
if (p->name) {
free(p->name);
}
free(p);
}
/******************************************/
/* Calculate cpu total */
/******************************************/
#define TMPL_SHORTPROC "%*s %llu %llu %llu %llu"
#define TMPL_LONGPROC "%*s %llu %llu %llu %llu %llu %llu %llu %llu"
static unsigned long long calc_cpu_total()
{
unsigned long long total = 0;
unsigned long long t = 0;
int rc;
int ps;
char line[BUFFER_LEN] = { 0 };
unsigned long long cpu = 0;
unsigned long long nice = 0;
unsigned long long system = 0;
unsigned long long idle = 0;
unsigned long long iowait = 0;
unsigned long long irq = 0;
unsigned long long softirq = 0;
unsigned long long steal = 0;
char * template = KFLAG_ISSET(KFLAG_IS_LONGSTAT) ? TMPL_LONGPROC : TMPL_SHORTPROC;
ps = open("/proc/stat", O_RDONLY);
rc = read(ps, line, sizeof(line));
close(ps);
if (rc < 0)
return 0;
sscanf(line, template, &cpu, &nice, &system, &idle, &iowait, &irq, &softirq, &steal);
total = cpu + nice + system + idle + iowait + irq + softirq + steal;
t = total - previous_total;
previous_total = total;
return t;
}
/******************************************/
/* Calculate each processes cpu */
/******************************************/
inline static void calc_cpu_each(unsigned long long total)
{
struct process *p = first_process;
while (p) {
p->amount =
100.0 * (p->user_time + p->kernel_time) / (float)total;
p = p->next;
}
}
/******************************************/
/* Find the top processes */
/******************************************/
/*
* free a sp_process structure
*/
void free_sp(struct sorted_process * sp) {
free(sp);
}
/*
* create a new sp_process structure
*/
struct sorted_process * malloc_sp(struct process * proc) {
struct sorted_process * sp;
sp = malloc(sizeof(struct sorted_process));
sp->greater = NULL;
sp->less = NULL;
sp->proc = proc;
return(sp);
}
/*
* cpu comparison function for insert_sp_element
*/
int compare_cpu(struct process *a, struct process *b) {
if (a->amount < b->amount) return 1;
return 0;
}
/*
* mem comparison function for insert_sp_element
*/
int compare_mem(struct process *a, struct process *b) {
if (a->totalmem < b->totalmem) return 1;
return 0;
}
/*
* insert this process into the list in a sorted fashion,
* or destroy it if it doesn't fit on the list
*/
int insert_sp_element(
struct sorted_process * sp_cur
, struct sorted_process ** p_sp_head
, struct sorted_process ** p_sp_tail
, int max_elements
, int (*compare_funct) (struct process *, struct process *)
) {
struct sorted_process * sp_readthru=NULL, * sp_destroy=NULL;
int did_insert = 0, x = 0;
if (*p_sp_head == NULL) {
*p_sp_head = sp_cur;
*p_sp_tail = sp_cur;
return(1);
}
for(sp_readthru=*p_sp_head, x=0; sp_readthru != NULL && x < max_elements; sp_readthru=sp_readthru->less, x++) {
if (compare_funct(sp_readthru->proc, sp_cur->proc) && !did_insert) {
/* sp_cur is bigger than sp_readthru so insert it before sp_readthru */
sp_cur->less=sp_readthru;
if (sp_readthru == *p_sp_head) {
*p_sp_head = sp_cur; /* insert as the new head of the list */
} else {
sp_readthru->greater->less = sp_cur; /* insert inside the list */
sp_cur->greater = sp_readthru->greater;
}
sp_readthru->greater=sp_cur;
did_insert = ++x; /* element was inserted, so increase the counter */
}
}
if (x < max_elements && sp_readthru == NULL && !did_insert) {
/* sp_cur is the smallest element and list isn't full, so insert at the end */
(*p_sp_tail)->less=sp_cur;
sp_cur->greater=*p_sp_tail;
*p_sp_tail = sp_cur;
did_insert=x;
} else if (x >= max_elements) {
/* we inserted an element and now the list is too big by one. Destroy the smallest element */
sp_destroy = *p_sp_tail;
*p_sp_tail = sp_destroy->greater;
(*p_sp_tail)->less = NULL;
free_sp(sp_destroy);
}
if (!did_insert) {
/* sp_cur wasn't added to the sorted list, so destroy it */
free_sp(sp_cur);
}
return did_insert;
}
/*
* copy the procs in the sorted list to the array, and destroy the list
*/
void sp_acopy(struct sorted_process *sp_head, struct process ** ar, int max_size)
{
struct sorted_process * sp_cur, * sp_tmp;
int x;
sp_cur = sp_head;
for (x=0; x < max_size && sp_cur != NULL; x++) {
ar[x] = sp_cur->proc;
sp_tmp = sp_cur;
sp_cur= sp_cur->less;
free_sp(sp_tmp);
}
}
// stole from common.c
#define NEED(a) ((need_mask & (1 << a)) && ((info.mask & (1 << a)) == 0))
/* ****************************************************************** */
/* Get a sorted list of the top cpu hogs and top mem hogs. */
/* Results are stored in the cpu,mem arrays in decreasing order[0-9]. */
/* ****************************************************************** */
inline void process_find_top(struct process **cpu, struct process **mem)
{
struct sorted_process *spc_head = NULL, *spc_tail = NULL, *spc_cur = NULL;
struct sorted_process *spm_head = NULL, *spm_tail = NULL, *spm_cur = NULL;
struct process *cur_proc = NULL;
unsigned long long total = 0;
if (!top_cpu && !top_mem) return;
total = calc_cpu_total(); /* calculate the total of the processor */
update_process_table(); /* update the table with process list */
calc_cpu_each(total); /* and then the percentage for each task */
process_cleanup(); /* cleanup list from exited processes */
cur_proc = first_process;
while (cur_proc !=NULL) {
if (top_cpu) {
spc_cur = malloc_sp(cur_proc);
insert_sp_element(spc_cur, &spc_head, &spc_tail, MAX_SP, &compare_cpu);
}
if (top_mem) {
spm_cur = malloc_sp(cur_proc);
insert_sp_element(spm_cur, &spm_head, &spm_tail, MAX_SP, &compare_mem);
}
cur_proc = cur_proc->next;
}
sp_acopy(spc_head, cpu, MAX_SP);
sp_acopy(spm_head, mem, MAX_SP);
}

View File

@ -1,99 +0,0 @@
/*
* Conky, a system monitor, based on torsmo
*
* Any original torsmo code is licensed under the BSD license
*
* All code written since the fork of torsmo is licensed under the GPL
*
* Please see COPYING for details
*
* Copyright (c) 2005 Adi Zaimi, Dan Piponi <dan@tanelorn.demon.co.uk>,
* Dave Clark <clarkd@skynet.ca>
* Copyright (c) 2005-2007 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/>.
*
* $Id$
*/
/*
* Ensure there's an operating system defined. There is *no* default
* because every OS has it's own way of revealing CPU/memory usage.
* compile with gcc -DOS ...
*/
/******************************************/
/* Includes */
/******************************************/
#include "conky.h"
#define CPU_THRESHHOLD 0 /* threshhold for the cpu diff to appear */
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <dirent.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <ctype.h>
#include <math.h>
#include <assert.h>
#include <limits.h>
#include <errno.h>
#include <signal.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <regex.h>
/******************************************/
/* Defines */
/******************************************/
/*
* XXX: I shouldn't really use this BUFFER_LEN variable but scanf is so
* lame and it'll take me a while to write a replacement.
*/
#define BUFFER_LEN 1024
#define PROCFS_TEMPLATE "/proc/%d/stat"
#define PROCFS_TEMPLATE_MEM "/proc/%d/statm"
#define PROCFS_CMDLINE_TEMPLATE "/proc/%d/cmdline"
#define MAX_SP 10 //number of elements to sort
/******************************************/
/* Globals */
/******************************************/
/******************************************/
/* Process class */
/******************************************/
struct sorted_process {
struct sorted_process *greater;
struct sorted_process *less;
struct process *proc;
};
/*
* Pointer to head of process list
*/
void process_find_top(struct process **, struct process **);

View File

@ -1,573 +0,0 @@
/*
* Conky, a system monitor, based on torsmo
*
* Any original torsmo code is licensed under the BSD license
*
* All code written since the fork of torsmo is licensed under the GPL
*
* Please see COPYING for details
*
* Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
* Copyright (c) 2005-2007 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/>.
*
* $Id$
*/
#include "conky.h"
#ifdef X11
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/Xmd.h>
#include <X11/Xutil.h>
#ifdef XFT
#include <X11/Xft/Xft.h>
#endif
#ifdef HAVE_XDBE
int use_xdbe;
#endif
#ifdef XFT
int use_xft = 0;
#endif
/* some basic X11 stuff */
Display *display;
int display_width;
int display_height;
int screen;
static int set_transparent;
static int background_colour;
/* workarea from _NET_WORKAREA, this is where window / text is aligned */
int workarea[4];
/* Window stuff */
struct conky_window window;
/* local prototypes */
static void update_workarea();
static Window find_desktop_window(Window *p_root, Window *p_desktop);
static Window find_subwindow(Window win, int w, int h);
/* X11 initializer */
void init_X11()
{
if ((display = XOpenDisplay(0)) == NULL)
CRIT_ERR("can't open display: %s", XDisplayName(0));
screen = DefaultScreen(display);
display_width = DisplayWidth(display, screen);
display_height = DisplayHeight(display, screen);
update_workarea();
}
static void update_workarea()
{
Window root = RootWindow(display, screen);
unsigned long nitems, bytes;
unsigned char *buf = NULL;
Atom type;
int format;
/* default work area is display */
workarea[0] = 0;
workarea[1] = 0;
workarea[2] = display_width;
workarea[3] = display_height;
/* get current desktop */
if (XGetWindowProperty(display, root, ATOM(_NET_CURRENT_DESKTOP),
0, 1, False, XA_CARDINAL, &type, &format,
&nitems, &bytes, &buf) == Success
&& type == XA_CARDINAL && nitems > 0) {
//Currently unused
/* long desktop = * (long *) buf; */
XFree(buf);
buf = 0;
}
if (buf) {
XFree(buf);
buf = 0;
}
}
/* Find root window and desktop window. Return desktop window on success,
* and set root and desktop byref return values. Return 0 on failure. */
static Window find_desktop_window(Window *p_root, Window *p_desktop)
{
Atom type;
int format, i;
unsigned long nitems, bytes;
unsigned int n;
Window root = RootWindow(display, screen);
Window win = root;
Window troot, parent, *children;
unsigned char *buf = NULL;
if (!p_root || !p_desktop)
return(0);
/* some window managers set __SWM_VROOT to some child of root window */
XQueryTree(display, root, &troot, &parent, &children, &n);
for (i = 0; i < (int) n; i++) {
if (XGetWindowProperty
(display, children[i], ATOM(__SWM_VROOT), 0, 1, False,
XA_WINDOW, &type, &format, &nitems, &bytes,
&buf) == Success && type == XA_WINDOW) {
win = *(Window *) buf;
XFree(buf);
XFree(children);
fprintf(stderr,
"Conky: desktop window (%lx) found from __SWM_VROOT property\n", win);
fflush(stderr);
*p_root=win;
*p_desktop=win;
return win;
}
if (buf) {
XFree(buf);
buf = 0;
}
}
XFree(children);
/* get subwindows from root */
win = find_subwindow(root, -1, -1);
update_workarea();
win = find_subwindow(win, workarea[2], workarea[3]);
if (buf) {
XFree(buf);
buf = 0;
}
if (win != root)
fprintf(stderr,
"Conky: desktop window (%lx) is subwindow of root window (%lx)\n",win,root);
else
fprintf(stderr, "Conky: desktop window (%lx) is root window\n",win);
fflush(stderr);
*p_root=root;
*p_desktop=win;
return win;
}
/* sets background to ParentRelative for the Window and all parents */
inline void set_transparent_background(Window win)
{
static int colour_set = -1;
if (set_transparent) {
Window parent = win;
unsigned int i;
for (i = 0; i < 50 && parent != RootWindow(display, screen); i++) {
Window r, *children;
unsigned int n;
XSetWindowBackgroundPixmap(display, parent, ParentRelative);
XQueryTree(display, parent, &r, &parent, &children, &n);
XFree(children);
}
} else if (colour_set != background_colour) {
XSetWindowBackground(display, win, background_colour);
colour_set = background_colour;
}
//XClearWindow(display, win); not sure why this was here
}
void init_window(int own_window, int w, int h, int set_trans, int back_colour,
char **argv, int argc)
{
/* There seems to be some problems with setting transparent background (on
* fluxbox this time). It doesn't happen always and I don't know why it
* happens but I bet the bug is somewhere here. */
set_transparent = set_trans;
background_colour = back_colour;
#ifdef OWN_WINDOW
if (own_window) {
if ( !find_desktop_window( &window.root, &window.desktop ) )
return;
if (window.type == TYPE_OVERRIDE) {
/*
An override_redirect True window. No WM hints or button processing needed.
*/
XSetWindowAttributes attrs = {
ParentRelative,0L,0,0L,0,0,Always,0L,0L,False,
StructureNotifyMask|ExposureMask,
0L,
True,
0,0 };
/* Parent is desktop window (which might be a child of root) */
window.window = XCreateWindow(display,
window.desktop,
window.x, window.y, w, h, 0,
CopyFromParent,
InputOutput,
CopyFromParent,
CWBackPixel|CWOverrideRedirect,
&attrs);
XLowerWindow(display, window.window);
fprintf(stderr, "Conky: window type - override\n"); fflush(stderr);
}
else { /* window.type != TYPE_OVERRIDE */
/*
A window managed by the window manager. Process hints and buttons.
*/
XSetWindowAttributes attrs = {
ParentRelative,0L,0,0L,0,0,Always,0L,0L,False,
StructureNotifyMask|ExposureMask|ButtonPressMask|ButtonReleaseMask,
0L,
False,
0,0 };
XClassHint classHint;
XWMHints wmHint;
Atom xa;
/* Parent is root window so WM can take control */
window.window = XCreateWindow(display,
window.root,
window.x, window.y, w, h, 0,
CopyFromParent,
InputOutput,
CopyFromParent,
CWBackPixel|CWOverrideRedirect,
&attrs);
classHint.res_name = window.class_name;
classHint.res_class = classHint.res_name;
wmHint.flags = InputHint | StateHint;
/* allow decorated windows to be given input focus by WM */
wmHint.input = TEST_HINT(window.hints,HINT_UNDECORATED) ? False : True;
wmHint.initial_state = NormalState;
XmbSetWMProperties (display, window.window, window.title, NULL,
argv, argc,
NULL, &wmHint, &classHint);
/* Sets an empty WM_PROTOCOLS property */
XSetWMProtocols(display,window.window,NULL,0);
/* Set window type */
if ( (xa = ATOM(_NET_WM_WINDOW_TYPE)) != None )
{
Atom prop;
switch(window.type) {
case TYPE_DESKTOP:
{
prop = ATOM(_NET_WM_WINDOW_TYPE_DESKTOP);
fprintf(stderr, "Conky: window type - desktop\n"); fflush(stderr);
}
break;
case TYPE_NORMAL:
default:
{
prop = ATOM(_NET_WM_WINDOW_TYPE_NORMAL);
fprintf(stderr, "Conky: window type - normal\n"); fflush(stderr);
}
break;
}
XChangeProperty(display, window.window, xa,
XA_ATOM, 32,
PropModeReplace,
(unsigned char *) &prop, 1);
}
/* Set desired hints */
/* Window decorations */
if (TEST_HINT(window.hints,HINT_UNDECORATED)) {
/*fprintf(stderr, "Conky: hint - undecorated\n"); fflush(stderr);*/
xa = ATOM(_MOTIF_WM_HINTS);
if (xa != None) {
long prop[5] = { 2, 0, 0, 0, 0 };
XChangeProperty(display, window.window, xa,
xa, 32, PropModeReplace,
(unsigned char *) prop, 5);
}
}
/* Below other windows */
if (TEST_HINT(window.hints,HINT_BELOW)) {
/*fprintf(stderr, "Conky: hint - below\n"); fflush(stderr); */
xa = ATOM(_WIN_LAYER);
if (xa != None) {
long prop = 0;
XChangeProperty(display, window.window, xa,
XA_CARDINAL, 32,
PropModeAppend,
(unsigned char *) &prop, 1);
}
xa = ATOM(_NET_WM_STATE);
if (xa != None) {
Atom xa_prop = ATOM(_NET_WM_STATE_BELOW);
XChangeProperty(display, window.window, xa,
XA_ATOM, 32,
PropModeAppend,
(unsigned char *) &xa_prop,
1);
}
}
/* Above other windows */
if (TEST_HINT(window.hints,HINT_ABOVE)) {
/*fprintf(stderr, "Conky: hint - above\n"); fflush(stderr);*/
xa = ATOM(_WIN_LAYER);
if (xa != None) {
long prop = 6;
XChangeProperty(display, window.window, xa,
XA_CARDINAL, 32,
PropModeAppend,
(unsigned char *) &prop, 1);
}
xa = ATOM(_NET_WM_STATE);
if (xa != None) {
Atom xa_prop = ATOM(_NET_WM_STATE_ABOVE);
XChangeProperty(display, window.window, xa,
XA_ATOM, 32,
PropModeAppend,
(unsigned char *) &xa_prop,
1);
}
}
/* Sticky */
if (TEST_HINT(window.hints,HINT_STICKY)) {
/*fprintf(stderr, "Conky: hint - sticky\n"); fflush(stderr); */
xa = ATOM(_NET_WM_DESKTOP);
if (xa != None) {
CARD32 xa_prop = 0xFFFFFFFF;
XChangeProperty(display, window.window, xa,
XA_CARDINAL, 32,
PropModeAppend,
(unsigned char *) &xa_prop,
1);
}
xa = ATOM(_NET_WM_STATE);
if (xa != None) {
Atom xa_prop = ATOM(_NET_WM_STATE_STICKY);
XChangeProperty(display, window.window, xa,
XA_ATOM, 32,
PropModeAppend,
(unsigned char *) &xa_prop,
1);
}
}
/* Skip taskbar */
if (TEST_HINT(window.hints,HINT_SKIP_TASKBAR)) {
/*fprintf(stderr, "Conky: hint - skip_taskbar\n"); fflush(stderr);*/
xa = ATOM(_NET_WM_STATE);
if (xa != None) {
Atom xa_prop = ATOM(_NET_WM_STATE_SKIP_TASKBAR);
XChangeProperty(display, window.window, xa,
XA_ATOM, 32,
PropModeAppend,
(unsigned char *) &xa_prop,
1);
}
}
/* Skip pager */
if (TEST_HINT(window.hints,HINT_SKIP_PAGER)) {
/*fprintf(stderr, "Conky: hint - skip_pager\n"); fflush(stderr);*/
xa = ATOM(_NET_WM_STATE);
if (xa != None) {
Atom xa_prop = ATOM(_NET_WM_STATE_SKIP_PAGER);
XChangeProperty(display, window.window, xa,
XA_ATOM, 32,
PropModeAppend,
(unsigned char *) &xa_prop,
1);
}
}
} /* else { window.type != TYPE_OVERRIDE */
fprintf(stderr, "Conky: drawing to created window (%lx)\n", window.window);
fflush(stderr);
XMapWindow(display, window.window);
} else /* if (own_window) { */
#endif
/* root / desktop window */
{
XWindowAttributes attrs;
if (!window.window)
window.window = find_desktop_window( &window.root, &window.desktop );
if (XGetWindowAttributes(display, window.window, &attrs)) {
window.width = attrs.width;
window.height = attrs.height;
}
fprintf(stderr, "Conky: drawing to desktop window\n");
}
/* Drawable is same as window. This may be changed by double buffering. */
window.drawable = window.window;
#ifdef HAVE_XDBE
if (use_xdbe) {
int major, minor;
if (!XdbeQueryExtension(display, &major, &minor)) {
use_xdbe = 0;
} else {
window.back_buffer =
XdbeAllocateBackBufferName(display,
window.window,
XdbeBackground);
if (window.back_buffer != None) {
window.drawable = window.back_buffer;
fprintf(stderr,
"Conky: drawing to double buffer\n");
} else
use_xdbe = 0;
}
if (!use_xdbe)
ERR("failed to set up double buffer");
}
if (!use_xdbe)
fprintf(stderr, "Conky: drawing to single buffer\n");
#endif
XFlush(display);
/*set_transparent_background(window.window); must be done after double buffer stuff? */
#ifdef OWN_WINDOW
/*if (own_window) {
set_transparent_background(window.window);
XClearWindow(display, window.window);
}*/
#endif
XSelectInput(display, window.window, ExposureMask
#ifdef OWN_WINDOW
| (own_window
? (StructureNotifyMask | PropertyChangeMask |
ButtonPressMask | ButtonReleaseMask) : 0)
#endif
);
}
static Window find_subwindow(Window win, int w, int h)
{
unsigned int i, j;
Window troot, parent, *children;
unsigned int n;
/* search subwindows with same size as display or work area */
for (i = 0; i < 10; i++) {
XQueryTree(display, win, &troot, &parent, &children, &n);
for (j = 0; j < n; j++) {
XWindowAttributes attrs;
if (XGetWindowAttributes
(display, children[j], &attrs)) {
/* Window must be mapped and same size as display or work space */
if (attrs.map_state != 0 &&
((attrs.width == display_width
&& attrs.height == display_height)
|| (attrs.width == w
&& attrs.height == h))) {
win = children[j];
break;
}
}
}
XFree(children);
if (j == n)
break;
}
return win;
}
long get_x11_color(const char *name)
{
XColor color;
color.pixel = 0;
if (!XParseColor
(display, DefaultColormap(display, screen), name, &color)) {
/* lets check if it's a hex colour with the # missing in front
* if yes, then do something about it
*/
char newname[64];
newname[0] = '#';
strncpy(&newname[1], name, 62);
/* now lets try again */
if (!XParseColor(display, DefaultColormap(display, screen), &newname[0], &color)) {
ERR("can't parse X color '%s'", name);
return 0xFF00FF;
}
}
if (!XAllocColor
(display, DefaultColormap(display, screen), &color))
ERR("can't allocate X color '%s'", name);
return (long) color.pixel;
}
void create_gc()
{
XGCValues values;
values.graphics_exposures = 0;
values.function = GXcopy;
window.gc = XCreateGC(display, window.drawable,
GCFunction | GCGraphicsExposures, &values);
}
#endif /* X11 */

View File

@ -1,370 +0,0 @@
/*
* Conky, a system monitor, based on torsmo
*
* Any original torsmo code is licensed under the BSD license
*
* All code written since the fork of torsmo is licensed under the GPL
*
* Please see COPYING for details
*
* Copyright (c) 2005-2007 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/>.
*
* $Id$
*/
#include "conky.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <xmmsclient/xmmsclient.h>
#define CONN_INIT 0
#define CONN_OK 1
#define CONN_NO 2
/* callbacks */
static void xmms_alloc(struct information *ptr)
{
if (ptr->xmms2.status == NULL) {
ptr->xmms2.status = malloc(TEXT_BUFFER_SIZE);
ptr->xmms2.status[0] = '\0';
}
if (ptr->xmms2.artist == NULL) {
ptr->xmms2.artist = malloc(TEXT_BUFFER_SIZE);
ptr->xmms2.artist[0] = '\0';
}
if (ptr->xmms2.album == NULL) {
ptr->xmms2.album = malloc(TEXT_BUFFER_SIZE);
ptr->xmms2.album[0] = '\0';
}
if (ptr->xmms2.title == NULL) {
ptr->xmms2.title = malloc(TEXT_BUFFER_SIZE);
ptr->xmms2.title[0] = '\0';
}
if (ptr->xmms2.genre == NULL) {
ptr->xmms2.genre = malloc(TEXT_BUFFER_SIZE);
ptr->xmms2.genre[0] = '\0';
}
if (ptr->xmms2.comment == NULL) {
ptr->xmms2.comment = malloc(TEXT_BUFFER_SIZE);
ptr->xmms2.comment[0] = '\0';
}
if (ptr->xmms2.decoder == NULL) {
ptr->xmms2.decoder = malloc(TEXT_BUFFER_SIZE);
ptr->xmms2.decoder[0] = '\0';
}
if (ptr->xmms2.transport == NULL) {
ptr->xmms2.transport = malloc(TEXT_BUFFER_SIZE);
ptr->xmms2.transport[0] = '\0';
}
if (ptr->xmms2.url == NULL) {
ptr->xmms2.url = malloc(TEXT_BUFFER_SIZE);
ptr->xmms2.url[0] = '\0';
}
if (ptr->xmms2.date == NULL) {
ptr->xmms2.date = malloc(TEXT_BUFFER_SIZE);
ptr->xmms2.date[0] = '\0';
}
}
static void xmms_clear(struct information *ptr) {
xmms_alloc(ptr);
ptr->xmms2.status[0] = '\0';
ptr->xmms2.artist[0] = '\0';
ptr->xmms2.album[0] = '\0';
ptr->xmms2.title[0] = '\0';
ptr->xmms2.genre[0] = '\0';
ptr->xmms2.comment[0] = '\0';
ptr->xmms2.decoder[0] = '\0';
ptr->xmms2.transport[0] = '\0';
ptr->xmms2.url[0] = '\0';
ptr->xmms2.date[0] = '\0';
}
void connection_lost(void *p)
{
struct information *ptr = p;
ptr->xmms2_conn_state = CONN_NO;
xmms_clear(ptr);
ptr->xmms2.tracknr = 0;
ptr->xmms2.id = 0;
ptr->xmms2.bitrate = 0;
ptr->xmms2.duration = 0;
ptr->xmms2.elapsed = 0;
ptr->xmms2.size = 0;
ptr->xmms2.progress = 0;
}
void handle_curent_id(xmmsc_result_t *res, void *p)
{
uint current_id;
struct information *ptr = p;
if ( xmmsc_result_get_uint( res, &current_id ) ) {
xmmsc_result_t *res2;
res2 = xmmsc_medialib_get_info(ptr->xmms2_conn, current_id);
xmmsc_result_wait( res2 );
xmms_clear(ptr);
ptr->xmms2.id = current_id;
char *temp;
xmmsc_result_get_dict_entry_string( res2, "artist", &temp );
if ( temp != NULL ) {
strncpy(ptr->xmms2.artist, temp, TEXT_BUFFER_SIZE - 1);
} else {
strncpy(ptr->xmms2.artist, "[Unknown]", TEXT_BUFFER_SIZE - 1);
}
xmmsc_result_get_dict_entry_string( res2, "title", &temp );
if ( temp != NULL ) {
strncpy(ptr->xmms2.title, temp, TEXT_BUFFER_SIZE - 1);
} else {
strncpy(ptr->xmms2.title, "[Unknown]", TEXT_BUFFER_SIZE - 1);
}
xmmsc_result_get_dict_entry_string( res2, "album", &temp );
if ( temp != NULL ) {
strncpy(ptr->xmms2.album, temp, TEXT_BUFFER_SIZE - 1);
} else {
strncpy(ptr->xmms2.album, "[Unknown]", TEXT_BUFFER_SIZE - 1);
}
xmmsc_result_get_dict_entry_string( res2, "genre", &temp );
if ( temp != NULL ) {
strncpy(ptr->xmms2.genre, temp, TEXT_BUFFER_SIZE - 1);
} else {
strncpy(ptr->xmms2.genre, "[Unknown]", TEXT_BUFFER_SIZE - 1);
}
xmmsc_result_get_dict_entry_string( res2, "comment", &temp );
if ( temp != NULL ) {
strncpy(ptr->xmms2.comment, temp, TEXT_BUFFER_SIZE - 1);
} else {
strncpy(ptr->xmms2.comment, "", TEXT_BUFFER_SIZE - 1);
}
xmmsc_result_get_dict_entry_string( res2, "decoder", &temp );
if ( temp != NULL ) {
strncpy(ptr->xmms2.decoder, temp, TEXT_BUFFER_SIZE - 1);
} else {
strncpy(ptr->xmms2.decoder, "[Unknown]", TEXT_BUFFER_SIZE - 1);
}
xmmsc_result_get_dict_entry_string( res2, "transport", &temp );
if ( temp != NULL ) {
strncpy(ptr->xmms2.transport, temp, TEXT_BUFFER_SIZE - 1);
} else {
strncpy(ptr->xmms2.transport, "[Unknown]", TEXT_BUFFER_SIZE - 1);
}
xmmsc_result_get_dict_entry_string( res2, "url", &temp );
if ( temp != NULL ) {
strncpy(ptr->xmms2.url, temp, TEXT_BUFFER_SIZE - 1);
} else {
strncpy(ptr->xmms2.url, "[Unknown]", TEXT_BUFFER_SIZE - 1);
}
xmmsc_result_get_dict_entry_string( res2, "date", &temp );
if ( temp != NULL ) {
strncpy(ptr->xmms2.date, temp, TEXT_BUFFER_SIZE - 1);
} else {
strncpy(ptr->xmms2.date, "????", TEXT_BUFFER_SIZE - 1);
}
int itemp;
xmmsc_result_get_dict_entry_int( res2, "tracknr", &itemp );
ptr->xmms2.tracknr = itemp;
xmmsc_result_get_dict_entry_int( res2, "duration", &itemp );
ptr->xmms2.duration = itemp;
xmmsc_result_get_dict_entry_int( res2, "bitrate", &itemp );
ptr->xmms2.bitrate = itemp / 1000;
xmmsc_result_get_dict_entry_int( res2, "size", &itemp );
ptr->xmms2.size = (float)itemp / 1048576;
xmmsc_result_unref( res2 );
}
}
void handle_playtime(xmmsc_result_t *res, void *p) {
struct information *ptr = p;
xmmsc_result_t * res2;
uint play_time;
if ( xmmsc_result_iserror( res ) )
return;
if ( !xmmsc_result_get_uint( res, &play_time ) )
return;
res2 = xmmsc_result_restart( res );
xmmsc_result_unref( res2 );
ptr->xmms2.elapsed = play_time;
ptr->xmms2.progress = (float) play_time / ptr->xmms2.duration;
}
void handle_playback_state_change(xmmsc_result_t *res, void *p) {
struct information *ptr = p;
uint pb_state = 0;
if ( xmmsc_result_iserror( res ) )
return;
if ( !xmmsc_result_get_uint( res, &pb_state ) )
return;
switch (pb_state) {
case XMMS_PLAYBACK_STATUS_PLAY:
strncpy(ptr->xmms2.status, "Playing", TEXT_BUFFER_SIZE - 1);
break;
case XMMS_PLAYBACK_STATUS_PAUSE:
strncpy(ptr->xmms2.status, "Paused", TEXT_BUFFER_SIZE - 1);
break;
case XMMS_PLAYBACK_STATUS_STOP:
strncpy(ptr->xmms2.status, "Stopped", TEXT_BUFFER_SIZE - 1);
break;
default:
strncpy(ptr->xmms2.status, "Unknown", TEXT_BUFFER_SIZE - 1);
}
}
void update_xmms2() {
struct information * current_info = &info;
/* initialize connection */
if ( current_info->xmms2_conn_state == CONN_INIT ) {
if ( current_info->xmms2_conn == NULL ) {
current_info->xmms2_conn = xmmsc_init( "conky" );
}
/* did init fail? */
if ( current_info->xmms2_conn == NULL ) {
fprintf(stderr,"Conky: xmms2 init failed. %s\n", xmmsc_get_last_error ( current_info->xmms2_conn ));
fflush(stderr);
return;
}
/* init ok but not connected yet.. */
current_info->xmms2_conn_state = CONN_NO;
/* clear all values */
xmms_clear(current_info);
current_info->xmms2.tracknr = 0;
current_info->xmms2.id = 0;
current_info->xmms2.bitrate = 0;
current_info->xmms2.duration = 0;
current_info->xmms2.elapsed = 0;
current_info->xmms2.size = 0;
current_info->xmms2.progress = 0;
/* fprintf(stderr,"Conky: xmms2 init ok.\n");
fflush(stderr); */
}
/* connect */
if ( current_info->xmms2_conn_state == CONN_NO ) {
char *path = getenv ( "XMMS_PATH" );
if ( !xmmsc_connect( current_info->xmms2_conn, path ) ) {
fprintf(stderr,"Conky: xmms2 connection failed. %s\n",
xmmsc_get_last_error ( current_info->xmms2_conn ));
fflush(stderr);
current_info->xmms2_conn_state = CONN_NO;
return;
}
/* set callbacks */
xmmsc_disconnect_callback_set( current_info->xmms2_conn, connection_lost, current_info );
XMMS_CALLBACK_SET( current_info->xmms2_conn, xmmsc_playback_current_id, handle_curent_id, current_info );
XMMS_CALLBACK_SET( current_info->xmms2_conn, xmmsc_broadcast_playback_current_id, handle_curent_id, current_info );
XMMS_CALLBACK_SET( current_info->xmms2_conn, xmmsc_signal_playback_playtime, handle_playtime, current_info );
XMMS_CALLBACK_SET( current_info->xmms2_conn, xmmsc_broadcast_playback_status, handle_playback_state_change, current_info );
/* get playback status, it wont be broadcasted untill it chages */
xmmsc_result_t * res = xmmsc_playback_status( current_info->xmms2_conn );
xmmsc_result_wait ( res );
unsigned int pb_state;
xmmsc_result_get_uint( res, &pb_state );
switch (pb_state) {
case XMMS_PLAYBACK_STATUS_PLAY:
strncpy(current_info->xmms2.status,
"Playing", TEXT_BUFFER_SIZE - 1 );
break;
case XMMS_PLAYBACK_STATUS_PAUSE:
strncpy( current_info->xmms2.status,
"Paused", TEXT_BUFFER_SIZE - 1 );
break;
case XMMS_PLAYBACK_STATUS_STOP:
strncpy( current_info->xmms2.status,
"Stopped", TEXT_BUFFER_SIZE - 1 );
break;
default:
strncpy( current_info->xmms2.status,
"Unknown", TEXT_BUFFER_SIZE - 1 );
}
xmmsc_result_unref ( res );
/* everything seems to be ok */
current_info->xmms2_conn_state = CONN_OK;
/* fprintf(stderr,"Conky: xmms2 connected.\n");
fflush(stderr); */
}
/* handle callbacks */
if ( current_info->xmms2_conn_state == CONN_OK ) {
struct timeval tmout;
tmout.tv_sec = 0;
tmout.tv_usec = 100;
select( current_info->xmms2_fd + 1, &current_info->xmms2_fdset, NULL, NULL, &tmout );
xmmsc_io_in_handle(current_info->xmms2_conn);
if (xmmsc_io_want_out(current_info->xmms2_conn)) {
xmmsc_io_out_handle(current_info->xmms2_conn);
}
}
}

View File

@ -1003,7 +1003,6 @@ enum text_object_type {
OBJ_alignc,
OBJ_i2c,
#if defined(__linux__)
OBJ_hwmon,
OBJ_i8k_version,
OBJ_i8k_bios,
OBJ_i8k_serial,
@ -1211,12 +1210,6 @@ struct text_object {
char *tz; /* timezone variable */
char *fmt; /* time display formatting */
} tztime;
#if defined(__linux__)
struct {
enum hwmon_sensor_type type;
char *fname; /* filename in /sys/class/hwmon/hwmonX/device/ */
} hwmon;
#endif
struct {
struct fs_stat *fs;
@ -1817,11 +1810,6 @@ static void free_text_objects(unsigned int count, struct text_object *objs)
case OBJ_acpitempf:
close(objs[i].data.i);
break;
#if defined(__linux__)
case OBJ_hwmon:
free(objs[i].data.hwmon.fname);
break;
#endif
case OBJ_i2c:
close(objs[i].data.i2c.fd);
break;
@ -2301,28 +2289,6 @@ static struct text_object *construct_text_object(const char *s, const char *arg,
obj->data.s = strdup(bat);
#endif /* !__OpenBSD__ */
#if defined(__linux__)
END OBJ(hwmon, 0)
if (!arg) {
CRIT_ERR("hwmon: needs arguments (hwmon-number, sensor type, sensor number, sensor subtype)");
} else {
unsigned int monidx, sensidx;
char sensor[10], senssub[32];
if (sscanf(arg, "%u %9s %u %31s", &monidx, sensor, &sensidx, senssub) != 4) {
CRIT_ERR("hwmon: invalid (number of) arguments");
} else {
unsigned int maxlen = strlen(arg)+29+1+1; /* 29=strlen("/sys/class/hwmon/hwmon/device") */
char fname[maxlen];
snprintf(fname, maxlen, "/sys/class/hwmon/hwmon%u/device/%s%u_%s", monidx, sensor, sensidx, senssub);
obj->data.hwmon.fname = strdup(fname);
if (strncmp(sensor, "temp", 5) == 0) {
obj->data.hwmon.type = HWMON_temp;
} else if (strncmp(sensor, "fan", 4) == 0) {
obj->data.hwmon.type = HWMON_fan;
} else {
obj->data.hwmon.type = HWMON_other;
}
}
}
END OBJ(i8k_version, INFO_I8K)
END OBJ(i8k_bios, INFO_I8K)
END OBJ(i8k_serial, INFO_I8K)
@ -3772,9 +3738,6 @@ static void generate_text_internal(char *p, int p_max_size, struct text_object *
new_fg(p, color9);
}
#if defined(__linux__)
OBJ(hwmon) {
get_hwmon_value(p, p_max_size, obj->data.hwmon.fname, obj->data.hwmon.type);
}
OBJ(i8k_version) {
snprintf(p, p_max_size, "%s", i8k.version);
}

View File

@ -280,12 +280,6 @@ enum {
INFO_PLATFORM = 25
};
enum hwmon_sensor_type {
HWMON_temp,
HWMON_fan,
HWMON_other
};
void get_hwmon_value( char * p_client_buffer, size_t client_buffer_size, char * fname, enum hwmon_sensor_type type );
/* get_battery_stuff() item selector */
enum {

View File

@ -777,33 +777,6 @@ double get_sysbus_info(int *fd, int div, char *devtype, char *type)
}
}
void get_hwmon_value( char * p_client_buffer, size_t client_buffer_size, char * fname, enum hwmon_sensor_type type )
{
static int rep;
int sensor_value;
FILE *fp;
if ( !p_client_buffer || client_buffer_size <= 0 || !fname )
return;
if ((fp = open_file(fname, &rep)) == NULL) {
snprintf( p_client_buffer, client_buffer_size, "hwmon: file '%s' not found", fname );
} else {
fscanf(fp, "%d", &sensor_value);
fclose(fp);
switch (type) {
case HWMON_temp:
sensor_value /= 1000; /* temperatures are given in milli-degree (at least for my abit uguru) */
break;
case HWMON_fan: /* already in RPM on my abit uguru */
case HWMON_other: /* do nothing */
default:
break;
}
snprintf( p_client_buffer, client_buffer_size, "%d", sensor_value );
}
}
/* Prior to kernel version 2.6.12, the CPU fan speed was available
* in ADT746X_FAN_OLD, whereas later kernel versions provide this
* information in ADT746X_FAN.