summaryrefslogtreecommitdiffstats
path: root/applypatch/main.c
diff options
context:
space:
mode:
authorDees_Troy <dees_troy@teamw.in>2013-09-04 20:35:08 +0200
committerDees_Troy <dees_troy@teamw.in>2013-09-04 21:00:58 +0200
commit1669f89dd288e2ba226233a7fd62ea78ddb473c1 (patch)
treee6d72d724b31b6fa72e6d273a9c6c8661d5c9c2c /applypatch/main.c
parentInitialize TWPartition::User_Rm_Rf to false in constructor (diff)
parentMerge "Update libpng API usage" (diff)
downloadandroid_bootable_recovery-1669f89dd288e2ba226233a7fd62ea78ddb473c1.tar
android_bootable_recovery-1669f89dd288e2ba226233a7fd62ea78ddb473c1.tar.gz
android_bootable_recovery-1669f89dd288e2ba226233a7fd62ea78ddb473c1.tar.bz2
android_bootable_recovery-1669f89dd288e2ba226233a7fd62ea78ddb473c1.tar.lz
android_bootable_recovery-1669f89dd288e2ba226233a7fd62ea78ddb473c1.tar.xz
android_bootable_recovery-1669f89dd288e2ba226233a7fd62ea78ddb473c1.tar.zst
android_bootable_recovery-1669f89dd288e2ba226233a7fd62ea78ddb473c1.zip
Diffstat (limited to 'applypatch/main.c')
-rw-r--r--applypatch/main.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/applypatch/main.c b/applypatch/main.c
index 7025a2e2e..f61db5d9e 100644
--- a/applypatch/main.c
+++ b/applypatch/main.c
@@ -100,6 +100,21 @@ static int ParsePatchArgs(int argc, char** argv,
}
int PatchMode(int argc, char** argv) {
+ Value* bonus = NULL;
+ if (argc >= 3 && strcmp(argv[1], "-b") == 0) {
+ FileContents fc;
+ if (LoadFileContents(argv[2], &fc, RETOUCH_DONT_MASK) != 0) {
+ printf("failed to load bonus file %s\n", argv[2]);
+ return 1;
+ }
+ bonus = malloc(sizeof(Value));
+ bonus->type = VAL_BLOB;
+ bonus->size = fc.size;
+ bonus->data = (char*)fc.data;
+ argc -= 2;
+ argv += 2;
+ }
+
if (argc < 6) {
return 2;
}
@@ -120,7 +135,7 @@ int PatchMode(int argc, char** argv) {
}
int result = applypatch(argv[1], argv[2], argv[3], target_size,
- num_patches, sha1s, patches);
+ num_patches, sha1s, patches, bonus);
int i;
for (i = 0; i < num_patches; ++i) {
@@ -130,6 +145,10 @@ int PatchMode(int argc, char** argv) {
free(p);
}
}
+ if (bonus) {
+ free(bonus->data);
+ free(bonus);
+ }
free(sha1s);
free(patches);
@@ -163,7 +182,7 @@ int main(int argc, char** argv) {
if (argc < 2) {
usage:
printf(
- "usage: %s <src-file> <tgt-file> <tgt-sha1> <tgt-size> "
+ "usage: %s [-b <bonus-file>] <src-file> <tgt-file> <tgt-sha1> <tgt-size> "
"[<src-sha1>:<patch> ...]\n"
" or %s -c <file> [<sha1> ...]\n"
" or %s -s <bytes>\n"