summaryrefslogtreecommitdiff
path: root/tbdiff_deploy.c
diff options
context:
space:
mode:
authorAlberto <alberto.ruiz@codethink.co.uk>2011-09-30 16:00:35 +0100
committerAlberto <alberto.ruiz@codethink.co.uk>2011-09-30 16:00:35 +0100
commit4fa0b0dbfb90b042a7633d7c69e592263cf2d179 (patch)
tree3e6d85739ec07df3f626d042ba30517f93a294a1 /tbdiff_deploy.c
parentcffbebcd9accf9898315bc281968a89ef5cbd4d3 (diff)
downloadtbdiff-4fa0b0dbfb90b042a7633d7c69e592263cf2d179.tar.gz
No mention to OTAP in the file structure
Diffstat (limited to 'tbdiff_deploy.c')
-rw-r--r--tbdiff_deploy.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/tbdiff_deploy.c b/tbdiff_deploy.c
new file mode 100644
index 0000000..c2d49ec
--- /dev/null
+++ b/tbdiff_deploy.c
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2011 Codethink Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <unistd.h>
+
+#include "otap.h"
+
+#include <errno.h>
+
+int
+main(int argc,
+ char **argv)
+{
+ if(argc < 2) {
+ fprintf(stderr, "Error: No patch stream specified.\n");
+ return EXIT_FAILURE;
+ }
+
+ FILE* patch = fopen(argv[1], "rb");
+ if(patch == NULL) {
+ fprintf(stderr, "Error: Can't open patch stream for reading.\n");
+ return EXIT_FAILURE;
+ }
+
+ int err;
+ if((err = otap_apply(patch)) != 0) {
+ fclose(patch);
+ fprintf(stderr, "Error: Error applying patch stream (err=%d).\n", err);
+ return EXIT_FAILURE;
+ }
+
+ fclose(patch);
+ return EXIT_SUCCESS;
+}