4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
28 * Copyright (c) 2013 RackTop Systems.
31 #include <sys/types.h>
34 #include <sys/param.h>
42 static projid_t projlist
[NPROJECTS_MAX
+ 1];
43 static int nproj_max
= NPROJECTS_MAX
;
45 /* Validate a list of projects */
47 valid_lproject(char *list
)
53 struct project projent
;
55 char mybuf
[PROJECT_BUFSZ
];
58 return ((int **)NULL
);
60 while ((ptr
= strtok((i
|| n_invalid
) ? NULL
: list
, ","))) {
62 switch (valid_project(ptr
, &projent
, mybuf
, sizeof (mybuf
),
65 errmsg(M_INVALID
, ptr
, "project id");
69 errmsg(M_TOOBIG
, "projid", ptr
);
73 errmsg(M_PROJ_NOTUSED
, ptr
);
78 /* ignore respecified primary */
79 projlist
[i
++] = projent
.pj_projid
;
81 /* Keep out duplicates */
82 for (j
= 0; j
< i
; j
++)
83 if (projent
.pj_projid
== projlist
[j
])
88 projlist
[i
++] = projent
.pj_projid
;
93 warningmsg(warning
, ptr
);
96 errmsg(M_MAXPROJECTS
, nproj_max
);
101 /* Terminate the list */
107 return ((int **)projlist
);