Cleanup - 0.0.2
[libautomation.git] / tools / atminject.c
blob53adad1080d6b4f570f130c487881fb741dc7428
1 #include <string.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <errno.h>
5 #include <ev.h>
7 #include "../lib/libautomation.h"
10 int main(int argc, char **argv) {
11 int v;
12 ATM_SHM s;
13 struct ATM_VALUE *p;
15 if(argc != 4)
16 atm_fail("atminject <domain> <key> <value>");
18 errno = 0;
19 v = strtol(argv[3], NULL, 0);
20 if (errno) {
21 perror(argv[3]);
22 return -1;
25 s = atm_shm_create(argv[1]);
26 if (!s)
27 atm_fail("Couldn't open shared memory for writing");
29 p = atm_shm_register(s, argv[2]);
30 atm_shm_update(p, v);
32 return 0;