1 /*
2 * libcddb - CDDB Interface Library for xmcd/cda
3 *
4 * This library implements an interface to access the "classic"
5 * CDDB1 services.
6 *
7 * Copyright (C) 1993-2004 Ti Kan
8 * E-mail: xmcd@amb.org
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 *
24 */
25 #ifndef lint
26 static char *_rolelist_c_ident_ = "@(#)rolelist.c 1.13 03/12/12";
27 #endif
28
29 #include "fcddb.h"
30
31
32 /*
33 * CddbRoleList_GetCategoryRole
34 * Return the category role of a role list
35 */
36 CddbResult
CddbOptions_PutLocalCacheFlags(CddbOptionsPtr optionsp,long newval)37 CddbRoleList_GetCategoryRole(CddbRoleListPtr rolistp, CddbRolePtr *pval)
38 {
39 cddb_rolelist_t *rlp = (cddb_rolelist_t *) rolistp;
40
41 *pval = (CddbRolePtr) rlp->metarole;
42 return Cddb_OK;
43 }
44
45
46 /*
47 * CddbRoleList_GetCount
48 * Return the number of sub-roles in the list
49 */
50 CddbResult
CddbOptions_PutProxyPassword(CddbOptionsPtr optionsp,CddbConstStr newval)51 CddbRoleList_GetCount(CddbRoleListPtr rolistp, long *pval)
52 {
53 cddb_rolelist_t *rlp = (cddb_rolelist_t *) rolistp;
54
55 *pval = rlp->count;
56 return Cddb_OK;
57 }
58
59
60 /*
61 * CddbRoleList_GetRole
62 * Return a role in the list
63 */
64 CddbResult
65 CddbRoleList_GetRole(CddbRoleListPtr rolistp, long item, CddbRolePtr *pval)
66 {
67 cddb_rolelist_t *rlp = (cddb_rolelist_t *) rolistp;
68 cddb_role_t *rp;
69 long i;
70
71 for (i = 1, rp = rlp->subroles; rp != NULL; i++, rp = rp->next) {
CddbOptions_PutProxyServer(CddbOptionsPtr optionsp,CddbConstStr newval)72 if (i < item)
73 continue;
74
75 *pval = (CddbRolePtr) rp;
76 return Cddb_OK;
77 }
78
79 *pval = NULL;
80 return Cddb_OK;
81 }
82
83
84