Module Name: src
Committed By: christos
Date: Sun Mar 6 23:26:17 UTC 2011
Modified Files:
src/usr.bin/quota: quotautil.c quotautil.h
Log Message:
merge one more triplicated function
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/quota/quotautil.c \
src/usr.bin/quota/quotautil.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/quota/quotautil.c
diff -u src/usr.bin/quota/quotautil.c:1.1 src/usr.bin/quota/quotautil.c:1.2
--- src/usr.bin/quota/quotautil.c:1.1 Sun Mar 6 17:36:07 2011
+++ src/usr.bin/quota/quotautil.c Sun Mar 6 18:26:05 2011
@@ -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 @@
#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 @@
} 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;
+}
Index: src/usr.bin/quota/quotautil.h
diff -u src/usr.bin/quota/quotautil.h:1.1 src/usr.bin/quota/quotautil.h:1.2
--- src/usr.bin/quota/quotautil.h:1.1 Sun Mar 6 17:36:07 2011
+++ src/usr.bin/quota/quotautil.h Sun Mar 6 18:26:16 2011
@@ -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);