commit ba87d6de7c9526db404a4e928b2716a9ed4b1721
parent ad9297133858770cb896908079e61469538dbd1b
Author: sin <sin@2f30.org>
Date: Fri, 14 Oct 2016 14:29:43 +0100
Move all stub implementations to stub.c
Diffstat:
6 files changed, 35 insertions(+), 30 deletions(-)
diff --git a/batt.c b/batt.c
@@ -75,10 +75,4 @@ battread(char *buf, size_t len)
battprint(buf, len, acon, life);
return 0;
}
-#else
-int
-battread(char *buf, size_t len)
-{
- return -1;
-}
#endif
diff --git a/cpu.c b/cpu.c
@@ -17,10 +17,4 @@ cpuread(char *buf, size_t len)
snprintf(buf, len, "%4dMHz", cpuspeed);
return 0;
}
-#else
-int
-cpuread(char *buf, size_t len)
-{
- return -1;
-}
#endif
diff --git a/mix.c b/mix.c
@@ -63,10 +63,4 @@ out:
close(fd);
return ret;
}
-#else
-int
-mixread(char *buf, size_t len)
-{
- return -1;
-}
#endif
diff --git a/stub.c b/stub.c
@@ -1,5 +1,26 @@
#include <stddef.h>
+#pragma weak battread
+int
+battread(char *buf, size_t len)
+{
+ return -1;
+}
+
+#pragma weak cpuread
+int
+cpuread(char *buf, size_t len)
+{
+ return -1;
+}
+
+#pragma weak mixread
+int
+mixread(char *buf, size_t len)
+{
+ return -1;
+}
+
#pragma weak mpdread
int
mpdread(char *buf, size_t len)
@@ -7,6 +28,20 @@ mpdread(char *buf, size_t len)
return -1;
}
+#pragma weak tempread
+int
+tempread(char *buf, size_t len)
+{
+ return -1;
+}
+
+#pragma weak wifiread
+int
+wifiread(char *buf, size_t len)
+{
+ return -1;
+}
+
#pragma weak xkblayoutread
int
xkblayoutread(char *buf, size_t len)
diff --git a/temp.c b/temp.c
@@ -41,10 +41,4 @@ tempread(char *buf, size_t len)
snprintf(buf, len, "%ddegC", temp / 1000);
return 0;
}
-#else
-int
-tempread(char *buf, size_t len)
-{
- return -1;
-}
#endif
diff --git a/wifi.c b/wifi.c
@@ -103,10 +103,4 @@ wifiread(char *buf, size_t len)
return 0;
return -1;
}
-#else
-int
-wifiread(char *buf, size_t len)
-{
- return -1;
-}
#endif