]>
git.ipfire.org Git - thirdparty/e2fsprogs.git/blob - lib/ss/invocation.c
2 * Copyright 1987, 1988 by MIT Student Information Processing Board
4 * For copyright information, see copyright.h.
10 #include "ss_internal.h"
11 #include "copyright.h"
12 #define size sizeof(ss_data *)
14 int ss_create_invocation(subsystem_name
, version_string
, info_ptr
,
15 request_table_ptr
, code_ptr
)
16 char *subsystem_name
, *version_string
;
18 ss_request_table
*request_table_ptr
;
22 register ss_data
*new_table
;
23 register ss_data
**table
;
27 new_table
= (ss_data
*) malloc(sizeof(ss_data
));
29 if (table
== (ss_data
**) NULL
) {
30 table
= (ss_data
**) malloc(2 * size
);
31 table
[0] = table
[1] = (ss_data
*)NULL
;
33 initialize_ss_error_table ();
35 for (sci_idx
= 1; table
[sci_idx
] != (ss_data
*)NULL
; sci_idx
++)
37 table
= (ss_data
**) realloc((char *)table
,
38 ((unsigned)sci_idx
+2)*size
);
39 table
[sci_idx
+1] = (ss_data
*) NULL
;
40 table
[sci_idx
] = new_table
;
42 new_table
->subsystem_name
= subsystem_name
;
43 new_table
->subsystem_version
= version_string
;
44 new_table
->argv
= (char **)NULL
;
45 new_table
->current_request
= (char *)NULL
;
46 new_table
->info_dirs
= (char **)malloc(sizeof(char *));
47 *new_table
->info_dirs
= (char *)NULL
;
48 new_table
->info_ptr
= info_ptr
;
49 new_table
->prompt
= malloc((unsigned)strlen(subsystem_name
)+4);
50 strcpy(new_table
->prompt
, subsystem_name
);
51 strcat(new_table
->prompt
, ": ");
53 new_table
->abbrev_info
= ss_abbrev_initialize("/etc/passwd", code_ptr
);
55 new_table
->abbrev_info
= NULL
;
57 new_table
->flags
.escape_disabled
= 0;
58 new_table
->flags
.abbrevs_disabled
= 0;
59 new_table
->rqt_tables
=
60 (ss_request_table
**) calloc(2, sizeof(ss_request_table
*));
61 *(new_table
->rqt_tables
) = request_table_ptr
;
62 *(new_table
->rqt_tables
+1) = (ss_request_table
*) NULL
;
68 ss_delete_invocation(sci_idx
)
76 free((char *)t
->rqt_tables
);
77 while(t
->info_dirs
[0] != (char *)NULL
)
78 ss_delete_info_dir(sci_idx
, t
->info_dirs
[0], &ignored_code
);
79 free((char *)t
->info_dirs
);