child-delete: Reply as usual when concurrently rekeying the IKE_SA
[strongswan.git] / src / dumm / irdumm.c
1 /*
2 * Copyright (C) 2008 Martin Willi
3 * Hochschule fuer Technik Rapperswil
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16 #undef PACKAGE_NAME
17 #undef PACKAGE_TARNAME
18 #undef PACKAGE_VERSION
19 #undef PACKAGE_STRING
20 #undef PACKAGE_BUGREPORT
21 #undef PACKAGE_URL
22 #include <ruby.h>
23
24 #ifdef HAVE_RB_ERRINFO
25 #define ruby_errinfo rb_errinfo()
26 #endif
27
28 /**
29 * main routine, parses args and reads from console
30 */
31 int main(int argc, char *argv[])
32 {
33 int state, i;
34 char buf[512];
35
36 ruby_init();
37 ruby_init_loadpath();
38
39 rb_eval_string_protect("require 'dumm' and include Dumm", &state);
40 if (state)
41 {
42 rb_p(ruby_errinfo);
43 printf("Please install the ruby extension first!\n");
44 }
45 for (i = 1; i < argc; i++)
46 {
47 snprintf(buf, sizeof(buf), "load \"%s\"", argv[i]);
48 printf("%s\n", buf);
49 rb_eval_string_protect(buf, &state);
50 if (state)
51 {
52 rb_p(ruby_errinfo);
53 }
54 }
55 rb_require("irb");
56 rb_require("irb/completion");
57 rb_eval_string_protect("IRB.start", &state);
58 if (state)
59 {
60 rb_p(ruby_errinfo);
61 }
62
63 ruby_finalize();
64 return 0;
65 }
66