1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-16 01:57:09 +00:00

Merge remote branch 'origin/master' into lua-config

This commit is contained in:
Pavel Labath 2010-02-25 21:53:31 +01:00
commit d22369333d
24 changed files with 37 additions and 219 deletions

View File

@ -30,10 +30,6 @@
#ifndef _ALGEBRA_H #ifndef _ALGEBRA_H
#define _ALGEBRA_H #define _ALGEBRA_H
#ifdef __cplusplus
extern "C" {
#endif
enum match_type { enum match_type {
OP_LT = 1, /* < */ OP_LT = 1, /* < */
OP_GT = 2, /* > */ OP_GT = 2, /* > */
@ -53,8 +49,4 @@ enum arg_type {
int compare(const char *); int compare(const char *);
int check_if_match(struct text_object *); int check_if_match(struct text_object *);
#ifdef __cplusplus
}
#endif
#endif /* _ALGEBRA_H */ #endif /* _ALGEBRA_H */

View File

@ -25,10 +25,6 @@
#ifndef APCUPSD_H_ #ifndef APCUPSD_H_
#define APCUPSD_H_ #define APCUPSD_H_
#ifdef __cplusplus
extern "C" {
#endif
int apcupsd_scan_arg(const char *); int apcupsd_scan_arg(const char *);
/* Service routine for the conky main thread */ /* Service routine for the conky main thread */
@ -48,8 +44,4 @@ void print_apcupsd_timeleft(struct text_object *, char *, int);
void print_apcupsd_temp(struct text_object *, char *, int); void print_apcupsd_temp(struct text_object *, char *, int);
void print_apcupsd_lastxfer(struct text_object *, char *, int); void print_apcupsd_lastxfer(struct text_object *, char *, int);
#ifdef __cplusplus
}
#endif
#endif /*APCUPSD_H_*/ #endif /*APCUPSD_H_*/

View File

@ -26,10 +26,6 @@
#ifndef BMPX_H_ #ifndef BMPX_H_
#define BMPX_H_ #define BMPX_H_
#ifdef __cplusplus
extern "C" {
#endif
void update_bmpx(void); void update_bmpx(void);
struct bmpx_s { struct bmpx_s {
char *title; char *title;
@ -47,8 +43,4 @@ void print_bmpx_uri(struct text_object *, char *, int);
void print_bmpx_track(struct text_object *, char *, int); void print_bmpx_track(struct text_object *, char *, int);
void print_bmpx_bitrate(struct text_object *, char *, int); void print_bmpx_bitrate(struct text_object *, char *, int);
#ifdef __cplusplus
}
#endif
#endif /*BMPX_H_*/ #endif /*BMPX_H_*/

View File

@ -71,12 +71,6 @@ static void set_up_gradient(void)
greenmask = greenmask << (colour_depth / 3); greenmask = greenmask << (colour_depth / 3);
} }
#ifdef __cplusplus
extern "C" {
#endif
/* this function is used in C code, use C calling conventions */
/* adjust colour values depending on colour depth */ /* adjust colour values depending on colour depth */
unsigned int adjust_colours(unsigned int colour) unsigned int adjust_colours(unsigned int colour)
{ {
@ -96,10 +90,6 @@ unsigned int adjust_colours(unsigned int colour)
return colour; return colour;
} }
#ifdef __cplusplus
}
#endif
/* this function returns the next colour between two colours for a gradient */ /* this function returns the next colour between two colours for a gradient */
unsigned long *do_gradient(int width, unsigned long first_colour, unsigned long last_colour) unsigned long *do_gradient(int width, unsigned long first_colour, unsigned long last_colour)
{ {

View File

@ -30,17 +30,7 @@
#ifndef _COLOURS_H #ifndef _COLOURS_H
#define _COLOURS_H #define _COLOURS_H
#ifdef __cplusplus
extern "C" {
#endif
/* this function is used in C code, use C calling conventions */
unsigned int adjust_colours(unsigned int); unsigned int adjust_colours(unsigned int);
#ifdef __cplusplus
}
#endif
unsigned long *do_gradient(int, unsigned long, unsigned long); unsigned long *do_gradient(int, unsigned long, unsigned long);
long get_x11_color(const char *); long get_x11_color(const char *);

View File

@ -32,16 +32,8 @@
#include <sys/socket.h> #include <sys/socket.h>
#include "text_object.h" #include "text_object.h"
#ifdef __cplusplus
extern "C" {
#endif
void print_to_bytes(struct text_object *, char *, int); void print_to_bytes(struct text_object *, char *, int);
#ifdef __cplusplus
}
#endif
void add_update_callback(void (*func)(void)); void add_update_callback(void (*func)(void));
void free_update_callbacks(void); void free_update_callbacks(void);
void start_update_threading(void); void start_update_threading(void);

View File

@ -33,6 +33,8 @@
#include "conky.h" #include "conky.h"
#include "common.h" #include "common.h"
#include "timed-thread.h" #include "timed-thread.h"
#include <algorithm>
#include <string>
#include <stdarg.h> #include <stdarg.h>
#include <cmath> #include <cmath>
#include <ctime> #include <ctime>
@ -389,7 +391,7 @@ unsigned int max_user_text;
unsigned int text_buffer_size = DEFAULT_TEXT_BUFFER_SIZE; unsigned int text_buffer_size = DEFAULT_TEXT_BUFFER_SIZE;
/* UTF-8 */ /* UTF-8 */
int utf8_mode = 0; bool utf8_mode = false;
/* no buffers in used memory? */ /* no buffers in used memory? */
int no_buffers; int no_buffers;
@ -2449,19 +2451,19 @@ void clean_up(void *memtofree1, void* memtofree2)
free_and_zero(global_cpu); free_and_zero(global_cpu);
} }
static int string_to_bool(const char *s) static bool string_to_bool(const char *s)
{ {
if (!s) { if (!s) {
// Assumes an option without a true/false means true // Assumes an option without a true/false means true
return 1; return true;
} else if (strcasecmp(s, "yes") == EQUAL) { } else if (strcasecmp(s, "yes") == EQUAL) {
return 1; return true;
} else if (strcasecmp(s, "true") == EQUAL) { } else if (strcasecmp(s, "true") == EQUAL) {
return 1; return true;
} else if (strcasecmp(s, "1") == EQUAL) { } else if (strcasecmp(s, "1") == EQUAL) {
return 1; return true;
} }
return 0; return false;
} }
#ifdef BUILD_X11 #ifdef BUILD_X11
@ -4116,13 +4118,22 @@ void initialisation(int argc, char **argv) {
#endif /* BUILD_LUA */ #endif /* BUILD_LUA */
} }
int main(int argc, char **argv)
{
#ifdef BUILD_X11 #ifdef BUILD_X11
char *s, *temp; bool isutf8(const char* envvar) {
unsigned int x; char *s = getenv(envvar);
if(s) {
std::string temp = s;
std::transform(temp.begin(), temp.end(), temp.begin(), ::tolower);
if( (temp.find("utf-8") != std::string::npos) || (temp.find("utf8") != std::string::npos) ) {
return true;
}
}
return false;
}
#endif #endif
int main(int argc, char **argv)
{
argc_copy = argc; argc_copy = argc;
argv_copy = argv; argv_copy = argv;
g_signal_pending = 0; g_signal_pending = 0;
@ -4139,21 +4150,8 @@ int main(int argc, char **argv)
/* handle command line parameters that don't change configs */ /* handle command line parameters that don't change configs */
#ifdef BUILD_X11 #ifdef BUILD_X11
if (((s = getenv("LC_ALL")) && *s) || ((s = getenv("LC_CTYPE")) && *s) if(isutf8("LC_ALL") || isutf8("LC_CTYPE") || isutf8("LANG")) {
|| ((s = getenv("LANG")) && *s)) { utf8_mode = true;
temp = (char *) malloc((strlen(s) + 1) * sizeof(char));
if (temp == NULL) {
NORM_ERR("malloc failed");
}
for (x = 0; x < strlen(s); x++) {
temp[x] = tolower(s[x]);
}
temp[x] = 0;
if (strstr(temp, "utf-8") || strstr(temp, "utf8")) {
utf8_mode = 1;
}
free(temp);
} }
if (!setlocale(LC_CTYPE, "")) { if (!setlocale(LC_CTYPE, "")) {
NORM_ERR("Can't set the specified locale!\nCheck LANG, LC_CTYPE, LC_ALL."); NORM_ERR("Can't set the specified locale!\nCheck LANG, LC_CTYPE, LC_ALL.");

View File

@ -86,10 +86,6 @@ struct text_object;
#include "mpd.h" #include "mpd.h"
#endif /* BUILD_MPD */ #endif /* BUILD_MPD */
#ifdef __cplusplus
/* this hack exists only to get around a compilation issue with some files
* being converted to C++, will need a better solution */
/* C++ headers */ /* C++ headers */
#ifdef BUILD_CURL #ifdef BUILD_CURL
#include "ccurl_thread.h" #include "ccurl_thread.h"
@ -99,8 +95,6 @@ struct text_object;
#include "audacious.h" #include "audacious.h"
#endif /* BUILD_AUDACIOUS */ #endif /* BUILD_AUDACIOUS */
#endif /* __cplusplus */
#ifdef BUILD_RSS #ifdef BUILD_RSS
#include "rss.h" #include "rss.h"
#endif /* BUILD_RSS */ #endif /* BUILD_RSS */
@ -196,9 +190,6 @@ enum {
BATTERY_TIME BATTERY_TIME
}; };
#ifdef __cplusplus
/* this hack exists only to get around a compilation issue with some files
* being converted to C++, will need a better solution */
struct information { struct information {
unsigned int mask; unsigned int mask;
@ -255,7 +246,6 @@ struct information {
short kflags; /* kernel settings, see enum KFLAG */ short kflags; /* kernel settings, see enum KFLAG */
}; };
#endif /* __cplusplus */
/* needed by linux.c and top.c -> outsource somewhere */ /* needed by linux.c and top.c -> outsource somewhere */
enum { enum {
@ -289,10 +279,6 @@ extern struct information info;
/* defined in conky.c */ /* defined in conky.c */
extern double current_update_time, last_update_time, update_interval; extern double current_update_time, last_update_time, update_interval;
#ifdef __cplusplus
extern "C" {
#endif
/* if_up strictness selector /* if_up strictness selector
* needed by conky.c and linux.c (and potentially others) */ * needed by conky.c and linux.c (and potentially others) */
enum _ifup_strictness { enum _ifup_strictness {
@ -332,10 +318,6 @@ void generate_text_internal(char *, int, struct text_object);
int percent_print(char *, int, unsigned); int percent_print(char *, int, unsigned);
void human_readable(long long, char *, int); void human_readable(long long, char *, int);
#ifdef __cplusplus
}
#endif
/* maximum size of config TEXT buffer, i.e. below TEXT line. */ /* maximum size of config TEXT buffer, i.e. below TEXT line. */
extern unsigned int max_user_text; extern unsigned int max_user_text;

View File

@ -38,18 +38,10 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
size_t remove_comments(char *string); size_t remove_comments(char *string);
#ifdef __cplusplus
extern "C" {
#endif
int extract_variable_text_internal(struct text_object *retval, const char *const_p); int extract_variable_text_internal(struct text_object *retval, const char *const_p);
void free_text_objects(struct text_object *root); void free_text_objects(struct text_object *root);
const char *dev_name(const char *); const char *dev_name(const char *);
#ifdef __cplusplus
}
#endif
#endif /* _CONKY_CORE_H_ */ #endif /* _CONKY_CORE_H_ */

View File

@ -1,4 +1,5 @@
/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*- /* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
* vim: ts=4 sw=4 noet ai cindent syntax=cpp
* *
* Conky, a system monitor, based on torsmo * Conky, a system monitor, based on torsmo
* *
@ -24,10 +25,6 @@
#ifndef _EVE_H #ifndef _EVE_H
#define _EVE_H #define _EVE_H
#ifdef __cplusplus
extern "C" {
#endif
#define EVEURL_TRAINING "http://api.eve-online.com/char/SkillInTraining.xml.aspx" #define EVEURL_TRAINING "http://api.eve-online.com/char/SkillInTraining.xml.aspx"
#define EVEURL_SKILLTREE "http://api.eve-online.com/eve/Skilltree.xml.aspx" #define EVEURL_SKILLTREE "http://api.eve-online.com/eve/Skilltree.xml.aspx"
#define EVE_OUTPUT_FORMAT "%s %d in %s" #define EVE_OUTPUT_FORMAT "%s %d in %s"
@ -36,8 +33,4 @@ void scan_eve(struct text_object *, const char *);
void print_eve(struct text_object *, char *, int); void print_eve(struct text_object *, char *, int);
void free_eve(struct text_object *); void free_eve(struct text_object *);
#ifdef __cplusplus
}
#endif
#endif /* _EVE_H */ #endif /* _EVE_H */

View File

@ -32,10 +32,6 @@
#include "x11.h" #include "x11.h"
#ifdef __cplusplus
extern "C" {
#endif
/* for fonts */ /* for fonts */
struct font_list { struct font_list {
@ -83,9 +79,5 @@ void set_first_font(const char *);
void free_fonts(void); void free_fonts(void);
void load_fonts(void); void load_fonts(void);
#ifdef __cplusplus
}
#endif
#endif /* _FONTS_H */ #endif /* _FONTS_H */
#endif /* BUILD_X11 */ #endif /* BUILD_X11 */

View File

@ -13,15 +13,7 @@
#include <machine/apm_bios.h> #include <machine/apm_bios.h>
#endif /* i386 || __i386__ */ #endif /* i386 || __i386__ */
#ifdef __cplusplus
extern "C" {
#endif
int get_entropy_avail(unsigned int *); int get_entropy_avail(unsigned int *);
int get_entropy_poolsize(unsigned int *); int get_entropy_poolsize(unsigned int *);
#ifdef __cplusplus
}
#endif
#endif /*FREEBSD_H_*/ #endif /*FREEBSD_H_*/

View File

@ -26,10 +26,6 @@
#ifndef _IBM_H #ifndef _IBM_H
#define _IBM_H #define _IBM_H
#ifdef __cplusplus
extern "C" {
#endif
void get_ibm_acpi_fan(struct text_object *, char *, int); void get_ibm_acpi_fan(struct text_object *, char *, int);
void get_ibm_acpi_temps(void); void get_ibm_acpi_temps(void);
void get_ibm_acpi_volume(struct text_object *, char *, int); void get_ibm_acpi_volume(struct text_object *, char *, int);
@ -37,8 +33,5 @@ void get_ibm_acpi_brightness(struct text_object *, char *, int);
void parse_ibm_temps_arg(struct text_object *, const char *); void parse_ibm_temps_arg(struct text_object *, const char *);
void print_ibm_temps(struct text_object *, char *, int); void print_ibm_temps(struct text_object *, char *, int);
#ifdef __cplusplus
}
#endif
#endif /* _IBM_H */ #endif /* _IBM_H */

View File

@ -72,10 +72,6 @@
#define MPD_ACK_ERROR_PLAYER_SYNC 55 #define MPD_ACK_ERROR_PLAYER_SYNC 55
#define MPD_ACK_ERROR_EXIST 56 #define MPD_ACK_ERROR_EXIST 56
#ifdef __cplusplus
extern "C" {
#endif
typedef enum mpd_TagItems { typedef enum mpd_TagItems {
MPD_TAG_ITEM_ARTIST, MPD_TAG_ITEM_ARTIST,
MPD_TAG_ITEM_ALBUM, MPD_TAG_ITEM_ALBUM,
@ -632,8 +628,4 @@ void mpd_sendPlaylistMoveCommand(mpd_Connection *connection, char *playlist,
void mpd_sendPlaylistDeleteCommand(mpd_Connection *connection, char *playlist, void mpd_sendPlaylistDeleteCommand(mpd_Connection *connection, char *playlist,
int pos); int pos);
#ifdef __cplusplus
}
#endif
#endif #endif

View File

@ -32,10 +32,6 @@
#include "mail.h" #include "mail.h"
#ifdef __cplusplus
extern "C" {
#endif
void clean_up(void *memtofree1, void* memtofree2); void clean_up(void *memtofree1, void* memtofree2);
#define NORM_ERR(...) { \ #define NORM_ERR(...) { \
@ -59,8 +55,4 @@ extern int global_debug_level;
#define DBGP(...) __DBGP(0, __VA_ARGS__) #define DBGP(...) __DBGP(0, __VA_ARGS__)
#define DBGP2(...) __DBGP(1, __VA_ARGS__) #define DBGP2(...) __DBGP(1, __VA_ARGS__)
#ifdef __cplusplus
}
#endif
#endif /* _LOGGING_H */ #endif /* _LOGGING_H */

View File

@ -1,11 +1,14 @@
/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*- */ /* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
* vim: ts=4 sw=4 noet ai cindent syntax=cpp
*/
#ifndef CONKY_NC_H
#define CONKY_NC_H
#ifdef __cplusplus
extern "C" { extern "C" {
#endif
void _nc_free_and_exit(int); void _nc_free_and_exit(int);
#ifdef __cplusplus
} }
#endif
#endif /* CONKY_NC_H */

View File

@ -30,15 +30,7 @@
#include "conky.h" #include "conky.h"
#include "common.h" #include "common.h"
#ifdef __cplusplus
extern "C" {
#endif
int get_entropy_avail(unsigned int *); int get_entropy_avail(unsigned int *);
int get_entropy_poolsize(unsigned int *); int get_entropy_poolsize(unsigned int *);
#ifdef __cplusplus
}
#endif
#endif /*NETBSD_H_*/ #endif /*NETBSD_H_*/

View File

@ -32,16 +32,8 @@
#ifndef NVIDIA_CONKY_H #ifndef NVIDIA_CONKY_H
#define NVIDIA_CONKY_H #define NVIDIA_CONKY_H
#ifdef __cplusplus
extern "C" {
#endif
int set_nvidia_type(struct text_object *, const char *); int set_nvidia_type(struct text_object *, const char *);
void print_nvidia_value(struct text_object *, char *, int); void print_nvidia_value(struct text_object *, char *, int);
void free_nvidia(struct text_object *); void free_nvidia(struct text_object *);
#ifdef __cplusplus
}
#endif
#endif #endif

View File

@ -9,10 +9,6 @@
#include <sys/sensors.h> #include <sys/sensors.h>
#include <machine/apmvar.h> #include <machine/apmvar.h>
#ifdef __cplusplus
extern "C" {
#endif
void parse_obsd_sensor(struct text_object *, const char *); void parse_obsd_sensor(struct text_object *, const char *);
void print_obsd_sensors_temp(struct text_object *, char *, int); void print_obsd_sensors_temp(struct text_object *, char *, int);
void print_obsd_sensors_fan(struct text_object *, char *, int); void print_obsd_sensors_fan(struct text_object *, char *, int);
@ -27,8 +23,4 @@ typedef struct apm_power_info *apm_info_t;
int get_entropy_avail(unsigned int *); int get_entropy_avail(unsigned int *);
int get_entropy_poolsize(unsigned int *); int get_entropy_poolsize(unsigned int *);
#ifdef __cplusplus
}
#endif
#endif /*OPENBSD_H_*/ #endif /*OPENBSD_H_*/

View File

@ -28,14 +28,13 @@
* *
*/ */
#ifndef CONKY_PROC_H
#define CONKY_PROC_H
#define PROCDIR "/proc" #define PROCDIR "/proc"
#define READERR "Can't read '%s'" #define READERR "Can't read '%s'"
#define READSIZE 128 #define READSIZE 128
#ifdef __cplusplus
extern "C" {
#endif
void print_pid_chroot(struct text_object *obj, char *p, int p_max_size); void print_pid_chroot(struct text_object *obj, char *p, int p_max_size);
void print_pid_cmdline(struct text_object *obj, char *p, int p_max_size); void print_pid_cmdline(struct text_object *obj, char *p, int p_max_size);
void print_pid_cwd(struct text_object *obj, char *p, int p_max_size); void print_pid_cwd(struct text_object *obj, char *p, int p_max_size);
@ -79,7 +78,5 @@ void print_pid_write(struct text_object *obj, char *p, int p_max_size);
void scan_cmdline_to_pid_arg(struct text_object *obj, const char *arg, void* free_at_crash); void scan_cmdline_to_pid_arg(struct text_object *obj, const char *arg, void* free_at_crash);
void print_cmdline_to_pid(struct text_object *obj, char *p, int p_max_size); void print_cmdline_to_pid(struct text_object *obj, char *p, int p_max_size);
#ifdef __cplusplus
}
#endif
#endif /* CONKY_PROC_H */

View File

@ -26,18 +26,10 @@
#ifndef RSS_H_ #ifndef RSS_H_
#define RSS_H_ #define RSS_H_
#ifdef __cplusplus
extern "C" {
#endif
void rss_scan_arg(struct text_object *, const char *); void rss_scan_arg(struct text_object *, const char *);
void rss_print_info(struct text_object *, char *, int); void rss_print_info(struct text_object *, char *, int);
void rss_free_obj_info(struct text_object *); void rss_free_obj_info(struct text_object *);
void rss_free_info(void); void rss_free_info(void);
#ifdef __cplusplus
}
#endif
#endif /*RSS_H_*/ #endif /*RSS_H_*/

View File

@ -31,14 +31,6 @@
#ifndef _SONY_H #ifndef _SONY_H
#define _SONY_H #define _SONY_H
#ifdef __cplusplus
extern "C" {
#endif
void get_sony_fanspeed(struct text_object *, char *, int); void get_sony_fanspeed(struct text_object *, char *, int);
#ifdef __cplusplus
}
#endif
#endif /* _SONY_H */ #endif /* _SONY_H */

View File

@ -33,10 +33,6 @@
#include "config.h" /* for the defines */ #include "config.h" /* for the defines */
#include "specials.h" /* enum special_types */ #include "specials.h" /* enum special_types */
#ifdef __cplusplus
extern "C" {
#endif
/* text object callbacks */ /* text object callbacks */
struct obj_cb { struct obj_cb {
/* text object: print obj's output to p */ /* text object: print obj's output to p */
@ -116,8 +112,4 @@ int ifblock_stack_empty(void **opaque);
/* make the given object be a plain text object printing given string */ /* make the given object be a plain text object printing given string */
void obj_be_plain_text(struct text_object *, const char *); void obj_be_plain_text(struct text_object *, const char *);
#ifdef __cplusplus
}
#endif
#endif /* _TEXT_OBJECT_H */ #endif /* _TEXT_OBJECT_H */

View File

@ -31,10 +31,6 @@
#include <xmmsclient/xmmsclient.h> #include <xmmsclient/xmmsclient.h>
#ifdef __cplusplus
extern "C" {
#endif
struct xmms2_s { struct xmms2_s {
char *artist; char *artist;
char *album; char *album;
@ -83,8 +79,4 @@ int if_xmms2_connected(struct text_object *);
void free_xmms2(struct text_object *); void free_xmms2(struct text_object *);
#ifdef __cplusplus
}
#endif
#endif /*XMMS2_H_*/ #endif /*XMMS2_H_*/