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.
27 extern ss_request_table test_cmds;
32 static char subsystem_name[] = "test_ss";
33 static char version[] = "1.0";
35 static int source_file(const char *cmd_file, int sci_idx)
44 if (strcmp(cmd_file, "-") == 0)
47 f = fopen(cmd_file, "r");
58 if (fgets(buf, sizeof(buf), f) == NULL)
67 cp = strchr(buf, '\n');
70 cp = strchr(buf, '\r');
74 printf("test_icount: %s\n", buf);
75 retval = ss_execute_line(sci_idx, buf);
77 ss_perror(sci_idx, retval, buf);
84 int main(int argc, char **argv)
87 char *request = (char *)NULL;
92 while ((c = getopt (argc, argv, "wR:f:")) != EOF) {
101 com_err(argv[0], 0, "Usage: test_ss [-R request] "
107 sci_idx = ss_create_invocation(subsystem_name, version,
108 (char *)NULL, &test_cmds, &code);
110 ss_perror(sci_idx, code, "creating invocation");
114 (void) ss_add_request_table (sci_idx, &ss_std_requests, 1, &code);
116 ss_perror (sci_idx, code, "adding standard requests");
120 printf("test_ss %s. Type '?' for a list of commands.\n\n",
124 code = ss_execute_line(sci_idx, request);
126 ss_perror(sci_idx, code, request);
129 } else if (cmd_file) {
130 exit_status = source_file(cmd_file, sci_idx);
139 void test_cmd(int argc, const char * const *argv,
140 int sci_idx __SS_ATTR((unused)),
141 void *infop __SS_ATTR((unused)))
143 printf("Hello, world!\n");
145 while (++argv, --argc) {
146 printf("'%s'", *argv);