function prototype with unspecified argument is obsolete since c99.
additionally some of these function which don't take any argument were
being called with a `const char *` arg, which is UB.
fix both these issues by declararing ALL the components to accept a
`const char *`, and name the arg "unused" if it's meant to be ignored.
#if defined(__linux__)
const char *
- cpu_freq(void)
+ cpu_freq(const char *unused)
{
uintmax_t freq;
}
const char *
- cpu_perc(void)
+ cpu_perc(const char *unused)
{
static long double a[7];
long double b[7], sum;
#include <sys/sysctl.h>
const char *
- cpu_freq(void)
+ cpu_freq(const char *unused)
{
int freq, mib[2];
size_t size;
}
const char *
- cpu_perc(void)
+ cpu_perc(const char *unused)
{
int mib[2];
static uintmax_t a[CPUSTATES];
#include <devstat.h>
const char *
- cpu_freq(void)
+ cpu_freq(const char *unused)
{
int freq;
size_t size;
}
const char *
- cpu_perc(void)
+ cpu_perc(const char *unused)
{
size_t size;
static long a[CPUSTATES];
#include "../util.h"
const char *
- entropy(void)
+ entropy(const char *unused)
{
uintmax_t num;
}
#elif defined(__OpenBSD__) | defined(__FreeBSD__)
const char *
- entropy(void)
+ entropy(const char *unused)
{
/* Unicode Character 'INFINITY' (U+221E) */
return "\xe2\x88\x9e";
#include "../slstatus.h"
const char *
-hostname(void)
+hostname(const char *unused)
{
if (gethostname(buf, sizeof(buf)) < 0) {
warn("gethostbyname:");
#include "../slstatus.h"
const char *
-kernel_release(void)
+kernel_release(const char *unused)
{
struct utsname udata;
}
const char *
-keymap(void)
+keymap(const char *unused)
{
Display *dpy;
XkbDescRec *desc;
#include "../slstatus.h"
const char *
-load_avg(void)
+load_avg(const char *unused)
{
double avgs[3];
#include <stdint.h>
const char *
- ram_free(void)
+ ram_free(const char *unused)
{
uintmax_t free;
}
const char *
- ram_perc(void)
+ ram_perc(const char *unused)
{
uintmax_t total, free, buffers, cached;
}
const char *
- ram_total(void)
+ ram_total(const char *unused)
{
uintmax_t total;
}
const char *
- ram_used(void)
+ ram_used(const char *unused)
{
uintmax_t total, free, buffers, cached;
}
const char *
- ram_free(void)
+ ram_free(const char *unused)
{
struct uvmexp uvmexp;
int free_pages;
}
const char *
- ram_perc(void)
+ ram_perc(const char *unused)
{
struct uvmexp uvmexp;
int percent;
}
const char *
- ram_total(void)
+ ram_total(const char *unused)
{
struct uvmexp uvmexp;
}
const char *
- ram_used(void)
+ ram_used(const char *unused)
{
struct uvmexp uvmexp;
#include <vm/vm_param.h>
const char *
- ram_free(void) {
+ ram_free(const char *unused) {
struct vmtotal vm_stats;
int mib[] = {CTL_VM, VM_TOTAL};
size_t len;
}
const char *
- ram_total(void) {
+ ram_total(const char *unused) {
unsigned int npages;
size_t len;
}
const char *
- ram_perc(void) {
+ ram_perc(const char *unused) {
unsigned int npages;
unsigned int active;
size_t len;
}
const char *
- ram_used(void) {
+ ram_used(const char *unused) {
unsigned int active;
size_t len;
}
const char *
- swap_free(void)
+ swap_free(const char *unused)
{
long free;
}
const char *
- swap_perc(void)
+ swap_perc(const char *unused)
{
long total, free, cached;
}
const char *
- swap_total(void)
+ swap_total(const char *unused)
{
long total;
}
const char *
- swap_used(void)
+ swap_used(const char *unused)
{
long total, free, cached;
}
const char *
- swap_free(void)
+ swap_free(const char *unused)
{
int total, used;
}
const char *
- swap_perc(void)
+ swap_perc(const char *unused)
{
int total, used;
}
const char *
- swap_total(void)
+ swap_total(const char *unused)
{
int total, used;
}
const char *
- swap_used(void)
+ swap_used(const char *unused)
{
int total, used;
}
const char *
- swap_free(void)
+ swap_free(const char *unused)
{
struct kvm_swap swap_info[1];
long used, total;
}
const char *
- swap_perc(void)
+ swap_perc(const char *unused)
{
struct kvm_swap swap_info[1];
long used, total;
}
const char *
- swap_total(void)
+ swap_total(const char *unused)
{
struct kvm_swap swap_info[1];
long total;
}
const char *
- swap_used(void)
+ swap_used(const char *unused)
{
struct kvm_swap swap_info[1];
long used;
#endif
const char *
-uptime(void)
+uptime(const char *unused)
{
char warn_buf[256];
uintmax_t h, m;
#include "../slstatus.h"
const char *
-gid(void)
+gid(const char *unused)
{
return bprintf("%d", getgid());
}
const char *
-username(void)
+username(const char *unused)
{
struct passwd *pw;
}
const char *
-uid(void)
+uid(const char *unused)
{
return bprintf("%d", geteuid());
}
# flags
CPPFLAGS = -I$(X11INC) -D_DEFAULT_SOURCE
-CFLAGS = -std=c99 -pedantic -Wall -Wextra -Os
+CFLAGS = -std=c99 -pedantic -Wall -Wextra -Wno-unused-parameter -Os
LDFLAGS = -L$(X11LIB) -s
# OpenBSD: add -lsndio
# FreeBSD: add -lkvm -lsndio
#include "util.h"
struct arg {
- const char *(*func)();
+ const char *(*func)(const char *);
const char *fmt;
const char *args;
};
const char *battery_remaining(const char *);
/* cpu */
-const char *cpu_freq(void);
-const char *cpu_perc(void);
+const char *cpu_freq(const char *unused);
+const char *cpu_perc(const char *unused);
/* datetime */
const char *datetime(const char *fmt);
const char *disk_used(const char *path);
/* entropy */
-const char *entropy(void);
+const char *entropy(const char *unused);
/* hostname */
-const char *hostname(void);
+const char *hostname(const char *unused);
/* ip */
const char *ipv4(const char *interface);
const char *ipv6(const char *interface);
/* kernel_release */
-const char *kernel_release(void);
+const char *kernel_release(const char *unused);
/* keyboard_indicators */
const char *keyboard_indicators(const char *fmt);
/* keymap */
-const char *keymap(void);
+const char *keymap(const char *unused);
/* load_avg */
-const char *load_avg(void);
+const char *load_avg(const char *unused);
/* netspeeds */
const char *netspeed_rx(const char *interface);
const char *num_files(const char *path);
/* ram */
-const char *ram_free(void);
-const char *ram_perc(void);
-const char *ram_total(void);
-const char *ram_used(void);
+const char *ram_free(const char *unused);
+const char *ram_perc(const char *unused);
+const char *ram_total(const char *unused);
+const char *ram_used(const char *unused);
/* run_command */
const char *run_command(const char *cmd);
const char *separator(const char *separator);
/* swap */
-const char *swap_free(void);
-const char *swap_perc(void);
-const char *swap_total(void);
-const char *swap_used(void);
+const char *swap_free(const char *unused);
+const char *swap_perc(const char *unused);
+const char *swap_total(const char *unused);
+const char *swap_used(const char *unused);
/* temperature */
const char *temp(const char *);
/* uptime */
-const char *uptime(void);
+const char *uptime(const char *unused);
/* user */
-const char *gid(void);
-const char *username(void);
-const char *uid(void);
+const char *gid(const char *unused);
+const char *username(const char *unused);
+const char *uid(const char *unused);
/* volume */
const char *vol_perc(const char *card);