Files
bsdiff/bspatch_main.cc
Alex Deymo ddf9db5293 Update Makefile to build shared libraries.
The Makefile didn't build libbspatch and libbsdiff. This patch includes
those libraries in the Makefile and moves the header files exposed by
those to an include/bsdiff subdirectory following the Android
convention so calling program can include "bsdiff/bspatch.h" avoiding
any collision with other libraries.

The Android.mk is updated to export the new include path while keeping
the old style until calling programs are updated.

The new Makefile allows Chromium OS to build the new libraries.

Bug: None
Test: FEATURES=test emerge-link bsdiff; sudo emerge bsdiff
Test: mmma external/bsdiff

Change-Id: I2ea9251eb224e9418fe236e4c4c9c5621853f590
2017-05-03 18:29:10 -07:00

28 lines
784 B
C++

// Copyright 2015 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <err.h>
#include <stdlib.h>
#include "bsdiff/bspatch.h"
#define USAGE_TEMPLATE_STR \
"usage: %s oldfile newfile patchfile [old-extents new-extents]\n" \
"with extents taking the form \"off_1:len_1,...,off_n:len_n\"\n"
int main(int argc, char* argv[]) {
const char* old_extents = NULL;
const char* new_extents = NULL;
if ((argc != 6) && (argc != 4))
errx(1, USAGE_TEMPLATE_STR, argv[0]);
if (argc == 6) {
old_extents = argv[4];
new_extents = argv[5];
}
return bsdiff::bspatch(argv[1], argv[2], argv[3], old_extents, new_extents);
}