#ifdef AIX_PROD
/* @(#)27    1.5  src/examples/pubsex/greet/greet_ep/client.c, examples.src, os2dce21.dss, 960602a.1 1/11/96 10:58:08 */
/*
 *   COMPONENT_NAME: examples.src
 *
 *   FUNCTIONS: main
 *
 *   ORIGINS: 72
 *
 */
#endif /* AIX_PROD */

#include <stdlib.h>
#include <stdio.h>
#include <dce/dce_error.h>
#include "greet.h"

int main(int ac, char *av[])
{
    handle_t                 h;
    error_status_t           st;
    idl_char                 *string_binding;
    int                      i, MAX_PASS, error_inq_st;
    char                     reply[STR_SZ], error_string[1024];

    if (ac != 3)  {
        fprintf(stderr, "Usage: %s address passes\n", av[0]);
        exit (1);
    }

    string_binding = (idl_char *) av[1];

    rpc_binding_from_string_binding(string_binding, &h, &st);
    if (st != error_status_ok)  {
         dce_error_inq_text(st, error_string, &error_inq_st);
         fprintf(stderr, "Cannot get binding from string binding %s - %s\n",
                string_binding, error_string);
         exit(1);
    }

    printf("Bound to %s\n",string_binding);
    fflush (stdout);

    MAX_PASS= atoi(av[2]);

         for (i=1; i <= MAX_PASS; i++) {
           /*  reply[0] = '\0'; */
             greet_rpc(h, "Hello Server !", reply);
             printf("The Greet Server said: %s\n", reply);
             fflush(stdout);
          }
          return(0);

}

