* 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 <stdio.h>
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));
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)
{
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 **)
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;