1
/* $Xorg: config.c,v 1.4 2001/02/09 02:05:34 xorgcvs Exp $ */
4
Copyright 1996, 1998 The Open Group
6
Permission to use, copy, modify, distribute, and sell this software and its
7
documentation for any purpose is hereby granted without fee, provided that
8
the above copyright notice appear in all copies and that both that
9
copyright notice and this permission notice appear in supporting
12
The above copyright notice and this permission notice shall be included
13
in all copies or substantial portions of the Software.
15
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
19
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21
OTHER DEALINGS IN THE SOFTWARE.
23
Except as contained in this notice, the name of The Open Group shall
24
not be used in advertising or otherwise to promote the sale, use or
25
other dealings in this Software without prior written authorization
28
/* $XFree86: xc/programs/proxymngr/config.c,v 1.7 2001/12/14 20:01:01 dawes Exp $ */
54
*pbuf = (char *) realloc (*pbuf, *plen + 1);
56
*pbuf = (char *) malloc (*plen + 1);
58
fprintf (stderr, "Memory allocation failure reading config file\n");
76
#ifdef NEED_STRCASECMP
78
ncasecmp (str1, str2, n)
82
char buf1[512],buf2[512];
86
for (i=0, s = buf1; i < n && (c = *str1++); i++) {
94
for (i=0, s = buf2; i < n && (c = *str2++); i++) {
102
return (strncmp(buf1, buf2, n));
104
#endif /* NEED_STRCASECMP */
121
*startCommand = *proxyAddress = NULL;
123
fp = fopen (configFile, "r");
130
n = strlen (serviceName);
132
while (!found && getnextline (&buf, &buflen, fp))
137
if (!(ncasecmp (buf, serviceName, n) == 0 && buf[n] == ' '))
140
/* found the right config line */
144
if (ncasecmp (p, "managed", 7) == 0)
149
else if (ncasecmp (p, "unmanaged", 9) == 0)
156
fprintf (stderr, "Error in config file at line \"%s\"\n", buf);
166
*startCommand = (char *) malloc (n + 2);
167
if (! *startCommand) {
169
"Memory allocation failed for service \"%s\"\n",
173
strcpy (*startCommand, p);
174
(*startCommand)[n] = '&';
175
(*startCommand)[n + 1] = '\0';
179
*proxyAddress = (char *) malloc (strlen (p) + 1);
180
if (! *proxyAddress) {
182
"Memory allocation failed for service \"%s\" at %s\n",
186
strcpy (*proxyAddress, p);