Back to index

courier  0.68.2
comparseqid.c
Go to the documentation of this file.
00001 /*
00002 ** Copyright 1998 - 1999 Double Precision, Inc.
00003 ** See COPYING for distribution information.
00004 */
00005 
00006 #include      "comparseqid.h"
00007 #include      <string.h>
00008 
00009 static const char hex[]="0123456789ABCDEF";
00010 
00011 int comparseqid(const char *qid, ino_t *n)
00012 {
00013 const  char *p;
00014 
00015        *n=0;
00016        for ( ; *qid; qid++)
00017        {
00018               if (*qid == '.')     return (0);
00019 
00020               if ((p=strchr(hex, *qid)) == 0)    return (-1);
00021               *n= (*n << 4) + (p-hex);
00022        }
00023        return (-1);
00024 }