1 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
10 extern ss_request_table test_cmds;
15 static char def_subsystem_name[5] = "test";
16 static char version [4] = "1.0";
23 char *argv0 = argv[0];
24 char *initial_request = (char *)NULL;
25 int quit = FALSE; /* quit after processing request */
29 subsystem_name = def_subsystem_name;
31 for (; *argv; ++argv, --argc) {
32 printf("checking arg: %s\n", *argv);
33 if (!strcmp(*argv, "-prompt")) {
36 "No argument supplied with -prompt\n");
40 subsystem_name = *argv;
42 else if (!strcmp(*argv, "-request") || !strcmp(*argv, "-rq")) {
45 "No string supplied with -request.\n");
49 initial_request = *argv;
51 else if (!strcmp(*argv, "-quit"))
53 else if (!strcmp(*argv, "-no_quit"))
55 else if (**argv == '-') {
56 fprintf(stderr, "Unknown control argument %s\n",
59 "Usage: %s [gateway] [ -prompt name ] [ -request name ] [ -quit ]\n",
65 sci_idx = ss_create_invocation(subsystem_name, version,
66 (char *)NULL, &test_cmds, &code);
68 ss_perror(sci_idx, code, "creating invocation");
72 (void) ss_add_request_table (sci_idx, &ss_std_requests, 1, &code);
74 ss_perror (sci_idx, code, "adding standard requests");
79 printf("test version %s. Type '?' for a list of commands.\n\n",
82 if (initial_request != (char *)NULL) {
83 code = ss_execute_line(sci_idx, initial_request);
85 ss_perror(sci_idx, code, initial_request);
88 code = ss_listen (sci_idx);
93 void test_cmd (argc, argv)
97 while (++argv, --argc)