summaryrefslogtreecommitdiff
path: root/dviware/quicspool/src/profile.c
blob: 7f6440c5398a9891f61f3a6aea999e05007a9cda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef lint
static char *rcs = "$Header: profile.c,v 1.1 88/01/15 13:05:09 simpson Rel $";
#endif
/*
$Log:	profile.c,v $
 * Revision 1.1  88/01/15  13:05:09  simpson
 * initial release
 * 
 * Revision 0.1  87/12/11  18:31:15  simpson
 * beta test
 * 
*/
/* Profile(3) related routines */

#include <stdio.h>
#include <local/profile.h>

/* Returns the value of a binding in the configuration stanza with the key
 * equal to the formal parameter name.  It returns NULL if unsuccessful.
 */
PROFILE_VALUE *getbindingvalue(key)
char	*key;
{
    FILE			*config;
    static PROFILE_STANZA	*s;
    PROFILE_BINDING		*b;

    if (!s)
    	if (config = fopen("configuration", "r")) {
	    if (!(s = profile_read_stanza(config))) {
		(void)fclose(config);
		return NULL;
	    }
	    (void)fclose(config);
	} else
	    return NULL;
    if (b = profile_has_binding(s, key))
    	return b->value;
    return NULL;
}