mirror of
https://github.com/sheumann/hush.git
synced 2024-10-29 20:27:40 +00:00
9f153f610f
fix bug in map_block2: s/(blknr >= 256 * 256)/(blknr < 256 * 256)/ function old new delta get_inode_common - 291 +291 add_zone_common - 205 +205 ask 229 215 -14 write_super_block 109 90 -19 write_block 653 629 -24 bad_zone 95 64 -31 read_block 241 198 -43 fsck_minix_main 3285 3195 -90 add_zone2 217 34 -183 add_zone 216 33 -183 recursive_check 1097 866 -231 recursive_check2 1340 956 -384 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 0/10 up/down: 496/-1202) Total: -706 bytes text data bss dec hex filename 799349 661 7428 807438 c520e busybox_old 798437 661 7428 806526 c4e7e busybox_unstripped
55 lines
1.1 KiB
C
55 lines
1.1 KiB
C
/* vi: set sw=4 ts=4: */
|
|
/*
|
|
* Copyright (C) 2002 by Glenn McGrath
|
|
*
|
|
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
|
*/
|
|
|
|
#include <fnmatch.h>
|
|
#include "libbb.h"
|
|
#include "unarchive.h"
|
|
|
|
/* Find a string in a shell pattern list */
|
|
const llist_t *find_list_entry(const llist_t *list, const char *filename)
|
|
{
|
|
while (list) {
|
|
if (fnmatch(list->data, filename, 0) == 0) {
|
|
return list;
|
|
}
|
|
list = list->link;
|
|
}
|
|
return NULL;
|
|
}
|
|
|
|
/* Same, but compares only path components present in pattern
|
|
* (extra trailing path components in filename are assumed to match)
|
|
*/
|
|
const llist_t *find_list_entry2(const llist_t *list, const char *filename)
|
|
{
|
|
char buf[PATH_MAX];
|
|
int pattern_slash_cnt;
|
|
const char *c;
|
|
char *d;
|
|
|
|
while (list) {
|
|
c = list->data;
|
|
pattern_slash_cnt = 0;
|
|
while (*c)
|
|
if (*c++ == '/') pattern_slash_cnt++;
|
|
c = filename;
|
|
d = buf;
|
|
/* paranoia is better than buffer overflows */
|
|
while (*c && d != buf + sizeof(buf)-1) {
|
|
if (*c == '/' && --pattern_slash_cnt < 0)
|
|
break;
|
|
*d++ = *c++;
|
|
}
|
|
*d = '\0';
|
|
if (fnmatch(list->data, buf, 0) == 0) {
|
|
return list;
|
|
}
|
|
list = list->link;
|
|
}
|
|
return NULL;
|
|
}
|