summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-06-12 20:18:52 +0200
committerCarl Hetherington <cth@carlh.net>2022-06-12 20:18:52 +0200
commita2d2e96446e35cd0914dfe2ae14e4c61e6b30fcf (patch)
treeaee17417f091ca489cb0f5c73573656858f99ec3
parent6c5328f07362510a41c8518ced62d74b2eff25cc (diff)
Hack sanity check in.
-rw-r--r--tools/dcpverify.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/tools/dcpverify.cc b/tools/dcpverify.cc
index f29393ed..a7dd2cd3 100644
--- a/tools/dcpverify.cc
+++ b/tools/dcpverify.cc
@@ -41,6 +41,8 @@
#include <iostream>
#include <cstdlib>
+#include <libxml/parser.h>
+
using std::cout;
using std::cerr;
using std::string;
@@ -83,6 +85,27 @@ progress ()
int
main (int argc, char* argv[])
{
+ if (argc != 2) {
+ fprintf(stderr, "Syntax: %s <path>\n", argv[0]);
+ exit(EXIT_FAILURE);
+ }
+
+ auto f = fopen(argv[1], "r");
+ if (f == nullptr) {
+ fprintf(stderr, "fopen returned nullptr\n");
+ exit(-1);
+ }
+ char buffer[1];
+ int N = fread(buffer, 1, 1, f);
+ printf("Read %d, errno=%d\n", N, errno);
+ fclose(f);
+
+ auto doc = xmlReadFile(argv[1], nullptr, 0);
+ if (doc == nullptr) {
+ fprintf(stderr, "xmlReadFile failed\n");
+ exit(EXIT_FAILURE);
+ }
+
dcp::init ();
bool ignore_missing_assets = false;