mirror of
git://sourceware.org/git/glibc.git
synced 2024-12-09 04:11:27 +08:00
7440c23e03
* include/libc-symbols.h: Define hidden attribute macros for libnsl. * include/rpcsvc/nislib.h: Use libnsl_hidden_proto for various functions. * nis/nis_add.c: Add libnsl_hidden_def. Minor optimizations. * nis/nis_call.c: Likewise. * nis/nis_clone_obj.c: Likewise. * nis/nis_defaults.c: Likewise. * nis/nis_domain_of_r.c: Likewise. * nis/nis_error.c: Likewise. * nis/nis_file.c: Likewise. * nis/nis_free.c: Likewise. * nis/nis_local_names.c: Likewise. * nis/nis_lookup.c: Likewise. * nis/nis_modify.c: Likewise. * nis/nis_print.c: Likewise. * nis/nis_remove.c: Likewise. * nis/nis_subr.c: Likewise. * nis/nis_table.c: Likewise. * nis/nis_util.c: Likewise. * nis/yp_xdr.c: Likewise. * nis/ypclnt.c: Likewise. * nis/ypupdate_xdr.c: Likewise.
58 lines
1.5 KiB
C
58 lines
1.5 KiB
C
/* Copyright (c) 1997, 2004 Free Software Foundation, Inc.
|
|
This file is part of the GNU C Library.
|
|
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Lesser General Public
|
|
License as published by the Free Software Foundation; either
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
License along with the GNU C Library; if not, write to the Free
|
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
02111-1307 USA. */
|
|
|
|
#include <errno.h>
|
|
#include <string.h>
|
|
#include <rpcsvc/nis.h>
|
|
|
|
nis_name
|
|
nis_domain_of_r (const_nis_name name, char *buffer, size_t buflen)
|
|
{
|
|
char *cptr;
|
|
size_t cptr_len;
|
|
|
|
if (buffer == NULL)
|
|
{
|
|
__set_errno (ERANGE);
|
|
return NULL;
|
|
}
|
|
|
|
buffer[0] = '\0';
|
|
|
|
cptr = strchr (name, '.');
|
|
|
|
if (cptr == NULL)
|
|
return buffer;
|
|
|
|
++cptr;
|
|
cptr_len = strlen (cptr);
|
|
|
|
if (cptr_len == 0)
|
|
return strcpy (buffer, ".");
|
|
|
|
if (__builtin_expect (cptr_len >= buflen, 0))
|
|
{
|
|
__set_errno (ERANGE);
|
|
return NULL;
|
|
}
|
|
|
|
return memcpy (buffer, cptr, cptr_len + 1);
|
|
}
|
|
libnsl_hidden_proto (nis_domain_of_r)
|