diff --git a/usr.bin/quota/quotautil.c b/usr.bin/quota/quotautil.c index bc558e2a8784..9e5d2edfce17 100644 --- a/usr.bin/quota/quotautil.c +++ b/usr.bin/quota/quotautil.c @@ -1,4 +1,4 @@ -/* $NetBSD: quotautil.c,v 1.1 2011/03/06 22:36:07 christos Exp $ */ +/* $NetBSD: quotautil.c,v 1.2 2011/03/06 23:26:05 christos Exp $ */ /* * Copyright (c) 1980, 1990, 1993 @@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1990, 1993\ #if 0 static char sccsid[] = "@(#)quota.c 8.4 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: quotautil.c,v 1.1 2011/03/06 22:36:07 christos Exp $"); +__RCSID("$NetBSD: quotautil.c,v 1.2 2011/03/06 23:26:05 christos Exp $"); #endif #endif /* not lint */ @@ -117,3 +117,17 @@ alldigits(const char *s) } while ((c = *s++) != 0); return 1; } + +/* + * Check to see if target appears in list of size cnt. + */ +int +oneof(const char *target, char *list[], int cnt) +{ + int i; + + for (i = 0; i < cnt; i++) + if (strcmp(target, list[i]) == 0) + return i; + return -1; +} diff --git a/usr.bin/quota/quotautil.h b/usr.bin/quota/quotautil.h index d96505139d09..a5cd4a0f9bc5 100644 --- a/usr.bin/quota/quotautil.h +++ b/usr.bin/quota/quotautil.h @@ -1,7 +1,8 @@ -/* $NetBSD: quotautil.h,v 1.1 2011/03/06 22:36:07 christos Exp $ */ +/* $NetBSD: quotautil.h,v 1.2 2011/03/06 23:26:16 christos Exp $ */ const char *qfextension[MAXQUOTAS]; const char *qfname; struct fstab; int hasquota(char *, size_t, struct fstab *, int); int alldigits(const char *); +int oneof(const char *, char *[], int);