From 34f25ae40a3db9369e9d98b3814f2b93bbc21451 Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Fri, 1 Sep 2017 00:08:07 -0400 Subject: Add client readOnly mode --- client.c | 7 ++++++- torus.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/client.c b/client.c index e674ba2..db03db3 100644 --- a/client.c +++ b/client.c @@ -44,6 +44,8 @@ static int client; +static bool readOnly = false; + static void clientMessage(const struct ClientMessage *msg) { ssize_t len = send(client, msg, sizeof(*msg), 0); if (len < 0) err(EX_IOERR, "send"); @@ -58,6 +60,7 @@ static void clientMove(int8_t dx, int8_t dy) { } static void clientPut(uint8_t color, char cell) { + if (readOnly) return; struct ClientMessage msg = { .type = CLIENT_PUT, .data.p = { .color = color, .cell = cell }, @@ -381,7 +384,9 @@ static void initColors(void) { } } -int main() { +int main(int argc, char *argv[] UNUSED) { + if (argc > 1) readOnly = true; + client = socket(PF_LOCAL, SOCK_STREAM, 0); if (client < 0) err(EX_OSERR, "socket"); diff --git a/torus.h b/torus.h index e337557..f2fb6ee 100644 --- a/torus.h +++ b/torus.h @@ -20,6 +20,7 @@ #include #include +#define UNUSED __attribute__((unused)) #define ALIGNED(x) __attribute__((aligned(x))) enum { -- cgit 1.4.1 tree commit diff
Commit message (Collapse)Author
2021-03-05build: Add OpenSSL includes to libcompatJune McEnroe
Some compat sources (getentropy_linux.c for example) require OpenSSL. Reported by Robert Scheck.
2020-12-15Import LibreSSL 3.3.1June McEnroe
2020-11-24Import LibreSSL 3.3.0June McEnroe
2020-10-22Import LibreSSL 3.2.2June McEnroe
2020-09-29Import LibreSSL 3.2.1June McEnroe
2020-09-29import: Add m4/ax_add_fortify_source.m4June McEnroe
2020-08-05build: Add README.7 to EXTRA_DIST 3.2.0June McEnroe
2020-08-03doc: Indicate that only OpenSSL 1.1.1b and newer workJune McEnroe