4 * Copyright (c) 2005 by Judd Vinet <jvinet@zeroflux.org>
5 * Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
6 * Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
7 * Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
32 #include "alpm_list.h"
36 /* Look for a filename in a pmpkg_t.backup list. If we find it,
37 * then we return the md5 or sha1 hash (parsed from the same line)
39 char *_alpm_needbackup(const char *file
, alpm_list_t
*backup
)
45 if(file
== NULL
|| backup
== NULL
) {
49 /* run through the backup list and parse out the md5 or sha1 hash for our file */
50 for(lp
= backup
; lp
; lp
= lp
->next
) {
51 char *str
= strdup(lp
->data
);
55 ptr
= strchr(str
, '\t');
62 /* now str points to the filename and ptr points to the md5 or sha1 hash */
63 if(strcmp(file
, str
) == 0) {
64 char *hash
= strdup(ptr
);
74 /* vim: set ts=2 sw=2 noet: */