summaryrefslogtreecommitdiff
path: root/send/util.h
diff options
context:
space:
mode:
authorthing1 <thing1@seacrossedlovers.xyz>2025-06-30 07:54:25 +0100
committerthing1 <thing1@seacrossedlovers.xyz>2025-06-30 07:54:25 +0100
commitbfb5a9ad837e8985aa66acb8a9d6e6790488dcd4 (patch)
tree04822c32837b15f0497d76f431df2305b5c90e92 /send/util.h
init commit, should remake send
Diffstat (limited to 'send/util.h')
-rw-r--r--send/util.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/send/util.h b/send/util.h
new file mode 100644
index 0000000..5f1a698
--- /dev/null
+++ b/send/util.h
@@ -0,0 +1,27 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+
+static void
+warn(const char *msg) {
+ if (errno != 0)
+ perror(msg);
+ else
+ fprintf(stderr, "error: %s\n", msg);
+}
+
+static void
+error(const char *msg) {
+ warn(msg);
+ exit(1);
+}
+
+static int
+make_mhash(char *m) {
+ int hash = 0;
+ while (*m != 0) {
+ hash += *m;
+ m++;
+ }
+ return hash;
+}