summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xcurtis/.bin/wake.c41
-rwxr-xr-xlink.sh1
2 files changed, 42 insertions, 0 deletions
diff --git a/curtis/.bin/wake.c b/curtis/.bin/wake.c
new file mode 100755
index 00000000..2f314975
--- /dev/null
+++ b/curtis/.bin/wake.c
@@ -0,0 +1,41 @@
+#if 0
+exec cc -Wall -Wextra -Wpedantic $@ -o $(dirname $0)/wake $0
+#endif
+
+#include <err.h>
+#include <netinet/in.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <sys/socket.h>
+#include <sysexits.h>
+
+#define MAC 0x04, 0x7D, 0x7B, 0xD5, 0x6A, 0x53
+
+const uint8_t payload[] = {
+    0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+    MAC, MAC, MAC, MAC, MAC, MAC, MAC, MAC,
+    MAC, MAC, MAC, MAC, MAC, MAC, MAC, MAC,
+};
+
+int main() {
+    int sock = socket(PF_INET, SOCK_DGRAM, 0);
+    if (sock < 0) err(EX_OSERR, "socket");
+
+    int on = 1;
+    int error = setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on));
+    if (error) err(EX_OSERR, "setsockopt");
+
+    struct sockaddr_in addr = {
+        .sin_family = AF_INET,
+        .sin_port = 9,
+        .sin_addr.s_addr = INADDR_BROADCAST,
+    };
+
+    ssize_t len = sendto(
+        sock, payload, sizeof(payload), 0,
+        (struct sockaddr *)&addr, sizeof(addr)
+    );
+    if (len < 0) err(EX_IOERR, "sendto");
+
+    return EX_OK;
+}
diff --git a/link.sh b/link.sh
index 574ae257..e591844e 100755
--- a/link.sh
+++ b/link.sh
@@ -29,6 +29,7 @@ link '.bin/pbd.c'
 link '.bin/sup'
 link '.bin/tup'
 link '.bin/up'
+link '.bin/wake.c'
 link '.bin/xx.c'
 link '.config/git/config'
 link '.config/git/ignore'
0df8029694955cc82ce77e27e09fb0e7eec2&follow=1'>Increase dark white brightness slightlyJune McEnroe 2021-01-13Add hilex example to htagml manualJune McEnroe 2021-01-12Style causal.agency like bin HTMLJune McEnroe 2021-01-12Avoid matching tag text inside HTML elementsJune McEnroe 2021-01-12Use hilex for up -hJune McEnroe 2021-01-12Use hilex for bin HTMLJune McEnroe 2021-01-12Don't output a pre in hilex by defaultJune McEnroe 2021-01-12Move hilex out of hilex directoryJune McEnroe 2021-01-12Consolidate hilex formatters into hilex.cJune McEnroe 2021-01-12Remove hacky tagging from hilexJune McEnroe 2021-01-12Add htagml -iJune McEnroe 2021-01-12Render tag index in HTMLJune McEnroe 2021-01-12Add htagml -xJune McEnroe 2021-01-12Prevent matching the same tag twiceJune McEnroe 2021-01-12Process htagml file line by lineJune McEnroe 2021-01-12Split fields by tab onlyJune McEnroe 2021-01-12List both Makefile and html.sh under README.7June McEnroe 2021-01-12Add htagml exampleJune McEnroe 2021-01-12Use mandoc and htagml for bin htmlJune McEnroe 2021-01-12Add htagmlJune McEnroe 2021-01-12Replace causal.agency with a simple mdoc pageJune McEnroe 2021-01-11Publish "Using vi"June McEnroe 2021-01-11Enable diff.colorMovedJune McEnroe 2021-01-10Set less search case-insensitiveJune McEnroe 2021-01-10Set EXINITJune McEnroe 2021-01-09Add c -t flag to print expression typeJune McEnroe 2021-01-05Update taglineJune McEnroe