2 * Copyright 1987, 1988 by MIT Student Information Processing Board
4 * This file may be copied under the terms of the GNU Public License.
10 #include "ss_internal.h"
11 #define size sizeof(ss_data *)
13 int ss_create_invocation(subsystem_name, version_string, info_ptr,
14 request_table_ptr, code_ptr)
15 const char *subsystem_name, *version_string;
17 ss_request_table *request_table_ptr;
21 register ss_data *new_table;
22 register ss_data **table;
26 new_table = (ss_data *) malloc(sizeof(ss_data));
28 if (table == (ss_data **) NULL) {
29 table = (ss_data **) malloc(2 * size);
30 table[0] = table[1] = (ss_data *)NULL;
32 initialize_ss_error_table ();
34 for (sci_idx = 1; table[sci_idx] != (ss_data *)NULL; sci_idx++)
36 table = (ss_data **) realloc((char *)table,
37 ((unsigned)sci_idx+2)*size);
38 table[sci_idx+1] = (ss_data *) NULL;
39 table[sci_idx] = new_table;
41 new_table->subsystem_name = subsystem_name;
42 new_table->subsystem_version = version_string;
43 new_table->argv = (char **)NULL;
44 new_table->current_request = (char *)NULL;
45 new_table->info_dirs = (char **)malloc(sizeof(char *));
46 *new_table->info_dirs = (char *)NULL;
47 new_table->info_ptr = info_ptr;
48 new_table->prompt = malloc((unsigned)strlen(subsystem_name)+4);
49 strcpy(new_table->prompt, subsystem_name);
50 strcat(new_table->prompt, ": ");
52 new_table->abbrev_info = ss_abbrev_initialize("/etc/passwd", code_ptr);
54 new_table->abbrev_info = NULL;
56 new_table->flags.escape_disabled = 0;
57 new_table->flags.abbrevs_disabled = 0;
58 new_table->rqt_tables =
59 (ss_request_table **) calloc(2, sizeof(ss_request_table *));
60 *(new_table->rqt_tables) = request_table_ptr;
61 *(new_table->rqt_tables+1) = (ss_request_table *) NULL;
67 ss_delete_invocation(sci_idx)
75 free((char *)t->rqt_tables);
76 while(t->info_dirs[0] != (char *)NULL)
77 ss_delete_info_dir(sci_idx, t->info_dirs[0], &ignored_code);
78 free((char *)t->info_dirs);