]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/opie/libopie/lookup.c
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / opie / libopie / lookup.c
1 /* lookup.c: The opielookup() library function.
2
3 %%% copyright-cmetz-96
4 This software is Copyright 1996-2001 by Craig Metz, All Rights Reserved.
5 The Inner Net License Version 3 applies to this software.
6 You should have received a copy of the license with this software. If
7 you didn't get a copy, you may request one from <license@inner.net>.
8
9         History:
10
11         Created by cmetz for OPIE 2.3 (re-write).
12 */
13
14 #include "opie_cfg.h"
15 #include <stdio.h>
16 #include "opie.h"
17
18 int opielookup FUNCTION((opie, principal), struct opie *opie AND char *principal)
19 {
20   int i;
21
22   memset(opie, 0, sizeof(struct opie));
23   opie->opie_principal = principal;
24
25   if (i = __opiereadrec(opie))
26     return i;
27
28   return (opie->opie_flags & __OPIE_FLAGS_RW) ? 0 : 2;
29 }
30