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");
55 if (fgets(buf, sizeof(buf), f) == NULL)
64 cp = strchr(buf, '\n');
67 cp = strchr(buf, '\r');
71 printf("test_icount: %s\n", buf);
72 retval = ss_execute_line(sci_idx, buf);
74 ss_perror(sci_idx, retval, buf);
81 int main(int argc, char **argv)
84 char *request = (char *)NULL;
88 const char *usage = "Usage: test_ss [-R request] [-f cmd_file]";
90 while ((c = getopt (argc, argv, "wR:f:")) != EOF) {
99 com_err(argv[0], 0, usage);
104 sci_idx = ss_create_invocation(subsystem_name, version,
105 (char *)NULL, &test_cmds, &code);
107 ss_perror(sci_idx, code, "creating invocation");
111 (void) ss_add_request_table (sci_idx, &ss_std_requests, 1, &code);
113 ss_perror (sci_idx, code, "adding standard requests");
117 printf("test_ss %s. Type '?' for a list of commands.\n\n",
121 code = ss_execute_line(sci_idx, request);
123 ss_perror(sci_idx, code, request);
126 } else if (cmd_file) {
127 exit_status = source_file(cmd_file, sci_idx);
136 void test_cmd (argc, argv)
140 printf("Hello, world!\n");
142 while (++argv, --argc) {
143 printf("'%s'", *argv);