summaryrefslogtreecommitdiff
path: root/examples/testUnbind.c
blob: 16a4a8ad4ec1f582bf0038a7fac519a6309b519b (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
/*
 *	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 <ivyloop.h>
#include <ivy.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);
  IvyMainLoop(0);
  return 0;
}