summaryrefslogtreecommitdiff
path: root/pjsip/src/test-pjsip/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'pjsip/src/test-pjsip/main.c')
-rw-r--r--pjsip/src/test-pjsip/main.c46
1 files changed, 45 insertions, 1 deletions
diff --git a/pjsip/src/test-pjsip/main.c b/pjsip/src/test-pjsip/main.c
index 3c5f0800..7994504d 100644
--- a/pjsip/src/test-pjsip/main.c
+++ b/pjsip/src/test-pjsip/main.c
@@ -18,10 +18,54 @@
*/
#include "test.h"
#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+static void usage()
+{
+ puts("Usage: test-pjsip");
+ puts("Options:");
+ puts(" -i,--interractive Key input at the end.");
+ puts(" -h,--help Show this screen");
+ puts(" -l,--log-level N Set log level (0-6)");
+}
int main(int argc, char *argv[])
{
- int retval = test_main();
+ int interractive = 0;
+ int retval;
+ char **opt_arg;
+
+ /* Parse arguments. */
+ opt_arg = argv+1;
+ while (*opt_arg) {
+ if (strcmp(*opt_arg, "-i") == 0 ||
+ strcmp(*opt_arg, "--interractive") == 0)
+ {
+ interractive = 1;
+ } else if (strcmp(*opt_arg, "-h") == 0 ||
+ strcmp(*opt_arg, "--help") == 0)
+ {
+ usage();
+ return 1;
+ } else if (strcmp(*opt_arg, "-l") == 0 ||
+ strcmp(*opt_arg, "--log-level") == 0)
+ {
+ ++opt_arg;
+ if (!opt_arg) {
+ usage();
+ return 1;
+ }
+ log_level = atoi(*opt_arg);
+ } else {
+ usage();
+ return 1;
+ }
+
+ ++opt_arg;
+ }
+
+ retval = test_main();
if (argc != 1) {
char s[10];