Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/quota merge one more triplicated function



details:   https://anonhg.NetBSD.org/src/rev/3425ecebde4c
branches:  trunk
changeset: 762978:3425ecebde4c
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Mar 06 23:26:05 2011 +0000

description:
merge one more triplicated function

diffstat:

 usr.bin/quota/quotautil.c |  18 ++++++++++++++++--
 usr.bin/quota/quotautil.h |   3 ++-
 2 files changed, 18 insertions(+), 3 deletions(-)

diffs (49 lines):

diff -r bd2c93fa46b8 -r 3425ecebde4c usr.bin/quota/quotautil.c
--- a/usr.bin/quota/quotautil.c Sun Mar 06 23:25:42 2011 +0000
+++ b/usr.bin/quota/quotautil.c Sun Mar 06 23:26:05 2011 +0000
@@ -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;
+}
diff -r bd2c93fa46b8 -r 3425ecebde4c usr.bin/quota/quotautil.h
--- a/usr.bin/quota/quotautil.h Sun Mar 06 23:25:42 2011 +0000
+++ b/usr.bin/quota/quotautil.h Sun Mar 06 23:26:05 2011 +0000
@@ -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);



Home | Main Index | Thread Index | Old Index