Altough the following configuration is wrong, it should only produce a error
about a missing $endif but instead it also produced a segmentation fault:
TEXT
$if_gw$gw_ip$else
All lines behind a comment line were also removed, comments should also be able
to start in the middle of line, \# shouldn't be replaced if it's in a comment
Also undid the last change because sony.h was not included, feel free to submit
it again if you include this file and other sourcefiles needed (there is also
no definition of get_sony_fanspeed). If sony systems already have this file and
a definition of this function, please update the configure file so that support
for this is disabled by default and can be enabled by sony owners.
Added the (incomplete) check_docs.py, to 'synchronize' the docs with the
code, as well as vim/nano syntax stuff.
Removed some unused OBJ_* stuff from text_objects.h, and updated docs
with some missing things. Also removed a couple deprecated objects
which were still documented.
The inconsistent naming of the cpu parameter in the docs led me to this,
so I also simplified parsing by introducing the macro SCAN_CPU(). Note
that this introduces a syntactical change to the config: the cpuN
argument now has to be passed at first position to $cpugraph.
Moved interface_up(...) from linux.{c.h} to common.{c,h} and taught it
to check for ENXIO as well to make it work on FreeBSD.
Signed-off-by: Nikos Ntarmos <ntarmos@cs.uoi.gr>
Moving sysfs-related functions and defs out of common.h and into
linux.h, as sysfs exists only on Linux, and updating openbsd.c,
netbsd.c, and freebsd.c accordingly.
Signed-off-by: Nikos Ntarmos <ntarmos@cs.uoi.gr>
Typo: __LINUX__ was used in a conditional code block, while the rest of
the code uses __linux__
data: free_text_objects(...) #define's 'data' to be 'obj->data' to make
the code more compact. The linux-specific parts of the code still
used obj->data, which should expand to obj->obj->data, which is
wrong.
Signed-off-by: Nikos Ntarmos <ntarmos@cs.uoi.gr>
This object makes use of the possibility to escape dollar signs in TEXT.
Take the following example in the conkyrc:
| $${downspeed ${gw_iface}}
will be evaluated to (assuming the gw_iface is eth0):
| ${downspeed eth0}
and finally interpreted to print the gateway interface's downspeed rate.
The idea found in the code is any double dollar ($$) is being treated as
explicit dollar sign ($) instead of the start of a text object
reference. Due to missing update of the 's' variable, when creating a
text object for the text following the second dollar sign, the later was
prepended, leading to a double dollar in the output.
Use dynamic allocated memory for skey and svalue,
allocate the length of value so that there are no limits,
but don't use the %a gnu extension to maintain compatibility
This patch is written by a anonymous author, see patch on sf.net
id #2663691 . I changed it a bit so that it can't overwrite
existing environment variables and updated the docs and syntaxfiles
As a side effect, font and colour specific stuff got outsourced, too.
This is because the apropriate functions are used by conky.c as well as
specials.c, so they should be kept on their own.
In the long term I hope for positive impact on the X11 integration mess.
(Take e.g. the mass of X11 ifdefs cluttering conky.c.) Though this
commit contains no optimisations in this direction, just plain
outsourcing, to ensure minimised (intended: none) changes to conky's
interface behaviour.
In fact these two objects share a lot of code, so the bigger plan is to
merge them into a single file to share equal code.
This should not change anything to the code flow, besides making conky
startup a bit more robust due to less use of CRIT_ERR.
Well, not really. I don't dare putting it all together into a single
source file, as that would just not make sense. Instead, this patch
eliminates the --enable-smapi configure option and all related checks,
replacing them with the equivalents from --enable-ibm.
Despite this is actually not much code and could stay inside linux.c as
well, this makes sense as I want to combine smapi and ibm-acpi
functionality. Virtually every user of a notebook made by IBM/Lenovo
will want both, so this should be a feature not a bug.
Besides making the ibm-acpi objects being built optionally, this should
not change anything to the code flow.
Also, note that free() does not zero the passed pointer. So conditional
freeing always needs to look like this:
| if (var) {
| free(var);
| var = 0;
| }
* change the height of execbar and execibar to be the same as other
bars have by default (6 pixels)
* treat mixer values as percentages as they're usually 0-100 (switch
to spaced_print() with pad_percents)
* change temp_print() from snprintf() to spaced_print()
* remove decimals from temp_print() as none of the current sources can
supply values smaller than 1 degree (C or F, doesn't matter)
* add a space between number and the unit in human_readable()
* fix number printing in human_readable()
* network $upspeed and $downspeed now use human_readable()
Since there is no choice of which moc player to get information from,
all moc objects' data source can be identical. Also hide some internal
data (the thread e.g.). Since from now on there can only be one moc
thread (not highlander ;), we don't need to treat the thread object
specially.
While here, fix indenting.
All objects parsing text into objects formerly parsed and evaluated
their arguments each update interval. This does only make sense when the
parsed text could change between updates, which is the case for execp
and execpi objects, but none of the others. So have them parse the text
when creating them, so each update interval only the output has to be
re-extracted.
In fact, this should give a performance boost when using any of the
affected objects, as parsing the input text is quite expensive since
we're evaluating templates.
Using a global ifblock stack for all parsed ifblock objects causes
problems when doing sub-parsing in objects taking other objects as
parameters, because the possibly non-empty stack at startup leads to
false alarm when checking for stack emptiness after parsing the objects.
Use a void ** as the object to pass around, so callers don't need to
know struct ifblock_stack_obj.
In fact, they are. But we don't want to treat them as those, because
the rewrite made the only situation when threaded objects matter
uncritical, i.e. when an object calls calling parse_conky_vars().
In general, argument types should match, but for combined long and
double usage the long is being converted to double before evaluation.
A few examples:
${if_match ${cpu} < 30}
${if_match "asdf" != "qwer"}
${if_match 0.5 < 0.50001}
${if_match 49.999 < 50}
The crux is to split args between those for scan_graph() on one hand and
prepare_diskio_stat() on the other hand. To make the code working with
minimal changes, move the yet optional devicename to the end.
General note on graphs:
- for all graphs there exist the optional arguments for scan_graph()
which come first and are optional (intended duplicate)
- all other args are object specific, and may be optional as well
Handle mpd internal information inside mpd.c. Use a refcounter to check
if the mpd-information can be freed (maybe useless). Remove the now
useless "full" flag of free_text_objects.
The only change of behaviour occurs when adjusting the unit of positive
values. For some reason 1000LL was used, which has now been replaced by
1024LL. Usage of abs() and MAX() might be OS dependent, but it should
not be too hard to implement them by hand if they're missing somewhere.
It was a static int before, holding the (already defined) enum's value,
which doesn't make sense. Also it's used only inside conky.c. Since
enums can't be assigned other values than what are defined, we can skip
checking for illegal spacer value at each invocation of spaced_print,
and then also drop the function name argument, which apparently didn't
make sense at all, because use_spacer is a global option.
Instead of splitting information, use diskio_stats[0] in diskio.c for
the totals. This saves a few branches, and frees some data from struct
information.
Some statics are now defined by configure.ac.in, conky.h got a lot
smaller, which I see as a positive sign.
This patch should not change any functionality, just change what's
defined where. Some features I did/could not test are probably broken,
also compiling for any other OS surely won't complete now. Though I
think fixing these problems is as easy as including some missing
headers.
I've done compile checks with the following configure options:
./configure --enable-eve --enable-rss --enable-smapi
--enable-wlan --enable-debug --enable-testing
So what needs to be tested is:
- audacious
- BMPx
- xmms2
- nvidia
Using a macro is not possible anymore, so have a function dev_name() do
the job. Functionality is the same as the old DEV_NAME, unless the
specified path is a symlink in which case it's being dereferenced first.
To save callers from having to free the returned string, a static local
buffer is used (effectively rendering the function non-reentrant).
This patch makes Conky print a sample config when being called with the
'-C' flag.
A short test showed an increase of ~10kbytes of the conky binary's size.
Two things that pissed me off about the old one:
* only limited support for nesting templates
* totally broken output when using conditionals inside a template
The later one was the hard one to fix. ;)
It requires to already have the full text substituted before the text
objects are being created from it. Generating only the contained objects
broke, because the conditionals got wrong offsets to jump to.
After that was fixed, full nesting support is realised by simply
repeating the replacement until no more template objects are found.
Withdrawn windows are those you get from applications supporting the
'-w' flag, like e.g. gkrellm or all those sweet WindowMaker dockapps
(wmcpu and Co.). In Fluxbox, these windows are drawn into the slit. Most
other window managers put them into their "taskbar", AFAIK.
This patch makes Conky act exactly the same if the following settings
are selected:
| own_window yes
| own_window_type dock
This introduces a new configuration variable called "temperature_unit",
specifying the unit of all temperature sensors. To achieve this, each
object outputting a temperature has to call temp_print() like so:
| temp_print(p, p_max_size, <temp val as double>, <unit of val>);
to specify the input temperature unit, either one of the constants
TEMP_CELSIUS or TEMP_FAHRENHEIT.
The new command line option '-D' ('--debug') increases debugging level by one.
For debugging output a user could be interested in, use the macros DEBUG() and
DEBUG2(). Functionality is equal to the ERR() macro. DEBUG2() prints stuff only
if debugging level is greater one, which means that '--debug' has been
specified more than once. This patch also includes usage of the macros for the
new template object (as debugging syntax errors in templates is one thing a
user potentially needs to do).
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@1273 7f574dfc-610e-0410-a909-a81674777703
* handle escaped characters in parameters to the template object, too
* add samples to the documentation
* do some code cleanup by outsourcing the string substitution into it's
own function
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@1271 7f574dfc-610e-0410-a909-a81674777703
Basically you can define a template like this:
| template0 \1:\n ${fs_free \2} / ${fs_used \2}
and use it later like this:
| ${template0 root /}
| ${template0 boot /boot}
which is exactly the same as the following:
| root:
| ${fs_free /} / ${fs_used /}
| boot:
| ${fs_free /boot} / ${fs_used /boot}
hope you like it, I do already. :)
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@1270 7f574dfc-610e-0410-a909-a81674777703
* happened when passing wrong arguments to ${scroll}, particularly with only
one instead of the mandatory two unsigned ints
* as it's not clear whether %n will change the value returned by sscanf or not,
use a solution that works in both situations (%n incrementing the return
value or not)
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@1268 7f574dfc-610e-0410-a909-a81674777703
* check only the unique part of the argument
* print temperatures like all others (%.1f)
* do argument parsing in nvidia.c (so all specific stuff is at one place)
* little header cleanup
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@1231 7f574dfc-610e-0410-a909-a81674777703
In order to do this correctly:
Removed duplicate includes
Fixed mpd functions to accept mpd_s instead of information
Freed mpd.h of any need to include conky.h (mpd.c still includes it for the constants)
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@1154 7f574dfc-610e-0410-a909-a81674777703
* New $loadgraph to show a graph of load averages,
* add "show_graph_scale" option to turn off/on the showing of the
current max value for the graph,
* minor code fixes,
* update nano and vim syntax highlighting stuff.
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@1104 7f574dfc-610e-0410-a909-a81674777703
* Fix bug due to usage of gethostbyname() in threads (which is not
reentrant) by using gethostbyname_r() when available.
* Added patch for battery_time problem on 2.6.24 (thanks wedge).
* Added patch to fix broken xmms2 stuff (thanks sleipner).
* Added patch to fix SIGHUP/SIGUSR1 segfault (thanks norsetto).
* Added patch to improve $if_up (thanks Aseem).
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@1103 7f574dfc-610e-0410-a909-a81674777703
* the macro DEV_NAME() "removes" any leading "/dev/"
if existing
* the only object that needs the full path is hddtemp,
so add code there to add "/dev/" if necessary
(can't be done via macro)
* attempt to fix also the hddtemp output, as the
"degree"-sign seems to be inserted in utf-8 and
printed in latin.
* hddtemp breaks the rules by inserting the unit
itself, but as it could be either "C" or "F", this
would lead to confusion otherwise
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@1091 7f574dfc-610e-0410-a909-a81674777703
* not sure but this looked completely wrong, as 'iconv'
is a function.
* if iconv_cd is NULL, iconv_count is 0 and therefore
realloc should do the same as malloc here.
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@1069 7f574dfc-610e-0410-a909-a81674777703
* instead of empty args "void" should always be specified.
Using this, the compiler can detect incorrect function calls,
like with update_stuff().
* No args seems to be interpreted as "unspecified args" by the
compiler, as with update_mail_count(). So no checking for
correctness of arguments when calling was done at all.
* This is not complete yet, as I still don't have any BSD for
testing.
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@1055 7f574dfc-610e-0410-a909-a81674777703
* I accidentially used wrong args when testing conky -> segfault
* reproduce using 'conky -c /this/doesnt/exist'
* code should be portable, but untested on freebsd
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@1044 7f574dfc-610e-0410-a909-a81674777703
* gathers information from /etc/resolv.conf
* included (still commented) code to prevent reading too often,
as I'm not sure whether reading from a real FS (not /proc or /sys)
could generate higher load in some cases -> comments please!
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@1035 7f574dfc-610e-0410-a909-a81674777703