/* * FILE: * myquery.c * * FUNCTION: * Sample usage of the oaf query function. * Also shows how to handle corba lists. * * HISTORY: * (c) 2001 Linas Vepstas */ #include #include #include main (int argc, char **argv) { int i; OAF_ServerInfoList *slist; OAF_ServerInfo *srv; char * q; CORBA_Environment ev; CORBA_exception_init (&ev); if (FALSE == oaf_is_initialized()) { oaf_init (argc, argv); } q = "repo_ids.has('IDL:Bonobo/Unknown:1.0')"; q = "repo_ids.has('IDL:Dohh/Echo:1.0')"; q = "repo_ids.has('IDL:GNOME/ObjectFactory:1.0')"; CORBA_exception_init (&ev); slist = oaf_query (q, NULL, &ev); if (ev._major != CORBA_NO_EXCEPTION) { printf ("Error: can't get list: %s\n", CORBA_exception_id (&ev)); CORBA_exception_free (&ev); } printf ("duude received a server info ist of length=%d max=%d\n", slist->_length, slist->_maximum); for (i=0; i_length; i++) { srv = &slist->_buffer[i]; printf ("\nduude server %d addr=%p\n", i, srv); printf ("duude server iid=%s \n", srv->iid); printf ("duude server type=%s location=%s host=%s\n", srv->server_type, srv->location_info, srv->hostname); printf ("duude server username=%s domain=%s\n", srv->username, srv->domain); } }