DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

(readline.info.gz) Function Writing

Info Catalog (readline.info.gz) Readline Typedefs (readline.info.gz) Custom Functions
 
 2.2.2 Writing a New Function
 ----------------------------
 
 In order to write new functions for Readline, you need to know the
 calling conventions for keyboard-invoked functions, and the names of the
 variables that describe the current state of the line read so far.
 
    The calling sequence for a command `foo' looks like
 
      `int foo (int count, int key)'
 
 where COUNT is the numeric argument (or 1 if defaulted) and KEY is the
 key that invoked this function.
 
    It is completely up to the function as to what should be done with
 the numeric argument.  Some functions use it as a repeat count, some as
 a flag, and others to choose alternate behavior (refreshing the current
 line as opposed to refreshing the screen, for example).  Some choose to
 ignore it.  In general, if a function uses the numeric argument as a
 repeat count, it should be able to do something useful with both
 negative and positive arguments.  At the very least, it should be aware
 that it can be passed a negative argument.
 
    A command function should return 0 if its action completes
 successfully, and a non-zero value if some error occurs.  This is the
 convention obeyed by all of the builtin Readline bindable command
 functions.
 
Info Catalog (readline.info.gz) Readline Typedefs (readline.info.gz) Custom Functions
automatically generated byinfo2html