print_search_path (struct r_search_path_elem **list,
                   const char *what, const char *name)
{
  char buf[max_dirnamelen + max_capstrlen];
  int first = 1;

  _dl_debug_message (1, " search path=", NULL);

  while (*list != NULL && (*list)->what == what) /* Yes, ==.  */
    {
      char *endp = __mempcpy (buf, (*list)->dirname, (*list)->dirnamelen);
      size_t cnt;

      for (cnt = 0; cnt < ncapstr; ++cnt)
	if ((*list)->status[cnt] != nonexisting)
	  {
	    char *cp = __mempcpy (endp, capstr[cnt].str, capstr[cnt].len);
	    if (cp == buf || (cp == buf + 1 && buf[0] == '/'))
	      cp[0] = '\0';
	    else
	      cp[-1] = '\0';
	    _dl_debug_message (0, first ? "" : ":", buf, NULL);
	    first = 0;
	  }

      ++list;
    }

  if (name != NULL)
    _dl_debug_message (0, "\t\t(", what, " from file ",
			name[0] ? name : _dl_argv[0], ")\n", NULL);
  else
    _dl_debug_message (0, "\t\t(", what, ")\n", NULL);
}
print_search_path (struct r_search_path_elem **list,
                   const char *what, const char *name)
{
  char buf[max_dirnamelen + max_capstrlen];
  int first = 1;

  _dl_debug_message (1, " search path=", NULL);

  while (*list != NULL && (*list)->what == what)  
    {
      char *endp = __mempcpy (buf, (*list)->dirname, (*list)->dirnamelen);
      size_t cnt;

      for (cnt = 0; cnt < ncapstr; ++cnt)
	if ((*list)->status[cnt] != nonexisting)
	  {
	    char *cp = __mempcpy (endp, capstr[cnt].str, capstr[cnt].len);
	    if (cp == buf || (cp == buf + 1 && buf[0] == '/'))
	      cp[0] = '\0';
	    else
	      cp[-1] = '\0';
	    _dl_debug_message (0, first ? "" : ":", buf, NULL);
	    first = 0;
	  }

      ++list;
    }

  if (name != NULL)
    _dl_debug_message (0, "\t\t(", what, " from file ",
			name[0] ? name : _dl_argv[0], ")\n", NULL);
  else
    _dl_debug_message (0, "\t\t(", what, ")\n", NULL);
}