MCPcopy Create free account
hub / github.com/Exiv2/exiv2 / main

Function main

samples/conntest.cpp:75–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73#endif
74
75int main(int argc, const char** argv) {
76 Exiv2::XmpParser::initialize();
77 ::atexit(Exiv2::XmpParser::terminate);
78
79 if (argc < 2) {
80 std::cout << "Usage: " << argv[0] << " url {-http1_0}" << std::endl;
81 return EXIT_FAILURE;
82 }
83 std::string url(argv[1]);
84 Exiv2::Protocol prot = Exiv2::fileProtocol(url);
85
86 bool useHttp1_0 = false;
87 for (int a = 1; a < argc; a++) {
88 std::string arg(argv[a]);
89 if (arg == "-http1_0")
90 useHttp1_0 = true;
91 }
92
93 bool isOk = false;
94 try {
95#ifdef EXV_USE_CURL
96 if (prot == Exiv2::pHttp || prot == Exiv2::pHttps || prot == Exiv2::pFtp) {
97 curlcon(url, useHttp1_0);
98 isOk = true;
99 }
100#endif
101 if (!isOk && prot == Exiv2::pHttp) {
102 httpcon(url, useHttp1_0);
103 isOk = true;
104 }
105 } catch (const Exiv2::Error& e) {
106 std::cout << "Error: '" << e << "'" << std::endl;
107 return EXIT_FAILURE;
108 }
109
110 if (!isOk)
111 std::cout << "The protocol is unsupported." << std::endl;
112 else
113 std::cout << "OK." << std::endl;
114 return EXIT_SUCCESS;
115}
116
117// That's all Folks!

Callers

nothing calls this directly

Calls 3

fileProtocolFunction · 0.85
curlconFunction · 0.85
httpconFunction · 0.85

Tested by

no test coverage detected