fixed order of variables and stuff (credit peter tarjan), small battery fix (credit...
authorBrenden Matthews <brenden1@rty.ca>
Thu, 8 Jun 2006 04:29:23 +0000 (04:29 +0000)
committerBrenden Matthews <brenden1@rty.ca>
Thu, 8 Jun 2006 04:29:23 +0000 (04:29 +0000)
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@671 7f574dfc-610e-0410-a909-a81674777703

ChangeLog
README
configure.in
doc/conky.1
doc/variables.xml
src/linux.c

index 3675cf7..c402264 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 # $Id$
 
+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
 
diff --git a/README b/README
index d117ade..ba93e8d 100644 (file)
--- a/README
+++ b/README
@@ -561,16 +561,6 @@ VARIABLES
              omitted, the parameter defaults to 1.
 
 
-       voltage_mv (n)
-             Returns CPU #n's voltage in mV. CPUs  are  counted  from  1.  If
-             omitted, the parameter defaults to 1.
-
-
-       voltage_v (n)
-             Returns CPU #n's voltage in V. CPUs are counted from 1. If omit-
-             ted, the parameter defaults to 1.
-
-
        freq_dyn
              Returns CPU frequency in MHz, but is calculated by  counting  to
              clock  cycles  to  complete  an  instruction. Only available for
@@ -696,6 +686,26 @@ VARIABLES
              the version formatting of /proc/i8k.
 
 
+       ibm_fan
+             If running the IBM ACPI, displays the fan speed.
+
+
+       ibm_temps N
+             If  running the IBM ACPI, displays the temperatures from the IBM
+             temperature sensors (N=0..7) Sensor 0 is on the CPU, 3 is on the
+             GPU.
+
+
+       ibm_volume
+             If  running  the  IBM  ACPI,  displays the "master" volume, con-
+             trolled by the volume keys (0-14).
+
+
+       ibm_brightness
+             If running the IBM ACPI, displays the brigtness of the laptops's
+             LCD (0-7).
+
+
        if_running (process)
              if  PROCESS  is  running,  display everything if_running and the
              matching $endif
@@ -1064,6 +1074,16 @@ VARIABLES
              text to overlap. See also $offset.
 
 
+       voltage_mv (n)
+             Returns  CPU  #n's  voltage  in  mV. CPUs are counted from 1. If
+             omitted, the parameter defaults to 1.
+
+
+       voltage_v (n)
+             Returns CPU #n's voltage in V. CPUs are counted from 1. If omit-
+             ted, the parameter defaults to 1.
+
+
        xmms_bar (height),(width)
              xmms / bmp / audacious / infopipe: progress bar
 
@@ -1125,26 +1145,6 @@ VARIABLES
              xmms / bmp / audacious / infopipe: title of current tune
 
 
-       ibm_fan
-             If running the IBM ACPI, displays the fan speed.
-
-
-       ibm_temps N
-             If running the IBM ACPI, displays the temperatures from the  IBM
-             temperature sensors (N=0..7) Sensor 0 is on the CPU, 3 is on the
-             GPU.
-
-
-       ibm_volume
-             If running the IBM ACPI,  displays  the  "master"  volume,  con-
-             trolled by the volume keys (0-14).
-
-
-       ibm_brightness
-             If running the IBM ACPI, displays the brigtness of the laptops's
-             LCD (0-7).
-
-
 EXAMPLES
        conky -t '${time %D %H:%m}' -o -u 30
              Start Conky in its own window with date and clock as text and 30
index 6057427..6f70533 100644 (file)
@@ -6,9 +6,6 @@ dnl
 dnl C Compiler
 dnl
 
-if test x$CFLAGS = x; then
-       AC_SUBST(CFLAGS, [ ])
-fi
 AC_PROG_CC
 AC_PROG_LIBTOOL
 PKG_PROG_PKG_CONFIG([0.17.2])
index b4a6f79..03a6681 100644 (file)
@@ -504,7 +504,7 @@ Specify a different font. This new font will apply to the current line and every
 \fBfreq\fR \fB(n)\fR 
 Returns CPU #n's frequency in MHz. CPUs are
 counted from 1. If omitted, the parameter
-defaults to 1. 
+defaults to 1.
 
 .TP 
 \fBfreq_g\fR \fB(n)\fR 
@@ -513,18 +513,6 @@ counted from 1. If omitted, the parameter
 defaults to 1.
 
 .TP 
-\fBvoltage_mv\fR \fB(n)\fR 
-Returns CPU #n's voltage in mV. CPUs are
-counted from 1. If omitted, the parameter
-defaults to 1. 
-
-.TP 
-\fBvoltage_v\fR \fB(n)\fR 
-Returns CPU #n's voltage in V. CPUs are
-counted from 1. If omitted, the parameter
-defaults to 1.
-
-.TP 
 \fBfreq_dyn\fR 
 Returns CPU frequency in MHz, but is calculated by counting to clock cycles to complete an instruction. Only available for x86/amd64.
 
@@ -617,6 +605,26 @@ If running the i8k kernel driver for Inspiron laptops, displays your laptop seri
 If running the i8k kernel driver for Inspiron laptops, displays the version formatting of /proc/i8k.
 
 .TP 
+\fBibm_fan\fR 
+If running the IBM ACPI, displays the fan speed.
+
+.TP 
+\fBibm_temps\fR \fBN\fR 
+If running the IBM ACPI, displays the temperatures
+from the IBM temperature sensors (N=0..7) Sensor 0 is
+on the CPU, 3 is on the GPU.
+
+.TP 
+\fBibm_volume\fR 
+If running the IBM ACPI, displays the "master" volume,
+controlled by the volume keys (0-14).
+
+.TP 
+\fBibm_brightness\fR 
+If running the IBM ACPI, displays the brigtness of the
+laptops's LCD (0-7).
+
+.TP 
 \fBif_running\fR \fB(process)\fR 
 if PROCESS is running, display everything if_running and the matching $endif
 
@@ -938,6 +946,18 @@ Seti@home total user credit
 Change vertical offset by N pixels. Negative values will cause text to overlap. See also $offset.
 
 .TP 
+\fBvoltage_mv\fR \fB(n)\fR 
+Returns CPU #n's voltage in mV. CPUs are
+counted from 1. If omitted, the parameter
+defaults to 1. 
+
+.TP 
+\fBvoltage_v\fR \fB(n)\fR 
+Returns CPU #n's voltage in V. CPUs are
+counted from 1. If omitted, the parameter
+defaults to 1.
+
+.TP 
 \fBxmms_bar\fR \fB(height),(width)\fR 
 xmms / bmp / audacious / infopipe: progress bar
 
@@ -989,26 +1009,6 @@ xmms / bmp / audacious / infopipe: player status (Playing/Paused/Stopped/Not run
 \fBxmms_title\fR 
 xmms / bmp / audacious / infopipe: title of current tune
 
-.TP 
-\fBibm_fan\fR 
-If running the IBM ACPI, displays the fan speed.
-
-.TP 
-\fBibm_temps\fR \fBN\fR 
-If running the IBM ACPI, displays the temperatures
-from the IBM temperature sensors (N=0..7) Sensor 0 is
-on the CPU, 3 is on the GPU.
-
-.TP 
-\fBibm_volume\fR 
-If running the IBM ACPI, displays the "master" volume,
-controlled by the volume keys (0-14).
-
-.TP 
-\fBibm_brightness\fR 
-If running the IBM ACPI, displays the brigtness of the
-laptops's LCD (0-7).
-
 .SH EXAMPLES
 .TP 
 conky \fB\-t '${time %D %H:%m}' \-o \-u 30\fR
index 2a8122b..d7a1a9b 100644 (file)
        <para></para></listitem>
 </varlistentry>
 
+<varlistentry>
+       <term>
+               <command><option>freq</option></command>
+               <option>(n)</option>
+       </term>
+       <listitem>
+               Returns CPU #n's frequency in MHz. CPUs are
+               counted from 1. If omitted, the parameter
+               defaults to 1.
+               <para></para></listitem>
+</varlistentry>
+<varlistentry>
+       <term>
+               <command><option>freq_g</option></command>
+               <option>(n)</option>
+       </term>
+       <listitem>
+               Returns CPU #n's frequency in GHz. CPUs are
+               counted from 1. If omitted, the parameter
+               defaults to 1.
+               <para></para></listitem>
+</varlistentry>
        
-       <varlistentry>
-               <term>
-                       <command><option>freq</option></command>
-                       <option>(n)</option>
-               </term>
-               <listitem>
-                       Returns CPU #n's frequency in MHz. CPUs are
-                       counted from 1. If omitted, the parameter
-                       defaults to 1. 
-                       <para></para></listitem>
-       </varlistentry>
-       <varlistentry>
-               <term>
-                       <command><option>freq_g</option></command>
-                       <option>(n)</option>
-               </term>
-               <listitem>
-                       Returns CPU #n's frequency in GHz. CPUs are
-                       counted from 1. If omitted, the parameter
-                       defaults to 1.
-                       <para></para></listitem>
-       </varlistentry>
-       
-       <varlistentry>
-               <term>
-                       <command><option>voltage_mv</option></command>
-                       <option>(n)</option>
-               </term>
-               <listitem>
-                       Returns CPU #n's voltage in mV. CPUs are
-                       counted from 1. If omitted, the parameter
-                       defaults to 1. 
-                       <para></para></listitem>
-       </varlistentry>
-       <varlistentry>
-               <term>
-                       <command><option>voltage_v</option></command>
-                       <option>(n)</option>
-               </term>
-               <listitem>
-                       Returns CPU #n's voltage in V. CPUs are
-                       counted from 1. If omitted, the parameter
-                       defaults to 1.
-                       <para></para></listitem>
-       </varlistentry>
-
-       <varlistentry>
-               <term>
-                       <command><option>freq_dyn</option></command>
-               </term>
-               <listitem>
+<varlistentry>
+       <term>
+               <command><option>freq_dyn</option></command>
+       </term>
+       <listitem>
                        Returns CPU frequency in MHz, but is calculated by counting to clock cycles to complete an instruction.  Only available for x86/amd64.
                        <para></para></listitem>
-       </varlistentry>
-       <varlistentry>
-               <term>
-                       <command><option>freq_dyn_g</option></command>
-               </term>
-               <listitem>
-                       Returns CPU frequency in GHz, but is calculated by counting to clock cycles to complete an instruction.  Only available for x86/amd64.
-                       <para></para></listitem>
-       </varlistentry>
+</varlistentry>
+
+<varlistentry>
+       <term>
+               <command><option>freq_dyn_g</option></command>
+       </term>
+       <listitem>
+               Returns CPU frequency in GHz, but is calculated by counting to clock cycles to complete an instruction.  Only available for x86/amd64.
+       <para></para></listitem>
+</varlistentry>
        
-       <varlistentry>
+<varlistentry>
        <term>
                <command><option>fs_bar</option></command>
        <option>(height),(width) fs</option>
        <para></para></listitem>
 </varlistentry>
 
+<varlistentry>
+       <term>
+               <command><option>ibm_fan</option></command>
+       </term>
+       <listitem>
+               If running the IBM ACPI, displays the fan speed.
+       <para></para></listitem>
+</varlistentry>
+
+<varlistentry>
+       <term>
+               <command><option>ibm_temps</option></command>
+               <option>N</option>
+       </term>
+       <listitem>
+               If running the IBM ACPI, displays the temperatures
+               from the IBM temperature sensors (N=0..7) Sensor 0 is
+               on the CPU, 3 is on the GPU.
+       <para></para></listitem>
+</varlistentry>
+
+<varlistentry>
+       <term>
+               <command><option>ibm_volume</option></command>
+       </term>
+       <listitem>
+               If running the IBM ACPI, displays the "master" volume,
+       controlled by the volume keys (0-14).
+       <para></para></listitem>
+</varlistentry>
+
+<varlistentry>
+       <term>
+               <command><option>ibm_brightness</option></command>
+       </term>
+       <listitem>
+               If running the IBM ACPI, displays the brigtness of the
+       laptops's LCD (0-7).
+       <para></para></listitem>
+</varlistentry>
+
 
 <varlistentry>
        <term>
                Seti@home total user credit
        <para></para></listitem>
 </varlistentry>
+
 <varlistentry>
        <term>
                <command><option>voffset</option></command>
 
 <varlistentry>
        <term>
+               <command><option>voltage_mv</option></command>
+               <option>(n)</option>
+       </term>
+       <listitem>
+               Returns CPU #n's voltage in mV. CPUs are
+               counted from 1. If omitted, the parameter
+               defaults to 1. 
+               <para></para></listitem>
+</varlistentry>
+
+<varlistentry>
+       <term>
+               <command><option>voltage_v</option></command>
+               <option>(n)</option>
+       </term>
+       <listitem>
+               Returns CPU #n's voltage in V. CPUs are
+               counted from 1. If omitted, the parameter
+               defaults to 1.
+               <para></para></listitem>
+</varlistentry>
+               
+<varlistentry>
+       <term>
                <command><option>xmms_bar</option></command>
                 <option>(height),(width)</option>
        </term>
        <para></para></listitem>
 </varlistentry>
 
-<varlistentry>
-       <term>
-               <command><option>ibm_fan</option></command>
-       </term>
-       <listitem>
-               If running the IBM ACPI, displays the fan speed.
-       <para></para></listitem>
-</varlistentry>
-
-<varlistentry>
-       <term>
-               <command><option>ibm_temps</option></command>
-               <option>N</option>
-       </term>
-       <listitem>
-               If running the IBM ACPI, displays the temperatures
-               from the IBM temperature sensors (N=0..7) Sensor 0 is
-               on the CPU, 3 is on the GPU.
-       <para></para></listitem>
-</varlistentry>
-
-<varlistentry>
-       <term>
-               <command><option>ibm_volume</option></command>
-       </term>
-       <listitem>
-               If running the IBM ACPI, displays the "master" volume,
-       controlled by the volume keys (0-14).
-       <para></para></listitem>
-</varlistentry>
-
-<varlistentry>
-       <term>
-               <command><option>ibm_brightness</option></command>
-       </term>
-       <listitem>
-               If running the IBM ACPI, displays the brigtness of the
-       laptops's LCD (0-7).
-       <para></para></listitem>
-</varlistentry>
-
 </variablelist>
index 1a4f788..36fd707 100644 (file)
@@ -1264,7 +1264,7 @@ void get_battery_stuff(char *buf, unsigned int n, const char *bat)
                /* charging */
                if (strcmp(charging_state, "charging") == 0) {
                        if (acpi_last_full != 0 && present_rate > 0) {
-                               strcpy(last_battery_str, "charging ");
+                               strncpy(last_battery_str, "charging ", 64);
                                format_seconds(last_battery_str + 9,
                                               63 - 9,
                                               (acpi_last_full -
@@ -1272,39 +1272,42 @@ void get_battery_stuff(char *buf, unsigned int n, const char *bat)
                                               60 / present_rate);
                        } else if (acpi_last_full != 0
                                   && present_rate <= 0) {
-                               sprintf(last_battery_str, "charging %d%%",
+                               snprintf(last_battery_str, 64, "charging %d%%",
                                        remaining_capacity * 100 /
                                        acpi_last_full);
                        } else {
-                               strcpy(last_battery_str, "charging");
+                               strncpy(last_battery_str, "charging", 63);
                        }
                }
                /* discharging */
-               else if (strcmp(charging_state, "discharging") == 0) {
-                       if (present_rate > 0)
+               else if (strncmp(charging_state, "discharging", 64) == 0) {
+                       if (present_rate > 0) {
                                format_seconds(last_battery_str, 63,
                                               (remaining_capacity * 60 *
                                                60) / present_rate);
-                       else
-                               sprintf(last_battery_str,
+                       } else if (present_rate == 0) { /* Thanks to Nexox for this one */
+                               snprintf(last_battery_str, 64, "full");
+                       } else {
+                               snprintf(last_battery_str, 64,
                                        "discharging %d%%",
                                        remaining_capacity * 100 /
                                        acpi_last_full);
+                       }
                }
                /* charged */
                /* thanks to Lukas Zapletal <lzap@seznam.cz> */
-               else if (strcmp(charging_state, "charged") == 0) {
+               else if (strncmp(charging_state, "charged", 64) == 0) {
                                strcpy(last_battery_str, "charged");
                }
                /* unknown, probably full / AC */
                else {
                        if (acpi_last_full != 0
                            && remaining_capacity != acpi_last_full)
-                               sprintf(last_battery_str, "unknown %d%%",
+                               snprintf(last_battery_str, 64, "unknown %d%%",
                                        remaining_capacity * 100 /
                                        acpi_last_full);
                        else
-                               strcpy(last_battery_str, "AC");
+                               strncpy(last_battery_str, "AC", 64);
                }
        } else {
                /* APM */