4 * Copyright 1987, 1988 by MIT Student Information Processing Board
6 * Permission to use, copy, modify, and distribute this software and
7 * its documentation for any purpose is hereby granted, provided that
8 * the names of M.I.T. and the M.I.T. S.I.P.B. not be used in
9 * advertising or publicity pertaining to distribution of the software
10 * without specific, written prior permission. M.I.T. and the
11 * M.I.T. S.I.P.B. make no representations about the suitability of
12 * this software for any purpose. It is provided "as is" without
13 * express or implied warranty.
26 extern ss_request_table test_cmds;
31 static char subsystem_name[] = "test_ss";
32 static char version[] = "1.0";
34 static int source_file(const char *cmd_file, int sci_idx)
43 if (strcmp(cmd_file, "-") == 0)
46 f = fopen(cmd_file, "r");
57 if (fgets(buf, sizeof(buf), f) == NULL)
66 cp = strchr(buf, '\n');
69 cp = strchr(buf, '\r');
73 printf("test_icount: %s\n", buf);
74 retval = ss_execute_line(sci_idx, buf);
76 ss_perror(sci_idx, retval, buf);
83 int main(int argc, char **argv)
86 char *request = (char *)NULL;
91 while ((c = getopt (argc, argv, "wR:f:")) != EOF) {
100 com_err(argv[0], 0, "Usage: test_ss [-R request] "
106 sci_idx = ss_create_invocation(subsystem_name, version,
107 (char *)NULL, &test_cmds, &code);
109 ss_perror(sci_idx, code, "creating invocation");
113 (void) ss_add_request_table (sci_idx, &ss_std_requests, 1, &code);
115 ss_perror (sci_idx, code, "adding standard requests");
119 printf("test_ss %s. Type '?' for a list of commands.\n\n",
123 code = ss_execute_line(sci_idx, request);
125 ss_perror(sci_idx, code, request);
128 } else if (cmd_file) {
129 exit_status = source_file(cmd_file, sci_idx);
138 void test_cmd (argc, argv)
142 printf("Hello, world!\n");
144 while (++argv, --argc) {
145 printf("'%s'", *argv);