summaryrefslogtreecommitdiffstats
path: root/libtar/wrapper.c
diff options
context:
space:
mode:
authorn0d3 <koko1510@gmail.com>2013-03-06 20:14:15 +0100
committerDees_Troy <dees_troy@teamw.in>2013-03-18 18:37:28 +0100
commit3b51163329d24df073610499af4f540c2f0766ed (patch)
treeddf4f8417ff638327e16fab22a8190505d150f30 /libtar/wrapper.c
parentMerge "trying to fix md5 Change-Id: I4ec037f76aa965bc818afe924942adbe9a080b36" into twrp2.4 (diff)
downloadandroid_bootable_recovery-3b51163329d24df073610499af4f540c2f0766ed.tar
android_bootable_recovery-3b51163329d24df073610499af4f540c2f0766ed.tar.gz
android_bootable_recovery-3b51163329d24df073610499af4f540c2f0766ed.tar.bz2
android_bootable_recovery-3b51163329d24df073610499af4f540c2f0766ed.tar.lz
android_bootable_recovery-3b51163329d24df073610499af4f540c2f0766ed.tar.xz
android_bootable_recovery-3b51163329d24df073610499af4f540c2f0766ed.tar.zst
android_bootable_recovery-3b51163329d24df073610499af4f540c2f0766ed.zip
Diffstat (limited to '')
-rw-r--r--libtar/wrapper.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/libtar/wrapper.c b/libtar/wrapper.c
index 116dc28cc..7f65375a0 100644
--- a/libtar/wrapper.c
+++ b/libtar/wrapper.c
@@ -153,3 +153,33 @@ tar_append_tree(TAR *t, char *realdir, char *savedir)
return 0;
}
+
+
+int
+tar_find(TAR *t, char *searchstr)
+{
+ if (!searchstr)
+ return 0;
+
+ char *filename;
+ int i, entryfound = 0;
+#ifdef DEBUG
+ printf("==> tar_find(0x%lx, %s)\n", (long unsigned int)t, searchstr);
+#endif
+ while ((i = th_read(t)) == 0) {
+ filename = th_get_pathname(t);
+ if (fnmatch(searchstr, filename, FNM_FILE_NAME | FNM_PERIOD) == 0) {
+ entryfound++;
+#ifdef DEBUG
+ printf("Found matching entry: %s\n", filename);
+#endif
+ break;
+ }
+ }
+#ifdef DEBUG
+ if (!entryfound)
+ printf("No matching entry found.\n");
+#endif
+
+ return entryfound;
+}