strncpy (buffer, name, i); buffer[i] = 0;
*((char *) __mempcpy (buffer, name, i)) = '\0';
nis_leaf_of_r (const_nis_name name, char *buffer, size_t buflen){  size_t i = 0;  buffer[0] = '\0';  while (name[i] != '.' && name[i] != '\0')    i++;  if (i > buflen - 1)    {      errno = ERANGE;      return NULL;    }  if (i > 0)    {      if ((size_t)i >= buflen)	{	  errno = ERANGE;	  return NULL;	}      strncpy (buffer, name, i);      buffer[i] = 0;    }  return buffer;}