list.c (77274) | list.c (88150) |
---|---|
1/* 2 * Copyright (c) 1980, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 19 unchanged lines hidden (view full) --- 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 */ 33 34#ifndef lint 35#if 0 | 1/* 2 * Copyright (c) 1980, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 19 unchanged lines hidden (view full) --- 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 */ 33 34#ifndef lint 35#if 0 |
36static char sccsid[] = "@(#)list.c 8.2 (Berkeley) 4/19/94"; | 36static char sccsid[] = "@(#)list.c 8.4 (Berkeley) 5/1/95"; |
37#endif 38static const char rcsid[] = | 37#endif 38static const char rcsid[] = |
39 "$FreeBSD: head/usr.bin/mail/list.c 77274 2001-05-27 20:26:22Z mikeh $"; | 39 "$FreeBSD: head/usr.bin/mail/list.c 88150 2001-12-18 20:52:09Z mikeh $"; |
40#endif /* not lint */ 41 42#include "rcv.h" 43#include <ctype.h> 44#include "extern.h" 45 46/* 47 * Mail -- a mail program --- 634 unchanged lines hidden (view full) --- 682 cp2 = ++backup; 683 cp = str; 684 } 685 } 686 return (*cp == '\0'); 687} 688 689/* | 40#endif /* not lint */ 41 42#include "rcv.h" 43#include <ctype.h> 44#include "extern.h" 45 46/* 47 * Mail -- a mail program --- 634 unchanged lines hidden (view full) --- 682 cp2 = ++backup; 683 cp = str; 684 } 685 } 686 return (*cp == '\0'); 687} 688 689/* |
690 * See if the passed name received the passed message number. Return true 691 * if so. 692 */ 693 694static char *to_fields[] = { "to", "cc", "bcc", NULL }; 695 696int 697matchto(str, mesg) 698 char *str; 699 int mesg; 700{ 701 struct message *mp; 702 char *cp, *cp2, *backup, **to; 703 704 str++; 705 706 /* null string matches nothing instead of everything */ 707 if (*str == '\0') 708 return (0); 709 710 mp = &message[mesg - 1]; 711 712 for (to = to_fields; *to != NULL; to++) { 713 cp = str; 714 cp2 = hfield(*to, mp); 715 if (cp2 != NULL) { 716 backup = cp2; 717 while (*cp2 != '\0') { 718 if (*cp == '\0') 719 return (1); 720 if (toupper(*cp++) != toupper(*cp2++)) { 721 cp2 = ++backup; 722 cp = str; 723 } 724 } 725 if (*cp == '\0') 726 return (1); 727 } 728 } 729 return (0); 730} 731 732/* |
|
690 * See if the given string matches inside the subject field of the 691 * given message. For the purpose of the scan, we ignore case differences. 692 * If it does, return true. The string search argument is assumed to 693 * have the form "/search-string." If it is of the form "/," we use the 694 * previous search string. 695 */ 696 697char lastscan[STRINGLEN]; --- 12 unchanged lines hidden (view full) --- 710 strlcpy(lastscan, str, sizeof(lastscan)); 711 mp = &message[mesg-1]; 712 713 /* 714 * Now look, ignoring case, for the word in the string. 715 */ 716 717 if (value("searchheaders") && (cp = strchr(str, ':')) != NULL) { | 733 * See if the given string matches inside the subject field of the 734 * given message. For the purpose of the scan, we ignore case differences. 735 * If it does, return true. The string search argument is assumed to 736 * have the form "/search-string." If it is of the form "/," we use the 737 * previous search string. 738 */ 739 740char lastscan[STRINGLEN]; --- 12 unchanged lines hidden (view full) --- 753 strlcpy(lastscan, str, sizeof(lastscan)); 754 mp = &message[mesg-1]; 755 756 /* 757 * Now look, ignoring case, for the word in the string. 758 */ 759 760 if (value("searchheaders") && (cp = strchr(str, ':')) != NULL) { |
761 /* Check for special case "/To:" */ 762 if (strncasecmp(str, "To:", 3) == 0) 763 return (matchto(cp, mesg)); |
|
718 *cp++ = '\0'; | 764 *cp++ = '\0'; |
719 cp2 = hfield(str, mp); | 765 cp2 = hfield(*str != '\0' ? str : "subject", mp); |
720 cp[-1] = ':'; 721 str = cp; 722 } else { 723 cp = str; 724 cp2 = hfield("subject", mp); 725 } 726 if (cp2 == NULL) 727 return (0); --- 90 unchanged lines hidden --- | 766 cp[-1] = ':'; 767 str = cp; 768 } else { 769 cp = str; 770 cp2 = hfield("subject", mp); 771 } 772 if (cp2 == NULL) 773 return (0); --- 90 unchanged lines hidden --- |