Alex Deymo | a5cff22 | 2015-04-08 14:10:30 -0700 | [diff] [blame] | 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 | |
Alex Deymo | ddf9db5 | 2017-03-02 16:10:41 -0800 | [diff] [blame] | 8 | #include "bsdiff/bspatch.h" |
Alex Deymo | a5cff22 | 2015-04-08 14:10:30 -0700 | [diff] [blame] | 9 | |
Alex Deymo | e1526cf | 2015-10-12 17:48:28 -0700 | [diff] [blame] | 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" |
Alex Deymo | a5cff22 | 2015-04-08 14:10:30 -0700 | [diff] [blame] | 13 | |
Alex Deymo | e1526cf | 2015-10-12 17:48:28 -0700 | [diff] [blame] | 14 | int main(int argc, char* argv[]) { |
Alex Deymo | a5cff22 | 2015-04-08 14:10:30 -0700 | [diff] [blame] | 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 | |
Alex Deymo | 20891f9 | 2015-10-12 17:28:04 -0700 | [diff] [blame] | 26 | return bsdiff::bspatch(argv[1], argv[2], argv[3], old_extents, new_extents); |
Alex Deymo | a5cff22 | 2015-04-08 14:10:30 -0700 | [diff] [blame] | 27 | } |