aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias Andrée <m@maandree.se>2024-10-05 23:23:17 +0200
committerMattias Andrée <m@maandree.se>2024-10-05 23:23:17 +0200
commit98a8ac8498974e499fc129878ab05b9a7bf8ba30 (patch)
tree2914967687516632a93da9af59818f22d3120861 /src
parentUpdate e-mail (diff)
downloadmds-98a8ac8498974e499fc129878ab05b9a7bf8ba30.tar.gz
mds-98a8ac8498974e499fc129878ab05b9a7bf8ba30.tar.bz2
mds-98a8ac8498974e499fc129878ab05b9a7bf8ba30.tar.xz
misc + update e-mailHEADmaster
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to 'src')
-rw-r--r--src/libmdsclient.h2
-rw-r--r--src/libmdsclient/address.c2
-rw-r--r--src/libmdsclient/address.h2
-rw-r--r--src/libmdsclient/comm.c2
-rw-r--r--src/libmdsclient/comm.h2
-rw-r--r--src/libmdsclient/inbound.c82
-rw-r--r--src/libmdsclient/inbound.h2
-rw-r--r--src/libmdsclient/proto-util.c2
-rw-r--r--src/libmdsclient/proto-util.h2
-rw-r--r--src/libmdsserver/client-list.c2
-rw-r--r--src/libmdsserver/client-list.h2
-rw-r--r--src/libmdsserver/config.h.in2
-rw-r--r--src/libmdsserver/fd-table.c2
-rw-r--r--src/libmdsserver/fd-table.h2
-rw-r--r--src/libmdsserver/hash-help.h2
-rw-r--r--src/libmdsserver/hash-list.h2
-rw-r--r--src/libmdsserver/hash-table.c2
-rw-r--r--src/libmdsserver/hash-table.h2
-rw-r--r--src/libmdsserver/linked-list.c2
-rw-r--r--src/libmdsserver/linked-list.h2
-rw-r--r--src/libmdsserver/macro-bits.h2
-rw-r--r--src/libmdsserver/macros.h118
-rw-r--r--src/libmdsserver/mds-message.c6
-rw-r--r--src/libmdsserver/mds-message.h2
-rw-r--r--src/libmdsserver/table-common.h2
-rw-r--r--src/libmdsserver/util.c145
-rw-r--r--src/libmdsserver/util.h34
-rw-r--r--src/mds-base.c18
-rw-r--r--src/mds-base.h2
-rw-r--r--src/mds-clipboard.c28
-rw-r--r--src/mds-clipboard.h2
-rw-r--r--src/mds-colour.c22
-rw-r--r--src/mds-colour.h2
-rw-r--r--src/mds-echo.c6
-rw-r--r--src/mds-echo.h2
-rw-r--r--src/mds-kbdc/builtin-functions.c2
-rw-r--r--src/mds-kbdc/builtin-functions.h2
-rw-r--r--src/mds-kbdc/call-stack.c2
-rw-r--r--src/mds-kbdc/call-stack.h2
-rw-r--r--src/mds-kbdc/callables.c2
-rw-r--r--src/mds-kbdc/callables.h2
-rw-r--r--src/mds-kbdc/compile-layout.c2
-rw-r--r--src/mds-kbdc/compile-layout.h2
-rw-r--r--src/mds-kbdc/eliminate-dead-code.c2
-rw-r--r--src/mds-kbdc/eliminate-dead-code.h2
-rw-r--r--src/mds-kbdc/globals.c2
-rw-r--r--src/mds-kbdc/globals.h2
-rw-r--r--src/mds-kbdc/include-stack.c2
-rw-r--r--src/mds-kbdc/include-stack.h2
-rw-r--r--src/mds-kbdc/make-tree.c38
-rw-r--r--src/mds-kbdc/make-tree.h2
-rw-r--r--src/mds-kbdc/mds-kbdc.c4
-rw-r--r--src/mds-kbdc/mds-kbdc.h2
-rw-r--r--src/mds-kbdc/parse-error.c2
-rw-r--r--src/mds-kbdc/parse-error.h2
-rw-r--r--src/mds-kbdc/parsed.c2
-rw-r--r--src/mds-kbdc/parsed.h2
-rw-r--r--src/mds-kbdc/paths.c2
-rw-r--r--src/mds-kbdc/paths.h2
-rw-r--r--src/mds-kbdc/process-includes.c2
-rw-r--r--src/mds-kbdc/process-includes.h2
-rw-r--r--src/mds-kbdc/raw-data.c2
-rw-r--r--src/mds-kbdc/raw-data.h2
-rw-r--r--src/mds-kbdc/simplify-tree.c2
-rw-r--r--src/mds-kbdc/simplify-tree.h2
-rw-r--r--src/mds-kbdc/string.c2
-rw-r--r--src/mds-kbdc/string.h2
-rw-r--r--src/mds-kbdc/tree.c2
-rw-r--r--src/mds-kbdc/tree.h2
-rw-r--r--src/mds-kbdc/validate-tree.c2
-rw-r--r--src/mds-kbdc/validate-tree.h2
-rw-r--r--src/mds-kbdc/variables.c2
-rw-r--r--src/mds-kbdc/variables.h2
-rw-r--r--src/mds-kkbd.c74
-rw-r--r--src/mds-kkbd.h2
-rw-r--r--src/mds-libinput.c20
-rw-r--r--src/mds-libinput.h2
-rw-r--r--src/mds-registry/globals.c2
-rw-r--r--src/mds-registry/globals.h2
-rw-r--r--src/mds-registry/mds-registry.c2
-rw-r--r--src/mds-registry/mds-registry.h2
-rw-r--r--src/mds-registry/reexec.c2
-rw-r--r--src/mds-registry/reexec.h2
-rw-r--r--src/mds-registry/registry.c20
-rw-r--r--src/mds-registry/registry.h2
-rw-r--r--src/mds-registry/signals.c2
-rw-r--r--src/mds-registry/signals.h2
-rw-r--r--src/mds-registry/slave.c4
-rw-r--r--src/mds-registry/slave.h2
-rw-r--r--src/mds-registry/util.c2
-rw-r--r--src/mds-registry/util.h2
-rw-r--r--src/mds-respawn.c24
-rw-r--r--src/mds-respawn.h2
-rw-r--r--src/mds-server/client.c2
-rw-r--r--src/mds-server/client.h2
-rw-r--r--src/mds-server/globals.c2
-rw-r--r--src/mds-server/globals.h2
-rw-r--r--src/mds-server/interception-condition.c2
-rw-r--r--src/mds-server/interception-condition.h2
-rw-r--r--src/mds-server/interceptors.c8
-rw-r--r--src/mds-server/interceptors.h2
-rw-r--r--src/mds-server/mds-server.c16
-rw-r--r--src/mds-server/mds-server.h2
-rw-r--r--src/mds-server/multicast.c2
-rw-r--r--src/mds-server/multicast.h2
-rw-r--r--src/mds-server/queued-interception.c2
-rw-r--r--src/mds-server/queued-interception.h2
-rw-r--r--src/mds-server/receiving.c16
-rw-r--r--src/mds-server/receiving.h2
-rw-r--r--src/mds-server/reexec.c2
-rw-r--r--src/mds-server/sending.c4
-rw-r--r--src/mds-server/sending.h2
-rw-r--r--src/mds-server/signals.c2
-rw-r--r--src/mds-server/slavery.c2
-rw-r--r--src/mds-server/slavery.h2
-rw-r--r--src/mds-vt.c18
-rw-r--r--src/mds-vt.h2
-rw-r--r--src/mds.c4
-rw-r--r--src/mds.h2
119 files changed, 287 insertions, 616 deletions
diff --git a/src/libmdsclient.h b/src/libmdsclient.h
index 125fe94..41a9ff9 100644
--- a/src/libmdsclient.h
+++ b/src/libmdsclient.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/libmdsclient/address.c b/src/libmdsclient/address.c
index b41c9c4..2aac894 100644
--- a/src/libmdsclient/address.c
+++ b/src/libmdsclient/address.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/libmdsclient/address.h b/src/libmdsclient/address.h
index e710ba6..3380e9f 100644
--- a/src/libmdsclient/address.h
+++ b/src/libmdsclient/address.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/libmdsclient/comm.c b/src/libmdsclient/comm.c
index dd0a38f..7c0712a 100644
--- a/src/libmdsclient/comm.c
+++ b/src/libmdsclient/comm.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/libmdsclient/comm.h b/src/libmdsclient/comm.h
index 9df1d41..3d25a05 100644
--- a/src/libmdsclient/comm.h
+++ b/src/libmdsclient/comm.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/libmdsclient/inbound.c b/src/libmdsclient/inbound.c
index 85b8b34..5a8e868 100644
--- a/src/libmdsclient/inbound.c
+++ b/src/libmdsclient/inbound.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -27,6 +27,8 @@
#include <stdio.h>
#include <assert.h>
+#include <libsimple.h>
+
#define try(INSTRUCTION) do { if ((r = INSTRUCTION) < 0) return r; } while (0)
#define static_strlen(str) (sizeof(str) / sizeof(char) - 1)
@@ -124,82 +126,6 @@ repoll:
/**
- * Check whether a NUL-terminated string is encoded in UTF-8
- *
- * @param string The string
- * @param allow_modified_nul Whether Modified UTF-8 is allowed, which allows a two-byte encoding for NUL
- * @return Zero if good, -1 on encoding error
- */
-static int __attribute__((nonnull, warn_unused_result)) /* Cannibalised from <libmdsserver/util.h>. */
-verify_utf8(const char *string, int allow_modified_nul)
-{
- static long BYTES_TO_MIN_BITS[] = {0, 0, 8, 12, 17, 22, 37};
- static long BYTES_TO_MAX_BITS[] = {0, 7, 11, 16, 21, 26, 31};
- long bytes = 0, read_bytes = 0, bits = 0, c, character;
-
- /* min bits max bits
- 0....... 0 7
- 110..... 10...... 8 11
- 1110.... 10...... 10...... 12 16
- 11110... 10...... 10...... 10...... 17 21
- 111110.. 10...... 10...... 10...... 10...... 22 26
- 1111110. 10...... 10...... 10...... 10...... 10...... 27 31
- */
-
- while ((c = (long)(*string++))) {
- if (!read_bytes) {
- /* First byte of the character. */
-
- if (!(c & 0x80))
- /* Single-byte character. */
- continue;
-
- if ((c & 0xC0) == 0x80)
- /* Single-byte character marked as multibyte, or
- a non-first byte in a multibyte character. */
- return -1;
-
- /* Multibyte character. */
- while ((c & 0x80))
- bytes++, c <<= 1;
- read_bytes = 1;
- character = c & 0x7F;
- if (bytes > 6)
- /* 31-bit characters can be encoded with 6-bytes,
- and UTF-8 does not cover higher code points. */
- return -1;
- } else {
- /* Not first byte of the character. */
-
- if ((c & 0xC0) != 0x80)
- /* Beginning of new character before a
- multibyte character has ended. */
- return -1;
-
- character = (character << 6) | (c & 0x7F);
-
- if (++read_bytes < bytes)
- /* Not at last byte yet. */
- continue;
-
- /* Check that the character is not unnecessarily long. */
- while (character)
- character >>= 1, bits++;
- bits = ((bits == 0) && (bytes == 2) && allow_modified_nul) ? 8 : bits;
- if ((bits < BYTES_TO_MIN_BITS[bytes]) || (BYTES_TO_MAX_BITS[bytes] < bits))
- return -1;
-
- read_bytes = bytes = bits = 0;
- }
- }
-
- /* Make sure we did not stop at the middle of a multibyte character. */
- return read_bytes == 0 ? 0 : -1;
-}
-
-
-
-/**
* Extend the header list's allocation
*
* @param this The message
@@ -313,7 +239,7 @@ validate_header(const char *header, size_t length)
{
char *p = memchr(header, ':', length * sizeof(char));
- if (verify_utf8(header, 0) < 0)
+ if (!isutf8(header, 0))
/* Either the string is not UTF-8, or your are under an UTF-8 attack,
let's just call this unrecoverable because the client will not correct. */
return -2;
diff --git a/src/libmdsclient/inbound.h b/src/libmdsclient/inbound.h
index 0342a8d..33d5a82 100644
--- a/src/libmdsclient/inbound.h
+++ b/src/libmdsclient/inbound.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/libmdsclient/proto-util.c b/src/libmdsclient/proto-util.c
index 4671a0c..8752e46 100644
--- a/src/libmdsclient/proto-util.c
+++ b/src/libmdsclient/proto-util.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/libmdsclient/proto-util.h b/src/libmdsclient/proto-util.h
index 0e8fbf9..d1d68d9 100644
--- a/src/libmdsclient/proto-util.h
+++ b/src/libmdsclient/proto-util.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/libmdsserver/client-list.c b/src/libmdsserver/client-list.c
index 02d555e..57609ef 100644
--- a/src/libmdsserver/client-list.c
+++ b/src/libmdsserver/client-list.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/libmdsserver/client-list.h b/src/libmdsserver/client-list.h
index ffe828a..b4ae0b2 100644
--- a/src/libmdsserver/client-list.h
+++ b/src/libmdsserver/client-list.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/libmdsserver/config.h.in b/src/libmdsserver/config.h.in
index abacfa1..11b0444 100644
--- a/src/libmdsserver/config.h.in
+++ b/src/libmdsserver/config.h.in
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/libmdsserver/fd-table.c b/src/libmdsserver/fd-table.c
index fafaa65..1344a0e 100644
--- a/src/libmdsserver/fd-table.c
+++ b/src/libmdsserver/fd-table.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/libmdsserver/fd-table.h b/src/libmdsserver/fd-table.h
index e484937..cb7f152 100644
--- a/src/libmdsserver/fd-table.h
+++ b/src/libmdsserver/fd-table.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/libmdsserver/hash-help.h b/src/libmdsserver/hash-help.h
index 0d80cf3..2dda579 100644
--- a/src/libmdsserver/hash-help.h
+++ b/src/libmdsserver/hash-help.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/libmdsserver/hash-list.h b/src/libmdsserver/hash-list.h
index 2087bce..fb12341 100644
--- a/src/libmdsserver/hash-list.h
+++ b/src/libmdsserver/hash-list.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/libmdsserver/hash-table.c b/src/libmdsserver/hash-table.c
index 2a7bc3c..a9247eb 100644
--- a/src/libmdsserver/hash-table.c
+++ b/src/libmdsserver/hash-table.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/libmdsserver/hash-table.h b/src/libmdsserver/hash-table.h
index 448a52d..32b0716 100644
--- a/src/libmdsserver/hash-table.h
+++ b/src/libmdsserver/hash-table.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/libmdsserver/linked-list.c b/src/libmdsserver/linked-list.c
index 954c6fe..235a474 100644
--- a/src/libmdsserver/linked-list.c
+++ b/src/libmdsserver/linked-list.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/libmdsserver/linked-list.h b/src/libmdsserver/linked-list.h
index fa115f1..bd38f1e 100644
--- a/src/libmdsserver/linked-list.h
+++ b/src/libmdsserver/linked-list.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/libmdsserver/macro-bits.h b/src/libmdsserver/macro-bits.h
index a93b39e..7b697c2 100644
--- a/src/libmdsserver/macro-bits.h
+++ b/src/libmdsserver/macro-bits.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/libmdsserver/macros.h b/src/libmdsserver/macros.h
index 45412b9..26ef4c0 100644
--- a/src/libmdsserver/macros.h
+++ b/src/libmdsserver/macros.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -22,31 +22,15 @@
#include "config.h"
#include "macro-bits.h"
-#include <stdio.h>
-#include <errno.h>
-#include <signal.h>
-#include <unistd.h>
-#include <time.h>
-#include <stddef.h>
-#include <sys/socket.h>
-
/*
#include <pthread.h>
-#include <string.h>
#include <sys/types.h>
-#include <dirent.h>
-#include <stdlib.h>
*/
/* # pragma GCC diagnostic ignored "-Wpedantic" */
-/* CLOCK_MONOTONIC_RAW is a Linux-specific bug-fix */
-#ifndef CLOCK_MONOTONIC_RAW
-# define CLOCK_MONOTONIC_RAW CLOCK_MONOTONIC
-#endif
-
/* Define TEMP_FAILURE_RETRY if not defined, however
* this version does not return a value, it will hoever
* clear `errno` if no error occurs. */
@@ -64,48 +48,6 @@
#endif
-/* Ensure that all aliases for AF_UNIX are defined */
-#if !defined(AF_LOCAL) && !defined(AF_UNIX) && defined(AF_FILE)
-# define AF_LOCAL AF_FILE
-# define AF_UNIX AF_FILE
-#elif !defined(AF_LOCAL) && defined(AF_UNIX)
-# define AF_LOCAL AF_UNIX
-#elif defined(AF_LOCAL) && !defined(AF_UNIX)
-# define AF_UNIX AF_LOCAL
-#endif
-#if !defined(AF_FILE) && defined(AF_LOCAL)
-# define AF_FILE AF_LOCAL
-#endif
-
-/* Ensure that all aliases for PF_UNIX are defined */
-#if !defined(PF_LOCAL) && !defined(PF_UNIX) && defined(PF_FILE)
-# define PF_LOCAL PF_FILE
-# define PF_UNIX PF_FILE
-#elif !defined(PF_LOCAL) && defined(PF_UNIX)
-# define PF_LOCAL PF_UNIX
-#elif defined(PF_LOCAL) && !defined(PF_UNIX)
-# define PF_UNIX PF_LOCAL
-#endif
-#if !defined(PF_FILE) && defined(PF_LOCAL)
-# define PF_FILE PF_LOCAL
-#endif
-
-/* Ensure that all aliases for AF_NETLINK are defined */
-#if !defined(AF_NETLINK) && defined(AF_ROUTE)
-# define AF_NETLINK AF_ROUTE
-#elif defined(AF_NETLINK) && !defined(AF_ROUTE)
-# define AF_ROUTE AF_NETLINK
-#endif
-
-/* Ensure that all aliases for PF_NETLINK are defined */
-#if !defined(PF_NETLINK) && defined(PF_ROUTE)
-# define PF_NETLINK PF_ROUTE
-#elif defined(PF_NETLINK) && !defined(PF_ROUTE)
-# define PF_ROUTE PF_NETLINK
-#endif
-
-
-
/**
* Wrapper around `asprintf` that makes sure that first
* argument gets set to `NULL` on error and that zero is
@@ -223,28 +165,6 @@
/**
- * Return the maximum value of two values
- *
- * @param a One of the values
- * @param b The other one of the values
- * @return The maximum value
- */
-#define max(a, b)\
- ((a) < (b) ? (b) : (a))
-
-
-/**
- * Return the minimum value of two values
- *
- * @param a One of the values
- * @param b The other one of the values
- * @return The minimum value
- */
-#define min(a, b)\
- ((a) < (b) ? (a) : (b))
-
-
-/**
* Cast a buffer to another type and get the slot for an element
*
* @param buffer:char* The buffer
@@ -335,28 +255,6 @@
/**
- * Check whether two strings are equal
- *
- * @param a:const char* One of the strings
- * @param b:const char* The other of the strings
- * @return :int Whether the strings are equal
- */
-#define strequals(a, b)\
- (!strcmp(a, b))
-
-
-/**
- * Check whether a string starts with another string
- *
- * @param haystack:const char* The string to inspect
- * @param needle:const char* The string `haystack` should start with
- * @return :int Whether `haystack` starts with `needle`
- */
-#define startswith(haystack, needle)\
- (strstr(haystack, needle) == haystack)
-
-
-/**
* Set effective user and the effective group to the
* real user and the real group, respectively. If the
* group cannot be set, the user till not be set either.
@@ -664,7 +562,7 @@
/**
* `strdup` wrapper that returns whether the allocation was not successful
*
- * This macro was added because GCC 6.1.1 warns of `original` is known to
+ * This macro was added because GCC 6.1.1 warns if `original` is known to
* be nonnull, when using `xstrdup`.
*
* @param var:char* The variable to which to assign the duplicate
@@ -748,18 +646,6 @@
/**
- * The way to get a pointer to the end of a string
- *
- * `strchr(str, '\0')` is faster than `str + strlen(str)`,
- * at least in the GNU C Library. If this is not true for
- * the compiler you are using, you may want to edit this
- * macro.
- */
-#define STREND(str)\
- (strchr(str, '\0'))
-
-
-/**
* The system is running out of memory.
* Quick, free up all your unused memory or kill yourself!
*/
diff --git a/src/libmdsserver/mds-message.c b/src/libmdsserver/mds-message.c
index c3d968f..0e93520 100644
--- a/src/libmdsserver/mds-message.c
+++ b/src/libmdsserver/mds-message.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -196,7 +196,7 @@ validate_header(const char *header, size_t length)
{
char *p = memchr(header, ':', length * sizeof(char));
- if (verify_utf8(header, 0) < 0)
+ if (!isutf8(header, 0))
/* Either the string is not UTF-8, or your are under an UTF-8 attack,
let's just call this unrecoverable because the client will not correct. */
return -2;
@@ -392,7 +392,7 @@ mds_message_read(mds_message_t *restrict this, int fd)
/* How much of the payload that has not yet been filled. */
need = this->payload_size - this->payload_ptr;
/* How much we have of that what is needed. */
- move = min(this->buffer_ptr, need);
+ move = MIN(this->buffer_ptr, need);
/* Copy what we have, and remove it from the the read buffer. */
memcpy(this->payload + this->payload_ptr, this->buffer, move * sizeof(char));
diff --git a/src/libmdsserver/mds-message.h b/src/libmdsserver/mds-message.h
index c6627e9..66023a2 100644
--- a/src/libmdsserver/mds-message.h
+++ b/src/libmdsserver/mds-message.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/libmdsserver/table-common.h b/src/libmdsserver/table-common.h
index f21675a..6282693 100644
--- a/src/libmdsserver/table-common.h
+++ b/src/libmdsserver/table-common.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/libmdsserver/util.c b/src/libmdsserver/util.c
index 09d996a..5a7450a 100644
--- a/src/libmdsserver/util.c
+++ b/src/libmdsserver/util.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -19,19 +19,7 @@
#include "config.h"
#include "macros.h"
-#include <alloca.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <limits.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/socket.h>
-#include <errno.h>
-#include <ctype.h>
-#include <time.h>
-#include <sys/wait.h>
-#include <stdint.h>
-#include <inttypes.h>
+#include <libsimple.h>
@@ -68,20 +56,6 @@ parse_client_id(const char *str)
/**
- * Read an environment variable, but handle it as undefined if empty
- *
- * @param var The environment variable's name
- * @return The environment variable's value, `NULL` if empty or not defined
- */
-char *
-getenv_nonempty(const char *var)
-{
- char *rc = getenv(var);
- return (rc && *rc) ? rc : NULL;
-}
-
-
-/**
* Prepare the server so that it can reexec into
* a newer version of the executed file.
*
@@ -197,7 +171,7 @@ send_message(int socket, const char *message, size_t length)
errno = 0;
while (length > 0) {
- if ((just_sent = send(socket, message + sent, min(block_size, length), MSG_NOSIGNAL)) < 0) {
+ if ((just_sent = send(socket, message + sent, MIN(block_size, length), MSG_NOSIGNAL)) < 0) {
if (errno == EPIPE)
errno = ECONNRESET;
if (errno == EMSGSIZE) {
@@ -275,17 +249,13 @@ strict_atoj(const char *str, intmax_t *value, intmax_t min, intmax_t max)
return -1;
while ((c = *str)) {
- if ('0' <= c && c <= '9') {
- if (r > INTMAX_MAX / 10) {
- return -1;
- } else if (r == INTMAX_MAX / 10) {
- if ((c & 15) > INTMAX_MAX % 10)
- return -1;
- }
- r = r * 10 + (c & 15);
- } else {
+ if (!isdigit(c))
return -1;
- }
+ if (r > INTMAX_MAX / 10)
+ return -1;
+ if (r == INTMAX_MAX / 10 && (c & 15) > INTMAX_MAX % 10)
+ return -1;
+ r = r * 10 + (c & 15);
}
if (neg)
@@ -326,17 +296,13 @@ strict_atouj(const char *str, uintmax_t *value, uintmax_t min, uintmax_t max)
return -1;
while ((c = *str)) {
- if ('0' <= c && c <= '9') {
- if (r > INTMAX_MAX / 10) {
- return -1;
- } else if (r == INTMAX_MAX / 10) {
- if ((c & 15) > INTMAX_MAX % 10)
- return -1;
- }
- r = r * 10 + (c & 15);
- } else {
+ if (!isdigit(c))
return -1;
- }
+ if (r > INTMAX_MAX / 10)
+ return -1;
+ if (r == INTMAX_MAX / 10 && (c & 15) > INTMAX_MAX % 10)
+ return -1;
+ r = r * 10 + (c & 15);
}
if (r < min || r > max)
@@ -588,8 +554,8 @@ full_write(int fd, const char *buffer, size_t length)
errno = 0;
wrote = write(fd, buffer, length);
fail_if (errno && errno != EINTR);
- length -= (size_t)max(wrote, 0);
- buffer += (size_t)max(wrote, 0);
+ length -= (size_t)MAX(wrote, 0);
+ buffer += (size_t)MAX(wrote, 0);
}
return 0;
fail:
@@ -686,11 +652,9 @@ startswith_n(const char *haystack, const char *needle, size_t haystack_n, size_t
size_t i;
if (haystack_n < needle_n)
return 0;
-
for (i = 0; i < needle_n; i++)
if (haystack[i] != needle[i])
return 0;
-
return 1;
}
@@ -732,81 +696,6 @@ fail:
/**
- * Check whether a NUL-terminated string is encoded in UTF-8
- *
- * @param string The string
- * @param allow_modified_nul Whether Modified UTF-8 is allowed, which allows a two-byte encoding for NUL
- * @return Zero if good, -1 on encoding error
- */
-int
-verify_utf8(const char *string, int allow_modified_nul)
-{
- static long BYTES_TO_MIN_BITS[] = {0, 0, 8, 12, 17, 22, 37};
- static long BYTES_TO_MAX_BITS[] = {0, 7, 11, 16, 21, 26, 31};
- long bytes = 0, read_bytes = 0, bits = 0, c, character;
-
- /* min bits max bits
- 0....... 0 7
- 110..... 10...... 8 11
- 1110.... 10...... 10...... 12 16
- 11110... 10...... 10...... 10...... 17 21
- 111110.. 10...... 10...... 10...... 10...... 22 26
- 1111110. 10...... 10...... 10...... 10...... 10...... 27 31
- */
-
- while ((c = (long)(*string++))) {
- if (read_bytes == 0) {
- /* First byte of the character. */
-
- if (!(c & 0x80))
- /* Single-byte character. */
- continue;
-
- if ((c & 0xC0) == 0x80)
- /* Single-byte character marked as multibyte, or
- a non-first byte in a multibyte character. */
- return -1;
-
- /* Multibyte character. */
- while ((c & 0x80))
- bytes++, c <<= 1;
- read_bytes = 1;
- character = c & 0x7F;
- if (bytes > 6)
- /* 31-bit characters can be encoded with 6-bytes,
- and UTF-8 does not cover higher code points. */
- return -1;
- } else {
- /* Not first byte of the character. */
-
- if ((c & 0xC0) != 0x80)
- /* Beginning of new character before a
- multibyte character has ended. */
- return -1;
-
- character = (character << 6) | (c & 0x7F);
-
- if (++read_bytes < bytes)
- /* Not at last byte yet. */
- continue;
-
- /* Check that the character is not unnecessarily long. */
- while (character)
- character >>= 1, bits++;
- bits = ((bits == 0) && (bytes == 2) && allow_modified_nul) ? 8 : bits;
- if ((bits < BYTES_TO_MIN_BITS[bytes]) || (BYTES_TO_MAX_BITS[bytes] < bits))
- return -1;
-
- read_bytes = bytes = bits = 0;
- }
- }
-
- /* Make sure we did not stop at the middle of a multibyte character. */
- return read_bytes == 0 ? 0 : -1;
-}
-
-
-/**
* Construct an error message to be sent to a client
*
* @param recv_client_id The client ID attached on the message that was received, must not be `NULL`
diff --git a/src/libmdsserver/util.h b/src/libmdsserver/util.h
index 77cfa17..9f2953d 100644
--- a/src/libmdsserver/util.h
+++ b/src/libmdsserver/util.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -23,20 +23,9 @@
#include <stdint.h>
#include <sys/types.h>
+#include <libsimple.h>
-#ifndef __USE_GNU
-static inline void *__attribute__((pure, nonnull))
-rawmemchr(const void *str, int chr)
-{
- intptr_t str_address = (intptr_t)str;
- void *str_nonconst = (void*)str_address;
- char *s = str_nonconst;
- while ((int)*s++ != chr);
- return s - 1;
-}
-#endif
-
/**
* Convert a client ID string into a client ID integer
@@ -48,15 +37,6 @@ __attribute__((pure, nonnull))
uint64_t parse_client_id(const char *str);
/**
- * Read an environment variable, but handle it as undefined if empty
- *
- * @param var The environment variable's name
- * @return The environment variable's value, `NULL` if empty or not defined
- */
-__attribute__((nonnull))
-char *getenv_nonempty(const char *var);
-
-/**
* Prepare the server so that it can reexec into
* a newer version of the executed file.
*
@@ -409,16 +389,6 @@ int startswith_n(const char *haystack, const char *needle, size_t haystack_n, si
pid_t uninterruptable_waitpid(pid_t pid, int *restrict status, int options);
/**
- * Check whether a NUL-terminated string is encoded in UTF-8
- *
- * @param string The string
- * @param allow_modified_nul Whether Modified UTF-8 is allowed, which allows a two-byte encoding for NUL
- * @return Zero if good, -1 on encoding error
- */
-__attribute__((pure, nonnull))
-int verify_utf8(const char *string, int allow_modified_nul);
-
-/**
* Construct an error message to be sent to a client
*
* @param recv_client_id The client ID attached on the message that was received, must not be `NULL`
diff --git a/src/mds-base.c b/src/mds-base.c
index 682ecf0..0c7d7fd 100644
--- a/src/mds-base.c
+++ b/src/mds-base.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -125,21 +125,21 @@ parse_cmdline(void)
/* Parse command line arguments. */
for (i = 1; i < argc; i++) {
arg = argv[i];
- if ((v = strequals(arg, "--initial-spawn")) || /* Initial spawn? */
- strequals(arg, "--respawn")) { /* Respawning after crash? */
+ if ((v = streq(arg, "--initial-spawn")) || /* Initial spawn? */
+ streq(arg, "--respawn")) { /* Respawning after crash? */
exit_if (is_respawn == v,
eprintf("conflicting arguments %s and %s cannot be combined.",
"--initial-spawn", "--respawn"););
is_respawn = !v;
- } else if (strequals(arg, "--re-exec")) { /* Re-exec state-marshal. */
+ } else if (streq(arg, "--re-exec")) { /* Re-exec state-marshal. */
is_reexec = 1;
- } else if (startswith(arg, "--alarm=")) { /* Schedule an alarm signal for forced abort. */
- alarm(min(atou(arg + strlen("--alarm=")), 60)); /* At most 1 minute. */
- } else if (strequals(arg, "--on-init-fork")) { /* Fork process when initialised. */
+ } else if (strstarts(arg, "--alarm=")) { /* Schedule an alarm signal for forced abort. */
+ alarm(MIN(atou(arg + strlen("--alarm=")), 60)); /* At most 1 minute. */
+ } else if (streq(arg, "--on-init-fork")) { /* Fork process when initialised. */
on_init_fork = 1;
- } else if (startswith(arg, "--on-init-sh=")) { /* Run a command when initialised. */
+ } else if (strstarts(arg, "--on-init-sh=")) { /* Run a command when initialised. */
on_init_sh = arg + strlen("--on-init-sh=");
- } else if (strequals(arg, "--immortal")) { /* I return to serve. */
+ } else if (streq(arg, "--immortal")) { /* I return to serve. */
is_immortal = 1;
}
}
diff --git a/src/mds-base.h b/src/mds-base.h
index c3bc735..1d70d0c 100644
--- a/src/mds-base.h
+++ b/src/mds-base.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-clipboard.c b/src/mds-clipboard.c
index bf159ee..a282772 100644
--- a/src/mds-clipboard.c
+++ b/src/mds-clipboard.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -433,7 +433,7 @@ handle_message(void)
int level;
#define __get_header(storage, header)\
- (startswith(received.headers[i], header))\
+ (strstarts(received.headers[i], header))\
storage = received.headers[i] + strlen(header)
for (i = 0; i < received.header_count; i++) {
@@ -456,7 +456,7 @@ handle_message(void)
return eprint("received message without ID, ignoring, master server is misbehaving."), 0;
if (recv_client_closed) {
- if (strequals(recv_client_closed, "0:0"))
+ if (streq(recv_client_closed, "0:0"))
return 0;
return clipboard_death(recv_client_closed);
}
@@ -468,27 +468,27 @@ handle_message(void)
level = atoi(recv_level);
if ((level < 0) || (CLIPBOARD_LEVELS <= level))
return eprint("received message without invalid clipboard level, ignoring."), 0;
- if (strequals(recv_client_id, "0:0"))
- if (strequals(recv_action, "read") || strequals(recv_action, "get-size"))
+ if (streq(recv_client_id, "0:0"))
+ if (streq(recv_action, "read") || streq(recv_action, "get-size"))
return eprint("received information request from an anonymous client, ignoring."), 0;
- if (strequals(recv_action, "add")) {
+ if (streq(recv_action, "add")) {
if (recv_length == NULL)
return eprint("received request for adding a clipboard entry "
"but did not receive any content, ignoring."), 0;
- if ((strequals(recv_client_id, "0:0")) && startswith(recv_time_to_live, "until-death"))
+ if ((streq(recv_client_id, "0:0")) && strstarts(recv_time_to_live, "until-death"))
return eprint("received request new clipboard entry with autopurge upon "
"client close from an anonymous client, ignoring."), 0;
return clipboard_add(level, recv_time_to_live, recv_client_id);
- } else if (strequals(recv_action, "read")) {
+ } else if (streq(recv_action, "read")) {
return clipboard_read(level, atoz(recv_index), recv_client_id, recv_message_id);
- } else if (strequals(recv_action, "clear")) {
+ } else if (streq(recv_action, "clear")) {
return clipboard_clear(level);
- } else if (strequals(recv_action, "set-size")) {
+ } else if (streq(recv_action, "set-size")) {
if (recv_size == NULL)
return eprint("received request for clipboard resizing without a new size, ignoring."), 0;
return clipboard_set_size(level, atoz(recv_size));
- } else if (strequals(recv_action, "get-size")) {
+ } else if (streq(recv_action, "get-size")) {
return clipboard_get_size(level, recv_client_id, recv_message_id);
}
@@ -654,11 +654,11 @@ clipboard_add(int level, const char *time_to_live, const char *recv_client_id)
fail_if (clipboard_purge(level, NULL));
- if (strequals(time_to_live, "forever")) {
+ if (streq(time_to_live, "forever")) {
autopurge = CLIPITEM_AUTOPURGE_NEVER;
- } else if (strequals(time_to_live, "until-death")) {
+ } else if (streq(time_to_live, "until-death")) {
autopurge = CLIPITEM_AUTOPURGE_UPON_DEATH;
- } else if (startswith(time_to_live, "until-death ")) {
+ } else if (strstarts(time_to_live, "until-death ")) {
autopurge = CLIPITEM_AUTOPURGE_UPON_DEATH_OR_CLOCK;
time_to_live += strlen("until-death ");
}
diff --git a/src/mds-clipboard.h b/src/mds-clipboard.h
index f3672ff..10c9600 100644
--- a/src/mds-clipboard.h
+++ b/src/mds-clipboard.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-colour.c b/src/mds-colour.c
index 51e7a49..52a1184 100644
--- a/src/mds-colour.c
+++ b/src/mds-colour.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -391,7 +391,7 @@ handle_message(void)
size_t i;
#define __get_header(storage, header)\
- (startswith(received.headers[i], header))\
+ (strstarts(received.headers[i], header))\
storage = received.headers[i] + strlen(header)
for (i = 0; i < received.header_count; i++) {
@@ -418,11 +418,11 @@ handle_message(void)
return 0; /* How did that get here, no matter, just ignore it? */
#define t(expr) do { fail_if (expr); return 0; } while (0)
- if (strequals(recv_command, "list-colours"))
+ if (streq(recv_command, "list-colours"))
t (handle_list_colours(recv_client_id, recv_message_id, recv_include_values));
- if (strequals(recv_command, "get-colour"))
+ if (streq(recv_command, "get-colour"))
t (handle_get_colour(recv_client_id, recv_message_id, recv_name));
- if (strequals(recv_command, "set-colour"))
+ if (streq(recv_command, "set-colour"))
t (handle_set_colour(recv_name, recv_remove, recv_bytes, recv_red, recv_green, recv_blue));
#undef t
@@ -529,12 +529,12 @@ handle_list_colours(const char *recv_client_id, const char *recv_message_id, con
size_t length;
char *temp;
- if (strequals(recv_client_id, "0:0"))
+ if (streq(recv_client_id, "0:0"))
return eprint("got a query from an anonymous client, ignoring."), 0;
if (!recv_include_values) include_values = 0;
- else if (strequals(recv_include_values, "yes")) include_values = 1;
- else if (strequals(recv_include_values, "no")) include_values = 0;
+ else if (streq(recv_include_values, "yes")) include_values = 1;
+ else if (streq(recv_include_values, "no")) include_values = 0;
else {
fail_if (send_error(recv_client_id, recv_message_id, "list-colours", 0, EPROTO, NULL));
return 0;
@@ -598,7 +598,7 @@ handle_get_colour(const char *recv_client_id, const char *recv_message_id, const
size_t length;
char *temp;
- if (strequals(recv_client_id, "0:0"))
+ if (streq(recv_client_id, "0:0"))
return eprint("got a query from an anonymous client, ignoring."), 0;
if (!recv_name) {
@@ -671,8 +671,8 @@ handle_set_colour(const char *recv_name, const char *recv_remove, const char *re
int bytes;
if (!recv_remove) remove_colour = 0;
- else if (strequals(recv_remove, "yes")) remove_colour = 1;
- else if (strequals(recv_remove, "no")) remove_colour = 0;
+ else if (streq(recv_remove, "yes")) remove_colour = 1;
+ else if (streq(recv_remove, "no")) remove_colour = 0;
else
return eprint("got an invalid value on the Remove-header, ignoring."), 0;
diff --git a/src/mds-colour.h b/src/mds-colour.h
index 5522f23..22b85ef 100644
--- a/src/mds-colour.h
+++ b/src/mds-colour.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-echo.c b/src/mds-echo.c
index 72f43f8..5dbbd11 100644
--- a/src/mds-echo.c
+++ b/src/mds-echo.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -289,7 +289,7 @@ echo_message(void)
/* Fetch headers. */
#define __get_header(storage, header, skip)\
- (startswith(received.headers[i], header))\
+ (strstarts(received.headers[i], header))\
storage = received.headers[i] + skip * strlen(header)
for (i = 0; i < received.header_count; i++) {
@@ -307,7 +307,7 @@ echo_message(void)
#undef __get_header
/* Validate headers. */
- if (!recv_client_id || strequals(recv_client_id, "0:0"))
+ if (!recv_client_id || streq(recv_client_id, "0:0"))
return eprint("received message from anonymous sender, ignoring."), 0;
else if (!recv_message_id)
return eprint("received message without ID, ignoring, master server is misbehaving."), 0;
diff --git a/src/mds-echo.h b/src/mds-echo.h
index 5a6e87b..e59db5c 100644
--- a/src/mds-echo.h
+++ b/src/mds-echo.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-kbdc/builtin-functions.c b/src/mds-kbdc/builtin-functions.c
index 72593cd..c610b11 100644
--- a/src/mds-kbdc/builtin-functions.c
+++ b/src/mds-kbdc/builtin-functions.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-kbdc/builtin-functions.h b/src/mds-kbdc/builtin-functions.h
index 8d2cc2d..cca62a5 100644
--- a/src/mds-kbdc/builtin-functions.h
+++ b/src/mds-kbdc/builtin-functions.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-kbdc/call-stack.c b/src/mds-kbdc/call-stack.c
index c864e7c..8171e22 100644
--- a/src/mds-kbdc/call-stack.c
+++ b/src/mds-kbdc/call-stack.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-kbdc/call-stack.h b/src/mds-kbdc/call-stack.h
index 94b6dc8..4b7fdcc 100644
--- a/src/mds-kbdc/call-stack.h
+++ b/src/mds-kbdc/call-stack.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-kbdc/callables.c b/src/mds-kbdc/callables.c
index 07b08b0..184dd25 100644
--- a/src/mds-kbdc/callables.c
+++ b/src/mds-kbdc/callables.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-kbdc/callables.h b/src/mds-kbdc/callables.h
index 9e0d3b3..901ccf8 100644
--- a/src/mds-kbdc/callables.h
+++ b/src/mds-kbdc/callables.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-kbdc/compile-layout.c b/src/mds-kbdc/compile-layout.c
index 8eb832b..5a841ee 100644
--- a/src/mds-kbdc/compile-layout.c
+++ b/src/mds-kbdc/compile-layout.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-kbdc/compile-layout.h b/src/mds-kbdc/compile-layout.h
index 86604e0..2554f86 100644
--- a/src/mds-kbdc/compile-layout.h
+++ b/src/mds-kbdc/compile-layout.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-kbdc/eliminate-dead-code.c b/src/mds-kbdc/eliminate-dead-code.c
index 5a8102f..f8a5b03 100644
--- a/src/mds-kbdc/eliminate-dead-code.c
+++ b/src/mds-kbdc/eliminate-dead-code.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-kbdc/eliminate-dead-code.h b/src/mds-kbdc/eliminate-dead-code.h
index 84bc3b6..57083b2 100644
--- a/src/mds-kbdc/eliminate-dead-code.h
+++ b/src/mds-kbdc/eliminate-dead-code.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-kbdc/globals.c b/src/mds-kbdc/globals.c
index 01feca9..a6aa1ce 100644
--- a/src/mds-kbdc/globals.c
+++ b/src/mds-kbdc/globals.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-kbdc/globals.h b/src/mds-kbdc/globals.h
index 1acf4bc..572cb2d 100644
--- a/src/mds-kbdc/globals.h
+++ b/src/mds-kbdc/globals.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-kbdc/include-stack.c b/src/mds-kbdc/include-stack.c
index 8ba787f..890d60c 100644
--- a/src/mds-kbdc/include-stack.c
+++ b/src/mds-kbdc/include-stack.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-kbdc/include-stack.h b/src/mds-kbdc/include-stack.h
index 284bb02..cc4aea4 100644
--- a/src/mds-kbdc/include-stack.h
+++ b/src/mds-kbdc/include-stack.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-kbdc/make-tree.c b/src/mds-kbdc/make-tree.c
index f5bdf55..07a32ab 100644
--- a/src/mds-kbdc/make-tree.c
+++ b/src/mds-kbdc/make-tree.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -190,7 +190,7 @@
/**
- * Suppress the next `line = STREND(line)`
+ * Suppress the next `line = strend(line)`
*/
#define NO_JUMP\
(*end = prev_end_char,\
@@ -566,11 +566,11 @@ fail:
static int
no_parameters(const char *restrict keyword)
{
- line = STREND(line);
+ line = strend(line);
*end = prev_end_char, prev_end_char = '\0';
SKIP_SPACES(line);
if (*line) {
- end = STREND(line);
+ end = strend(line);
NEW_ERROR(1, ERROR, "extra token after ‘%s’", keyword);
}
@@ -597,11 +597,11 @@ names_1(char **restrict var)
int stray_char = 0;
char *end_end;
- line = STREND(line);
+ line = strend(line);
*end = prev_end_char, prev_end_char = '\0';
SKIP_SPACES(line);
if (!*line) {
- line = original, end = STREND(line);
+ line = original, end = strend(line);
NEW_ERROR(1, ERROR, "a name is expected");
} else {
name_end = line;
@@ -652,11 +652,11 @@ chars(char **restrict var)
int escape, quote;
if (too_few)
return 0;
- line = STREND(line);
+ line = strend(line);
*end = prev_end_char, prev_end_char = '\0';
SKIP_SPACES(line);
if (!*line) {
- line = original, end = STREND(line);
+ line = original, end = strend(line);
NEW_ERROR(1, ERROR, "too few parameters");
line = end, too_few = 1;
} else {
@@ -700,7 +700,7 @@ static int
quotes(void)
{
char *line_ = line, *arg_end;
- line = STREND(line);
+ line = strend(line);
*end = prev_end_char;
SKIP_SPACES(line);
if (*line && *line != '"') {
@@ -728,11 +728,11 @@ have_more_parameters(void)
{
if (too_few)
return 0;
- line = STREND(line);
+ line = strend(line);
*end = prev_end_char, prev_end_char = '\0';
SKIP_SPACES(line);
if (!*line) {
- line = original, end = STREND(line);
+ line = original, end = strend(line);
NEW_ERROR(1, ERROR, "too few parameters");
line = end, too_few = 1;
return 0;
@@ -989,16 +989,16 @@ parse_else(void)
NEW_ERROR(1, ERROR, "runaway ‘else’ statement");
return 0;
}
- line = STREND(line);
+ line = strend(line);
*end = prev_end_char, prev_end_char = '\0';
- end = STREND(line);
+ end = strend(line);
SKIP_SPACES(line);
i = stack_ptr - 1;
while (!keyword_stack[i])
i--;
if (strcmp(keyword_stack[i], "if")) {
stack_ptr--;
- line = original, end = STREND(line);
+ line = original, end = strend(line);
NEW_ERROR(1, ERROR, "runaway ‘else’ statement");
} else if (!*line) {
/* else */
@@ -1075,7 +1075,7 @@ parse_let(void)
else
LEAF;
if (!*line) {
- line = original, end = STREND(line), prev_end_char = '\0';
+ line = original, end = strend(line), prev_end_char = '\0';
NEW_ERROR(1, ERROR, "too few parameters");
} else if (*line != '{') {
#define node subnode
@@ -1117,12 +1117,12 @@ parse_end(void)
NEW_ERROR(1, ERROR, "runaway ‘end’ statement");
return 0;
}
- line = STREND(line);
+ line = strend(line);
*end = prev_end_char, prev_end_char = '\0';
SKIP_SPACES(line);
while (!keyword_stack[--stack_ptr]);
if (!*line) {
- line = original, end = STREND(line);
+ line = original, end = strend(line);
NEW_ERROR(1, ERROR, "expecting a keyword after ‘end’");
} else if (strcmp(line, keyword_stack[stack_ptr])) {
NEW_ERROR(1, ERROR, "expected ‘%s’ but got ‘%s’", keyword_stack[stack_ptr], line);
@@ -1184,7 +1184,7 @@ parse_map(void)
}
if (!*line)
return prev_end_char = *end, 0;
- end = STREND(line), prev_end_char = *end;
+ end = strend(line), prev_end_char = *end;
NEW_ERROR(1, ERROR, "too many parameters");
return 0;
@@ -1268,7 +1268,7 @@ parse_array_elements(void)
return 0;
} else if (*line == '}') {
line++;
- end = STREND(line);
+ end = strend(line);
END;
line = end, prev_end_char = '\0';
goto done;
diff --git a/src/mds-kbdc/make-tree.h b/src/mds-kbdc/make-tree.h
index 0878414..b64f933 100644
--- a/src/mds-kbdc/make-tree.h
+++ b/src/mds-kbdc/make-tree.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-kbdc/mds-kbdc.c b/src/mds-kbdc/mds-kbdc.c
index 0f668e4..1affa92 100644
--- a/src/mds-kbdc/mds-kbdc.c
+++ b/src/mds-kbdc/mds-kbdc.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -42,7 +42,7 @@ parse_cmdline(void)
{
int i;
for (i = 0; i < argc; i++)
- if (strequals(argv[i], "--force"))
+ if (streq(argv[i], "--force"))
argv_force = 1;
}
diff --git a/src/mds-kbdc/mds-kbdc.h b/src/mds-kbdc/mds-kbdc.h
index 8cf6204..c496541 100644
--- a/src/mds-kbdc/mds-kbdc.h
+++ b/src/mds-kbdc/mds-kbdc.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-kbdc/parse-error.c b/src/mds-kbdc/parse-error.c
index 6a31424..b62e943 100644
--- a/src/mds-kbdc/parse-error.c
+++ b/src/mds-kbdc/parse-error.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-kbdc/parse-error.h b/src/mds-kbdc/parse-error.h
index 9668f8f..cfcf17c 100644
--- a/src/mds-kbdc/parse-error.h
+++ b/src/mds-kbdc/parse-error.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-kbdc/parsed.c b/src/mds-kbdc/parsed.c
index e4c23dc..7e56036 100644
--- a/src/mds-kbdc/parsed.c
+++ b/src/mds-kbdc/parsed.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-kbdc/parsed.h b/src/mds-kbdc/parsed.h
index 58ad6fa..83c8d2a 100644
--- a/src/mds-kbdc/parsed.h
+++ b/src/mds-kbdc/parsed.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-kbdc/paths.c b/src/mds-kbdc/paths.c
index 70bddf1..f2795fc 100644
--- a/src/mds-kbdc/paths.c
+++ b/src/mds-kbdc/paths.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-kbdc/paths.h b/src/mds-kbdc/paths.h
index 6dbe007..e4dc877 100644
--- a/src/mds-kbdc/paths.h
+++ b/src/mds-kbdc/paths.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-kbdc/process-includes.c b/src/mds-kbdc/process-includes.c
index a46533c..aa18f14 100644
--- a/src/mds-kbdc/process-includes.c
+++ b/src/mds-kbdc/process-includes.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-kbdc/process-includes.h b/src/mds-kbdc/process-includes.h
index 6146600..4381c2f 100644
--- a/src/mds-kbdc/process-includes.h
+++ b/src/mds-kbdc/process-includes.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-kbdc/raw-data.c b/src/mds-kbdc/raw-data.c
index 2b89840..4003ae8 100644
--- a/src/mds-kbdc/raw-data.c
+++ b/src/mds-kbdc/raw-data.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-kbdc/raw-data.h b/src/mds-kbdc/raw-data.h
index bdc1078..55519e6 100644
--- a/src/mds-kbdc/raw-data.h
+++ b/src/mds-kbdc/raw-data.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-kbdc/simplify-tree.c b/src/mds-kbdc/simplify-tree.c
index b3f588c..0c2c6e9 100644
--- a/src/mds-kbdc/simplify-tree.c
+++ b/src/mds-kbdc/simplify-tree.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-kbdc/simplify-tree.h b/src/mds-kbdc/simplify-tree.h
index e648a46..518288c 100644
--- a/src/mds-kbdc/simplify-tree.h
+++ b/src/mds-kbdc/simplify-tree.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-kbdc/string.c b/src/mds-kbdc/string.c
index c0e9852..0d8efd1 100644
--- a/src/mds-kbdc/string.c
+++ b/src/mds-kbdc/string.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-kbdc/string.h b/src/mds-kbdc/string.h
index 81155ed..635a699 100644
--- a/src/mds-kbdc/string.h
+++ b/src/mds-kbdc/string.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-kbdc/tree.c b/src/mds-kbdc/tree.c
index 33db89e..469fca3 100644
--- a/src/mds-kbdc/tree.c
+++ b/src/mds-kbdc/tree.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-kbdc/tree.h b/src/mds-kbdc/tree.h
index 392c85b..db90cb6 100644
--- a/src/mds-kbdc/tree.h
+++ b/src/mds-kbdc/tree.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-kbdc/validate-tree.c b/src/mds-kbdc/validate-tree.c
index 80ef7d5..a54ca13 100644
--- a/src/mds-kbdc/validate-tree.c
+++ b/src/mds-kbdc/validate-tree.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-kbdc/validate-tree.h b/src/mds-kbdc/validate-tree.h
index 5ca9277..05345fd 100644
--- a/src/mds-kbdc/validate-tree.h
+++ b/src/mds-kbdc/validate-tree.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-kbdc/variables.c b/src/mds-kbdc/variables.c
index 15a1cb6..4ea9300 100644
--- a/src/mds-kbdc/variables.c
+++ b/src/mds-kbdc/variables.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-kbdc/variables.h b/src/mds-kbdc/variables.h
index a175ab7..b03461c 100644
--- a/src/mds-kbdc/variables.h
+++ b/src/mds-kbdc/variables.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-kkbd.c b/src/mds-kkbd.c
index 31915bd..24fee29 100644
--- a/src/mds-kkbd.c
+++ b/src/mds-kkbd.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -240,23 +240,23 @@ parse_cmdline(void)
/* Parse command line arguments. */
for (i = 1; i < argc; i++) {
arg = argv[i];
- if ((v = strequals(arg, "--initial-spawn")) || /* Initial spawn? */
- strequals(arg, "--respawn")) { /* Respawning after crash? */
+ if ((v = streq(arg, "--initial-spawn")) || /* Initial spawn? */
+ streq(arg, "--respawn")) { /* Respawning after crash? */
exit_if (is_respawn == v,
eprintf("conflicting arguments %s and %s cannot be combined.",
"--initial-spawn", "--respawn"););
is_respawn = !v;
- } else if (strequals(arg, "--re-exec")) { /* Re-exec state-marshal. */
+ } else if (streq(arg, "--re-exec")) { /* Re-exec state-marshal. */
is_reexec = 1;
- } else if (startswith(arg, "--alarm=")) { /* Schedule an alarm signal for forced abort. */
- alarm(min(atou(arg + strlen("--alarm=")), 60)); /* At most 1 minute. */
- } else if (strequals(arg, "--on-init-fork")) { /* Fork process when initialised. */
+ } else if (strstarts(arg, "--alarm=")) { /* Schedule an alarm signal for forced abort. */
+ alarm(MIN(atou(arg + strlen("--alarm=")), 60)); /* At most 1 minute. */
+ } else if (streq(arg, "--on-init-fork")) { /* Fork process when initialised. */
on_init_fork = 1;
- } else if (startswith(arg, "--on-init-sh=")) { /* Run a command when initialised. */
+ } else if (strstarts(arg, "--on-init-sh=")) { /* Run a command when initialised. */
on_init_sh = arg + strlen("--on-init-sh=");
- } else if (strequals(arg, "--immortal")) { /* I return to serve. */
+ } else if (streq(arg, "--immortal")) { /* I return to serve. */
is_immortal = 1;
- } else if (startswith(arg, "--led=")) { /* Remap LED:s. */
+ } else if (strstarts(arg, "--led=")) { /* Remap LED:s. */
if (remap_led_cmdline(arg + strlen("--led=")) < 0)
return -1;
}
@@ -598,7 +598,7 @@ handle_message(void)
size_t i;
#define __get_header(storage, header)\
- (startswith(received.headers[i], header))\
+ (strstarts(received.headers[i], header))\
storage = received.headers[i] + strlen(header)
for (i = 0; i < received.header_count; i++) {
@@ -621,20 +621,20 @@ handle_message(void)
return 0; /* How did that get here, no matter, just ignore it? */
#define t(expr) do { fail_if (expr); return 0; } while (0)
- if (strequals(recv_command, "enumerate-keyboards"))
+ if (streq(recv_command, "enumerate-keyboards"))
t (handle_enumerate_keyboards(recv_client_id, recv_message_id, recv_modify_id));
- if (strequals(recv_command, "keyboard-enumeration"))
+ if (streq(recv_command, "keyboard-enumeration"))
t (handle_keyboard_enumeration(recv_modify_id));
- if (strequals(recv_command, "keycode-map"))
+ if (streq(recv_command, "keycode-map"))
t (handle_keycode_map(recv_client_id, recv_message_id, recv_action, recv_keyboard));
/* The following do not need to be inside a mutex, because this server
only interprets on message at the time, thus there can not be any
conflicts and access to LED:s are automatically atomic. */
- if (strequals(recv_command, "set-keyboard-leds"))
+ if (streq(recv_command, "set-keyboard-leds"))
t (handle_set_keyboard_leds(recv_active, recv_mask, recv_keyboard));
- if (strequals(recv_command, "get-keyboard-leds"))
+ if (streq(recv_command, "get-keyboard-leds"))
t (handle_get_keyboard_leds(recv_client_id, recv_message_id, recv_keyboard));
- if (strequals(recv_command, "map-keyboard-leds"))
+ if (streq(recv_command, "map-keyboard-leds"))
t (handle_map_keyboard_leds(recv_keyboard));
#undef t
@@ -688,7 +688,7 @@ handle_enumerate_keyboards(const char *recv_client_id, const char *recv_message_
return eprint("did not get a modify ID, ignoring."), 0;
- if (strequals(recv_client_id, "0:0")) {
+ if (streq(recv_client_id, "0:0")) {
eprint("received information request from an anonymous client, sending non-modifying response.");
with_mutex (send_mutex,
@@ -813,7 +813,7 @@ handle_keyboard_enumeration(const char *recv_modify_id)
n = off;
for (i = 0; i < received.header_count; i++) {
header = received.headers[i];
- if (!have_len && startswith(header, "Length: ")) {
+ if (!have_len && strstarts(header, "Length: ")) {
have_len = 1;
sprintf(send_buffer + n,
"Length: %zu\n",
@@ -896,7 +896,7 @@ handle_set_keyboard_leds(const char *recv_active, const char *recv_mask, const c
const char *begin;
const char *end;
- if ((recv_keyboard) && !strequals(recv_keyboard, KEYBOARD_ID))
+ if ((recv_keyboard) && !streq(recv_keyboard, KEYBOARD_ID))
return 0;
if (!recv_active)
@@ -911,7 +911,7 @@ handle_set_keyboard_leds(const char *recv_active, const char *recv_mask, const c
return 0; /* Not fatal */
}
-#define __test(have, want) (startswith(have, want " ") || strequals(have, want))
+#define __test(have, want) (strstarts(have, want " ") || streq(have, want))
for (begin = end = recv_active; end;) {
end = strchr(begin, ' ');
@@ -963,13 +963,13 @@ handle_get_keyboard_leds(const char *recv_client_id, const char *recv_message_id
size_t n;
int r, leds, error;
- if (recv_keyboard && !strequals(recv_keyboard, KEYBOARD_ID))
+ if (recv_keyboard && !streq(recv_keyboard, KEYBOARD_ID))
return 0;
if (!recv_keyboard)
return eprint("received LED reading request but no specified keyboard, ignoring."), 0;
- if (strequals(recv_client_id, "0:0"))
+ if (streq(recv_client_id, "0:0"))
return eprint("received information request from an anonymous client, ignoring."), 0;
leds = get_leds();
@@ -1027,11 +1027,11 @@ fail:
__attribute__((nonnull))
static int parse_led(const char* name)
{
- if (strequals(name, "num")) return LED_NUM_LOCK;
- if (strequals(name, "caps")) return LED_CAPS_LOCK;
- if (strequals(name, "scrl")) return LED_SCRL_LOCK;
+ if (streq(name, "num")) return LED_NUM_LOCK;
+ if (streq(name, "caps")) return LED_CAPS_LOCK;
+ if (streq(name, "scrl")) return LED_SCRL_LOCK;
#ifdef LED_COMPOSE
- if (strequals(name, "compose")) return LED_COMPOSE;
+ if (streq(name, "compose")) return LED_COMPOSE;
#endif
return -1;
}
@@ -1127,7 +1127,7 @@ handle_map_keyboard_leds(const char *recv_keyboard)
size_t i, len;
char *pos_;
- if (recv_keyboard && !strequals(recv_keyboard, KEYBOARD_ID))
+ if (recv_keyboard && !streq(recv_keyboard, KEYBOARD_ID))
return 0;
/* Parse the payload. `led` and `pos` are set just when thier first
@@ -1268,8 +1268,8 @@ remap(char *table, size_t n)
goto next;
}
- if (in != out) greatest_remap = max(greatest_remap, in);
- else greatest_reset = max(greatest_reset, in);
+ if (in != out) greatest_remap = MAX(greatest_remap, in);
+ else greatest_reset = MAX(greatest_reset, in);
fail_if (add_mapping(in, out) < 0);
@@ -1310,7 +1310,7 @@ mapping_query(const char *recv_client_id, const char *recv_message_id)
with the highest value. */
for (i = 0; i < mapping_size; i++) {
if (mapping[i] != (int)i) {
- greatest = max(greatest, mapping[i]);
+ greatest = MAX(greatest, mapping[i]);
n++;
}
}
@@ -1318,7 +1318,7 @@ mapping_query(const char *recv_client_id, const char *recv_message_id)
highest targt, that source value will
be highest integer that will be included
the mapping-table. */
- greatest = max(greatest, (int)mapping_size);
+ greatest = MAX(greatest, (int)mapping_size);
/* Calculate an upper bound for the payload. */
n *= 2 + 2 * (size_t)(greatest > 0x00FF ? 5 : 3);
@@ -1388,12 +1388,12 @@ handle_keycode_map(const char *recv_client_id, const char *recv_message_id,
const char *recv_action, const char *recv_keyboard)
{
int r;
- if (recv_keyboard && !strequals(recv_keyboard, KEYBOARD_ID))
+ if (recv_keyboard && !streq(recv_keyboard, KEYBOARD_ID))
return 0;
if (!recv_action) {
eprint("received keycode map request but without any action, ignoring.");
- } else if (strequals(recv_action, "remap")) {
+ } else if (streq(recv_action, "remap")) {
if (!received.payload_size)
return eprint("received keycode remap request without a payload, ignoring."), 0;
with_mutex (mapping_mutex,
@@ -1401,13 +1401,13 @@ handle_keycode_map(const char *recv_client_id, const char *recv_message_id,
if (r) r = errno ? errno : -1;
);
fail_if (errno = (r == -1 ? 0 : r), r);
- } else if (strequals(recv_action, "reset")) {
+ } else if (streq(recv_action, "reset")) {
with_mutex (mapping_mutex,
free(mapping);
mapping_size = 0;
);
- } else if (strequals(recv_action, "query")) {
- if (strequals(recv_client_id, "0:0"))
+ } else if (streq(recv_action, "query")) {
+ if (streq(recv_client_id, "0:0"))
return eprint("received information request from an anonymous client, ignoring."), 0;
fail_if (mapping_query(recv_client_id, recv_message_id));
} else {
diff --git a/src/mds-kkbd.h b/src/mds-kkbd.h
index d6976e1..abfc6a1 100644
--- a/src/mds-kkbd.h
+++ b/src/mds-kkbd.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-libinput.c b/src/mds-libinput.c
index 45c8286..300f01e 100644
--- a/src/mds-libinput.c
+++ b/src/mds-libinput.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -193,23 +193,23 @@ parse_cmdline(void)
/* Parse command line arguments. */
for (i = 1; i < argc; i++) {
arg = argv[i];
- if ((v = strequals(arg, "--initial-spawn")) || /* Initial spawn? */
- strequals(arg, "--respawn")) { /* Respawning after crash? */
+ if ((v = streq(arg, "--initial-spawn")) || /* Initial spawn? */
+ streq(arg, "--respawn")) { /* Respawning after crash? */
exit_if (is_respawn == v,
eprintf("conflicting arguments %s and %s cannot be combined.",
"--initial-spawn", "--respawn"););
is_respawn = !v;
- } else if (strequals(arg, "--re-exec")) { /* Re-exec state-marshal. */
+ } else if (streq(arg, "--re-exec")) { /* Re-exec state-marshal. */
is_reexec = 1;
- } else if (startswith(arg, "--alarm=")) { /* Schedule an alarm signal for forced abort. */
- alarm(min(atou(arg + strlen("--alarm=")), 60)); /* At most 1 minute. */
- } else if (strequals(arg, "--on-init-fork")) { /* Fork process when initialised. */
+ } else if (strstarts(arg, "--alarm=")) { /* Schedule an alarm signal for forced abort. */
+ alarm(MIN(atou(arg + strlen("--alarm=")), 60)); /* At most 1 minute. */
+ } else if (streq(arg, "--on-init-fork")) { /* Fork process when initialised. */
on_init_fork = 1;
- } else if (startswith(arg, "--on-init-sh=")) { /* Run a command when initialised. */
+ } else if (strstarts(arg, "--on-init-sh=")) { /* Run a command when initialised. */
on_init_sh = arg + strlen("--on-init-sh=");
- } else if (strequals(arg, "--immortal")) { /* I return to serve. */
+ } else if (streq(arg, "--immortal")) { /* I return to serve. */
is_immortal = 1;
- } else if (startswith(arg, "--seat=")) { /* Seat to pass to libinput. */
+ } else if (strstarts(arg, "--seat=")) { /* Seat to pass to libinput. */
seat = arg + strlen("--seat=");
}
}
diff --git a/src/mds-libinput.h b/src/mds-libinput.h
index 6474e6d..254d833 100644
--- a/src/mds-libinput.h
+++ b/src/mds-libinput.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-registry/globals.c b/src/mds-registry/globals.c
index 590248e..58a6359 100644
--- a/src/mds-registry/globals.c
+++ b/src/mds-registry/globals.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-registry/globals.h b/src/mds-registry/globals.h
index 1f0107b..8e1b005 100644
--- a/src/mds-registry/globals.h
+++ b/src/mds-registry/globals.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-registry/mds-registry.c b/src/mds-registry/mds-registry.c
index 3d17247..1497ac4 100644
--- a/src/mds-registry/mds-registry.c
+++ b/src/mds-registry/mds-registry.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-registry/mds-registry.h b/src/mds-registry/mds-registry.h
index 484731a..d901dfa 100644
--- a/src/mds-registry/mds-registry.h
+++ b/src/mds-registry/mds-registry.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-registry/reexec.c b/src/mds-registry/reexec.c
index b6c45e0..a04ab61 100644
--- a/src/mds-registry/reexec.c
+++ b/src/mds-registry/reexec.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-registry/reexec.h b/src/mds-registry/reexec.h
index 423afe4..89a6eec 100644
--- a/src/mds-registry/reexec.h
+++ b/src/mds-registry/reexec.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-registry/registry.c b/src/mds-registry/registry.c
index 0c4d5a5..3b00834 100644
--- a/src/mds-registry/registry.c
+++ b/src/mds-registry/registry.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -72,7 +72,7 @@ handle_close_message(void)
/* Remove server for all protocols. */
for (i = 0; i < received.header_count; i++) {
- if (startswith(received.headers[i], "Client closed: ")) {
+ if (strstarts(received.headers[i], "Client closed: ")) {
client = parse_client_id(received.headers[i] + strlen("Client closed: "));
foreach_hash_table_entry (reg_table, j, entry) {
@@ -409,7 +409,7 @@ handle_register_message(void)
size_t i, length = 0;
#define __get_header(storage, header)\
- (startswith(received.headers[i], header))\
+ (strstarts(received.headers[i], header))\
storage = received.headers[i] + strlen(header)
for (i = 0; i < received.header_count; i++) {
@@ -428,11 +428,11 @@ handle_register_message(void)
#undef __get_header
/* Validate headers. */
- if (!recv_client_id || strequals(recv_client_id, "0:0"))
+ if (!recv_client_id || streq(recv_client_id, "0:0"))
return eprint("received message from anonymous sender, ignoring."), 0;
else if (!strchr(recv_client_id, ':'))
return eprint("received message from sender without a colon it its ID, ignoring, invalid ID."), 0;
- else if (!recv_length && (!recv_action || !strequals(recv_action, "list")))
+ else if (!recv_length && (!recv_action || !streq(recv_action, "list")))
return eprint("received empty message without `Action: list`, ignoring, has no effect."), 0;
else if (!recv_message_id)
return eprint("received message without ID, ignoring, master server is misbehaving."), 0;
@@ -446,10 +446,10 @@ handle_register_message(void)
/* Perform action. */
#define __registry_action(action) registry_action(length, action, recv_client_id, recv_message_id)
- if (strequals(recv_action, "add")) return __registry_action(1);
- else if (strequals(recv_action, "remove")) return __registry_action(-1);
- else if (strequals(recv_action, "wait")) return __registry_action(0);
- else if (strequals(recv_action, "list")) return list_registry(recv_client_id, recv_message_id);
+ if (streq(recv_action, "add")) return __registry_action(1);
+ else if (streq(recv_action, "remove")) return __registry_action(-1);
+ else if (streq(recv_action, "wait")) return __registry_action(0);
+ else if (streq(recv_action, "list")) return list_registry(recv_client_id, recv_message_id);
else {
eprint("received invalid action, ignoring.");
return 0;
@@ -470,7 +470,7 @@ handle_message(void)
{
size_t i;
for (i = 0; i < received.header_count; i++) {
- if (strequals(received.headers[i], "Command: register")) {
+ if (streq(received.headers[i], "Command: register")) {
fail_if (handle_register_message());
return 0;
}
diff --git a/src/mds-registry/registry.h b/src/mds-registry/registry.h
index e88afde..f2f92a2 100644
--- a/src/mds-registry/registry.h
+++ b/src/mds-registry/registry.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-registry/signals.c b/src/mds-registry/signals.c
index 8fb90dd..20f0f0f 100644
--- a/src/mds-registry/signals.c
+++ b/src/mds-registry/signals.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-registry/signals.h b/src/mds-registry/signals.h
index dc899f6..d868003 100644
--- a/src/mds-registry/signals.h
+++ b/src/mds-registry/signals.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-registry/slave.c b/src/mds-registry/slave.c
index 4639393..daf156a 100644
--- a/src/mds-registry/slave.c
+++ b/src/mds-registry/slave.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -183,7 +183,7 @@ start_slave(hash_table_t *restrict wait_set, const char *restrict recv_client_id
fail_if (slave->node == LINKED_LIST_UNUSED);
for (i = 0; i < received.header_count; i++) {
- if (startswith(received.headers[i], "Time to live: ")) {
+ if (strstarts(received.headers[i], "Time to live: ")) {
ttl = received.headers[i] + strlen("Time to live: ");
slave->timed = 1;
fail_if (monotone(&(slave->dethklok)));
diff --git a/src/mds-registry/slave.h b/src/mds-registry/slave.h
index 0b4f7b2..defe845 100644
--- a/src/mds-registry/slave.h
+++ b/src/mds-registry/slave.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-registry/util.c b/src/mds-registry/util.c
index 77dff5a..c37d102 100644
--- a/src/mds-registry/util.c
+++ b/src/mds-registry/util.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-registry/util.h b/src/mds-registry/util.h
index 4547400..d948fce 100644
--- a/src/mds-registry/util.h
+++ b/src/mds-registry/util.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-respawn.c b/src/mds-respawn.c
index aa02ccf..3439329 100644
--- a/src/mds-respawn.c
+++ b/src/mds-respawn.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -104,17 +104,17 @@ int parse_cmdline(void)
for (i = 1; i < argc; i++) {
arg = argv[i];
- if (startswith(arg, "--alarm=")) { /* Schedule an alarm signal for forced abort. */
- alarm((unsigned)min(atou(arg + strlen("--alarm=")), 60)); /* At most 1 minute. */
- } else if (startswith(arg, "--interval=")) {
- interval = min(atoi(arg + strlen("--interval=")), 60); /* At most 1 minute. */
- } else if (strequals(arg, "--re-exec")) { /* Re-exec state-marshal. */
+ if (strstarts(arg, "--alarm=")) { /* Schedule an alarm signal for forced abort. */
+ alarm((unsigned)MIN(atou(arg + strlen("--alarm=")), 60)); /* At most 1 minute. */
+ } else if (strstarts(arg, "--interval=")) {
+ interval = MIN(atoi(arg + strlen("--interval=")), 60); /* At most 1 minute. */
+ } else if (streq(arg, "--re-exec")) { /* Re-exec state-marshal. */
is_reexec = 1;
- } else if (strequals(arg, "{")) {
+ } else if (streq(arg, "{")) {
servers += stack++ == 0 ? 1 : 0;
- } else if (strequals(arg, "}")) {
+ } else if (streq(arg, "}")) {
exit_if (!stack--, eprint("Terminating non-started command, aborting."););
- exit_if (!stack && strequals(argv[i - 1], "{"),
+ exit_if (!stack && streq(argv[i - 1], "{"),
eprint("Zero argument command specified, aborting."););
} else if (!stack) {
eprintf("Unrecognised option: %s, did you forget `='?", arg);
@@ -139,11 +139,11 @@ int parse_cmdline(void)
/* Fill command arrays. */
for (i = 1, args = j = 0; i < argc; i++) {
arg = argv[i];
- if (strequals(arg, "}"))
+ if (streq(arg, "}"))
commands_args[args++] = --stack == 0 ? NULL : arg;
else if (stack > 0)
commands_args[args++] = arg;
- else if (strequals(arg, "{") && !stack++)
+ else if (streq(arg, "{") && !stack++)
commands[j++] = commands_args + args;
}
@@ -277,7 +277,7 @@ postinitialise_server(void)
for (i = j = 0; j < servers; i++) {
if (!commands_args[i])
j++;
- else if (strequals(commands_args[i], "--initial-spawn"))
+ else if (streq(commands_args[i], "--initial-spawn"))
fail_if (xstrdup(commands_args[i], "--respawn"));
}
diff --git a/src/mds-respawn.h b/src/mds-respawn.h
index b664c05..3cdbb8d 100644
--- a/src/mds-respawn.h
+++ b/src/mds-respawn.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-server/client.c b/src/mds-server/client.c
index 4122f64..dc9c57f 100644
--- a/src/mds-server/client.c
+++ b/src/mds-server/client.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-server/client.h b/src/mds-server/client.h
index b003d31..6c37ffc 100644
--- a/src/mds-server/client.h
+++ b/src/mds-server/client.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-server/globals.c b/src/mds-server/globals.c
index 774de73..5ec5ad2 100644
--- a/src/mds-server/globals.c
+++ b/src/mds-server/globals.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-server/globals.h b/src/mds-server/globals.h
index 8083717..a9fe9b9 100644
--- a/src/mds-server/globals.h
+++ b/src/mds-server/globals.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-server/interception-condition.c b/src/mds-server/interception-condition.c
index fecf1f0..accfdfa 100644
--- a/src/mds-server/interception-condition.c
+++ b/src/mds-server/interception-condition.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-server/interception-condition.h b/src/mds-server/interception-condition.h
index 78383f4..85858a4 100644
--- a/src/mds-server/interception-condition.h
+++ b/src/mds-server/interception-condition.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-server/interceptors.c b/src/mds-server/interceptors.c
index bcb8621..ede924d 100644
--- a/src/mds-server/interceptors.c
+++ b/src/mds-server/interceptors.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -99,7 +99,7 @@ add_intercept_condition(client_t *client, char *condition, int64_t priority, int
also look for non-modifying condition to swap position
with for optimisation. */
for (i = 0; i < n; i++) {
- if ((conds[i].header_hash != hash) || !strequals(conds[i].condition, condition)) {
+ if ((conds[i].header_hash != hash) || !streq(conds[i].condition, condition)) {
/* Look for the first non-modifying, this is a part of the
optimisation where we put all modifying conditions at the
beginning. */
@@ -186,8 +186,8 @@ is_condition_matching(interception_condition_t *cond, size_t *hashes,
if (*cond->condition == '\0')
return 1;
else if ((cond->header_hash == hashes[i]) &&
- (strequals(cond->condition, keys[i]) ||
- strequals(cond->condition, headers[i])))
+ (streq(cond->condition, keys[i]) ||
+ streq(cond->condition, headers[i])))
return 1;
}
return 0;
diff --git a/src/mds-server/interceptors.h b/src/mds-server/interceptors.h
index 21f74d4..84cdc55 100644
--- a/src/mds-server/interceptors.h
+++ b/src/mds-server/interceptors.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-server/mds-server.c b/src/mds-server/mds-server.c
index 58908a4..6ee2e81 100644
--- a/src/mds-server/mds-server.c
+++ b/src/mds-server/mds-server.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -98,14 +98,14 @@ preinitialise_server(void)
/* Parse command line arguments. */
for (i = 1; i < argc; i++) {
arg = argv[i];
- if (startswith(arg, "--socket-fd=")) { /* Socket file descriptor. */
+ if (strstarts(arg, "--socket-fd=")) { /* Socket file descriptor. */
exit_if (socket_fd != -1,
eprintf("duplicate declaration of %s.", "--socket-fd"););
exit_if (strict_atoi(arg += strlen("--socket-fd="), &socket_fd, 0, INT_MAX) < 0,
eprintf("invalid value for %s: %s.", "--socket-fd", arg););
- } else if (startswith(arg, "--alarm=")) { /* Schedule an alarm signal for forced abort. */
- alarm((unsigned)min(atou(arg + strlen("--alarm=")), 60)); /* At most 1 minute. */
- } else if (!strequals(arg, "--initial-spawn") && !strequals(arg, "--respawn")) {
+ } else if (strstarts(arg, "--alarm=")) { /* Schedule an alarm signal for forced abort. */
+ alarm((unsigned)MIN(atou(arg + strlen("--alarm=")), 60)); /* At most 1 minute. */
+ } else if (!streq(arg, "--initial-spawn") && !streq(arg, "--respawn")) {
/* Not recognised, it is probably for another server. */
unparsed_args[unparsed_args_ptr++] = arg;
}
@@ -523,11 +523,11 @@ run_initrc(char **args)
(xsnprintf(pathname, FORMAT, __VA_ARGS__), execv(args[0], args))
/* Test $XDG_CONFIG_HOME. */
- if ((env = getenv_nonempty("XDG_CONFIG_HOME")))
+ if ((env = getenv_ne("XDG_CONFIG_HOME")))
__exec("%s/%s", env, INITRC_FILE);
/* Test $HOME. */
- if ((env = getenv_nonempty("HOME"))) {
+ if ((env = getenv_ne("HOME"))) {
__exec("%s/.config/%s", env, INITRC_FILE);
__exec("%s/.%s", env, INITRC_FILE);
}
@@ -543,7 +543,7 @@ run_initrc(char **args)
}
/* Test $XDG_CONFIG_DIRS. */
- if ((env = getenv_nonempty("XDG_CONFIG_DIRS"))) {
+ if ((env = getenv_ne("XDG_CONFIG_DIRS"))) {
for (begin = env;;) {
end = strchrnul(begin, ':');
len = (int)(end - begin);
diff --git a/src/mds-server/mds-server.h b/src/mds-server/mds-server.h
index c1263e4..f7a7667 100644
--- a/src/mds-server/mds-server.h
+++ b/src/mds-server/mds-server.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-server/multicast.c b/src/mds-server/multicast.c
index 5095471..6870f47 100644
--- a/src/mds-server/multicast.c
+++ b/src/mds-server/multicast.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-server/multicast.h b/src/mds-server/multicast.h
index 126c4ba..c1b078a 100644
--- a/src/mds-server/multicast.h
+++ b/src/mds-server/multicast.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-server/queued-interception.c b/src/mds-server/queued-interception.c
index afa6c65..c266fac 100644
--- a/src/mds-server/queued-interception.c
+++ b/src/mds-server/queued-interception.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-server/queued-interception.h b/src/mds-server/queued-interception.h
index 1555801..84df386 100644
--- a/src/mds-server/queued-interception.h
+++ b/src/mds-server/queued-interception.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-server/receiving.c b/src/mds-server/receiving.c
index 60e86b7..3f7e9ce 100644
--- a/src/mds-server/receiving.c
+++ b/src/mds-server/receiving.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -249,13 +249,13 @@ message_received(client_t *client)
/* Parser headers. */
for (i = 0; i < message.header_count; i++) {
h = message.headers[i];
- if (strequals(h, "Command: assign-id")) assign_id = 1;
- else if (strequals(h, "Command: intercept")) intercept = 1;
- else if (strequals(h, "Modifying: yes")) modifying = 1;
- else if (strequals(h, "Stop: yes")) stop = 1;
- else if (startswith(h, "Message ID: ")) message_id = strstr(h, ": ") + 2;
- else if (startswith(h, "Priority: ")) priority = ato64(strstr(h, ": ") + 2);
- else if (startswith(h, "Modify ID: ")) modify_id = atou64(strstr(h, ": ") + 2);
+ if (streq(h, "Command: assign-id")) assign_id = 1;
+ else if (streq(h, "Command: intercept")) intercept = 1;
+ else if (streq(h, "Modifying: yes")) modifying = 1;
+ else if (streq(h, "Stop: yes")) stop = 1;
+ else if (strstarts(h, "Message ID: ")) message_id = strstr(h, ": ") + 2;
+ else if (strstarts(h, "Priority: ")) priority = ato64(strstr(h, ": ") + 2);
+ else if (strstarts(h, "Modify ID: ")) modify_id = atou64(strstr(h, ": ") + 2);
}
diff --git a/src/mds-server/receiving.h b/src/mds-server/receiving.h
index 03542eb..98ed7fa 100644
--- a/src/mds-server/receiving.h
+++ b/src/mds-server/receiving.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-server/reexec.c b/src/mds-server/reexec.c
index 0dcfa44..b3f1384 100644
--- a/src/mds-server/reexec.c
+++ b/src/mds-server/reexec.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-server/sending.c b/src/mds-server/sending.c
index 95123eb..5b91b01 100644
--- a/src/mds-server/sending.c
+++ b/src/mds-server/sending.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -175,7 +175,7 @@ void multicast_message(multicast_t *multicast)
/* Act upon the reply. */
mod = client->modify_message;
for (i = 0; i < mod->header_count; i++) {
- if (strequals(mod->headers[i], "Modify: yes")) {
+ if (streq(mod->headers[i], "Modify: yes")) {
modifying = 1;
consumed = mod->payload_size == 0;
break;
diff --git a/src/mds-server/sending.h b/src/mds-server/sending.h
index ef2b330..eb72486 100644
--- a/src/mds-server/sending.h
+++ b/src/mds-server/sending.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-server/signals.c b/src/mds-server/signals.c
index cc86b75..3ace64c 100644
--- a/src/mds-server/signals.c
+++ b/src/mds-server/signals.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-server/slavery.c b/src/mds-server/slavery.c
index ddbfc8c..b106947 100644
--- a/src/mds-server/slavery.c
+++ b/src/mds-server/slavery.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-server/slavery.h b/src/mds-server/slavery.h
index 89586aa..68834b0 100644
--- a/src/mds-server/slavery.h
+++ b/src/mds-server/slavery.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds-vt.c b/src/mds-vt.c
index 7a34dd6..9d6c0a0 100644
--- a/src/mds-vt.c
+++ b/src/mds-vt.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -558,7 +558,7 @@ handle_message(void)
size_t i;
#define __get_header(storage, header)\
- (startswith(received.headers[i], header))\
+ (strstarts(received.headers[i], header))\
storage = received.headers[i] + strlen(header)
for (i = 0; i < received.header_count; i++) {
@@ -576,7 +576,7 @@ handle_message(void)
if (!recv_message_id)
return eprint("received message without ID, ignoring, master server is misbehaving."), 0;
- if (strequals(recv_client_id, "0:0"))
+ if (streq(recv_client_id, "0:0"))
return eprint("received information request from an anonymous client, ignoring."), 0;
if (strlen(recv_client_id) > 21)
@@ -589,10 +589,10 @@ handle_message(void)
if (!recv_command)
return 0; /* How did that get here, no matter, just ignore it? */
- if (strequals(recv_command, "get-vt"))
+ if (streq(recv_command, "get-vt"))
fail_if (handle_get_vt(recv_client_id, recv_message_id));
- if (strequals(recv_command, "configure-vt"))
+ if (streq(recv_command, "configure-vt"))
fail_if (handle_configure_vt(recv_client_id, recv_message_id, recv_graphical, recv_exclusive));
return 0; /* How did that get here, no matter, just ignore it? */
@@ -651,19 +651,19 @@ handle_configure_vt(const char *client, const char *message, const char *graphic
char buf[60 + 41 + 3 * sizeof(int)];
int r = 0, set_nonexclusive;
- if (strequals(exclusive, "yes") || strequals(exclusive, "no")) {
+ if (streq(exclusive, "yes") || streq(exclusive, "no")) {
/* Switch to exclusive mode when no server has request
non-exclusive mode anymore, and switch to non-exclusive
mode when the number of server that server that has
request non-exclusive switches from zero to one. */
- set_nonexclusive = strequals(exclusive, "no");
+ set_nonexclusive = streq(exclusive, "no");
if (nonexclusive_counter == (ssize_t)!set_nonexclusive)
r |= vt_set_exclusive(display_tty_fd, !set_nonexclusive);
nonexclusive_counter += set_nonexclusive ? 1 : -1;
}
- if (strequals(graphical, "yes") || strequals(graphical, "no"))
- r |= vt_set_graphical(display_tty_fd, strequals(graphical, "yes"));
+ if (streq(graphical, "yes") || streq(graphical, "no"))
+ r |= vt_set_graphical(display_tty_fd, streq(graphical, "yes"));
sprintf(buf,
"Command: error\n"
diff --git a/src/mds-vt.h b/src/mds-vt.h
index fa2fdd0..82e9381 100644
--- a/src/mds-vt.h
+++ b/src/mds-vt.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/mds.c b/src/mds.c
index 32cbeae..bdd2b65 100644
--- a/src/mds.c
+++ b/src/mds.c
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -89,7 +89,7 @@ int main(int argc_, char **argv_)
/* Parse command line arguments. */
for (j = 1; j < argc; j++) {
arg = argv[j];
- if (startswith(arg, "--master-server=")) { /* Master server. */
+ if (strstarts(arg, "--master-server=")) { /* Master server. */
exit_if (got_master_server,
eprintf("duplicate declaration of %s.", "--master-server"););
got_master_server = 1;
diff --git a/src/mds.h b/src/mds.h
index 49c911c..90ffe63 100644
--- a/src/mds.h
+++ b/src/mds.h
@@ -1,6 +1,6 @@
/**
* mds — A micro-display server
- * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (maandree@kth.se)
+ * Copyright © 2014, 2015, 2016, 2017 Mattias Andrée (m@maandree.se)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by