spoon.patch - randomcrap - random crap programs of varying quality
(HTM) git clone git://git.codemadness.org/randomcrap
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
spoon.patch (1728B)
---
1 diff --git a/Makefile b/Makefile
2 index 90a4121..b75d600 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -1,7 +1,7 @@
6 VERSION = 0.2
7 PREFIX = /usr/local
8 SRC = spoon.c batt.c wifi.c cpu.c temp.c mix.c date.c load.c\
9 - strlcpy.c strlcat.c stub.c xkblayout.c mpd.c
10 + strlcpy.c strlcat.c stub.c xkblayout.c
11 OBJ = spoon.o batt.o wifi.o cpu.o temp.o mix.o date.o load.o\
12 strlcpy.o strlcat.o stub.o
13 BIN = spoon
14 @@ -21,8 +21,8 @@ LDLIBS = -lX11
15 OBJ += xkblayout.o
16 LDLIBS += -lxkbfile
17
18 -OBJ += mpd.o
19 -LDLIBS += -lmpdclient
20 +#OBJ += mpd.o
21 +#LDLIBS += -lmpdclient
22
23 all: $(BIN)
24
25 diff --git a/config.h b/config.h
26 new file mode 100644
27 index 0000000..2ae7b28
28 --- /dev/null
29 +++ b/config.h
30 @@ -0,0 +1,13 @@
31 +/* delay between each update in seconds */
32 +int delay = 1;
33 +/* format for dateread */
34 +char timeformat[] = "%a %H:%M";
35 +
36 +struct ent ents[] = {
37 + /* reorder this if you want */
38 + { .fmt = "[%s] ", .read = mixread },
39 + { .fmt = "[%s] ", .read = loadread },
40 + { .fmt = "[%s] ", .read = cpuread },
41 + { .fmt = "[%s] ", .read = tempread },
42 + { .fmt = "%s", .read = dateread },
43 +};
44 diff --git a/config.mk b/config.mk
45 new file mode 100644
46 index 0000000..3f84a3b
47 --- /dev/null
48 +++ b/config.mk
49 @@ -0,0 +1 @@
50 +UNAME = OpenBSD
51 diff --git a/temp.c b/temp.c
52 index 6309ea3..026dc22 100644
53 --- a/temp.c
54 +++ b/temp.c
55 @@ -4,6 +4,7 @@
56
57 #ifdef __OpenBSD__
58 #include <sys/sysctl.h>
59 +#include <sys/time.h>
60 #include <sys/sensors.h>
61
62 int
63 @@ -21,7 +22,7 @@ tempread(char *buf, size_t len)
64 sz = sizeof(temp);
65 if (sysctl(mib, 5, &temp, &sz, NULL, 0) == -1)
66 return -1;
67 - snprintf(buf, len, "%ddegC", (temp.value - 273150000) / 1000000);
68 + snprintf(buf, len, "%dC", (temp.value - 273150000) / 1000000);
69 return 0;
70 }
71 #elif __linux__