/* Bunch of low level function for managing interface names. Compare two interface names, with wildcards. We can't use fnmatch() because we don't want expansion of '' expressions, '\' sequences and matching of '.'. We only want to match a single '*' (converted to a d at that point) to a numerical value (no ascii). Return 0 is matches.  */
static int if_match_ifname(const char *pattern, const char *value)
/* Bunch of low level function for managing interface names. Compare two interface names, with wildcards. We can't use fnmatch() because we don't want expansion of '' expressions, '\' sequences and matching of '.'. We only want to match a single '*' (converted to a d at that point) to a numerical value (no ascii). Return 0 is matches.  */
static int if_match_ifname(const char *pattern, const char *value)
{
  const char *	p;
  const char *	v;
  int		n;
  int		ret;
  p = strchr(pattern, '*');
  if(p == NULL)
    return(strcmp(pattern, value));
  n = (p - pattern);
  ret = strncmp(pattern, value, n);
  if(ret)
    return(ret);
  v = value + n;
  if(!isdigit(*v))
    return(-1);
  do
    v++;
  while(isdigit(*v));
  p += 1;
  return(strcmp(p, v));
}