Changeset 705:44ec217adfaa for attach.c

Show
Ignore:
Timestamp:
1999-01-07 01:57:04 (10 years ago)
Author:
Thomas Roessler <roessler@…>
Branch:
HEAD
Message:

Merge in the mailcap patch from stable.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • attach.c

    r703 r705  
    277277} 
    278278 
     279 
     280/* for compatibility with metamail */ 
     281static int is_mmnoask (const char *buf) 
     282{ 
     283  char tmp[LONG_STRING], *p, *q; 
     284  int lng; 
     285 
     286  if ((p = getenv ("MM_NOASK")) != NULL && *p) 
     287  { 
     288    if (mutt_strcmp (p, "1") == 0) 
     289      return (1); 
     290 
     291    strfcpy (tmp, p, sizeof (tmp)); 
     292    p = tmp; 
     293 
     294    while ((p = strtok (p, ",")) != NULL) 
     295    { 
     296      if ((q = strrchr (p, '/')) != NULL) 
     297      { 
     298        if (*(q+1) == '*') 
     299        { 
     300          if (mutt_strncasecmp (buf, p, q-p) == 0) 
     301            return (1); 
     302        } 
     303        else 
     304        { 
     305          if (mutt_strcasecmp (buf, p) == 0) 
     306            return (1); 
     307        } 
     308      } 
     309      else 
     310      { 
     311        lng = mutt_strlen (p); 
     312        if (buf[lng] == '/' && mutt_strncasecmp (buf, p, lng) == 0) 
     313          return (1); 
     314      } 
     315 
     316      p = NULL; 
     317    } 
     318  } 
     319 
     320  return (0); 
     321} 
     322 
    279323int mutt_is_autoview (char *type) 
    280324{ 
     
    282326  int i; 
    283327 
     328  if (option (OPTIMPLICITAUTOVIEW)) 
     329    return 1; 
     330 
     331  if (is_mmnoask (type)) 
     332    return 1; 
     333   
    284334  while (t) 
    285335  {