* NTLM authentication support with the ntlm library, in Unix systems.
[alpine.git] / pith / copyaddr.c
blobf177aaffb90895742b6beb4060f6b8b30b7d3c2c
1 #if !defined(lint) && !defined(DOS)
2 static char rcsid[] = "$Id: copyaddr.c 761 2007-10-23 22:35:18Z hubert@u.washington.edu $";
3 #endif
5 /*
6 * ========================================================================
7 * Copyright 2013-2017 Eduardo Chappa
8 * Copyright 2006 University of Washington
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
14 * http://www.apache.org/licenses/LICENSE-2.0
16 * ========================================================================
19 #include "../pith/headers.h"
20 #include "../pith/copyaddr.h"
24 * Copy the first address in list a and return it in allocated memory.
26 ADDRESS *
27 copyaddr(struct mail_address *a)
29 ADDRESS *new = NULL;
31 if(a){
32 new = mail_newaddr();
33 if(a->personal)
34 new->personal = cpystr(a->personal);
36 if(a->adl)
37 new->adl = cpystr(a->adl);
39 if(a->mailbox)
40 new->mailbox = cpystr(a->mailbox);
42 if(a->host)
43 new->host = cpystr(a->host);
45 new->next = NULL;
48 return(new);
53 * Copy the whole list a.
55 ADDRESS *
56 copyaddrlist(struct mail_address *a)
58 ADDRESS *new = NULL, *head = NULL, *current;
60 for(; a; a = a->next){
61 new = copyaddr(a);
62 if(!head)
63 head = current = new;
64 else{
65 current->next = new;
66 current = new;
70 return(head);