summaryrefslogtreecommitdiff
path: root/examples/testUnbind.c
blob: 2cc7fdd05dd3ece21d52d9d36a0cb35f07e1de13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
 *	Ivy unbind Test
 *
 *	Copyright (C) 1997-2004
 *	Centre d'Études de la Navigation Aérienne
 *
 *	Authors: Yannick Jestin <jestin@cena.fr>
 *
 *	Please refer to file ../src/version.h for the
 *	copyright notice regarding this software
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <Ivy/ivyloop.h>
#include <Ivy/ivy.h>
#include <Ivy/version.h>
#define REGEXP "^ub"

void Callback (IvyClientPtr app, void *user_data, int argc, char *argv[]) {
  MsgRcvPtr *ptr = (MsgRcvPtr *) user_data;
  printf ("%s sent unbind message, unbinding to %s\n",
      IvyGetApplicationName(app),REGEXP);
  IvyUnbindMsg(*ptr);
}

int main(int argc, char *argv[]) {
  MsgRcvPtr ptr;
  IvyInit("TestUnbind","TestUnbind Ready",NULL,NULL,NULL,NULL);
  ptr=IvyBindMsg(Callback,&ptr,REGEXP);
  printf("bound to %s\n",REGEXP);
  IvyStart(NULL);
#if (IVYMAJOR_VERSION == 3) && (IVYMINOR_VERSION < 9)
  IvyMainLoop(NULL, NULL);
#else
  IvyMainLoop();
#endif
  return 0;
}