2 * Copyright (C) 1995-2007, Index Data ApS
3 * See the file LICENSE for details.
5 * $Id: oid_util.c,v 1.4 2007-05-08 08:22:36 adam Exp $
10 * \brief Implements OID base utilities
21 #include <yaz/snprintf.h>
22 #include <yaz/oid_util.h>
24 void oid_oidcpy(Odr_oid *t, const Odr_oid *s)
26 while ((*(t++) = *(s++)) > -1);
29 void oid_oidcat(Odr_oid *t, const Odr_oid *s)
33 while ((*(t++) = *(s++)) > -1);
36 int oid_oidcmp(const Odr_oid *o1, const Odr_oid *o2)
38 while (*o1 == *o2 && *o1 > -1)
51 int oid_oidlen(const Odr_oid *o)
61 char *oid_oid_to_dotstring(const Odr_oid *oid, char *oidbuf)
67 for (i = 0; oid[i] != -1 && i < OID_SIZE; i++)
69 yaz_snprintf(tmpbuf, sizeof(tmpbuf)-1, "%d", oid[i]);
72 strcat(oidbuf, tmpbuf);
77 int oid_dotstring_to_oid(const char *name, Odr_oid *oid)
81 while (isdigit (*(unsigned char *) name))
83 val = val*10 + (*name - '0');
103 * indent-tabs-mode: nil
105 * vim: shiftwidth=4 tabstop=8 expandtab