diff options
Diffstat (limited to 'libbb/append_archive_list.c')
-rw-r--r-- | libbb/append_archive_list.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/libbb/append_archive_list.c b/libbb/append_archive_list.c new file mode 100644 index 000000000..c955d08d2 --- /dev/null +++ b/libbb/append_archive_list.c | |||
@@ -0,0 +1,39 @@ | |||
1 | /* | ||
2 | * This program is free software; you can redistribute it and/or modify | ||
3 | * it under the terms of the GNU General Public License as published by | ||
4 | * the Free Software Foundation; either version 2 of the License, or | ||
5 | * (at your option) any later version. | ||
6 | * | ||
7 | * This program is distributed in the hope that it will be useful, | ||
8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
10 | * GNU Library General Public License for more details. | ||
11 | * | ||
12 | * You should have received a copy of the GNU General Public License | ||
13 | * along with this program; if not, write to the Free Software | ||
14 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
15 | */ | ||
16 | |||
17 | #include <stdlib.h> | ||
18 | #include "libbb.h" | ||
19 | |||
20 | file_headers_t *append_archive_list(file_headers_t *head, file_headers_t *tail_entry) | ||
21 | { | ||
22 | file_headers_t *tail_ptr; | ||
23 | file_headers_t *new_node = (file_headers_t *) malloc(sizeof(file_headers_t)); | ||
24 | |||
25 | *new_node = *tail_entry; | ||
26 | new_node->next = NULL; | ||
27 | |||
28 | if (head->name == NULL) { | ||
29 | head = new_node; | ||
30 | } else { | ||
31 | tail_ptr = head; | ||
32 | while(tail_ptr->next != NULL) { | ||
33 | tail_ptr = tail_ptr->next; | ||
34 | } | ||
35 | tail_ptr->next = new_node; | ||
36 | } | ||
37 | |||
38 | return(head); | ||
39 | } \ No newline at end of file | ||