I am a bit confused about the correct way to delete a user defined builtin using
sh_addbuiltin.

.../cmd/ksh93/sh/nvdisc.c says:

/*
 * add or replace built-in version of command corresponding to 
 * The  argument is a pointer to the built-in
 * if ==1, the built-in will be deleted
 * Special builtins cannot be added or deleted return failure
 * The return value for adding builtins is a pointer to the node or NULL on
 *   failure.  For delete NULL means success and the node that cannot be
 *   deleted is returned on failure.
 */
Namval_t *sh_addbuiltin(const char *path, int (*bltin)(int, char*[],void*),void 
*extra)

whereas shell.3 manpage says

     The sh_addbuiltin()  function  is used to add, replace or delete
     built-in commands. It takes the name of the built-in,  name,
     a  pointer to the function that implements the built-in, fn,
     and a pointer that will be passed to the function when it is
     invoked.   If,  fn is non-NULL the built-in command is added
     or replaced.  Otherwise, the given built-in command will  be
     deleted.

Which is the correct way to delete a user-defined builtin?
Set extra to 1 or set fn to NULL?

- Finnbarr

_______________________________________________
ast-developers mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-developers

Reply via email to