133965Sjdp/* lookup.c: The opielookup() library function.
238889Sjdp
333965Sjdp%%% copyright-cmetz-96
433965SjdpThis software is Copyright 1996-2001 by Craig Metz, All Rights Reserved.
533965SjdpThe Inner Net License Version 3 applies to this software.
633965SjdpYou should have received a copy of the license with this software. If
733965Sjdpyou didn't get a copy, you may request one from <license@inner.net>.
833965Sjdp
933965Sjdp        History:
1033965Sjdp
1133965Sjdp        Created by cmetz for OPIE 2.3 (re-write).
1233965Sjdp*/
1333965Sjdp
1433965Sjdp#include "opie_cfg.h"
1533965Sjdp#include <stdio.h>
1633965Sjdp#include "opie.h"
1733965Sjdp
1833965Sjdpint opielookup FUNCTION((opie, principal), struct opie *opie AND char *principal)
1933965Sjdp{
2033965Sjdp  int i;
2133965Sjdp
2233965Sjdp  memset(opie, 0, sizeof(struct opie));
2333965Sjdp  opie->opie_principal = principal;
2433965Sjdp
2533965Sjdp  if (i = __opiereadrec(opie))
2633965Sjdp    return i;
2733965Sjdp
2833965Sjdp  return (opie->opie_flags & __OPIE_FLAGS_RW) ? 0 : 2;
2933965Sjdp}
3033965Sjdp
3133965Sjdp