Changeset 1411:6bd74b844e23
- Timestamp:
- 1999-12-04 01:37:20 (9 years ago)
- Author:
- Thomas Roessler <roessler@…>
- Branch:
- HEAD
- Message:
-
William Feavish's GECOS regexp patch.
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r1374
|
r1411
|
|
| 84 | 84 | { |
| 85 | 85 | struct passwd *pw = getpwnam (a->mailbox); |
| 86 | | char buffer[256], *p; |
| 87 | 86 | |
| 88 | 87 | if (pw) |
| 89 | 88 | { |
| 90 | | strfcpy (buffer, pw->pw_gecos, sizeof (buffer)); |
| 91 | | if ((p = strchr (buffer, ','))) |
| 92 | | *p = 0; |
| 93 | | a->personal = safe_strdup (buffer); |
| | 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 | * expaned. |
| | 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 | |
| 94 | 105 | #ifdef EXACT_ADDRESS |
| 95 | 106 | FREE (&a->val); |
-
|
r1409
|
r1411
|
|
| 531 | 531 | ** can be overridden using my_hdr (including from send-hooks) and |
| 532 | 532 | ** ``$reverse_name''. |
| | 533 | */ |
| | 534 | { "gecos_mask", DT_RX, R_NONE, UL &GecosMask, UL "^[^,]*" }, |
| | 535 | /* |
| | 536 | ** .pp |
| | 537 | ** A regular expression used by mutt to parse the GECOS field of a password |
| | 538 | ** entry when expanding the alias. By default the regular expression is set |
| | 539 | ** to "^[^,]*" which will return the string up to the first "," encountered. |
| | 540 | ** If the GECOS field contains a string like "lastname, firstname" then you |
| | 541 | ** should set the gecos_regexp=".*". |
| 533 | 542 | */ |
| 534 | 543 | { "hdr_format", DT_SYN, R_NONE, UL "index_format", 0 }, |
-
|
r703
|
r1411
|
|
| 52 | 52 | WHERE REGEXP ReplyRegexp; |
| 53 | 53 | WHERE REGEXP Smileys; |
| | 54 | WHERE REGEXP GecosMask; |
| 54 | 55 | |
| 55 | 56 | #endif /* MUTT_REGEX_H */ |