Debian Codegraph @

Xpjproject/pjnath/src/pjnath-test/main.c

raw symbols SCIP
1 /*
2 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
3 * Copyright (C) 2003-2008 Benny Prijono <[email protected]>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 #include "test.h"
20 #include <pj/argparse.h>
21
22 #define boost()
23
24 static void usage()
25 {
26 puts("Usage:");
27 puts(" pjnath-test [OPTION] [test_to_run] [..]");
28 puts("");
29 puts("where OPTIONS:");
30 puts("");
31 puts(" -h, --help Show this help screen");
32
33 ut_usage();
34
35 puts(" -i Ask ENTER before quitting");
36 }
37
38 int main(int argc, char *argv[])
39 {
40 int rc;
41 int interractive = 0;
42
43 boost();
44
45 if (pj_argparse_get_bool(&argc, argv, "-h") ||
46 pj_argparse_get_bool(&argc, argv, "--help"))
47 {
48 usage();
49 return 0;
50 }
51
52 ut_app_init0(&test_app.ut_app);
53
54 interractive = pj_argparse_get_bool(&argc, argv, "-i");
55 if (ut_parse_args(&test_app.ut_app, &argc, argv))
56 return 1;
57
58 rc = test_main(argc, argv);
59
60 if (interractive) {
61 char s[10];
62 puts("");
63 puts("Press <ENTER> to exit");
64 if (!fgets(s, sizeof(s), stdin))
65 return rc;
66 }
67
68 return rc;
69 }
70