ibash: extend bash with guile call-outs.
Bash is modified to call out to Guile code whenever the user enters a command-line; the code has the opportunity to fix up the command line in any way. The Guile code is under the ibash-scheme directory, all is all newly created in this delta. * configure: why does this have to be in here? * configure.ac: look for guile and libguile. * eval.c: call guile_main and load ~/.bash_guile.scm. * shell.c: perform call-outs prior to executing command lines. * ibash-scheme/ibash-callout.scm: first call-out. * ibash-scheme/remote-sender.scm: second call-out. * ibash-scheme/ibash-server.scm: central intelligence service. * ibash-scheme/modules/i-bash: transform ib -> i-bash. * ibash-scheme/modules/cd: cd command line processor.
This commit is contained in:
parent
b0776d8c49
commit
de19bb2129
9 changed files with 592 additions and 17 deletions
48
shell.c
48
shell.c
|
|
@ -89,6 +89,8 @@ extern int get_tty_state __P((void));
|
|||
# include <opennt/opennt.h>
|
||||
#endif
|
||||
|
||||
#include <libguile.h>
|
||||
|
||||
#if !defined (HAVE_GETPW_DECLS)
|
||||
extern struct passwd *getpwuid ();
|
||||
#endif /* !HAVE_GETPW_DECLS */
|
||||
|
|
@ -353,18 +355,13 @@ _cygwin32_check_tmp ()
|
|||
}
|
||||
#endif /* __CYGWIN__ */
|
||||
|
||||
#if defined (NO_MAIN_ENV_ARG)
|
||||
/* systems without third argument to main() */
|
||||
int
|
||||
main (argc, argv)
|
||||
char **pass_env;
|
||||
|
||||
void
|
||||
inner_main (closure, argc, argv)
|
||||
void *closure;
|
||||
int argc;
|
||||
char **argv;
|
||||
#else /* !NO_MAIN_ENV_ARG */
|
||||
int
|
||||
main (argc, argv, env)
|
||||
int argc;
|
||||
char **argv, **env;
|
||||
#endif /* !NO_MAIN_ENV_ARG */
|
||||
{
|
||||
register int i;
|
||||
int code, old_errexit_flag;
|
||||
|
|
@ -379,6 +376,8 @@ main (argc, argv, env)
|
|||
env = environ;
|
||||
#endif /* __OPENNT */
|
||||
|
||||
char **env = pass_env;
|
||||
|
||||
USE_VAR(argc);
|
||||
USE_VAR(argv);
|
||||
USE_VAR(env);
|
||||
|
|
@ -518,6 +517,17 @@ main (argc, argv, env)
|
|||
}
|
||||
this_command_name = (char *)NULL;
|
||||
|
||||
/* Pull in the command-line processor call-out, so that the Guile
|
||||
command-line processor is available in the Guile universe. */
|
||||
scm_c_eval_string
|
||||
("(let ((f (getenv \"I_BASH_CALLOUT\"))) "
|
||||
"(cond ((and f (access? f R_OK)) (load f)) "
|
||||
"(else (let ((f (string-append (getenv \"HOME\") "
|
||||
"\"/.bash_guile.scm\"))) "
|
||||
"(cond ((access? f R_OK) (load f)) "
|
||||
"(else (display \"iBash: ERROR: no call-out.\n\") "
|
||||
"(exit 1)))))))");
|
||||
|
||||
/* First, let the outside world know about our interactive status.
|
||||
A shell is interactive if the `-i' flag was given, or if all of
|
||||
the following conditions are met:
|
||||
|
|
@ -793,6 +803,24 @@ main (argc, argv, env)
|
|||
exit_shell (last_command_exit_value);
|
||||
}
|
||||
|
||||
#if defined (NO_MAIN_ENV_ARG)
|
||||
/* systems without third argument to main() */
|
||||
int
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
#else /* !NO_MAIN_ENV_ARG */
|
||||
int
|
||||
main (argc, argv, env)
|
||||
int argc;
|
||||
char **argv, **env;
|
||||
#endif /* !NO_MAIN_ENV_ARG */
|
||||
{
|
||||
pass_env = env;
|
||||
scm_boot_guile (argc, argv, inner_main, 0);
|
||||
return 0; /* Never reached. */
|
||||
}
|
||||
|
||||
static int
|
||||
parse_long_options (argv, arg_start, arg_end)
|
||||
char **argv;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue