tNo need for cpu args struct - spoon - dwm status utility (2f30 fork) | |
git clone git://src.adamsgaard.dk/spoon | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit cc9730b94b734a1cd45163d8ab57e156e3bb2f59 | |
parent 1299e08d72f8fd99c4d251c1c725bf7c3e438a23 | |
Author: sin <[email protected]> | |
Date: Wed, 14 Mar 2018 10:48:13 +0000 | |
No need for cpu args struct | |
Diffstat: | |
M config.def.h | 2 +- | |
M cpu.c | 8 +++----- | |
M types.h | 4 ---- | |
3 files changed, 4 insertions(+), 10 deletions(-) | |
--- | |
diff --git a/config.def.h b/config.def.h | |
t@@ -7,7 +7,7 @@ struct ent ents[] = { | |
{ .fmt = "[%s] ", .read = countread, .arg = (char []){"/… | |
{ .fmt = "[%s] ", .read = mixread, .arg = NULL }, | |
{ .fmt = "[%s] ", .read = loadread, .arg = NULL }, | |
- { .fmt = "[%s] ", .read = cpuread, .arg = &(struct cpuar… | |
+ { .fmt = "[%s] ", .read = cpuread, .arg = "/sys/devices/… | |
{ .fmt = "[%s°] ", .read = tempread, .arg = "/sys/class… | |
{ .fmt = "%s ", .read = battread, .arg = &(struc… | |
{ .fmt = "%s ", .read = wifiread, .arg = NULL }, | |
diff --git a/cpu.c b/cpu.c | |
t@@ -1,8 +1,6 @@ | |
#include <err.h> | |
#include <stdio.h> | |
-#include "types.h" | |
- | |
#ifdef __OpenBSD__ | |
#include <sys/sysctl.h> | |
t@@ -24,13 +22,13 @@ cpuread(void *arg, char *buf, size_t len) | |
int | |
cpuread(void *arg, char *buf, size_t len) | |
{ | |
- struct cpuarg *cpuarg = arg; | |
+ char *path = arg; | |
FILE *fp; | |
int freq; | |
- fp = fopen(cpuarg->freq, "r"); | |
+ fp = fopen(path, "r"); | |
if (fp == NULL) { | |
- warn("fopen %s", cpuarg->freq); | |
+ warn("fopen %s", path); | |
return -1; | |
} | |
fscanf(fp, "%d", &freq); | |
diff --git a/types.h b/types.h | |
t@@ -3,10 +3,6 @@ struct battarg { | |
char *ac; | |
}; | |
-struct cpuarg { | |
- char *freq; | |
-}; | |
- | |
struct mpdarg { | |
char *host; | |
unsigned int port; |