$tail
authorBrenden Matthews <brenden1@rty.ca>
Sun, 21 Aug 2005 08:23:04 +0000 (08:23 +0000)
committerBrenden Matthews <brenden1@rty.ca>
Sun, 21 Aug 2005 08:23:04 +0000 (08:23 +0000)
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@125 7f574dfc-610e-0410-a909-a81674777703

ChangeLog
README
conky.c
conkyrc.sample
doc/docs.xml

index b75fdff..6932fce 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,7 @@
        * Added $voffset
        * Removed metar code.  It sucked.
        * Added $acpitempf for amooricans
+       * $tail fixes
 
 2005-08-12
        * Multiple unit additions and modifications
diff --git a/README b/README
index baefbb3..348ffb7 100644 (file)
--- a/README
+++ b/README
@@ -29,7 +29,7 @@
 
        To compile and run Conky with all optional components (If you run Gentoo, see the "Ebuild" Section below):
 
-               ./configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --enable-double-buffer --enable-own-window --enable-proc-uptime --enable-mpd --enable-xft --enable-metar --enable-seti
+               ./configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --enable-double-buffer --enable-own-window --enable-proc-uptime --enable-mpd --enable-xft --enable-seti
                make
                ./conky
 
@@ -79,9 +79,6 @@
        gap_y                 Gap between top or bottom border of screen, same as passing -y at command line
        no_buffers            Substract (file system) buffers from used memory?    
        mail_spool            Mail spool for mail checking                         
-       metar_station         METAR station code for weather, see http://www.wrh.noaa.gov/ if you need to find your code.
-       metar_server          Define a custom METAR ftp server
-       metar_path            Path on server to use
        minimum_size          Minimum size of window                               
        mldonkey_hostname     Hostname for mldonkey stuff, defaults to localhost
        mldonkey_port         Mldonkey port, 4001 default
        memmax                          Total amount of memory                   
        memperc                         Percentage of memory in use
        
-       metar_ob_time
-       metar_temp
-       metar_tempf                     Temp in F
-       metar_windchill
-       metar_dew_point                 There are a bunch of these
-       metar_rh                        and they are self-explanatory
-       metar_windspeed                                 Windspeed in knots
-       metar_windspeed_km                              Windspeed in km/hr
-       metar_windspeed_mph                             Windspeed in mph
-       metar_winddir
-       metar_swinddir
-       metar_cloud
-       metar_u2d_time
-       
        ml_upload_counter               total session upload in mb
        ml_download_counter             total session download in mb
        ml_nshared_files                number of shared files
diff --git a/conky.c b/conky.c
index 34122fe..ec0d9a2 100644 (file)
--- a/conky.c
+++ b/conky.c
@@ -407,6 +407,7 @@ static struct special_t *new_special(char *buf, int t)
 typedef struct tailstring_list {
        char data[TEXT_BUFFER_SIZE];
        struct tailstring_list *next;
+       struct tailstring_list *first;
 } tailstring;
 
 void addtail(tailstring ** head, char *data_in)
@@ -415,6 +416,11 @@ void addtail(tailstring ** head, char *data_in)
        if ((tmp = malloc(sizeof(*tmp))) == NULL) {
                CRIT_ERR("malloc");
        }
+       if (*head == NULL) {
+               tmp->first = tmp;
+       } else {
+               tmp->first = (*head)->first;
+       }
        strncpy(tmp->data, data_in, TEXT_BUFFER_SIZE);
        tmp->next = *head;
        *head = tmp;
@@ -423,7 +429,6 @@ void addtail(tailstring ** head, char *data_in)
 void freetail(tailstring * head)
 {
        tailstring *tmp;
-
        while (head != NULL) {
                tmp = head->next;
                free(head);
@@ -431,7 +436,22 @@ void freetail(tailstring * head)
        }
 }
 
-
+void freelasttail(tailstring * head)
+{
+       tailstring * tmp = head;
+       while(tmp != NULL) {
+               if (tmp->next == head->first) {
+                       tmp->next = NULL;
+                       break;
+               }
+               tmp = tmp->next;
+       }
+       free(head->first);
+       while(head != NULL && tmp != NULL) {
+               head->first = tmp;
+               head = head->next;
+       }
+}
 
 static void new_bar(char *buf, int w, int h, int usage)
 {
@@ -2375,6 +2395,7 @@ static void generate_text()
                                        obj->data.tail.last_update = current_update_time;
                                        FILE *fp;
                                        int i;
+                                       int added = 0;
                                        tailstring *head = NULL;
                                        tailstring *headtmp = NULL;
                                        fp = fopen(obj->data.tail.logfile, "rt");
@@ -2385,6 +2406,12 @@ static void generate_text()
                                                obj->data.tail.readlines = 0;
 
                                                while (fgets(obj->data.tail.buffer, TEXT_BUFFER_SIZE*4, fp) != NULL) {
+                                                       if (added >= 30) {
+                                                               freelasttail(head);
+                                                       }
+                                                       else {
+                                                               added++;
+                                                       }
                                                        addtail(&head, obj->data.tail.buffer);
                                                        obj->data.tail.readlines++;
                                                }
@@ -3469,6 +3496,7 @@ static void clean_up()
        else
 #endif
        {
+               XClearWindow(display, RootWindow(display, screen));
                clear_text(1);
                XFlush(display);
        }
index f45ce3e..f877dc3 100644 (file)
@@ -120,16 +120,6 @@ use_spacer no
 #   mldonkey_login        Mldonkey login, default none
 #   mldonkey_password     Mldonkey password, default none
 
-# METAR station code for weather, get codes from weather.noaa.gov or google
-# or http://www.maltalinks.com/weather/ (thanks Hopeless @ f.g.o)
-metar_station  CYBW
-
-# METAR ftp server
-# metar_server weather.noaa.gov
-
-# METAR path on server
-# metar_path /data/observations/metar/stations
-
 # boinc (seti) dir
 # seti_dir /opt/seti
 
@@ -168,5 +158,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}
-${color}Current conditions:  ${color lightgrey}${metar_temp}C $metar_cloud
 ${tail /var/log/Xorg.0.log 3 30}
index 1044793..be585d0 100644 (file)
@@ -67,7 +67,7 @@
                                        --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info 
                                        --datadir=/usr/ share --sysconfdir=/etc --localstatedir=/var/lib 
                                        --enable-double-buffer --enable-own-window --enable-proc-uptime 
-                                       --enable-mpd --enable-xft --enable-metar --enable-seti</option>
+                                       --enable-mpd --enable-xft --enable-seti</option>
                                </term>
                        </varlistentry>
                        <varlistentry>