From: Sebastian Hammer Date: Tue, 20 Feb 1996 13:02:58 +0000 (+0000) Subject: Wais length. X-Git-Tag: YAZ.1.8~797 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=d1f1647de20f92bdb32c61a8dafac5f252dac914;p=yaz-moved-to-github.git Wais length. --- diff --git a/comstack/waislen.c b/comstack/waislen.c new file mode 100644 index 0000000..e082680 --- /dev/null +++ b/comstack/waislen.c @@ -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; +}