ref: 96d36720dd81338a92dad8fd151278da2c5c9cac
parent: d24ba6187aebabe39813ded5227516637b708626
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Wed Jan 13 13:40:14 EST 2021
make it build on Plan 9 as well (with -D__plan9__)
--- a/c9.c
+++ b/c9.c
@@ -5,8 +5,13 @@
* any sense to copy-paste protocol documentation, which
* you can read at http://man.cat-v.org/plan_9/5/, see 'intro'.
*/
+#ifdef __plan9__
+#include <u.h>
+#include <libc.h>
+#else
#include <stdint.h>
#include <string.h>
+#endif
#include "c9.h"
enum
@@ -717,10 +722,9 @@
C9error
s9flush(C9ctx *c, C9tag tag)
{
- uint8_t *b;
C9error err;
- if((b = R(c, 0, Rflush, tag, &err)) != NULL)
+ if(R(c, 0, Rflush, tag, &err) != NULL)
err = c->end(c);
return err;
}
@@ -880,10 +884,9 @@
C9error
s9clunk(C9ctx *c, C9tag tag)
{
- uint8_t *b;
C9error err;
- if((b = R(c, 0, Rclunk, tag, &err)) != NULL)
+ if(R(c, 0, Rclunk, tag, &err) != NULL)
err = c->end(c);
return err;
}
@@ -891,10 +894,9 @@
C9error
s9remove(C9ctx *c, C9tag tag)
{
- uint8_t *b;
C9error err;
- if((b = R(c, 0, Rremove, tag, &err)) != NULL)
+ if(R(c, 0, Rremove, tag, &err) != NULL)
err = c->end(c);
return err;
}
@@ -943,10 +945,9 @@
C9error
s9wstat(C9ctx *c, C9tag tag)
{
- uint8_t *b;
C9error err;
- if((b = R(c, 0, Rwstat, tag, &err)) != NULL)
+ if(R(c, 0, Rwstat, tag, &err) != NULL)
err = c->end(c);
return err;
}
--- a/c9.h
+++ b/c9.h
@@ -1,3 +1,12 @@
+#ifdef __plan9__
+typedef u64int uint64_t;
+typedef u32int uint32_t;
+typedef u16int uint16_t;
+typedef u8int uint8_t;
+#define __attribute__(...)
+#define NULL nil
+#endif
+
struct C9aux;
typedef struct C9r C9r;