fix compiling for freebsd
authorPhil Sutter <phil@nwl.cc>
Sat, 14 Nov 2009 03:19:51 +0000 (04:19 +0100)
committerPhil Sutter <phil@nwl.cc>
Sun, 15 Nov 2009 00:36:17 +0000 (01:36 +0100)
Tested using default options, lua disabled as only lua50 available in
7.2-RELEASE.

src/conky.c
src/core.c
src/net_stat.c
src/read_tcp.c

index d353b27..91f5ec5 100644 (file)
@@ -2097,6 +2097,7 @@ void generate_text_internal(char *p, int p_max_size,
                        /* we have four different types of top (top, top_mem,
                         * top_time and top_io). To avoid having almost-same code four
                         * times, we have this special handler. */
+#ifdef __linux__
                        break;
                        case OBJ_top:
                        case OBJ_top_mem:
@@ -2107,6 +2108,7 @@ void generate_text_internal(char *p, int p_max_size,
                                /* yes, passing top_name_width instead
                                 * of p_max_size is intended here */
                                print_top(obj, p, top_name_width);
+#endif /* __linux__ */
                        OBJ(tail) {
                                print_tailhead("tail", obj, p, p_max_size);
                        }
index 7afdaaf..3b1cf36 100644 (file)
@@ -523,8 +523,6 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
                parse_platform_sensor(obj, arg);
        END OBJ_ARG(hwmon, 0, "hwmon needs argumanets")
                parse_hwmon_sensor(obj, arg);
-#endif /* __linux__ */
-
        END
        /* we have four different types of top (top, top_mem, top_time and top_io). To
         * avoid having almost-same code four times, we have this special
@@ -537,7 +535,6 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
                }
        } else OBJ(addr, &update_net_stats)
                parse_net_stat_arg(obj, arg, free_at_crash);
-#if defined(__linux__)
        END OBJ(addrs, &update_net_stats)
                parse_net_stat_arg(obj, arg, free_at_crash);
 #endif /* __linux__ */
@@ -682,7 +679,9 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
                extract_variable_text_internal(obj->sub, arg);
        END OBJ(processes, &update_total_processes)
        END OBJ(running_processes, &update_running_processes)
+#ifdef __linux__
        END OBJ(threads, &update_threads)
+#endif
        END OBJ(shadecolor, 0)
 #ifdef X11
                obj->data.l = arg ? get_x11_color(arg) : default_bg_color;
@@ -737,13 +736,13 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
 #endif
        END OBJ(uptime_short, &update_uptime)
        END OBJ(uptime, &update_uptime)
+#if defined(__linux__)
        END OBJ(user_names, &update_users)
        END OBJ(user_times, &update_users)
        END OBJ_ARG(user_time, 0, "user time needs a console name as argument")
                obj->data.s = strndup(arg, text_buffer_size);
        END OBJ(user_terms, &update_users)
        END OBJ(user_number, &update_users)
-#if defined(__linux__)
        END OBJ(gw_iface, &update_gateway_info)
        END OBJ(gw_ip, &update_gateway_info)
 #endif /* !__linux__ */
@@ -1517,6 +1516,7 @@ void free_text_objects(struct text_object *root, int internal)
                        case OBJ_nameserver:
                                free_dns_data();
                                break;
+#ifdef __linux__
                        case OBJ_top:
                        case OBJ_top_mem:
                        case OBJ_top_time:
@@ -1525,6 +1525,7 @@ void free_text_objects(struct text_object *root, int internal)
 #endif
                                free_top(obj, internal);
                                break;
+#endif /* __linux__ */
 #ifdef HDDTEMP
                        case OBJ_hddtemp:
                                if (data.s) {
index e479003..0a948aa 100644 (file)
@@ -35,6 +35,7 @@
 #include "net/if.h"
 #include "text_object.h"
 #include "net_stat.h"
+#include <netinet/in.h>
 #include <errno.h>
 #include <string.h>
 #include <sys/ioctl.h>
index e106043..828cae4 100644 (file)
@@ -35,6 +35,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <netinet/in.h>
 
 struct read_tcp_data {
        char *host;