commit bash-20150807 snapshot

This commit is contained in:
Chet Ramey
2015-08-11 16:41:53 -04:00
parent d54a780601
commit e9eee9d4b0
29 changed files with 317 additions and 73 deletions
+2 -3
View File
@@ -34,18 +34,17 @@ new loadable builtins.
basename.c Return non-directory portion of pathname.
cat.c cat(1) replacement with no options - the way cat was intended.
cut.c cut(1) replacement.
dirname.c Return directory portion of pathname.
finfo.c Print file info.
getconf.c POSIX.2 getconf utility.
getconf.h Replacement definitions for ones the system doesn't provide.
head.c Copy first part of files.
hello.c Obligatory "Hello World" / sample loadable.
id.c POSIX.2 user identity.
ln.c Make links.
loadables.h Start at a file loadable builtins can include for shell definitions
logname.c Print login name of current user.
Makefile.in Simple makefile for the sample loadable builtins.
mkdir.c Make directories.
mypid.c Add $MYPID variable, demonstrate use of unload hook function
necho.c echo without options or argument interpretation.
pathchk.c Check pathnames for validity and portability.
print.c Loadable ksh-93 style print builtin.
+17
View File
@@ -56,6 +56,23 @@ hello_builtin (list)
return (EXECUTION_SUCCESS);
}
int
hello_builtin_load (s)
char *s;
{
printf ("hello builtin loaded\n");
fflush (stdout);
return (1);
}
void
hello_builtin_unload (s)
char *s;
{
printf ("hello builtin unloaded\n");
fflush (stdout);
}
/* An array of strings forming the `long' documentation for a builtin xxx,
which is printed by `help xxx'. It must end with a NULL. By convention,
the first line is a short description. */
+11
View File
@@ -5,6 +5,11 @@
* Then, from within bash, enable -f ./mypid enable_mypid, where ./mypid
* is the binary obtained from running make. Hereafter, `${MYPID}'
* is a shell builtin variable.
*
* This defines an unload hook function that is called when the builtin is
* deleted with enable -d that will unbind the MYPID variable so future
* references to it do not attempt to access memory that is no longer part
* of this process's address space.
*/
#include <stdio.h>
@@ -56,6 +61,12 @@ enable_mypid_builtin(WORD_LIST *list)
return 0;
}
void
enable_mypid_builtin_unload (char *s)
{
unbind_variable ("MYPID");
}
char const *enable_mypid_doc[] = {
"Enable $MYPID.",
"",
+16
View File
@@ -41,6 +41,22 @@ template_builtin (list)
return (rval);
}
/* Called when `template' is enabled and loaded from the shared object. If this
function returns 0, the load fails. */
int
template_builtin_load (name)
char *name;
{
return (1);
}
/* Called when `template' is disabled. */
void
template_builtin_unload (name)
char *name;
{
}
char *template_doc[] = {
"Short description.",
""