From 37da2899f40661e3e9631e497da8dc59b971cbd0 Mon Sep 17 00:00:00 2001 From: "Charles.Forsyth" Date: Fri, 22 Dec 2006 17:07:39 +0000 Subject: 20060303a --- liblogfs/gn.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 liblogfs/gn.c (limited to 'liblogfs/gn.c') diff --git a/liblogfs/gn.c b/liblogfs/gn.c new file mode 100644 index 00000000..c5d02977 --- /dev/null +++ b/liblogfs/gn.c @@ -0,0 +1,26 @@ +#include "lib9.h" +#include "logfs.h" +#include "fcall.h" +#include "local.h" + +int +logfsgn(uchar **pp, uchar *mep, char **v) +{ + uchar *p = *pp; + int l; + if(p + BIT16SZ > mep) + return 0; + l = GBIT16(p); p += BIT16SZ; + if(p + l > mep) + return 0; + *pp = p + l; + if(l == 0) { + *v = 0; + return 1; + } + *v = (char *)(p - 1); + memmove(p - 1, p, l); + p[l - 1] = 0; + return 1; +} + -- cgit v1.2.3