annotate lib/acl_entries.c @ 9258:bee5960c276a

Rename search_.h to search.in.h.
author Bruno Haible <bruno@clisp.org>
date Tue, 02 Oct 2007 00:24:48 +0200
parents 2798cb65bd90
children bbbbbf4cd1c5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8476
2798cb65bd90 Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
1 /* Return the number of entries in an ACL.
2798cb65bd90 Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
2
2798cb65bd90 Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
3 Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
2798cb65bd90 Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
4
2798cb65bd90 Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
5 This program is free software; you can redistribute it and/or modify
2798cb65bd90 Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
6 it under the terms of the GNU General Public License as published by
2798cb65bd90 Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
7 the Free Software Foundation; either version 2, or (at your option)
2798cb65bd90 Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
8 any later version.
2798cb65bd90 Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
9
2798cb65bd90 Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
10 This program is distributed in the hope that it will be useful,
2798cb65bd90 Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
2798cb65bd90 Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2798cb65bd90 Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
13 GNU General Public License for more details.
2798cb65bd90 Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
14
2798cb65bd90 Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
15 You should have received a copy of the GNU General Public License
2798cb65bd90 Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
16 along with this program; if not, write to the Free Software Foundation,
2798cb65bd90 Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
2798cb65bd90 Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
18
2798cb65bd90 Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
19 Written by Paul Eggert and Andreas Gruenbacher. */
2798cb65bd90 Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
20
2798cb65bd90 Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
21 #include <config.h>
2798cb65bd90 Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
22
2798cb65bd90 Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
23 #include "acl-internal.h"
2798cb65bd90 Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
24
2798cb65bd90 Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
25 /* Return the number of entries in ACL. */
2798cb65bd90 Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
26
2798cb65bd90 Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
27 int
2798cb65bd90 Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
28 acl_entries (acl_t acl)
2798cb65bd90 Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
29 {
2798cb65bd90 Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
30 char *t;
2798cb65bd90 Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
31 int entries = 0;
2798cb65bd90 Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
32 char *text = acl_to_text (acl, NULL);
2798cb65bd90 Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
33 if (! text)
2798cb65bd90 Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
34 return -1;
2798cb65bd90 Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
35 for (t = text; *t; t++)
2798cb65bd90 Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
36 entries += (*t == '\n');
2798cb65bd90 Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
37 acl_free (text);
2798cb65bd90 Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
38 return entries;
2798cb65bd90 Add limited support for Solaris 10 ZFS-style ACLs: just enough to
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
39 }