| 1 | /* | 
|---|
| 2 | * CORBA echo tests | 
|---|
| 3 | * | 
|---|
| 4 | * This program is free software; you can redistribute it and/or modify it | 
|---|
| 5 | * under the terms of the GNU General Public License as published by the | 
|---|
| 6 | * Free Software Foundation; either version 2, or (at your option) any | 
|---|
| 7 | * later version. | 
|---|
| 8 | * | 
|---|
| 9 | * This program is distributed in the hope that it will be useful, | 
|---|
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 12 | * GNU General Public License for more details. | 
|---|
| 13 | * | 
|---|
| 14 | * You should have received a copy of the GNU General Public License | 
|---|
| 15 | * along with this program; if not, write to the Free Software Foundation, | 
|---|
| 16 | * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 
|---|
| 17 | * | 
|---|
| 18 | * Author: Elliot Lee <sopwith@redhat.com> | 
|---|
| 19 | */ | 
|---|
| 20 |  | 
|---|
| 21 | #include <stdio.h> | 
|---|
| 22 | #include <stdlib.h> | 
|---|
| 23 | #include <string.h> | 
|---|
| 24 | #include <signal.h> | 
|---|
| 25 | #include "echo.h" | 
|---|
| 26 | #include "echo-share.h" | 
|---|
| 27 |  | 
|---|
| 28 | /*public*/ gboolean echo_opt_quiet = 0; | 
|---|
| 29 |  | 
|---|
| 30 | int | 
|---|
| 31 | main (int argc, char *argv[]) | 
|---|
| 32 | { | 
|---|
| 33 | FILE *iorfile; | 
|---|
| 34 | CORBA_Environment ev; | 
|---|
| 35 | CORBA_ORB orb; | 
|---|
| 36 | Echo echo_client = CORBA_OBJECT_NIL; | 
|---|
| 37 | char *retval; | 
|---|
| 38 |  | 
|---|
| 39 | signal(SIGINT, exit); | 
|---|
| 40 | signal(SIGTERM, exit); | 
|---|
| 41 |  | 
|---|
| 42 | CORBA_exception_init(&ev); | 
|---|
| 43 | orb = CORBA_ORB_init(&argc, argv, "orbit-local-orb", &ev); | 
|---|
| 44 | g_assert(ev._major == CORBA_NO_EXCEPTION); | 
|---|
| 45 |  | 
|---|
| 46 | echo_srv_start_poa(orb, &ev); | 
|---|
| 47 | g_assert(ev._major == CORBA_NO_EXCEPTION); | 
|---|
| 48 | echo_client = echo_srv_start_object(&ev); | 
|---|
| 49 | retval = CORBA_ORB_object_to_string(orb, echo_client, &ev); | 
|---|
| 50 | g_assert(ev._major == CORBA_NO_EXCEPTION); | 
|---|
| 51 |  | 
|---|
| 52 | iorfile = fopen ("echo-server.iorfile", "w"); | 
|---|
| 53 | fprintf(iorfile, "%s\n", retval); | 
|---|
| 54 | fclose(iorfile); | 
|---|
| 55 |  | 
|---|
| 56 | fprintf(stdout, "%s\n", retval); | 
|---|
| 57 |  | 
|---|
| 58 | CORBA_free(retval); | 
|---|
| 59 |  | 
|---|
| 60 | CORBA_ORB_run (orb, &ev); | 
|---|
| 61 |  | 
|---|
| 62 | echo_srv_finish_object(&ev); | 
|---|
| 63 | echo_srv_finish_poa(&ev); | 
|---|
| 64 | CORBA_exception_free(&ev); | 
|---|
| 65 |  | 
|---|
| 66 | return 0; | 
|---|
| 67 | } | 
|---|