X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=zutil%2Fsortspec.c;h=3ffee80131a14a261078cbfed5795b47d474936a;hp=c421fcbe61b3ffc939fa3c595ff470ce1d141d0f;hb=fd4adcc80d442f84c6a1894e890b1b6ccd02615e;hpb=109b6408fbe38ca68651a23b59a9ac875e7b8944 diff --git a/zutil/sortspec.c b/zutil/sortspec.c index c421fcb..3ffee80 100644 --- a/zutil/sortspec.c +++ b/zutil/sortspec.c @@ -2,7 +2,7 @@ * Copyright (c) 1995-2001, Index Data. * See the file LICENSE for details. * - * $Id: sortspec.c,v 1.1 2001-08-08 19:35:06 adam Exp $ + * $Id: sortspec.c,v 1.4 2001-11-13 23:00:43 adam Exp $ */ #include @@ -15,8 +15,6 @@ Z_SortKeySpecList *yaz_sort_spec (ODR out, const char *arg) { - int oid[OID_SIZE]; - oident bib1; char sort_string_buf[32], sort_flags[32]; Z_SortKeySpecList *sksl = (Z_SortKeySpecList *) odr_malloc (out, sizeof(*sksl)); @@ -25,9 +23,6 @@ Z_SortKeySpecList *yaz_sort_spec (ODR out, const char *arg) sksl->num_specs = 0; sksl->specs = (Z_SortKeySpec **)odr_malloc (out, sizeof(sksl->specs) * 20); - bib1.proto = PROTO_Z3950; - bib1.oclass = CLASS_ATTSET; - bib1.value = VAL_BIB1; while ((sscanf (arg, "%31s %31s%n", sort_string_buf, sort_flags, &off)) == 2 && off > 1) { @@ -50,7 +45,8 @@ Z_SortKeySpecList *yaz_sort_spec (ODR out, const char *arg) sk->which = Z_SortKey_sortAttributes; sk->u.sortAttributes = (Z_SortAttributes *) odr_malloc (out, sizeof(*sk->u.sortAttributes)); - sk->u.sortAttributes->id = oid_ent_to_oid(&bib1, oid); + sk->u.sortAttributes->id = + yaz_oidval_to_z3950oid(out, CLASS_ATTSET, VAL_BIB1); sk->u.sortAttributes->list = (Z_AttributeList *) odr_malloc (out, sizeof(*sk->u.sortAttributes->list)); sk->u.sortAttributes->list->attributes = (Z_AttributeElement **) @@ -84,24 +80,20 @@ Z_SortKeySpecList *yaz_sort_spec (ODR out, const char *arg) sks->sortRelation = odr_intdup (out, Z_SortRelation_ascending); sks->caseSensitivity = odr_intdup (out, Z_SortCase_caseSensitive); -#ifdef ASN_COMPILED sks->which = Z_SortKeySpec_null; sks->u.null = odr_nullval (); -#else - sks->missingValueAction = NULL; -#endif for (i = 0; sort_flags[i]; i++) { switch (sort_flags[i]) { - case 'a': - case 'A': + case 'd': + case 'D': case '>': *sks->sortRelation = Z_SortRelation_descending; break; - case 'd': - case 'D': + case 'a': + case 'A': case '<': *sks->sortRelation = Z_SortRelation_ascending; break;