1 /* This file is part of the YAZ toolkit.
2 * Copyright (C) 1995-2008 Index Data
3 * See the file LICENSE for details.
8 * \brief Implements OID base utilities
19 #include <yaz/snprintf.h>
20 #include <yaz/oid_util.h>
22 void oid_oidcpy(Odr_oid *t, const Odr_oid *s)
24 while ((*(t++) = *(s++)) > -1);
27 void oid_oidcat(Odr_oid *t, const Odr_oid *s)
31 while ((*(t++) = *(s++)) > -1);
34 int oid_oidcmp(const Odr_oid *o1, const Odr_oid *o2)
36 while (*o1 == *o2 && *o1 > -1)
49 int oid_oidlen(const Odr_oid *o)
59 char *oid_oid_to_dotstring(const Odr_oid *oid, char *oidbuf)
65 for (i = 0; oid[i] != -1 && i < OID_SIZE; i++)
67 yaz_snprintf(tmpbuf, sizeof(tmpbuf)-1, "%d", oid[i]);
70 strcat(oidbuf, tmpbuf);
75 int oid_dotstring_to_oid(const char *name, Odr_oid *oid)
79 while (isdigit (*(unsigned char *) name))
81 val = val*10 + (*name - '0');
101 * indent-tabs-mode: nil
103 * vim: shiftwidth=4 tabstop=8 expandtab