/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*
* files/bootparams_getbyname.c -- "files" backend for
* nsswitch "bootparams" database.
*/
#include "files_common.h"
#include <stdlib.h>
#include <ctype.h>
#include <strings.h>
nss_XbyY_args_t *, const char *);
static nss_status_t
void *a;
{
return (res);
}
}
};
/*ARGSUSED*/
{
return (_nss_files_constr(bootparams_ops,
sizeof (bootparams_ops) / sizeof (bootparams_ops[0]),
NULL, 0));
}
/*
* bootparams has the hostname as part of the data in the file, but the other
* backends don't include it in the data passed to the backend. For this
* reason, we process everything here and don't bother calling the backend.
*/
/*ARGSUSED*/
static nss_status_t
const char *filter;
/*
* filter not useful here since the key
* we are looking for is the first "word"
* on the line and we can be fast enough.
*/
{
(void) _nss_files_endent(be, 0);
return (NSS_UNAVAIL); /* really panic, malloc failed */
}
res = NSS_NOTFOUND;
/*CONSTCOND*/
while (1) {
int linelen;
/*
* _nss_files_read_line does process the '\' that are used
* in /etc/bootparams for continuation and gives one long
* buffer.
*
* linelen counts the characters up to but excluding the '\n'
*/
/* End of file */
break;
}
/*
* we need to strip off the host name before returning it.
*/
p = instr;
/* Skip over leading whitespace */
p++;
}
host = p;
/* Skip over the hostname */
p++;
}
*p++ = '\0';
continue;
}
/* Skip over whitespace between name and first datum */
p++;
}
if (p >= limit) {
/* Syntax error -- no data! Just skip it. */
continue;
}
break;
}
res = NSS_SUCCESS;
break;
}
(void) _nss_files_endent(be, 0);
return (res);
}