Changeset 1833:584162f7ebab for alias.c

Show
Ignore:
Timestamp:
2000-05-20 00:48:26 (9 years ago)
Author:
Thomas Roessler <roessler@…>
Branch:
HEAD
Message:

Add mutt_gecos_name function which centrally handles the GECOS
processing.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • alias.c

    r1603 r1833  
    2121#include "mutt_curses.h" 
    2222 
    23 #include <pwd.h> 
    2423#include <string.h> 
    2524 
     
    8786        if (pw) 
    8887        { 
    89            regmatch_t pat_match[1]; 
    90  
    91            /* Use regular expression to parse Gecos field.  This result of the 
    92             * parsing will be used as the personal ID string when the alias is 
    93             * expanded. 
    94             */ 
    95           if (regexec (GecosMask.rx, pw->pw_gecos, 1, pat_match, 0) == 0) 
    96           { 
    97             /* Malloc enough for the matching pattern + terminating NULL */ 
    98             a->personal = safe_malloc ((pat_match[0].rm_eo -  
    99                                         pat_match[0].rm_so) + 1); 
    100              
    101             strfcpy (a->personal, pw->pw_gecos + pat_match[0].rm_so,  
    102                      pat_match[0].rm_eo - pat_match[0].rm_so + 1); 
    103           } 
    104  
     88          char namebuf[STRING]; 
     89           
     90          mutt_gecos_name (namebuf, sizeof (namebuf), pw); 
     91          mutt_str_replace (&a->personal, namebuf); 
     92           
    10593#ifdef EXACT_ADDRESS 
    10694          FREE (&a->val);