LIBS+=-lossaudio
endif
+# This probably applies for any pkgsrc based system
+ifeq ($(shell uname),DragonFly)
+CFLAGS+=-I/usr/pkg/include/
+LDFLAGS+=-L/usr/pkg/lib/
+endif
+
+
CFLAGS+=$(EXTRA_CFLAGS)
# Fallback for libyajl 1 which did not include yajl_version.h. We need
#define THERMAL_ZONE "/sys/class/thermal/thermal_zone%d/temp"
-#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
/* this needs the coretemp module to be loaded */
+#if defined(__DragonFly__)
+#define THERMAL_ZONE "hw.sensors.cpu%d.temp0"
+#else
#define THERMAL_ZONE "dev.cpu.%d.temperature"
+#endif
#define BATT_LIFE "hw.acpi.battery.life"
#define BATT_TIME "hw.acpi.battery.time"
#define BATT_STATE "hw.acpi.battery.state"
#include "i3status.h"
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
#include <sys/types.h>
#include <sys/sysctl.h>
#endif
}
}
}
-#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
int state;
int sysctl_rslt;
size_t sysctl_size = sizeof(sysctl_rslt);
#include "i3status.h"
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
#include <err.h>
#include <sys/types.h>
#include <sys/sysctl.h>
if (colorful_output)
END_COLOR;
}
-#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
int sysctl_rslt;
size_t sysctl_size = sizeof(sysctl_rslt);
if (sysctlbyname(path, &sysctl_rslt, &sysctl_size, NULL, 0))
#include <sys/dkstat.h>
#endif
+#if defined(__DragonFly__)
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#include <sys/resource.h>
+#endif
+
#include "i3status.h"
static int prev_total = 0;
diff_usage = (diff_total ? (1000 * (diff_total - diff_idle)/diff_total + 5)/10 : 0);
prev_total = curr_total;
prev_idle = curr_idle;
-#elif defined(__FreeBSD__) || defined(__OpenBSD__)
+#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__DragonFly__)
size_t size;
long cp_time[CPUSTATES];
size = sizeof cp_time;
#include <stdint.h>
#include <sys/statvfs.h>
#include <sys/types.h>
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || (__OpenBSD__)
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || (__OpenBSD__) || defined(__DragonFly__)
#include <sys/param.h>
#include <sys/mount.h>
#endif
INSTANCE(path);
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__)
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__DragonFly__)
struct statfs buf;
if (statfs(path, &buf) == -1)
#define PART_ETHSPEED "E: %s (%d Mbit/s)"
#endif
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
#include <net/if_media.h>
#define IFM_TYPE_MATCH(dt, t) \
(IFM_TYPE((dt)) == 0 || IFM_TYPE((dt)) == IFM_TYPE((t)))
ethspeed = (ecmd.speed == USHRT_MAX ? 0 : ecmd.speed);
return sprintf(outwalk, "%d Mbit/s", ethspeed);
} else return sprintf(outwalk, "?");
-#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
char *ethspeed;
struct ifmediareq ifm;
(void)memset(&ifm, 0, sizeof(ifm));
char *outwalk = buffer;
/* Get load */
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(linux) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__) || defined(sun)
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(linux) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__) || defined(sun) || defined(__DragonFly__)
double loadavg[3];
const char *walk;
#include <alloca.h>
#endif
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__DragonFly__)
#include <fcntl.h>
#include <unistd.h>
#include <sys/soundcard.h>
}
}
#endif
-#if defined(__FreeBSD__) || defined(__OpenBSD__)
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
char mixerpath[] = "/dev/mixer";
int mixfd, vol, devmask = 0;
#define IW_ESSID_MAX_SIZE IEEE80211_NWID_LEN
#endif
+#ifdef __DragonFly__
+#include <sys/param.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <ifaddrs.h>
+#include <net/if.h>
+#include <net/if_media.h>
+#include <netproto/802_11/ieee80211.h>
+#include <netproto/802_11/ieee80211_ioctl.h>
+#include <unistd.h>
+#define IW_ESSID_MAX_SIZE IEEE80211_NWID_LEN
+#endif
+
#ifdef __OpenBSD__
#include <sys/ioctl.h>
#include <sys/socket.h>
close(skfd);
return 1;
#endif
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__DragonFly__)
int s, len, inwid;
uint8_t buf[24 * 1024], *cp;
struct ieee80211req na;