2 #include <zypp/CpeId.h>
3 #include <zypp/Pathname.h>
10 int main( int argc, const char * argv[] )
12 if ( argc == 1 || argv[1] == std::string( "--help" ) || argv[1] == std::string( "-h" ) )
15 "Usage: " << Pathname::basename( argv[0] ) << " [CPEID]...\n"
16 "Check and print all supplied CPEIDs as FS, URI and WFN.\n"
17 "Afterwards compare them pairwise. \n"
19 " (wfn:[part=\"a\",vendor=\"openSUSE\",product=\"libzypp\",version=\"14\\.17\\.3\"])\n"
20 " URI: cpe:/a:openSUSE:libzypp:14.17.3\n"
21 " FS: cpe:2.3:a:openSUSE:libzypp:14.17.3:*:*:*:*:*:*:*\n"
29 std::vector<CpeId> args;
32 for ( ; argc; --argc, ++argv )
36 cout << '[' << args.size() << "]-----------------------------------------------------------------------------" << endl;
37 cout << "arg: " << argv[0] << endl;
38 cout << " (" << cpe.asWfn() << ')' << endl;
39 cout << "URI: " << cpe.asUri() << endl;
40 cout << "FS: " << cpe<< endl;
41 args.push_back( cpe );
43 catch ( const std::invalid_argument & exp )
45 cout << "--------------------------------------------------------------------------------" << endl;
46 cout << "arg: " << argv[0] << endl;
47 cout << "ERR: " << exp.what() << endl;
51 cout << "--------------------------------------------------------------------------------" << endl;
53 for ( const auto & lhs : args )
56 for ( const auto & rhs : args )
58 cout << "[" << lhsidx << "] " << lhs << endl;
59 cout << "[" << rhsidx << "] " << rhs << endl;
60 cout << " ==> " << compare( lhs, rhs ) << endl;