2 * Copyright (c) 1995-2003, Index Data
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
6 * $Id: odr_bool.c,v 1.15 2003-05-20 19:55:30 adam Exp $
16 * Top level boolean en/decoder.
17 * Returns 1 on success, 0 on error.
19 int odr_bool(ODR o, int **p, int opt, const char *name)
27 o->t_class = ODR_UNIVERSAL;
28 o->t_tag = ODR_BOOLEAN;
30 if ((res = ber_tag(o, p, o->t_class, o->t_tag, &cons, opt, name)) < 0)
33 return odr_missing(o, opt, name);
34 if (o->direction == ODR_PRINT)
37 fprintf(o->print, "%s\n", (**p ? "TRUE" : "FALSE"));
42 if (o->direction == ODR_DECODE)
43 *p = (int *)odr_malloc(o, sizeof(int));
44 return ber_boolean(o, *p);