From a57cdc84e2f38ea99fd464d8b5b6446c769cc545 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Wed, 23 Jan 2019 08:56:40 +0100 Subject: Switch to autotools (#316) --- src/auto_detect_format.c | 1 + src/first_network_device.c | 1 + src/general.c | 1 + src/output.c | 1 + src/print_battery_info.c | 9 +++++---- src/print_cpu_temperature.c | 3 ++- src/print_cpu_usage.c | 5 +++-- src/print_ddate.c | 1 + src/print_disk_info.c | 1 + src/print_eth_info.c | 5 +++-- src/print_ip_addr.c | 1 + src/print_ipv6_addr.c | 1 + src/print_load.c | 1 + src/print_mem.c | 1 + src/print_path_exists.c | 1 + src/print_run_watch.c | 1 + src/print_time.c | 1 + src/print_volume.c | 5 +++-- src/print_wireless_info.c | 17 ++++++++--------- src/process_runs.c | 1 + src/pulse.c | 3 ++- 21 files changed, 40 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/auto_detect_format.c b/src/auto_detect_format.c index 8a256e9..5bb05f3 100644 --- a/src/auto_detect_format.c +++ b/src/auto_detect_format.c @@ -1,6 +1,7 @@ /* * vim:ts=4:sw=4:expandtab */ +#include #include #include #include diff --git a/src/first_network_device.c b/src/first_network_device.c index 93626a2..3d06217 100644 --- a/src/first_network_device.c +++ b/src/first_network_device.c @@ -1,4 +1,5 @@ // vim:ts=4:sw=4:expandtab +#include #include #include #include diff --git a/src/general.c b/src/general.c index 2424cc6..1b11bd8 100644 --- a/src/general.c +++ b/src/general.c @@ -1,4 +1,5 @@ // vim:ts=4:sw=4:expandtab +#include #include #include #include diff --git a/src/output.c b/src/output.c index 663700e..937fa60 100644 --- a/src/output.c +++ b/src/output.c @@ -1,4 +1,5 @@ // vim:ts=4:sw=4:expandtab +#include #include #include #include diff --git a/src/print_battery_info.c b/src/print_battery_info.c index 3ac8c11..1c51624 100644 --- a/src/print_battery_info.c +++ b/src/print_battery_info.c @@ -1,4 +1,5 @@ // vim:ts=4:sw=4:expandtab +#include #include #include #include @@ -9,7 +10,7 @@ #include "i3status.h" -#if defined(LINUX) +#if defined(__linux__) #include #include #include @@ -75,7 +76,7 @@ static bool acpi_init(void) { } #endif -#if defined(LINUX) || defined(__NetBSD__) +#if defined(__linux__) || defined(__NetBSD__) /* * Add batt_info data to acc. */ @@ -132,7 +133,7 @@ static void add_battery_info(struct battery_info *acc, const struct battery_info static bool slurp_battery_info(struct battery_info *batt_info, yajl_gen json_gen, char *buffer, int number, const char *path, const char *format_down) { char *outwalk = buffer; -#if defined(LINUX) +#if defined(__linux__) char buf[1024]; const char *walk, *last; bool watt_as_unit = false; @@ -469,7 +470,7 @@ static bool slurp_battery_info(struct battery_info *batt_info, yajl_gen json_gen * Returns false on error, and an error message will have been written. */ static bool slurp_all_batteries(struct battery_info *batt_info, yajl_gen json_gen, char *buffer, const char *path, const char *format_down) { -#if defined(LINUX) +#if defined(__linux__) char *outwalk = buffer; bool is_found = false; diff --git a/src/print_cpu_temperature.c b/src/print_cpu_temperature.c index 569ea60..01744a1 100644 --- a/src/print_cpu_temperature.c +++ b/src/print_cpu_temperature.c @@ -1,4 +1,5 @@ // vim:ts=4:sw=4:expandtab +#include #include #include #include @@ -52,7 +53,7 @@ typedef struct temperature_s { #define ERROR_CODE 1 static int read_temperature(char *thermal_zone, temperature_t *temperature) { -#if defined(LINUX) +#if defined(__linux__) static char buf[16]; long int temp; diff --git a/src/print_cpu_usage.c b/src/print_cpu_usage.c index faac920..3c3c0d5 100644 --- a/src/print_cpu_usage.c +++ b/src/print_cpu_usage.c @@ -1,4 +1,5 @@ // vim:ts=4:sw=4:expandtab +#include #include #include #include @@ -60,7 +61,7 @@ void print_cpu_usage(yajl_gen json_gen, char *buffer, const char *format, const int diff_idle, diff_total, diff_usage; bool colorful_output = false; -#if defined(LINUX) +#if defined(__linux__) // Detecting if CPU count has changed int curr_cpu_count = get_nprocs_conf(); @@ -161,7 +162,7 @@ void print_cpu_usage(yajl_gen json_gen, char *buffer, const char *format, const outwalk += sprintf(outwalk, "%02d%s", diff_usage, pct_mark); walk += strlen("usage"); } -#if defined(LINUX) +#if defined(__linux__) else if (BEGINS_WITH(walk + 1, "cpu")) { int number = -1; sscanf(walk + 1, "cpu%d", &number); diff --git a/src/print_ddate.c b/src/print_ddate.c index 1c368b5..93e652d 100644 --- a/src/print_ddate.c +++ b/src/print_ddate.c @@ -1,4 +1,5 @@ // vim:ts=4:sw=4:expandtab +#include #include #include #include diff --git a/src/print_disk_info.c b/src/print_disk_info.c index 03c95e5..5f12e93 100644 --- a/src/print_disk_info.c +++ b/src/print_disk_info.c @@ -1,4 +1,5 @@ // vim:ts=4:sw=4:expandtab +#include #include #include #include diff --git a/src/print_eth_info.c b/src/print_eth_info.c index f3cab7e..f9e63da 100644 --- a/src/print_eth_info.c +++ b/src/print_eth_info.c @@ -1,4 +1,5 @@ // vim:ts=4:sw=4:expandtab +#include #include #include #include @@ -14,7 +15,7 @@ #include "i3status.h" -#if defined(LINUX) +#if defined(__linux__) #include #include #define PART_ETHSPEED "E: %s (%d Mbit/s)" @@ -32,7 +33,7 @@ #endif static int print_eth_speed(char *outwalk, const char *interface) { -#if defined(LINUX) +#if defined(__linux__) int ethspeed = 0; struct ifreq ifr; struct ethtool_cmd ecmd; diff --git a/src/print_ip_addr.c b/src/print_ip_addr.c index 30a1ce3..463412f 100644 --- a/src/print_ip_addr.c +++ b/src/print_ip_addr.c @@ -1,4 +1,5 @@ // vim:ts=4:sw=4:expandtab +#include #include #include #include diff --git a/src/print_ipv6_addr.c b/src/print_ipv6_addr.c index a50bf39..5a0c38d 100644 --- a/src/print_ipv6_addr.c +++ b/src/print_ipv6_addr.c @@ -1,4 +1,5 @@ // vim:ts=4:sw=4:expandtab +#include #include #include #include diff --git a/src/print_load.c b/src/print_load.c index e0ba677..5d97a2c 100644 --- a/src/print_load.c +++ b/src/print_load.c @@ -1,4 +1,5 @@ // vim:ts=4:sw=4:expandtab +#include #include "i3status.h" #include #include diff --git a/src/print_mem.c b/src/print_mem.c index f9284f3..840f997 100644 --- a/src/print_mem.c +++ b/src/print_mem.c @@ -1,4 +1,5 @@ // vim:ts=4:sw=4:expandtab +#include #include #include #include diff --git a/src/print_path_exists.c b/src/print_path_exists.c index 7bdbe30..87601b4 100644 --- a/src/print_path_exists.c +++ b/src/print_path_exists.c @@ -1,4 +1,5 @@ // vim:ts=4:sw=4:expandtab +#include #include #include #include diff --git a/src/print_run_watch.c b/src/print_run_watch.c index 0887521..f0a0746 100644 --- a/src/print_run_watch.c +++ b/src/print_run_watch.c @@ -1,4 +1,5 @@ // vim:ts=4:sw=4:expandtab +#include #include #include #include diff --git a/src/print_time.c b/src/print_time.c index 864aeae..5133c51 100644 --- a/src/print_time.c +++ b/src/print_time.c @@ -1,4 +1,5 @@ // vim:ts=4:sw=4:expandtab +#include #include #include #include diff --git a/src/print_volume.c b/src/print_volume.c index 1d81e13..91e8ce2 100644 --- a/src/print_volume.c +++ b/src/print_volume.c @@ -1,4 +1,5 @@ // vim:ts=4:sw=4:expandtab +#include #include #include #include @@ -8,7 +9,7 @@ #include #include -#ifdef LINUX +#ifdef __linux__ #include #include #include @@ -147,7 +148,7 @@ void print_volume(yajl_gen json_gen, char *buffer, const char *fmt, const char * * proceed to ALSA / OSS */ #endif -#ifdef LINUX +#ifdef __linux__ const long MAX_LINEAR_DB_SCALE = 24; int err; snd_mixer_t *m; diff --git a/src/print_wireless_info.c b/src/print_wireless_info.c index 1d87c79..8b2d210 100644 --- a/src/print_wireless_info.c +++ b/src/print_wireless_info.c @@ -1,10 +1,13 @@ // vim:ts=4:sw=4:expandtab +#include #include #include +#include #include #include +#include -#ifdef LINUX +#ifdef __linux__ #include #include #include @@ -16,14 +19,12 @@ #endif #ifdef __APPLE__ -#include #define IW_ESSID_MAX_SIZE 32 #endif #ifdef __FreeBSD__ #include #include -#include #include #include #include @@ -36,7 +37,6 @@ #ifdef __DragonFly__ #include #include -#include #include #include #include @@ -49,7 +49,6 @@ #ifdef __OpenBSD__ #include -#include #include #include #include @@ -81,7 +80,7 @@ typedef struct { #ifdef IW_ESSID_MAX_SIZE char essid[IW_ESSID_MAX_SIZE + 1]; #endif -#ifdef LINUX +#ifdef __linux__ uint8_t bssid[ETH_ALEN]; #endif int quality; @@ -95,7 +94,7 @@ typedef struct { double frequency; } wireless_info_t; -#ifdef LINUX +#ifdef __linux__ // Like iw_print_bitrate, but without the dependency on libiw. static void print_bitrate(char *buffer, int buflen, int bitrate) { const int kilo = 1e3; @@ -275,7 +274,7 @@ static int gwi_scan_cb(struct nl_msg *msg, void *data) { static int get_wireless_info(const char *interface, wireless_info_t *info) { memset(info, 0, sizeof(wireless_info_t)); -#ifdef LINUX +#ifdef __linux__ struct nl_sock *sk = nl_socket_alloc(); if (genl_connect(sk) != 0) goto error1; @@ -589,7 +588,7 @@ void print_wireless_info(yajl_gen json_gen, char *buffer, const char *interface, outwalk += sprintf(outwalk, "%s", ip_address); walk += strlen("ip"); } -#ifdef LINUX +#ifdef __linux__ else if (BEGINS_WITH(walk + 1, "bitrate")) { char br_buffer[128]; diff --git a/src/process_runs.c b/src/process_runs.c index da2dba1..08963a0 100644 --- a/src/process_runs.c +++ b/src/process_runs.c @@ -1,4 +1,5 @@ // vim:ts=4:sw=4:expandtab +#include #include #include #include diff --git a/src/pulse.c b/src/pulse.c index 9e278c5..b733f98 100644 --- a/src/pulse.c +++ b/src/pulse.c @@ -1,4 +1,5 @@ // vim:ts=4:sw=4:expandtab +#include #include #include #include @@ -310,7 +311,7 @@ bool pulse_initialize(void) { pa_proplist *proplist = pa_proplist_new(); pa_proplist_sets(proplist, PA_PROP_APPLICATION_NAME, APP_NAME); pa_proplist_sets(proplist, PA_PROP_APPLICATION_ID, APP_ID); - pa_proplist_sets(proplist, PA_PROP_APPLICATION_VERSION, VERSION); + pa_proplist_sets(proplist, PA_PROP_APPLICATION_VERSION, I3STATUS_VERSION); context = pa_context_new_with_proplist(api, APP_NAME, proplist); pa_proplist_free(proplist); if (!context) -- cgit v1.2.3