Add support for tab-completion when selecting by rule
[alpine.git] / pith / copyaddr.c
blob10f060a48abb1e5dcf4fbf616e887b2668841f9a
1 /*
2 * ========================================================================
3 * Copyright 2013-2022 Eduardo Chappa
4 * Copyright 2006 University of Washington
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * ========================================================================
15 #include "../pith/headers.h"
16 #include "../pith/copyaddr.h"
20 * Copy the first address in list a and return it in allocated memory.
22 ADDRESS *
23 copyaddr(struct mail_address *a)
25 ADDRESS *new = NULL;
27 if(a){
28 new = mail_newaddr();
29 if(a->personal)
30 new->personal = cpystr(a->personal);
32 if(a->adl)
33 new->adl = cpystr(a->adl);
35 if(a->mailbox)
36 new->mailbox = cpystr(a->mailbox);
38 if(a->host)
39 new->host = cpystr(a->host);
41 new->next = NULL;
44 return(new);
49 * Copy the whole list a.
51 ADDRESS *
52 copyaddrlist(struct mail_address *a)
54 ADDRESS *new = NULL, *head = NULL, *current = NULL;
56 for(; a; a = a->next){
57 new = copyaddr(a);
58 if(!head)
59 head = current = new;
60 else{
61 current->next = new;
62 current = new;
66 return(head);