made defines of some literal values and defines to configure.ac.in
authorNikolas Garofil <ngarofil@users.sourceforge.net>
Sat, 12 Jul 2008 10:25:05 +0000 (10:25 +0000)
committerNikolas Garofil <ngarofil@users.sourceforge.net>
Sat, 12 Jul 2008 10:25:05 +0000 (10:25 +0000)
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@1223 7f574dfc-610e-0410-a909-a81674777703

configure.ac.in
src/conky.c
src/conky.h
src/linux.c
src/x11.c
src/xmms2.c

index f4d9b87..ceed7cd 100644 (file)
@@ -525,7 +525,8 @@ dnl
 dnl Some defines
 dnl
 
-AC_DEFINE(DEFAULTNETDEV, "eth0", [Set to the default networkdevice])
+AC_DEFINE(DEFAULTNETDEV, "eth0", [Default networkdevice])
+AC_DEFINE(CONFIG_FILE, "$HOME/.conkyrc", [Configfile of the user])
 
 dnl
 dnl Some functions
index bca52df..89e0166 100644 (file)
@@ -66,7 +66,6 @@
 #define S_ISSOCK(x)   ((x & S_IFMT) == S_IFSOCK)
 #endif
 
-#define CONFIG_FILE "$HOME/.conkyrc"
 #define MAIL_FILE "$MAIL"
 #define MAX_IF_BLOCK_DEPTH 5
 #define MAX_TAIL_LINES 100
