blob: 2a71a1cb151f246c59680ac114af7c2895f111b9 [file] [log] [blame]
Alex Deymoa5cff222015-04-08 14:10:30 -07001// 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 Deymoddf9db52017-03-02 16:10:41 -08008#include "bsdiff/bspatch.h"
Alex Deymoa5cff222015-04-08 14:10:30 -07009
Alex Deymoe1526cf2015-10-12 17:48:28 -070010#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 Deymoa5cff222015-04-08 14:10:30 -070013
Alex Deymoe1526cf2015-10-12 17:48:28 -070014int main(int argc, char* argv[]) {
Alex Deymoa5cff222015-04-08 14:10:30 -070015 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 Deymo20891f92015-10-12 17:28:04 -070026 return bsdiff::bspatch(argv[1], argv[2], argv[3], old_extents, new_extents);
Alex Deymoa5cff222015-04-08 14:10:30 -070027}