From a3106fac72c01f92ab397cbfd88cec76480dc991 Mon Sep 17 00:00:00 2001 From: Brenden Matthews Date: Fri, 5 Aug 2005 01:06:17 +0000 Subject: [PATCH] stuff git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@57 7f574dfc-610e-0410-a909-a81674777703 --- Conky.kdevelop | 43 +++++++++++++++++++++---------------------- common.c | 8 ++++++++ conky.c | 28 ++++++++++++++++------------ conky.h | 8 ++++++++ fs.c | 8 ++++++++ ftp.c | 2 ++ ftp.h | 2 ++ libmpdclient.h | 2 ++ linux.c | 41 +++++++++++++++++++++++++++++++++-------- mail.c | 8 ++++++++ metarinfo.c | 8 ++++++++ metarinfo.h | 8 ++++++++ mixer.c | 8 ++++++++ top.c | 8 ++++++++ top.h | 2 ++ x11.c | 8 ++++++++ 16 files changed, 150 insertions(+), 42 deletions(-) diff --git a/Conky.kdevelop b/Conky.kdevelop index 9f9fe1db..748a1019 100644 --- a/Conky.kdevelop +++ b/Conky.kdevelop @@ -9,20 +9,19 @@ . false - + - - src/Conky + conky debug conky build / - + false true @@ -36,7 +35,7 @@ kdevgccoptions kdevgppoptions kdevpgf77options - -O2 -pipe + -fomit-frame-pointer -O2 -fexceptions --prefix=/usr --enable-mpd --enable-xft --enable-seti --enable-double-buffer --enable-own-window --enable-metar --enable-mldonkey @@ -49,21 +48,21 @@ - --enable-debug=full --prefix=/usr --enable-xft --enable-double-buffer --enable-own-window --enable-metar --enable-mldonkey + --enable-debug=full --prefix=/usr --enable-mpd --enable-xft --enable-seti --enable-double-buffer --enable-own-window --enable-metar --enable-mldonkey debug kdevgccoptions kdevgppoptions kdevpgf77options - -O2 -Wall + -O2 -Wall -fexceptions -fomit-frame-pointer -fshort-enums -g3 - - - - - - - -O2 -Wall - + + + + + + + + @@ -80,12 +79,12 @@ - libtool - - - - - + /usr/bin/libtool + + /usr/bin/ + + + true false false @@ -166,7 +165,7 @@ 250 - + set m_,_ theValue diff --git a/common.c b/common.c index c51133ed..3833dd68 100644 --- a/common.c +++ b/common.c @@ -1,3 +1,11 @@ +/* + * Conky, a system monitor, based on torsmo + * + * This program is licensed under BSD license, read COPYING + * + * $Id$ + */ + #include "conky.h" #include #include diff --git a/conky.c b/conky.c index 2effe6a8..bbb2d873 100644 --- a/conky.c +++ b/conky.c @@ -1,6 +1,9 @@ -/* Conky, a system monitor, based on torsmo +/* + * Conky, a system monitor, based on torsmo * * This program is licensed under BSD license, read COPYING + * + * $Id$ */ #include "conky.h" @@ -128,7 +131,7 @@ static void load_fonts() #ifdef XFT /* load Xft font */ if (use_xft) { - if (fonts[i].xftfont != NULL && font_count < 1) { + if (fonts[i].xftfont != NULL && selected_font == 0) { XftFontClose(display, fonts[i].xftfont); } if ((fonts[i].xftfont = @@ -3997,20 +4000,21 @@ int main(int argc, char **argv) { /* handle command line parameters that don't change configs */ char *s; + char temp[10]; + unsigned int x; - if (((s = getenv("LC_ALL")) && *s) - || ((s = getenv("LC_CTYPE")) && *s) || ((s = getenv("LANG")) - && *s)) { - if (strstr(s, "UTF-8") || strstr(s, "utf-8") - || strstr(s, "UTF8") - || strstr(s, "utf8")) + if (((s = getenv("LC_ALL")) && *s) || ((s = getenv("LC_CTYPE")) && + *s) || ((s = getenv("LANG")) && *s)) { + strcpy(temp, s); + for(x = 0; x < strlen(s) ; x++) { + temp[x] = tolower(s[x]); + } + if (strstr(temp, "utf-8") || strstr(temp, "utf8")) { utf8_mode = 1; + } } if (!setlocale(LC_CTYPE, "")) { - fprintf - (stderr, - "Can't set the specified locale! " - "Check LANG, LC_CTYPE, LC_ALL.\n"); + ERR("Can't set the specified locale!\nCheck LANG, LC_CTYPE, LC_ALL."); return 1; } while (1) { diff --git a/conky.h b/conky.h index c954ab07..4ac50831 100644 --- a/conky.h +++ b/conky.h @@ -1,3 +1,11 @@ +/* + * Conky, a system monitor, based on torsmo + * + * This program is licensed under BSD license, read COPYING + * + * $Id$ + */ + #ifndef _conky_h_ #define _conky_h_ diff --git a/fs.c b/fs.c index c5f2fa85..9c019e87 100644 --- a/fs.c +++ b/fs.c @@ -1,3 +1,11 @@ +/* + * Conky, a system monitor, based on torsmo + * + * This program is licensed under BSD license, read COPYING + * + * $Id$ + */ + #include "conky.h" #include #include diff --git a/ftp.c b/ftp.c index 52cd3868..8549994a 100644 --- a/ftp.c +++ b/ftp.c @@ -3,6 +3,8 @@ * directory availability. No transfer is needed. * * Reference: RFC 959 + * + * $Id$ */ #include diff --git a/ftp.h b/ftp.h index dc178277..b158eba3 100644 --- a/ftp.h +++ b/ftp.h @@ -3,6 +3,8 @@ * to check for directory availability. No transfer is needed. * * Reference: RFC 959 + * + * $Id$ */ #ifndef __MIRRORS_FTP_H__ diff --git a/libmpdclient.h b/libmpdclient.h index 0ccaf30c..2b7669ce 100644 --- a/libmpdclient.h +++ b/libmpdclient.h @@ -28,6 +28,8 @@ 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. + + $Id$ */ diff --git a/linux.c b/linux.c index 9982a0a8..380b90ae 100644 --- a/linux.c +++ b/linux.c @@ -1,3 +1,10 @@ +/* linux.c + * Contains linux specific code + * + * $Id$ + */ + + #include "conky.h" #include #include @@ -636,7 +643,6 @@ char *get_adt746x_cpu() /***********************************************************************/ /* - * $Id$ * This file is part of x86info. * (C) 2001 Dave Jones. * @@ -646,19 +652,21 @@ char *get_adt746x_cpu() * Small changes by David Sterba * */ - -#if defined(CPU_X86) +#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 static char *buffer = NULL; +#else +static char *frequency; +#endif char *get_freq() { +#if defined(__i386) || defined(__x86_64) if (buffer == NULL) buffer = malloc(64); struct timezone tz; @@ -670,16 +678,12 @@ char *get_freq() /* get this function in cached memory */ gettimeofday(&tvstart, &tz); - #if defined(CPU_X86) cycles[0] = rdtsc(); - #endif gettimeofday(&tvstart, &tz); /* we don't trust that this is any specific length of time */ usleep(100); - #if defined(CPU_X86) cycles[1] = rdtsc(); - #endif gettimeofday(&tvstop, &tz); microseconds = ((tvstop.tv_sec - tvstart.tv_sec) * 1000000) + (tvstop.tv_usec - tvstart.tv_usec); @@ -687,6 +691,27 @@ char *get_freq() sprintf(buffer, "%lldMHz", (cycles[1] - cycles[0]) / microseconds); return buffer; +#else + FILE *f; + char s[1000]; + if (frequency == NULL) { + frequency = (char *) malloc(100); + assert(frequency != NULL); + } + //char frequency[10]; + f = fopen("/proc/cpuinfo", "r"); //open the CPU information file + //if (!f) + // return; + while (fgets(s, 1000, f) != NULL) //read the file + if (strncmp(s, "cpu M", 5) == 0) { //and search for the cpu mhz + //printf("%s", strchr(s, ':')+2); + strcpy(frequency, strchr(s, ':') + 2); //copy just the number + frequency[strlen(frequency) - 1] = '\0'; // strip \n + break; + } + fclose(f); + return frequency; +#endif } diff --git a/mail.c b/mail.c index f98bc0b3..baf77413 100644 --- a/mail.c +++ b/mail.c @@ -1,3 +1,11 @@ +/* + * Conky, a system monitor, based on torsmo + * + * This program is licensed under BSD license, read COPYING + * + * $Id$ + */ + #include "conky.h" #include #include diff --git a/metarinfo.c b/metarinfo.c index c2191887..f8ac0ac6 100644 --- a/metarinfo.c +++ b/metarinfo.c @@ -1,3 +1,11 @@ +/* + * Conky, a system monitor, based on torsmo + * + * This program is licensed under BSD license, read COPYING + * + * $Id$ + */ + #include "conky.h" #include #include "ftp.h" diff --git a/metarinfo.h b/metarinfo.h index 2236249f..0e884456 100644 --- a/metarinfo.h +++ b/metarinfo.h @@ -1,3 +1,11 @@ +/* + * Conky, a system monitor, based on torsmo + * + * This program is licensed under BSD license, read COPYING + * + * $Id$ + */ + #include #include #include diff --git a/mixer.c b/mixer.c index 7f03cc64..7b4ce24f 100644 --- a/mixer.c +++ b/mixer.c @@ -1,3 +1,11 @@ +/* + * Conky, a system monitor, based on torsmo + * + * This program is licensed under BSD license, read COPYING + * + * $Id$ + */ + #include "conky.h" #include #include diff --git a/top.c b/top.c index 28f2ccef..a7821ac9 100644 --- a/top.c +++ b/top.c @@ -1,3 +1,11 @@ +/* + * Conky, a system monitor, based on torsmo + * + * This program is licensed under BSD license, read COPYING + * + * $Id$ + */ + #include "top.h" static regex_t *exclusion_expression = 0; diff --git a/top.h b/top.h index b1463dfd..18f899e3 100644 --- a/top.h +++ b/top.h @@ -11,6 +11,8 @@ * from code originally contained in wmsysmon by Dave Clark (clarkd@skynet.ca) * This software is licensed through the GNU General Public License. + + * $Id$ */ /* diff --git a/x11.c b/x11.c index 7c08cbbe..8fb28925 100644 --- a/x11.c +++ b/x11.c @@ -1,3 +1,11 @@ +/* + * Conky, a system monitor, based on torsmo + * + * This program is licensed under BSD license, read COPYING + * + * $Id$ + */ + #include "conky.h" #include #include