@@ -78,10 +77,10 @@ static void print_version(void) __attribute__((noreturn));
 
 static void print_version(void)
 {
-       printf("Conky %s compiled %s for %s\n", VERSION, BUILD_DATE, BUILD_ARCH);
+       printf(PACKAGE_NAME" "VERSION" compiled "BUILD_DATE" for "BUILD_ARCH"\n");
 
        printf("\nCompiled in features:\n\n"
-                  "System config file: %s\n\n"
+                  "System config file: "SYSTEM_CONFIG_FILE"\n\n"
 #ifdef X11
                   " X11:\n"
 # ifdef HAVE_XDAMAGE
@@ -132,7 +131,6 @@ static void print_version(void)
 #ifdef NVIDIA
        "  * nvidia\n"
 #endif
-       "", SYSTEM_CONFIG_FILE
        );
 
        exit(0);
@@ -3259,7 +3257,7 @@ static struct text_object *construct_text_object(const char *s,
                                return NULL;
                        } else if (n2 < 1 || n2 < update_interval) {
                                CRIT_ERR("invalid arg for tail, interval must be greater than "
-                                       "0 and Conky's interval");
+                                       "0 and "PACKAGE_NAME"'s interval");
                                return NULL;
                        } else {
                                FILE *fp = 0;
@@ -3341,7 +3339,7 @@ static struct text_object *construct_text_object(const char *s,
                                return NULL;
                        } else if (n2 < 1 || n2 < update_interval) {
                                CRIT_ERR("invalid arg for head, interval must be greater than "
-                                       "0 and Conky's interval");
+                                       "0 and "PACKAGE_NAME"'s interval");
                                return NULL;
                        } else {
                                FILE *fp;
@@ -7978,9 +7976,9 @@ static void set_default_configurations(void)
        own_window = 0;
        window.type = TYPE_NORMAL;
        window.hints = 0;
-       strcpy(window.class_name, "Conky");
+       strcpy(window.class_name, PACKAGE_NAME);
        update_uname();
-       sprintf(window.title, "Conky (%s)", info.uname_s.nodename);
+       sprintf(window.title, PACKAGE_NAME" (%s)", info.uname_s.nodename);
 #endif
        stippled_borders = 0;
        border_margin = 3;
@@ -8696,7 +8694,7 @@ static void load_config_file(const char *f)
 
 static void print_help(const char *prog_name) {
        printf("Usage: %s [OPTION]...\n"
-                       "Conky is a system monitor that renders text on desktop or to own transparent\n"
+                       PACKAGE_NAME" is a system monitor that renders text on desktop or to own transparent\n"
                        "window. Command line options will override configurations defined in config\n"
                        "file.\n"
                        "   -v, --version             version\n"
@@ -8719,7 +8717,7 @@ static void print_help(const char *prog_name) {
 #endif /* X11 */
                        "   -t, --text=TEXT           text to render, remember single quotes, like -t '$uptime'\n"
                        "   -u, --interval=SECS       update interval\n"
-                       "   -i COUNT                  number of times to update Conky (and quit)\n",
+                       "   -i COUNT                  number of times to update "PACKAGE_NAME" (and quit)\n",
                        prog_name
        );
 }
@@ -8991,7 +8989,7 @@ int main(int argc, char **argv)
 
                switch (pid) {
                        case -1:
-                               ERR("Conky: couldn't fork() to background: %s",
+                               ERR(PACKAGE_NAME": couldn't fork() to background: %s",
                                        strerror(errno));
                                break;
 
@@ -9004,7 +9002,7 @@ int main(int argc, char **argv)
 
                        default:
                                /* parent process */
-                               fprintf(stderr, "Conky: forked to background, pid is %d\n",
+                               fprintf(stderr, PACKAGE_NAME": forked to background, pid is %d\n",
                                        pid);
                                fflush(stderr);
                                return 0;
index 925f759..2172877 100644 (file)
@@ -107,7 +107,7 @@ extern unsigned int text_buffer_size;
 #include <sys/socket.h>
 
 #define ERR(...) { \
-       fprintf(stderr, "Conky: "); \
+       fprintf(stderr, PACKAGE_NAME": "); \
        fprintf(stderr, __VA_ARGS__); \
        fprintf(stderr, "\n"); \
 }
index 7f270d9..80d6974 100644 (file)
@@ -889,7 +889,7 @@ int open_sysfs_sensor(const char *dir, const char *dev, const char *type, int n,
        fd = open(path, O_RDONLY);
        if (fd < 0) {
                CRIT_ERR("can't open '%s': %s\nplease check your device or remove this "
-                       "var from Conky", path, strerror(errno));
+                       "var from "PACKAGE_NAME, path, strerror(errno));
        }
 
        if (strcmp(type, "in") == 0 || strcmp(type, "temp") == 0
@@ -1150,7 +1150,7 @@ char get_freq(char *p_client_buffer, size_t client_buffer_size,
        // open the CPU information file
        f = open_file("/proc/cpuinfo", &rep);
        if (!f) {
-               perror("Conky: Failed to access '/proc/cpuinfo' at get_freq()");
+               perror(PACKAGE_NAME": Failed to access '/proc/cpuinfo' at get_freq()");
                return 0;
        }
 
@@ -1240,7 +1240,7 @@ char get_voltage(char *p_client_buffer, size_t client_buffer_size,
                }
                fclose(f);
        } else {
-               fprintf(stderr, "Conky: Failed to access '%s' at ", current_freq_file);
+               fprintf(stderr, PACKAGE_NAME": Failed to access '%s' at ", current_freq_file);
                perror("get_voltage()");
                if (f) {
                        fclose(f);
@@ -1268,7 +1268,7 @@ char get_voltage(char *p_client_buffer, size_t client_buffer_size,
                }
                fclose(f);
        } else {
-               fprintf(stderr, "Conky: Failed to access '%s' at ", current_freq_file);
+               fprintf(stderr, PACKAGE_NAME": Failed to access '%s' at ", current_freq_file);
                perror("get_voltage()");
                if (f) {
                        fclose(f);
@@ -2193,7 +2193,7 @@ void get_ibm_acpi_fan(char *p_client_buffer, size_t client_buffer_size)
                }
        } else {
                CRIT_ERR("can't open '%s': %s\nYou are not using the IBM ACPI. Remove "
-                       "ibm* from your Conky config file.", fan, strerror(errno));
+                       "ibm* from your "PACKAGE_NAME" config file.", fan, strerror(errno));
        }
 
        fclose(fp);
@@ -2257,7 +2257,7 @@ void get_ibm_acpi_temps(void)
                }
        } else {
                CRIT_ERR("can't open '%s': %s\nYou are not using the IBM ACPI. Remove "
-                       "ibm* from your Conky config file.", thermal, strerror(errno));
+                       "ibm* from your "PACKAGE_NAME" config file.", thermal, strerror(errno));
        }
 
        fclose(fp);
@@ -2305,7 +2305,7 @@ void get_ibm_acpi_volume(char *p_client_buffer, size_t client_buffer_size)
                }
        } else {
                CRIT_ERR("can't open '%s': %s\nYou are not using the IBM ACPI. Remove "
-                       "ibm* from your Conky config file.", volume, strerror(errno));
+                       "ibm* from your "PACKAGE_NAME" config file.", volume, strerror(errno));
        }
 
        fclose(fp);
@@ -2354,7 +2354,7 @@ void get_ibm_acpi_brightness(char *p_client_buffer, size_t client_buffer_size)
                }
        } else {
                CRIT_ERR("can't open '%s': %s\nYou are not using the IBM ACPI. Remove "
-                       "ibm* from your Conky config file.", filename, strerror(errno));
+                       "ibm* from your "PACKAGE_NAME" config file.", filename, strerror(errno));
        }
 
        fclose(fp);
