aboutsummaryrefslogtreecommitdiffstats
path: root/bindings/tutorial/tuto-app1.c
blob: 93747cdd049fcc9e7a11e45085ea18899b261855 (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
#include <stdio.h>

#define AFB_BINDING_VERSION 3
#include <afb/afb-binding.h>

static int appmain(void *arg)
{
	const char *name = arg;
	char buffer[50];

	AFB_API_NOTICE(afbBindingV3root, "Entering Application main");
	printf("Hello, I'm %s!\n", name);
	printf("What's your name? ");
	scanf("%s", buffer);
	printf("Hi %s! Nice to meet you. OOOOPS I'm late bye bye\n", buffer);
	return 0;
}

static void application(int signum, void *arg)
{
	if (signum)
		exit(127);
	exit(appmain(arg));
}

int afbBindingV3entry(struct afb_api_x3 *rootapi)
{
	return afb_api_queue_job(rootapi, application, "BOB", NULL, 0);
}