Wais length.
authorSebastian Hammer <quinn@indexdata.com>
Tue, 20 Feb 1996 13:02:58 +0000 (13:02 +0000)
committerSebastian Hammer <quinn@indexdata.com>
Tue, 20 Feb 1996 13:02:58 +0000 (13:02 +0000)
comstack/waislen.c [new file with mode: 0644]

diff --git a/comstack/waislen.c b/comstack/waislen.c
new file mode 100644 (file)
index 0000000..e082680
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 1995, Index Data.
+ * See the file LICENSE for details.
+ * Sebastian Hammer, Adam Dickmeiss
+ *
+ * $Log: waislen.c,v $
+ * Revision 1.1  1996-02-20 13:02:58  quinn
+ * Wais length.
+ *
+ *
+ */
+
+/*
+ * Return length of WAIS package or 0
+ */
+int completeWAIS(unsigned char *buf, int len)
+{
+    int i, lval = 0;
+
+    if (*buf != '0')
+       return 0;
+    if (len < 25)
+       return 0;
+    /* calculate length */
+    for (i = 0; i < 10; i++)
+       lval = lval * 10 + buf[i];
+    lval += 25;
+    if (len >= lval)
+       return lval;
+    return 0;
+}