diff options
author | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2011-10-19 11:37:06 +0200 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2011-10-19 11:37:06 +0200 |
commit | f4447a4d02d21c4820d8e469b27f308326f77922 (patch) | |
tree | e90c69b7e72795c86dac7b2fd8304c4587111464 /test/grab.c | |
parent | d18b6e21b82b4d64e1c0bf1b7526271ded38318e (diff) | |
parent | cb66db4b221e516153763735f1994206aa20abe4 (diff) | |
download | uca-f4447a4d02d21c4820d8e469b27f308326f77922.tar.gz uca-f4447a4d02d21c4820d8e469b27f308326f77922.tar.bz2 uca-f4447a4d02d21c4820d8e469b27f308326f77922.tar.xz uca-f4447a4d02d21c4820d8e469b27f308326f77922.zip |
Merge pending changes
Diffstat (limited to 'test/grab.c')
-rw-r--r-- | test/grab.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/test/grab.c b/test/grab.c index 76d3176..ab3263f 100644 --- a/test/grab.c +++ b/test/grab.c @@ -1,15 +1,27 @@ #include <stdio.h> #include <stdlib.h> +#include <signal.h> #include "uca.h" #define handle_error(errno) {if ((errno) != UCA_NO_ERROR) printf("error at <%s:%i>\n", \ __FILE__, __LINE__);} +static struct uca *u = NULL; + +void sigint_handler(int signal) +{ + printf("Closing down libuca\n"); + handle_error(uca_cam_stop_recording(u->cameras)); + uca_destroy(u); + exit(signal); +} int main(int argc, char *argv[]) { - struct uca *u = uca_init(NULL); + (void) signal(SIGINT, sigint_handler); + + u = uca_init(NULL); if (u == NULL) { printf("Couldn't find a camera\n"); return 1; |