-rw-r--r-- | test/idiscover.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/test/idiscover.cc b/test/idiscover.cc index 4b1e90c..8a5a3fb 100644 --- a/test/idiscover.cc +++ b/test/idiscover.cc | |||
@@ -1,41 +1,42 @@ | |||
1 | #include <iostream> | 1 | #include <iostream> |
2 | #include <stdexcept> | 2 | #include <stdexcept> |
3 | #include <iterator> | 3 | #include <iterator> |
4 | #include <algorithm> | 4 | #include <algorithm> |
5 | #include <unistd.h> | ||
5 | using namespace std; | 6 | using namespace std; |
6 | #include <opkele/exception.h> | 7 | #include <opkele/exception.h> |
7 | #include <opkele/discovery.h> | 8 | #include <opkele/discovery.h> |
8 | #include <opkele/util.h> | 9 | #include <opkele/util.h> |
9 | #include <opkele/util-internal.h> | 10 | #include <opkele/util-internal.h> |
10 | 11 | ||
11 | namespace opkele { | 12 | namespace opkele { |
12 | ostream& operator<<(ostream& o,const opkele::openid_endpoint_t& oep) { | 13 | ostream& operator<<(ostream& o,const opkele::openid_endpoint_t& oep) { |
13 | o | 14 | o |
14 | << " URI: " << oep.uri << endl | 15 | << " URI: " << oep.uri << endl |
15 | << " Claimed ID: " << oep.claimed_id << endl | 16 | << " Claimed ID: " << oep.claimed_id << endl |
16 | << " Local ID: " << oep.local_id << endl; | 17 | << " Local ID: " << oep.local_id << endl; |
17 | return o; | 18 | return o; |
18 | } | 19 | } |
19 | } | 20 | } |
20 | 21 | ||
21 | int main(int argc,char **argv) { | 22 | int main(int argc,char **argv) { |
22 | try { | 23 | try { |
23 | if(argc<2) | 24 | if(argc<2) |
24 | throw opkele::exception(OPKELE_CP_ "Please, give me something to resolve"); | 25 | throw opkele::exception(OPKELE_CP_ "Please, give me something to resolve"); |
25 | for(int a=1;a<argc;++a) { | 26 | for(int a=1;a<argc;++a) { |
26 | cout << "==============================================================" << endl | 27 | cout << "==============================================================" << endl |
27 | << "User-supplied ID: " << argv[a] << endl | 28 | << "User-supplied ID: " << argv[a] << endl |
28 | << "Endpoints:" << endl | 29 | << "Endpoints:" << endl |
29 | << " --" << endl; | 30 | << " --" << endl; |
30 | string normalized = opkele::idiscover( | 31 | string normalized = opkele::idiscover( |
31 | ostream_iterator<opkele::openid_endpoint_t>(cout," --\n") | 32 | ostream_iterator<opkele::openid_endpoint_t>(cout," --\n") |
32 | ,argv[a]); | 33 | ,argv[a]); |
33 | cout << "Normalized ID: " << normalized << endl; | 34 | cout << "Normalized ID: " << normalized << endl; |
34 | } | 35 | } |
35 | }catch(exception& e) { | 36 | }catch(exception& e) { |
36 | cerr << "oops, caught " << opkele::util::abi_demangle(typeid(e).name()) << endl | 37 | cerr << "oops, caught " << opkele::util::abi_demangle(typeid(e).name()) << endl |
37 | << " .what(): " << e.what() << endl; | 38 | << " .what(): " << e.what() << endl; |
38 | _exit(1); | 39 | _exit(1); |
39 | } | 40 | } |
40 | _exit(0); | 41 | _exit(0); |
41 | } | 42 | } |