Debian Codegraph @

Xpjproject/pjlib-util/src/pjlib-util-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/string.h>
21 #include <pj/argparse.h>
22
23 #define boost()
24
25 static void usage()
26 {
27 puts("Usage:");
28 puts(" pjlib-util-test [OPTION] [test_to_run] [..]");
29 puts("");
30 puts("where OPTIONS:");
31 puts("");
32 puts(" -h, --help Show this help screen");
33
34 ut_usage();
35
36 puts(" -i Ask ENTER before quitting");
37 }
38
39
40 int main(int argc, char *argv[])
41 {
42 int rc;
43 int interractive = 0;
44
45 boost();
46
47 if (pj_argparse_get_bool(&argc, argv, "-h") ||
48 pj_argparse_get_bool(&argc, argv, "--help"))
49 {
50 usage();
51 return 0;
52 }
53
54 ut_app_init0(&test_app.ut_app);
55
56 interractive = pj_argparse_get_bool(&argc, argv, "-i");
57 if (ut_parse_args(&test_app.ut_app, &argc, argv))
58 return 1;
59
60 rc = test_main(argc, argv);
61
62 if (interractive) {
63 char s[10];
64 puts("");
65 puts("Press <ENTER> to exit");
66 if (!fgets(s, sizeof(s), stdin))
67 return rc;
68 }
69
70 return rc;
71 }