index f62e02b..60e09de 100644 (file)
--- a/src/x11.c
+++ b/src/x11.c
@@ -139,7 +139,7 @@ static Window find_desktop_window(Window *p_root, Window *p_desktop)
                        XFree(buf);
                        XFree(children);
                        fprintf(stderr,
-                               "Conky: desktop window (%lx) found from __SWM_VROOT property\n",
+                               PACKAGE_NAME": desktop window (%lx) found from __SWM_VROOT property\n",
                                win);
                        fflush(stderr);
                        *p_root = win;
@@ -168,10 +168,10 @@ static Window find_desktop_window(Window *p_root, Window *p_desktop)
 
        if (win != root) {
                fprintf(stderr,
-                       "Conky: desktop window (%lx) is subwindow of root window (%lx)\n",
+                       PACKAGE_NAME": desktop window (%lx) is subwindow of root window (%lx)\n",
                        win, root);
        } else {
-               fprintf(stderr, "Conky: desktop window (%lx) is root window\n", win);
+               fprintf(stderr, PACKAGE_NAME": desktop window (%lx) is root window\n", win);
        }
 
        fflush(stderr);
@@ -238,7 +238,7 @@ void init_window(int own_window, int w, int h, int set_trans, int back_colour,
 
                        XLowerWindow(display, window.window);
 
-                       fprintf(stderr, "Conky: window type - override\n");
+                       fprintf(stderr, PACKAGE_NAME": window type - override\n");
                        fflush(stderr);
                } else { /* window.type != TYPE_OVERRIDE */
 
@@ -279,18 +279,18 @@ void init_window(int own_window, int w, int h, int set_trans, int back_colour,
                                switch (window.type) {
                                        case TYPE_DESKTOP:
                                                prop = ATOM(_NET_WM_WINDOW_TYPE_DESKTOP);
-                                               fprintf(stderr, "Conky: window type - desktop\n");
+                                               fprintf(stderr, PACKAGE_NAME": window type - desktop\n");
                                                fflush(stderr);
                                                break;
                                        case TYPE_DOCK:
                                                prop = ATOM(_NET_WM_WINDOW_TYPE_DOCK);
-                                               fprintf(stderr, "Conky: window type - dock\n");
+                                               fprintf(stderr, PACKAGE_NAME": window type - dock\n");
                                                fflush(stderr);
                                                break;
                                        case TYPE_NORMAL:
                                        default:
                                                prop = ATOM(_NET_WM_WINDOW_TYPE_NORMAL);
-                                               fprintf(stderr, "Conky: window type - normal\n");
+                                               fprintf(stderr, PACKAGE_NAME": window type - normal\n");
                                                fflush(stderr);
                                                break;
                                }
@@ -302,7 +302,7 @@ void init_window(int own_window, int w, int h, int set_trans, int back_colour,
 
                        /* Window decorations */
                        if (TEST_HINT(window.hints, HINT_UNDECORATED)) {
-                               /* fprintf(stderr, "Conky: hint - undecorated\n");
+                               /* fprintf(stderr, PACKAGE_NAME": hint - undecorated\n");
                                fflush(stderr); */
 
                                xa = ATOM(_MOTIF_WM_HINTS);
@@ -315,7 +315,7 @@ void init_window(int own_window, int w, int h, int set_trans, int back_colour,
 
                        /* Below other windows */
                        if (TEST_HINT(window.hints, HINT_BELOW)) {
-                               /* fprintf(stderr, "Conky: hint - below\n");
+                               /* fprintf(stderr, PACKAGE_NAME": hint - below\n");
                                fflush(stderr); */
 
                                xa = ATOM(_WIN_LAYER);
@@ -337,7 +337,7 @@ void init_window(int own_window, int w, int h, int set_trans, int back_colour,
 
                        /* Above other windows */
                        if (TEST_HINT(window.hints, HINT_ABOVE)) {
-                               /* fprintf(stderr, "Conky: hint - above\n");
+                               /* fprintf(stderr, PACKAGE_NAME": hint - above\n");
                                fflush(stderr); */
 
                                xa = ATOM(_WIN_LAYER);
@@ -359,7 +359,7 @@ void init_window(int own_window, int w, int h, int set_trans, int back_colour,
 
                        /* Sticky */
                        if (TEST_HINT(window.hints, HINT_STICKY)) {
-                               /* fprintf(stderr, "Conky: hint - sticky\n");
+                               /* fprintf(stderr, PACKAGE_NAME": hint - sticky\n");
                                fflush(stderr); */
 
                                xa = ATOM(_NET_WM_DESKTOP);
@@ -381,7 +381,7 @@ void init_window(int own_window, int w, int h, int set_trans, int back_colour,
 
                        /* Skip taskbar */
                        if (TEST_HINT(window.hints, HINT_SKIP_TASKBAR)) {
-                               /* fprintf(stderr, "Conky: hint - skip_taskbar\n");
+                               /* fprintf(stderr, PACKAGE_NAME": hint - skip_taskbar\n");
                                fflush(stderr); */
 
                                xa = ATOM(_NET_WM_STATE);
@@ -395,7 +395,7 @@ void init_window(int own_window, int w, int h, int set_trans, int back_colour,
 
                        /* Skip pager */
                        if (TEST_HINT(window.hints, HINT_SKIP_PAGER)) {
-                               /* fprintf(stderr, "Conky: hint - skip_pager\n");
+                               /* fprintf(stderr, PACKAGE_NAME": hint - skip_pager\n");
                                fflush(stderr); */
 
                                xa = ATOM(_NET_WM_STATE);
@@ -408,7 +408,7 @@ void init_window(int own_window, int w, int h, int set_trans, int back_colour,
                        }
                } /* else { window.type != TYPE_OVERRIDE */
 
-               fprintf(stderr, "Conky: drawing to created window (0x%lx)\n",
+               fprintf(stderr, PACKAGE_NAME": drawing to created window (0x%lx)\n",
                        window.window);
                fflush(stderr);
 
@@ -428,7 +428,7 @@ void init_window(int own_window, int w, int h, int set_trans, int back_colour,
                        window.height = attrs.height;
                }
 
-               fprintf(stderr, "Conky: drawing to desktop window\n");
+               fprintf(stderr, PACKAGE_NAME": drawing to desktop window\n");
        }
 
        /* Drawable is same as window. This may be changed by double buffering. */
@@ -445,7 +445,7 @@ void init_window(int own_window, int w, int h, int set_trans, int back_colour,
                                window.window, XdbeBackground);
                        if (window.back_buffer != None) {
                                window.drawable = window.back_buffer;
-                               fprintf(stderr, "Conky: drawing to double buffer\n");
+                               fprintf(stderr, PACKAGE_NAME": drawing to double buffer\n");
                        } else {
                                use_xdbe = 0;
                        }
@@ -455,7 +455,7 @@ void init_window(int own_window, int w, int h, int set_trans, int back_colour,
                }
        }
        if (!use_xdbe) {
-               fprintf(stderr, "Conky: drawing to single buffer\n");
+               fprintf(stderr, PACKAGE_NAME": drawing to single buffer\n");
        }
 #endif
 
index 4c6c4a5..c264a68 100644 (file)
@@ -102,7 +102,7 @@ void connection_lost(void *p)
        struct information *ptr = p;
        ptr->xmms2_conn_state = CONN_NO;
 
-       fprintf(stderr,"Conky: xmms2 connection failed. %s\n",
+       fprintf(stderr,PACKAGE_NAME": xmms2 connection failed. %s\n",
                     xmmsc_get_last_error ( ptr->xmms2_conn ));
         fflush(stderr);
 
@@ -269,12 +269,12 @@ void update_xmms2()
        if (current_info->xmms2_conn_state == CONN_INIT) {
 
                if (current_info->xmms2_conn == NULL) {
-                       current_info->xmms2_conn = xmmsc_init("conky");
+                       current_info->xmms2_conn = xmmsc_init(PACKAGE);
                }
 
                /* did init fail? */
                if (current_info->xmms2_conn == NULL) {
-                       fprintf(stderr, "Conky: xmms2 init failed. %s\n",
+                       fprintf(stderr, PACKAGE_NAME": xmms2 init failed. %s\n",
                                        xmmsc_get_last_error(current_info->xmms2_conn));
                        fflush(stderr);
                        return;
@@ -286,7 +286,7 @@ void update_xmms2()
                /* clear all values */
                xmms_clear(current_info);
 
-               /* fprintf(stderr, "Conky: xmms2 init ok.\n");
+               /* fprintf(stderr, PACKAGE_NAME": xmms2 init ok.\n");
                fflush(stderr); */
        }
 
@@ -296,7 +296,7 @@ void update_xmms2()
                char *path = getenv("XMMS_PATH");
 
                if (!xmmsc_connect(current_info->xmms2_conn, path)) {
-                       fprintf(stderr, "Conky: xmms2 connection failed. %s\n",
+                       fprintf(stderr, PACKAGE_NAME": xmms2 connection failed. %s\n",
                                xmmsc_get_last_error(current_info->xmms2_conn));
                        fflush(stderr);
                        current_info->xmms2_conn_state = CONN_NO;
@@ -329,7 +329,7 @@ void update_xmms2()
                /* everything seems to be ok */
                current_info->xmms2_conn_state = CONN_OK;
 
-               /* fprintf(stderr, "Conky: xmms2 connected.\n");
+               /* fprintf(stderr, PACKAGE_NAME": xmms2 connected.\n");
                fflush(stderr); */
        }