Home | History | Annotate | Download | only in bsdiff
      1 // Copyright 2015 The Chromium OS Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #include <err.h>
      6 #include <stdlib.h>
      7 
      8 #include "bspatch.h"
      9 
     10 #define USAGE_TEMPLATE_STR                                          \
     11   "usage: %s oldfile newfile patchfile [old-extents new-extents]\n" \
     12   "with extents taking the form \"off_1:len_1,...,off_n:len_n\"\n"
     13 
     14 int main(int argc, char* argv[]) {
     15   const char* old_extents = NULL;
     16   const char* new_extents = NULL;
     17 
     18   if ((argc != 6) && (argc != 4))
     19     errx(1, USAGE_TEMPLATE_STR, argv[0]);
     20 
     21   if (argc == 6) {
     22     old_extents = argv[4];
     23     new_extents = argv[5];
     24   }
     25 
     26   return bsdiff::bspatch(argv[1], argv[2], argv[3], old_extents, new_extents);
     27 }
     28