Esempio n. 1
0
int main()
{

  gtm_char_t err[maxmsg];
  gtm_char_t msg[maxmsg];
  gtm_char_t value[maxstr];

  gtm_status_t status;
  gtm_string_t p_value;

  int failed=0;

  // Initialization
  p_value.address = (xc_char_t *) &value;
  p_value.length = 0;



  // Initialize GT.M runtime
  CALLGTM( gtm_init() );


  // Initialize the GT.M access routines
  p_value.address = ( xc_char_t *) &value ; p_value.length = maxstr ;
  CALLGTM( gtm_ci( "gtminit", &err ));
  if (0 != strlen( err )) fprintf( stdout, "%s\n", err);


  // Set a node - note that value can be an arbitrary blob, not just a null terminated string
  gtm_char_t washington[] = "Washington, DC";
  p_value.address = (xc_char_t *) &washington;
  p_value.length = strlen( "Washington, DC" );
  CALLGTM( gtm_ci( "gtmset", "^Capital(\"United States\")", &p_value, &err ));
  if (0 != strlen( err )) fprintf( stdout, "%s\n", err);



  // Cleanup GT.M runtime
  CALLGTM( gtm_exit() );

  if( failed == 0 )
    {
    printf("Test PASSED !\n");
    }
  else
    {
    printf("Test FAILED !\n");
    }

  return failed;
}
Esempio n. 2
0
File: zappyd.c Progetto: fosm/xapi
int main()
{
 	gtm_char_t	port[] = "6520";
	gtm_char_t	logLevel[] = "0";
	gtm_char_t	msgbuf[BUF_LEN];
        gtm_status_t    status;
        status = gtm_init();
        if (status != 0)
        {
            gtm_zstatus(msgbuf, BUF_LEN);
            return status;
        }
        status = gtm_ci("zappyd", port, logLevel);
        if (status != 0)
        {
            gtm_zstatus(msgbuf, BUF_LEN);
            fprintf(stderr, "%s\n", msgbuf);
            return status;
        }
        return 0;
}