summaryrefslogtreecommitdiff
path: root/lib/ss/invocation.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2003-03-16 06:26:25 -0500
committerTheodore Ts'o <tytso@mit.edu>2003-03-16 06:26:25 -0500
commit3ae497eab281eab5f98770e6a3d5992b9d37325e (patch)
tree078fb4dfd86d1a323823e783f5a73d0eef0de1f7 /lib/ss/invocation.c
parent63182203a757e6b9f5700ea57d9f6e5973251666 (diff)
downloade2fsprogs-3ae497eab281eab5f98770e6a3d5992b9d37325e.tar.gz
Add to the ss (subsystem) library the ability to dynamically link
to the readline library if it is present in the system.
Diffstat (limited to 'lib/ss/invocation.c')
-rw-r--r--lib/ss/invocation.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/ss/invocation.c b/lib/ss/invocation.c
index 81c70e48..748886fa 100644
--- a/lib/ss/invocation.c
+++ b/lib/ss/invocation.c
@@ -16,6 +16,9 @@
#endif
#include "ss_internal.h"
#define size sizeof(ss_data *)
+#ifdef HAVE_DLOPEN
+#include <dlfcn.h>
+#endif
int ss_create_invocation(subsystem_name, version_string, info_ptr,
request_table_ptr, code_ptr)
@@ -27,6 +30,7 @@ int ss_create_invocation(subsystem_name, version_string, info_ptr,
register int sci_idx;
register ss_data *new_table;
register ss_data **table;
+ void *handle;
*code_ptr = 0;
table = _ss_table;
@@ -66,7 +70,16 @@ int ss_create_invocation(subsystem_name, version_string, info_ptr,
(ss_request_table **) calloc(2, sizeof(ss_request_table *));
*(new_table->rqt_tables) = request_table_ptr;
*(new_table->rqt_tables+1) = (ss_request_table *) NULL;
+
+ new_table->readline_handle = 0;
+ new_table->readline = 0;
+ new_table->add_history = 0;
+ new_table->redisplay = 0;
+ new_table->rl_completion_matches = 0;
_ss_table = table;
+#if defined(HAVE_DLOPEN) && defined(SHARED_ELF_LIB)
+ ss_get_readline(sci_idx);
+#endif
return(sci_idx);
}
@@ -83,5 +96,9 @@ ss_delete_invocation(sci_idx)
while(t->info_dirs[0] != (char *)NULL)
ss_delete_info_dir(sci_idx, t->info_dirs[0], &ignored_code);
free((char *)t->info_dirs);
+#if defined(HAVE_DLOPEN) && defined(SHARED_ELF_LIB)
+ if (t->readline_shutdown)
+ (*t->readline_shutdown)(t);
+#endif
free((char *)t);
}