Browse Source

The first klish tree.

git-svn-id: https://klish.googlecode.com/svn/trunk@13 0eaa4687-2ee9-07dd-09d9-bcdd2d2dd5fb
Serj Kalichev 8 years ago
parent
commit
c30fc7a7e8
100 changed files with 33632 additions and 0 deletions
  1. 565 0
      CHANGES
  2. 91 0
      ISSUES
  3. 456 0
      LICENCE
  4. 45 0
      Makefile.am
  5. 3123 0
      Makefile.in
  6. 160 0
      README
  7. 8951 0
      aclocal.m4
  8. 136 0
      aux_scripts/compile
  9. 1463 0
      aux_scripts/config.guess
  10. 1579 0
      aux_scripts/config.sub
  11. 522 0
      aux_scripts/depcomp
  12. 322 0
      aux_scripts/install-sh
  13. 8413 0
      aux_scripts/ltmain.sh
  14. 360 0
      aux_scripts/missing
  15. 46 0
      bin/clish.cpp
  16. 329 0
      bin/confd.c
  17. 49 0
      bin/lubheap.c
  18. 42 0
      bin/module.am
  19. 111 0
      bin/tclish.cpp
  20. 53 0
      cliconf/buf.h
  21. 278 0
      cliconf/buf/buf.c
  22. 2 0
      cliconf/buf/module.am
  23. 22 0
      cliconf/buf/private.h
  24. 62 0
      cliconf/conf.h
  25. 253 0
      cliconf/conf/conf.c
  26. 37 0
      cliconf/conf/conf_dump.c
  27. 3 0
      cliconf/conf/module.am
  28. 22 0
      cliconf/conf/private.h
  29. 21 0
      cliconf/module.am
  30. 18 0
      cliconf/net.h
  31. 2 0
      cliconf/net/module.am
  32. 107 0
      cliconf/net/net.c
  33. 11 0
      cliconf/net/private.h
  34. 31 0
      cliconf/query.h
  35. 2 0
      cliconf/query/module.am
  36. 18 0
      cliconf/query/private.h
  37. 255 0
      cliconf/query/query.c
  38. 384 0
      clish.xsd
  39. 13 0
      clish/README
  40. 47 0
      clish/clish_access_callback.c
  41. 334 0
      clish/clish_config_callback.c
  42. 21 0
      clish/clish_script_callback.c
  43. 18 0
      clish/clish_shutdown.c
  44. 56 0
      clish/clish_startup.c
  45. 97 0
      clish/command.h
  46. 475 0
      clish/command/command.c
  47. 48 0
      clish/command/command_dump.c
  48. 4 0
      clish/command/module.am
  49. 28 0
      clish/command/private.h
  50. 195 0
      clish/conf/conf.c
  51. 37 0
      clish/conf/conf_dump.c
  52. 3 0
      clish/conf/module.am
  53. 15 0
      clish/conf/private.h
  54. 47 0
      clish/module.am
  55. 64 0
      clish/nspace.h
  56. 3 0
      clish/nspace/module.am
  57. 273 0
      clish/nspace/nspace.c
  58. 29 0
      clish/nspace/nspace_dump.c
  59. 17 0
      clish/nspace/private.h
  60. 89 0
      clish/param.h
  61. 3 0
      clish/param/module.am
  62. 289 0
      clish/param/param.c
  63. 47 0
      clish/param/param_dump.c
  64. 23 0
      clish/param/private.h
  65. 83 0
      clish/pargv.h
  66. 3 0
      clish/pargv/module.am
  67. 442 0
      clish/pargv/pargv.c
  68. 33 0
      clish/pargv/pargv_dump.c
  69. 16 0
      clish/pargv/private.h
  70. 33 0
      clish/private.h
  71. 133 0
      clish/ptype.h
  72. 4 0
      clish/ptype/module.am
  73. 36 0
      clish/ptype/private.h
  74. 622 0
      clish/ptype/ptype.c
  75. 22 0
      clish/ptype/ptype_dump.c
  76. 328 0
      clish/shell.h
  77. 30 0
      clish/shell/module.am
  78. 120 0
      clish/shell/private.h
  79. 12 0
      clish/shell/shell__get_client_cookie.c
  80. 12 0
      clish/shell/shell__get_tinyrl.c
  81. 12 0
      clish/shell/shell__get_view.c
  82. 12 0
      clish/shell/shell__get_viewid.c
  83. 198 0
      clish/shell/shell_command_generator.c
  84. 75 0
      clish/shell/shell_delete.c
  85. 35 0
      clish/shell/shell_dump.c
  86. 285 0
      clish/shell/shell_execute.c
  87. 39 0
      clish/shell/shell_find_create_ptype.c
  88. 27 0
      clish/shell/shell_find_create_view.c
  89. 12 0
      clish/shell/shell_find_view.c
  90. 18 0
      clish/shell/shell_getfirst_command.c
  91. 13 0
      clish/shell/shell_getnext_command.c
  92. 136 0
      clish/shell/shell_help.c
  93. 12 0
      clish/shell/shell_insert_ptype.c
  94. 12 0
      clish/shell/shell_insert_view.c
  95. 63 0
      clish/shell/shell_new.c
  96. 34 0
      clish/shell/shell_parse.c
  97. 29 0
      clish/shell/shell_pop_file.c
  98. 27 0
      clish/shell/shell_push_file.c
  99. 45 0
      clish/shell/shell_pwd.c
  100. 0 0
      clish/shell/shell_resolve_command.c

+ 565 - 0
CHANGES

@@ -0,0 +1,565 @@
+/**
+\page _changes_page Changes
+
+<HR>
+
+The following updates were introduced as part of work undertaken as an employee
+of Newport Networks. (http://www.newport-networks.com)
+
+    Graeme McKerrell
+
+\section _0_7_3 0.7.3
+- minor bug fix from Cliff Martin which avoids a SEGV when CTRL-C is invoked
+  on an empty line.
+
+\section _0_7_2 0.7.2
+- updated the default value fix slightly to ensure that if the default is set
+  to the empty string then the parameter will not be translated. This means
+  that legacy code which uses an empty default as an indicator of a parameter
+  not being provided will continue to work.
+  
+- incorporated bug from Charlie (nmsguru at sourceforge dot net) to make
+  sure that default values are correctly translated. e.g. a SELECT parameter
+  can be given the textual name in the XML and will be translated into the
+  appropriate interpretation when used.
+
+- updated the configuration so that the --enable-lubheap option is disabled by default. There
+  were a number of people which were having problems compiling the memory management code and tests.
+
+- added in lub_partition component which provides a fast local memory heap for the current thread
+  as well as a global mutex controlled heap which is used by multiple threads.
+  
+- added statistics to lub_blockpool component
+
+- performance overhaul of lub_heap component. Added a cache for smaller sized blocks which provides
+  a boost to the alocation/deallocation speed.
+  
+- updated escape_decode() function in vt100.c to become non-blocking for
+  the scope of decoding an escape sequence. This prevents hanging the
+  input if a user presses the ESC key.
+  
+- added a lub_heap_show_allocs() function which enables any leak detection
+  tracked allocations to be output. This is useful in the case where memory
+  corruption is preventing a scan from taking place.
+  
+- updated lub_heap__set_framecount() so that when you disable leak detection
+  the tainting state is returned to that before leak detection was enabled.
+
+- implemented correct alignement allocations of sizes other than 
+  native alignment. Changed the naming convention to 
+  LUB_HEAP_ALIGN_2_POWER_X and provided support upto 128MB alignment.
+  
+- updated the memInit() function in lubheap/vxwork/memLib.c to call
+  memLibInit() and memPartLibInit(). This is necessary for systems which
+  only call memInit() in usrRoot() routine.
+
+- updated the root-view.xml example file to demonstrate the use of different
+  parameter types.
+
+- updated the named-view.xml example file to demonstrate the use of viewid.
+
+- added patch from Anselmo Lacerda Silveira de Melo to add CTRL-U key
+  combination to tinyrl which deletes the current line contents.
+
+- fixed "const-ness" issue in lub/heap/context.c
+
+- added error checking to posix/heap_leak_mutex.c in case the pthread
+  calls fail.
+  
+- added heap address to the details output by lub_heap_show()
+
+- fixed possible uninitialised variable in heap_realloc.c
+
+- updated clish.xsd to make sure the "PARAM" tag is named.
+
+\section _0_7_1 0.7.1
+-  Cleaned up configure.ac, added --enable-lubheap experimental option which can
+   be used to replace the normal system memory libraries with a lub/heap implementation.
+   Added librt and libintl support as well as POSIXifiying the build for clean
+   building under LINUX.
+
+-  Updated the shell_spawn.c file to enable tilde expansion in CLISH_PATH.
+
+-  split lub_heap platform specifics into two parts 
+   1) the platform specific support code required by the core 
+      lub_heap implementation. 
+   2) a lubheap component which can be linked in to replace the normal
+      platform memory libraries.
+
+-  updated lub_heap component so that memory scanning is handled by specific functions
+   rather than assume the naming conventions of particular sections during the link.
+   The platform specific code now has to perform the scanning.
+
+-  refactored lub/heap/vxworks to better override vxworks libraries when linked in
+   as a library.
+
+-  fixed lub_heap component so that it compiles on 64 bit architecture, and with GCC-4.0
+
+-  updated tinyxml to version 2.5.1
+
+-  updated lub/heap/vxworks/malloc.c/free.c/realloc.c to undefine any
+   MACRO set with their function name. This ensures that they always get compiled 
+   with the correct name, even if the rest of the CLISH framework is being 
+   compiled to use an alternative memory heap, via -D options
+   
+-  Fixed issue in tinyrl_readline where raw mode was enabled (and input buffer
+   flushed) between printing prompt and accepting input. This was causing
+   things like expect scripts to fail. Fix was to change to raw mode prior to
+   printing the prompt.
+
+-  Fixed lub_heap component to work with latest version of Cygwin.
+   The areas which use the __builtin_return_address() function,
+   provided by GCC, now uses the lub_heap_data_start value to
+   check whether a returned address is beyond the "text" section.
+   Hence a stack trace is deemed to come to an end if either the return
+   address is 0 or greater than lub_heap_data_start.
+   
+- Changed next pointer in lub_heap_s to be "lub_heap_s *"as opposed 
+  to "lub_heap_t *" so that GDB does not give incomplete type.
+
+  Fixed memory stomp in tinyrl_completion.
+
+- Updated to account for obscure problem related to C-strings
+  being signed and the ctype.h API taking a signed integer.
+
+  If a string contains characters greater than 127 then the signed bit
+  will be set and when calling a ctype.h utility this can get sign
+  extended.
+  e.g. 
+  char *ptr = "£10"; isspace(*ptr);  will have the value -100
+  passed to the function (or MACRO) as the '£' character (decimal 156)
+  is negative when held as a signed char.
+
+  The solution is to ensure that you always used unsigned chars to
+  pass to the utility functions. This was achieved by adding a lub_ctype 
+  component which provides 8-bit safe versions of these functions.
+
+- added ability to have scripts stop on error or not by introducing a new
+  clish_source_no_stop entry point,
+
+- added ability to limit the maximum line length in tinyrl.
+
+- fixed bug in tinyrl_completion which was stomping on memory when there
+  were an exact multiple of 10 completions. Fix is to allocate one extra
+  entry for the NULL terminator.
+
+- added lub_heap_destroy() operation which frees up a heap object so
+  that the memory segments used for it can be reused for something else.
+  
+- Updated lub_heap so that leak scanning will account for
+  any non-monitored allocated blocks in the system. This 
+  prevents false leaks from being reported. However it
+  cannot account for any of the non-monitored blocks being
+  leaked themselves.
+
+- stripped out some spurious code in vxworks/heap_symShow.c
+
+- lubMallocTest.exe now exercises stress test on lub_heap component.
+  mallocTest.exe runs the same test on the native heap manager for the
+  host platform.
+
+- fixed lub_heap__get_max_free() to work when no free blocks are present.
+
+- added a generic lub_heap_scan_stack() function which can be used
+  to scan any variables held in the current stack up to 32 levels.
+  (needed for non VxWorks systems)
+
+- made lub_heap_scan_memory() take a const void* argument.
+
+- updated lub/heap.h to work when included from C++ file.
+
+- updated the posix/heap_symShow.c to use libbfd for symbol decoding.
+  A lub_heap_init() operation now exists which is called to
+  provide the filename of the current program so that symbols can be
+  loaded.
+
+- disabled memory leak detection and memory taiting by default for
+  the POSIX platform.
+
+- changed default behaviour to tainting and leak detection off.
+
+- when leak detection is enabled for the first time an exit handler is
+  registered to dump memory when a program completes.
+
+- updated configure.ac so that -disable-gpl may be used to prevent
+  linking with GPL licenced libraries.
+
+- fixed bug in tinyrl_completion which was stomping on memory when there
+  were an exact multiple of 10 completions. Fix is to allocate one extra
+  entry for the NULL terminator.
+
+- fixed bug in clish_pargv_new() which was only allocating enough memory 
+  for the number of arguments entered on the command-line. In the case of
+  optional trailing parameters, which were not entered, this caused a memory
+  stomp! Fixed by allocating enough memory for the maximum of the entered 
+  parameters or the command parameters.
+
+- added clish_command__get_param_count() method to obtain the number of 
+  parameters associated with a command.
+
+- fixed bug in lub_heap_graft_to_bottom; the tail was not getting it's 
+  free and segment fields set up.
+
+\section _0_7_0 0.7.0
+- Updated shell_execute.c to ensure that directories are not executed
+
+- fixed minor bug in autocompletion of parameters. 
+  clish_shell_parameter_generator() needed to account for trailing space 
+  when giving context sensitive help for parameters.
+  
+- updated lub_heap to maintain the length of blocks inclusive of the block
+  headers and tail. This reduces the overhead of manipulating sizes during
+  operations and also addresses an issue with the re-use of previously freed blocks.
+
+- added dblockpool component for creating dynamic chunks to be used as 
+  blockpools. The lub_heap implementation now uses this for holding
+  context instances, which both reduces the overhead memory used and
+  greatly reduces fragmentation when detecting leaks.
+  
+- fixed double insert bug in the lub_bintree_insert.c file.
+  Although the function was correctly returning -1 it was also 
+  replacing the root node with the provided client node!
+
+- updated shell_tinyrl.c so that typing "?" whilst in the middle of a 
+  quoted string inserts the '?' character rather than giving context
+  sensitive help.
+
+- fixed memory leaks which occurred when clish thread is cancelled during 
+  execution of a script.
+
+- updated to make the execution of a script asynchronously cancellable.
+
+- modified clish_shell's history command to use new methods 
+
+- added tinyrl_history_entry__get_index() method and removed 
+  tinyrl_history__get_base()
+
+- modified tinyrl_history so that index is held in the history_entry 
+  instances Then updated the history insertion code so that duplicate
+  entries are only held once in the history. This means that numeric
+  gaps can now occur in the history list, but a stifled list will no
+  longer force recent commands off the list through the repetition of 
+  a single command.
+  
+- updated tinyrl_completion() so that if the completion list contains
+  words which have a common (case insensitive) prefix are correctly
+  handled. Before this fix if commands "one" and "OneTwoThree" both
+  existed in the same view then the user would be unable to type
+  anything beyond "one".
+
+- fixed bug in clish_shell_tinyrl_key_enter() where a pointer to the line
+  for the current tinyrl instance was being held onto after it had been 
+  changed by an auto-completion, hence was now referencing freed memory.
+
+- ensure that when reading a script and an error occurs we don't bother
+  to show the errored command line after the "DING"
+
+- ensure that after reading a script the prompt isn't duplicated.
+
+- fixed memory leak in clish_pargv_init() where the 'args' parameter wasn't
+  releasing its working string.
+
+- fixed tinyrl_redisplay so that CTRL-K works; wasn't accounting for 
+  insertion point movements before erasing characters from end of line.
+
+- fixed history.c so that stifled history lists add_n_replace() properly.
+  This also addresses an assertion which was occuring with "history 1"
+
+- updated clish_shell class so that when an error occurs in a script, 
+  execution is terminated in any parent scripts. 
+  This doesn't terminate an interactive session.
+  This means that a script will now only run until it's first error 
+  (or the first error of a child script etc...)
+
+- plugged a poential memory leak in lub_string_catn() function.
+
+- fixed clish_shell_delete() so that the file stack is cleared out.
+
+- updated lub/argv class to be more resilient when memory
+  allocation failures occur.
+
+- reduced the terminal noise generated by tinyrl when 
+  auto-completion occurs.
+
+- reduced the termnal noise generated by tinyrl when user deletes
+  characters from the end of a line.
+   
+- VxWorks has an issue with its pthreads library which means that a
+  cleanup hook can be called multiple times (recursively)!!!. Updated
+  the cleanup function to set the pthread cancel state to 
+  PTHREAD_CANCEL_DISABLE to prevent this.
+  
+- found and fixed a memory leak in the stack of files being used for input.
+
+- updated auto-completion code to handle quoted arguments.
+
+- fixed echoing issue when echoing should be hidden.
+
+- overhauled the auto-completion code. Now capable of autocompleting 
+  parameters as well as commands. Parameters are now validated as they
+  are typed. This has involved some restructuring of the
+  tinyrl_completion interfaces.
+
+- fixed so that validation of integers works correctly.
+
+- removing the spurious auto-completions has had the side effect of not 
+  echoing commands executed from scripts. fixed this issue.
+  
+- modified the help system so that if a command has possible other
+  commands which are an extension of the current command name 
+  (e.g. slot, slotOne, slotTwo) then the command help will be augmented
+  the summary help of the possile completion commands.
+  
+- fixed bug where the SPACE key could cause spurious completion 
+  information to be displayed before entering a space character.
+
+- fixed clish_shell_help.c so that any detailed help held for
+  "place-holder" commands (e.g. "show slot" has a place holder command 
+  called "show") will be displayed when ?? is entered.
+
+- fixed bug where entering a command which happened to be a prefix
+  of other commands, caused spurious completion information to be
+  displayed before executing the command.
+
+- cleaned up the tinyrl.c to remove a spurious tinyrl_crlf() call
+  when reading a line. If a command outputs no text to stdout/stderr
+  then the prompt will now reappear on the following
+  line rather than leave a blank.
+
+- Updated the context sensitive help so that any parmeters which
+  have specific ranges e.g. "integer" or "selection" indicate
+  these possible values in the help text.
+  
+- Updated the ptype class to allow for pre-processing of parameter
+  before validation. See the XML schema for details.
+
+- Updated the ptype class to allow three methods for parameter validation.
+ "regexp"[default], "integer" and "select" See the XML schema for details.
+
+- Went through the code cleaning up PC Lint issues.
+
+- Added a last_buffer field to the tinyrl class to cache the last
+ displayed line. This can then be used to reduce the number of output
+ characters when only a single char has been added to the end. 
+ This simplifies the automated testing/interaction with the CLI.
+ e.g. expect scripts.
+ 
+- updated tinyrl.c to cache the isatty settings. This provides a
+  new operation called tinyrl__get_isatty()
+
+- removed nested shell support for a single client. It is no longer
+  needed as the "clish_source" command is used instead of spawning
+  another shell.
+
+- changed so that history entries are only added for interactive lines.
+  So if for example a user were to "clish_source" another file, 
+  the commands so issued from that file will not be added to the history.
+  
+- changed "clish_spawn" back to "clish_source" and implemented a stack of 
+  file handles per shell instance. The spawning of a sub-script was 
+  resource intensive, and had issues with spawned pthreads not having 
+  the attributes (e.g. stack size) as the parent thread. It also felt
+  too clunky to have multiple shell associated with a single client.
+
+- fixed tinyrl_readline() to make sure that lines longer than 80 chars are
+  handled correctly when read from a script.
+  
+- modified tinyrl_replace_line() to only modify the insertion point if
+  the buffer shrinks beyond the current insertion point. This
+  addresses the inserting spaces in the middle of a line issue.
+  
+- fixed clish_shell_spawn_from_file() so that it returns 
+  BOOL_TRUE upon success.
+
+- fixed tclish executable to read input from files correctly.
+
+- updated tinyrl.c to simply read non-tty input streams rather than
+  try and treat them like an interactive session.
+  
+- fixed tclish executable to account for nested shells being attached
+  to a single client. (using the "clish_spawn" builtin command.) 
+  Only when the root shell is initialised or finalised will
+  the resources be allocated and freed.
+
+- renamed the "clish_source" builtin command to "clish_spawn"; it takes
+  a filename and spawns a new shell to interpret the contents of the file.
+
+- added tinyrl__get_istream() tinyrl__get_ostream(), 
+  tinyrl_vt100__get_istream() and tinyrl_vt100__get_ostream() operations. 
+  This means that a client of CLISH can identify which file handles are 
+  being used. This is useful in the case of a client which is sourcing 
+  files using the "clish_source" builtin command.
+
+- Fixed to ensure that SPACE auto-completion works with commands which
+  take "args" type parameters.
+  
+\section _0_6_3 0.6.3
+- Updated tinyrl.c to ensure that SPACE auto-completes multi-word commands.
+  
+- Updated tinyrl.c to ensure that the line is redisplayed after a
+  completion has been performed. This is needed to ensure that when
+  a line is complete e.g. when pressing ENTER, the completion is 
+  shown before moving on.
+
+- fixed a freed memory usage in clish/shell/shell_tinyrl.c where a 
+  line pointer was obtained before completion was performed, then used. 
+  Needed to re-aquire the line pointer after completion, because it
+  could have changed.
+
+- fixed a memory corruption in tinyrl/history.c where a spurious NULL
+  terminator was being added to the vector of history entries
+  and corrupting the heap.
+
+- Updated command help to show the full multi-word command in the
+  detailed help. Also shows required parameters &lt;like_this&gt;
+
+\section _0_6_2 0.6.2
+- removed any non-interpreter specific setup/restore details from
+  tclish_init_callback and tclishell_fini_callback and put them into 
+  tclish.cpp
+  
+- updated tinyrl_readline() to change the terminal input mode on the fly 
+  to raw mode and then restore it when the line has been entered. This
+  is needed to ensure that the terminal is in the correct mode for any 
+  sub-shells which are launched. This means that clish_init_callback.c
+  and clish_fini_callback.c are redundant so have been removed.
+
+- updated clish_shell_spawn interface to take a pthread attibute as
+  a parameter this makes it possible for a client to control the
+  thread details.  
+
+- Documentation cleanups; added link to sourceforge pages, removed
+  redundant issues, started a doxygen todo list.
+
+\section _0_6_1 0.6.1
+- Fixed a bug where trying to insert text in the middle of a line
+  caused the remains of the line to be deleted.
+
+- updated the tdemo script to use the normal installation location for TCL
+  /usr/share/tcl8.4 rather than /usr/local/share/tcl8.4 which is used when 
+  you build it from scratch.
+
+\section _0_6_0 0.6.0
+
+    
+\subsection _0_6_0e 0.6.0e
+- Fixed shell_spawn.c so that client initialisation can fail hence cause the 
+  creation of the shell instance to be terminated. This means that client's 
+  may choose to perform user authentication at this point if they so wish.
+
+- Added a cmd_line hook which is called to provide the client details of 
+  each command line accepted by the shell. This enables logging of this
+  detail if so required. 
+
+\subsection _0_6_0d 0.6.0d
+- updated the autoconf system to use the TCL version for the tclishX.X name.
+
+- fixed clish/tclish_init_callback.c so that Tcl_FindExecutable() is called.
+  This is required to setup the TCL environment correctly. 0.6.0c release 
+  didn't load init.tcl correctly and was also crashing when file operations
+  were performed (e.g. glob, pwd)
+
+- finalized clish.xsd with proper namespace details
+
+
+\subsection _0_6_0c 0.6.0c
+- Fixed autoconf scripts to check for pthreads and TCL library.
+
+- Updated lub_argv class to be able to tell you when a parameter was quoted.
+  The paramter value itself will not contain the " marks.
+  
+- Introduced "args" and "args_help" attributes to the COMMAND element. 
+  This enables the remenant of a command line, after the parameters defined in
+  the PARAMS elements, to be assigned to a psuedo parameter variable.
+
+- Introduced a "escape_chars" attribute to the COMMAND element. This allows 
+  commands to override the default selection of characters which are escaped 
+  (e.g. \$) when expanded from a variable. Escaping of special characters is a
+  security feature to prevent the user from executing an underlying shell
+  command through the use of "clever" parameters. e.g. "fred`rm -rf \*`bloggs"
+  would be a rather unfortunate parameter on a UNIX system!!!
+
+- Introduced a "builtin" attribute to the ACTION element. Also enabled clients
+  to register their own built commands when spawning a shell. The XML MUST now
+  specify a builtin attribute to invoke a builtin command callback.
+  
+- entering an empty line simply redisplays the prompt. This enables a user to 
+  create some clear space on the screen.
+
+- Added tinyxml into the distibution; currently the tarball of this 
+  component (available from http://www.grinninglizard.com/tinyxml/index.html)
+  doesn't support autoconf, so by adding this in (plus a module.am) you get 
+  autoconf support. This library is 'much' smaller than libxml2 and hence is
+  more appropriate for an embedded system. libxml2 is no longer needed by 
+  clish.
+  
+- Added spawn interface to the shell class. This causes a separate thread to 
+  be lauched to handle the shell session. This is required for flat namespace 
+  embedded envrioments where you may need to sustain multiple concurrent
+  sessions.
+  
+- Introduced tinyrl component. This is a simplistic replacement for the 
+  readline library, which cannot be used in embedded-single memory space 
+  systems due to the use of global variables. Tinyrl implements sufficient 
+  functionality for the clish component to function, and no-more although more 
+  may be added in the future. readline is no longer needed to build clish.
+
+- Updated clish component so that "viewid" tag can be used to define view
+  specific variables. The syntax is of the form "fred=hello world;bert=goodbye"
+  and causes ${fred} and ${bert} to expand to the assigned values whilst in the
+  new view.
+  NB. the values themselves may be based on variables available in the current
+  context (e.g. environment, parameters or current viewid variables.)
+  
+- Updated clish component to use history escape sequences via an external
+  history_expand function. 
+  tinyrl_history currently supports "!!" "!N" and "!-N" expansion.
+  
+- Updated clish component to not use the exit(1) command to terminate the shell
+  instead a "close" instruction can be given to the shell and it will exit it's
+  external loop and terminate normally. This is for ease of use in 
+  single-memory-space embedded systems.
+  
+- Added a partial string test, which confirmed a bug in the VxWorks standard
+  headers which was causing lub_string_nocase_cmp() to work incorrectly.
+  
+- Updated clish component to support STARTUP XML element. This is used to 
+  display a banner and perform a startup action when a shell is first started.
+
+- Updated clish component to support OVERVIEW XML element. This is used to 
+  display some textual help when the clish_overview internal command is 
+  specified in an ACTION element.
+  
+- Updated clish component to support the DETAILS XML element.
+  These enhance the context sensitive help with the ability to provide more
+  details for a particular command. (a repeated press of the '?' key displays
+  this extra detail)
+  
+- Introduces more built in commands (can be specified in the ACTION element)
+  There are now four in total.
+  "clish_close"        - terminates the session.
+  "clish_overview"     - displays the text defined in the OVERVIEW element
+                         of the XML.
+  "clish_history [n]"  - displays the currently held history of command lines.
+                         Also enables the stifling of the history list to a
+                         value specified by the optional parameter 'n'. 
+                         A value of zero means unstifled.                   
+  "clish_source file"  - spawn a separate clish session reading the input from
+                         the specified file. Output still goes to the current
+                         output stream.
+
+- Mapped [space] and [enter] to auto-complete commands if appropriate.
+
+
+<HR>
+
+\section _0_5_4 0.5.4
+This work was done as an employee of 3Com (http://www.3com.com)
+
+    Graeme McKerrell
+
+- Initial public release
+
+
+*/
+*/

+ 91 - 0
ISSUES

@@ -0,0 +1,91 @@
+/**
+\page _issues_page Issues
+
+\todo
+- placing a "?" character in a text file doesn't display help text when 
+  passed into clish.
+
+- ACTIONS which are meant to handle signals like CTRL-C 
+  don't seem to work properly, either the sub-script fails and the
+  shell breaks, or the sub-script never handles the signal (depending on 
+  platform).
+  
+- the heap unittest current has 10 failures
+
+- no unittests for the dblockpool component yet...
+
+- lub_heap_destroy() method should be provided which will de-register any allocated blocks from the
+  leak detection trees.
+
+- update leak detection to scan non-monitored allocated memory blocks, for references. This requires
+  the ability to iterate all the heaps in the system.
+
+- auto-completion currently doesn't handle optional parameters (defined using the "prefix" attribute).
+  
+- If a multi-word command is defined in global and local views then
+auto-completion currently works for both, but resolving doesn't seem to.
+\verbatim
+e.g. "mode"     - local view
+     "mode qos" - global view
+     Will auto-complete "mode qos" but won't run it...
+\endverbatim
+- Doesn't handle wrapping of long lines properly; get multiple lines scrolling
+  down the screen.
+- Not all files have been split out into one file per function...
+- need to complete the Doxygen documentation for clish, tinyrl and lub/argv
+
+\section _nice Nice to have
+- when importing from a namespace, allow the specification of the following:
+  no-help         - defaults to false but may be set true to prevent display in the help menu.
+  no-completion   - defaults to false but may be set true to prevent auto-completion. 
+  no-context-help - defaults to false but may be set true to prevent context sensitive help for 
+                    commands.
+
+- place an access level on namespaces; saves worrying about defining access for
+  every single command. e.g. device_show namespace could have different access
+  to device_config namespace. device view simply imports both namespaces.
+
+- When defining a default attribute if you could include a variable in the 
+  definition, default could be given meaningful values.
+- Augment the XML schema for support of dynamic variables.
+  e.g. 
+  \verbatim
+  <VARIABLE name="fred"><ACTION>puts "hello world"</ACTION></VARIABLE>
+  \endverbatim
+  will get the value of "hello world" when expanded as ${fred}... 
+  This is simple for TCL as the result is returned... what about for clish ,  
+  how do we get a return value into the execitable?
+
+- Currently handles commands in one view or all views. Better model is to be able
+  to specify a namespace for commands and then assign a view to a namespace.
+  e.g.
+  \verbatim
+ <NAMESPACE name="fred">
+    <COMMAND>
+ </NAMESPACE>
+ <VIEW name=" kdjkdj"...>
+    <IMPORT namespace="fred">
+    <COMMAND ...>
+ </VIEW>
+  \endverbatim
+  by default a view imports commands from the global namespace.
+  NB. need to be able to resolve commands from all included namespaces.
+  
+- In addition a command could become an alias for an entire namespace's worth
+  of sub-commands.
+  e.g.
+  \verbatim
+ <NAMESPACE name="config">
+   <COMMAND name="show"...>
+   <COMMAND name="show ip"...>
+   ...
+ </NAMESPACE>
+  
+ <VIEW name="foobar"...>
+    <COMMAND      name="do" 
+                  help="perform a configuration command" 
+             namespace="config"/>
+ </VIEW>
+  \endverbatim
+
+*/

+ 456 - 0
LICENCE

@@ -0,0 +1,456 @@
+/**
+\page _licence_page Licence
+
+\section Overview
+This package contains code which is copyrighted to multiple sources.
+
+<HR>
+
+\section _3com 3Com Corporation
+The intial public release of this software was developed by Graeme McKerrell
+whilst in the employment of 3Com Europe Ltd.
+
+\verbatim
+clish/
+clish/command
+clish/param
+clish/pargv
+clish/ptype
+clish/shell
+clish/variable
+clish/view
+
+lub/
+lub/argv
+lub/bintree
+lub/blockpool
+lub/test
+lub/dump
+lub/string
+\endverbatim
+
+
+Copyright (c) 2005, 3Com Corporation
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimer in the documentation
+      and/or other materials provided with the distribution.
+    * Neither the name of 3Com Corporation nor the names of its contributors may
+      be used to endorse or promote products derived from this software without
+      specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+<HR>
+
+\section _newport Newport Networks Ltd.
+The 0.6-0.7 releases of this software was developed by Graeme McKerrell whilst in the 
+employment of Newport Networks Ltd.
+As well as enhancing the existing code the following new modules were developed.
+
+\verbatim
+tinyrl/
+tinyrl/history
+tinyrl/vt100
+
+lub/heap/
+lub/heap/vxworks
+lub/heap/posix
+lub/dblockpool
+lubheap/
+lubheap/vxworks
+lubheap/posix
+
+\endverbatim
+
+
+Copyright (c) 2005,2006, Newport Networks Ltd
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimer in the documentation
+      and/or other materials provided with the distribution.
+    * Neither the name of Newport Networks Ltd nor the names of its contributors may
+      be used to endorse or promote products derived from this software without
+      specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+<HR>
+
+\section _tinyxml Yves Berquin
+As of release 0.6 the tinyxml library is included (unchanged) as part of the
+distribution.
+\verbatim
+tinyxml (v2.5.1)
+\endverbatim
+
+http://www.sourceforge.net/projects/tinyxml
+Original file by Yves Berquin.
+
+This software is provided 'as-is', without any express or implied 
+warranty. In no event will the authors be held liable for any 
+damages arising from the use of this software.
+
+Permission is granted to anyone to use this software for any 
+purpose, including commercial applications, and to alter it and 
+redistribute it freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must 
+not claim that you wrote the original software. If you use this 
+software in a product, an acknowledgment in the product documentation 
+would be appreciated but is not required.
+
+2. Altered source versions must be plainly marked as such, and
+must not be misrepresented as being the original software.
+
+3. This notice may not be removed or altered from any source 
+distribution.
+
+<HR>
+
+\section _binutils GNU binutils
+As of release 0.7.1 libbfd can be used to resolve symbols for
+stacktraces. This feature can be turned off if linking with GPL code
+is problematic, using "configure --without-gpl".
+
+The Binary File Descriptor library is part of GNU binutils
+http://www.gnu.org/software/binutils/
+
+The following file is licenced under the GPLv2.
+
+\verbatim
+lub/heap/posix/heap_symShow.c
+
+This file is part of the CLISH project http://clish.sourceforge.net/
+
+The code in this file is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; version 2
+   
+This code is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+Derived from addr2line.c in the GNU binutils package by Ulrich.Lauther@mchp.siemens.de 
+
+\endverbatim
+
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+             
+<HR>
+
+*/

+ 45 - 0
Makefile.am

@@ -0,0 +1,45 @@
+## Process this file with automake to generate Makefile.in
+AUTOMAKE_OPTIONS        = foreign nostdinc
+
+AM_CPPFLAGS             = -I. -I$(top_srcdir)
+AM_LD                   = $(CXX)
+
+if DEBUG
+  DEBUG_CFLAGS = -DDEBUG
+endif
+
+AM_CFLAGS               = -ansi -pedantic -Werror -Wall -D_POSIX_C_SOURCE=199309 $(DEBUG_CFLAGS)
+
+bin_PROGRAMS            =
+lib_LTLIBRARIES         =
+lib_LIBRARIES           =
+nobase_include_HEADERS  =
+
+EXTRA_DIST              =  \
+    bin/module.am          \
+    clish/module.am        \
+    lub/module.am          \
+    lubheap/module.am      \
+    tinyrl/module.am       \
+    tinyxml/module.am      \
+    test/module.am         \
+    xml-examples/module.am \
+    cliconf/module.am      \
+    doxygen.config         \
+    clish.xsd              \
+    LICENCE                \
+    README                 \
+    CHANGES                \
+    ISSUES
+
+
+
+include $(top_srcdir)/bin/module.am
+include $(top_srcdir)/clish/module.am
+include $(top_srcdir)/lub/module.am
+include $(top_srcdir)/lubheap/module.am
+include $(top_srcdir)/tinyrl/module.am
+include $(top_srcdir)/tinyxml/module.am
+include $(top_srcdir)/test/module.am
+include $(top_srcdir)/xml-examples/module.am
+include $(top_srcdir)/cliconf/module.am

File diff suppressed because it is too large
+ 3123 - 0
Makefile.in


+ 160 - 0
README

@@ -0,0 +1,160 @@
+/**
+\mainpage
+
+\section abstract Abstract
+A modular framework for implementing a CISCO-like CLI on a *NIX system.
+Arbitary command menus and actions can be defined using XML files.
+This software handles the user interaction, and forks the appropriate system
+commands to perform any actions. 
+
+- \ref _licence_page 
+- \ref _changes_page 
+- \ref _issues_page
+
+\section downloads Downloads
+This project is hosted on 
+<A HREF="http://sourceforge.net/projects/clish/">sourceforge.</A> from where
+the source-code can be downloaded.
+
+\section background Background
+The CISCO-like CLI has become a de-facto standard in the domain of network 
+devices. It is a much more restricted interface than traditional *NIX shells,
+hence is simpler to use and inherently more secure. As more devices move to 
+using an embedded *NIX operating systems, a simple, scalable means of producing 
+such a CLI becomes valuable.
+
+\section existing Existing Solutions
+
+\subsection Libcli
+<A HREF="http://libcli.sourceforge.net/">Libcli</A>
+provides a similar facility but has the following main limitations:-
+
+1) In order to add new commands a monolithic executable (which uses the
+   library) needs to be recompiled, after editing the source code to add the
+   newly required commands and actions.
+
+2) libcli takes responsiblity for attaching to a socket (telnet-like). This 
+   limits the usage of the CLI; difficult to use over SSH for example, similarly
+   cannot get the menus directly from an existing shell.
+
+3) The implementation of the command actions is hard-linked into the monolithic
+   executable, this can cause licence concerns/issues when a commercial company
+   wishes to control proprietry software from within the CLI.
+
+4) libcli takes responsiblity for the authentication of the user. This is
+   different from other "shells" which do not deal with authentication, but are
+   simply spawned as the required user.
+   
+\subsection GNU-zebra
+<A HREF="http://www.zebra.org/">Zebra</A>
+is a routing package, and comes with it's own integrated CLI, to handle its
+configuration (VTYSH).
+
+\section project CLISH Project
+The project is written (mostly) in ANSI-C and provides two example executables
+which can be used as a drop-in replacement for a more conventional "shell".
+
+The software was initially developed as part of some internal work at 3Com and
+due to the dependancy on 3rd party open-source packages, and it's self contained
+nature, it is being released into the public domain.
+
+It is designed to run on any *NIX system e.g. Linux, BSD, Cygwin and makes use
+of the following other opensource packages (glibc,tinyxml,doxygen)
+
+\subsection clish  clish  (pronounced see-lish)
+This application is a standard UNIX shell replacement. The ACTION tags in the XML
+specification are mapped to the system() call and hence will be interpreted as
+a Bourne-shell script.
+
+\subsection tclish tclish (pronounced tickle-ish)
+This application is built if the TCL libraries are present on the build system.
+The name of the executable produced will reflect the version of TCL used. e.g. 
+tclish8.4 will be generated if TCL8.4 is present on the system.
+
+This application will spawn a TCL interpreter when started, and the contents of
+the ACTION tags will be interpreted as TCL scripts within that interpreter for
+the duration of the shell.
+  
+\subsection Features
+The "clish" shell has the following features:-
+
+-	Provides CLI tree handling facilities
+	-	Tree built from multiple XML encoded files. (uses tinyxml)
+	        This means that XML configuration files can be be made part of
+		3rd party packages and simply installing them integrates
+		commands into the CLI.
+	
+-	Access permissions are defined as part of the CLI tree definition; a CLI
+	node/branch may be limited to a specific *NIX group.
+
+-	Provides interface to user
+	-	Handles auto-completion of commands
+	-	Only appropriate commands for the current user's "group" will be 
+		available.
+	-	Provides parameter type verification facility
+		*	Each parameter may be of a specific type, which the
+		        framework will ensure is correctly entered by the user.
+	-	Provides key-handling for the interface (uses tinyrl)
+		*	Provides command line editing facilities
+		*	up/down arrow keys
+		*	[TAB] command completion 
+		*	[CTRL-A] move to start of command line
+		*	[?] provides context sensitive help.
+
+- 	Able to be launched non-interactively
+	- textual scripts can be written to drive the CLI
+
+-	Executes a specified CLI command by launching the appropriate
+        (as defined in the CLI tree) system command line to perform the
+        required action
+	-	Only commands permitted for the current user are available.
+	-	During execution the I/O streams are handed over to the new 
+	        program.
+	-	Able to spawn a 3rd party shell, where necessary
+	        This will take over control of the  I/O channel until that
+		sub-shell exits.
+
+
+"clish" makes use of multiple XML files to define it's behaviour these...
+
+-	Identify scope of the commands (global or specific view(s))
+
+-	Include access permissions. By default a command will be
+        accessible to all users, but the schema will provide
+	the ability to limit the command based on UNIX group membership.
+
+-	Includes help text for menus
+
+-	Includes parameter definitions (with types where appropriate)
+
+-	Includes prompt modifications (different views)
+
+-	Includes full command line which each leaf node should execute
+        to achieve result.
+
+-	Separate set of files for each localization (language) can be
+        provided and determined by the user logging in.
+
+-	"packages" can contribute files to define their facilities
+        within the CLI; this makes augmentation of the CLI as simple
+	as including/excluding a particular package.
+
+\section example xml-example directory
+
+\include README
+
+Some of the example files are put here for reference:
+
+\subsection global_xml global-command.xml
+\include global-commands.xml
+
+\subsection startup_xml startup.xml
+\include startup.xml
+
+\subsection types_xml types.xml
+\include types.xml
+
+\subsection debug_xml debug-view.xml
+\include debug-view.xml
+
+*/

File diff suppressed because it is too large
+ 8951 - 0
aclocal.m4


+ 136 - 0
aux_scripts/compile

@@ -0,0 +1,136 @@
+#! /bin/sh
+# Wrapper for compilers which do not understand `-c -o'.
+
+scriptversion=2003-11-09.00
+
+# Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
+# Written by Tom Tromey <tromey@cygnus.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This file is maintained in Automake, please report
+# bugs to <bug-automake@gnu.org> or send patches to
+# <automake-patches@gnu.org>.
+
+case $1 in
+  '')
+     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
+     exit 1;
+     ;;
+  -h | --h*)
+    cat <<\EOF
+Usage: compile [--help] [--version] PROGRAM [ARGS]
+
+Wrapper for compilers which do not understand `-c -o'.
+Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
+arguments, and rename the output as expected.
+
+If you are trying to build a whole package this is not the
+right script to run: please start by reading the file `INSTALL'.
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+    exit 0
+    ;;
+  -v | --v*)
+    echo "compile $scriptversion"
+    exit 0
+    ;;
+esac
+
+
+prog=$1
+shift
+
+ofile=
+cfile=
+args=
+while test $# -gt 0; do
+  case "$1" in
+    -o)
+      # configure might choose to run compile as `compile cc -o foo foo.c'.
+      # So we do something ugly here.
+      ofile=$2
+      shift
+      case "$ofile" in
+	*.o | *.obj)
+	  ;;
+	*)
+	  args="$args -o $ofile"
+	  ofile=
+	  ;;
+      esac
+       ;;
+    *.c)
+      cfile=$1
+      args="$args $1"
+      ;;
+    *)
+      args="$args $1"
+      ;;
+  esac
+  shift
+done
+
+if test -z "$ofile" || test -z "$cfile"; then
+  # If no `-o' option was seen then we might have been invoked from a
+  # pattern rule where we don't need one.  That is ok -- this is a
+  # normal compilation that the losing compiler can handle.  If no
+  # `.c' file was seen then we are probably linking.  That is also
+  # ok.
+  exec "$prog" $args
+fi
+
+# Name of file we expect compiler to create.
+cofile=`echo $cfile | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
+
+# Create the lock directory.
+# Note: use `[/.-]' here to ensure that we don't use the same name
+# that we are using for the .o file.  Also, base the name on the expected
+# object file name, since that is what matters with a parallel build.
+lockdir=`echo $cofile | sed -e 's|[/.-]|_|g'`.d
+while true; do
+  if mkdir $lockdir > /dev/null 2>&1; then
+    break
+  fi
+  sleep 1
+done
+# FIXME: race condition here if user kills between mkdir and trap.
+trap "rmdir $lockdir; exit 1" 1 2 15
+
+# Run the compile.
+"$prog" $args
+status=$?
+
+if test -f "$cofile"; then
+  mv "$cofile" "$ofile"
+fi
+
+rmdir $lockdir
+exit $status
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:

File diff suppressed because it is too large
+ 1463 - 0
aux_scripts/config.guess


File diff suppressed because it is too large
+ 1579 - 0
aux_scripts/config.sub


+ 522 - 0
aux_scripts/depcomp

@@ -0,0 +1,522 @@
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2004-05-31.23
+
+# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
+
+case $1 in
+  '')
+     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
+     exit 1;
+     ;;
+  -h | --h*)
+    cat <<\EOF
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]
+
+Run PROGRAMS ARGS to compile a file, generating dependencies
+as side-effects.
+
+Environment variables:
+  depmode     Dependency tracking mode.
+  source      Source file read by `PROGRAMS ARGS'.
+  object      Object file output by `PROGRAMS ARGS'.
+  DEPDIR      directory where to store dependencies.
+  depfile     Dependency file to output.
+  tmpdepfile  Temporary file to use when outputing dependencies.
+  libtool     Whether libtool is used (yes/no).
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+    exit 0
+    ;;
+  -v | --v*)
+    echo "depcomp $scriptversion"
+    exit 0
+    ;;
+esac
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+  echo "depcomp: Variables source, object and depmode must be set" 1>&2
+  exit 1
+fi
+
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+  sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags.  We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write.  Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+  # HP compiler uses -M and no extra arg.
+  gccflag=-M
+  depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+   # This is just like dashmstdout with a different argument.
+   dashmflag=-xM
+   depmode=dashmstdout
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff.  Hmm.
+  "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  mv "$tmpdepfile" "$depfile"
+  ;;
+
+gcc)
+## There are various ways to get dependency output from gcc.  Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+##   up in a subdir.  Having to rename by hand is ugly.
+##   (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+##   -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+##   than renaming).
+  if test -z "$gccflag"; then
+    gccflag=-MD,
+  fi
+  "$@" -Wp,"$gccflag$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+  sed -e 's/^[^:]*: / /' \
+      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header).  We avoid this by adding
+## dummy dependencies for each header file.  Too bad gcc doesn't do
+## this for us directly.
+  tr ' ' '
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'.  On the theory
+## that the space means something, we add a space to the output as
+## well.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+hp)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
+sgi)
+  if test "$libtool" = yes; then
+    "$@" "-Wp,-MDupdate,$tmpdepfile"
+  else
+    "$@" -MDupdate "$tmpdepfile"
+  fi
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+
+  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
+    echo "$object : \\" > "$depfile"
+
+    # Clip off the initial element (the dependent).  Don't try to be
+    # clever and replace this with sed code, as IRIX sed won't handle
+    # lines with more than a fixed number of characters (4096 in
+    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
+    # the IRIX cc adds comments like `#:fec' to the end of the
+    # dependency line.
+    tr ' ' '
+' < "$tmpdepfile" \
+    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+    tr '
+' ' ' >> $depfile
+    echo >> $depfile
+
+    # The second pass generates a dummy entry for each header file.
+    tr ' ' '
+' < "$tmpdepfile" \
+   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+   >> $depfile
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+aix)
+  # The C for AIX Compiler uses -M and outputs the dependencies
+  # in a .u file.  In older versions, this file always lives in the
+  # current directory.  Also, the AIX compiler puts `$object:' at the
+  # start of each line; $object doesn't have directory information.
+  # Version 6 uses the directory in both cases.
+  stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
+  tmpdepfile="$stripped.u"
+  if test "$libtool" = yes; then
+    "$@" -Wc,-M
+  else
+    "$@" -M
+  fi
+  stat=$?
+
+  if test -f "$tmpdepfile"; then :
+  else
+    stripped=`echo "$stripped" | sed 's,^.*/,,'`
+    tmpdepfile="$stripped.u"
+  fi
+
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+
+  if test -f "$tmpdepfile"; then
+    outname="$stripped.o"
+    # Each line is of the form `foo.o: dependent.h'.
+    # Do two passes, one to just change these to
+    # `$object: dependent.h' and one to simply `dependent.h:'.
+    sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
+    sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+icc)
+  # Intel's C compiler understands `-MD -MF file'.  However on
+  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+  # ICC 7.0 will fill foo.d with something like
+  #    foo.o: sub/foo.c
+  #    foo.o: sub/foo.h
+  # which is wrong.  We want:
+  #    sub/foo.o: sub/foo.c
+  #    sub/foo.o: sub/foo.h
+  #    sub/foo.c:
+  #    sub/foo.h:
+  # ICC 7.1 will output
+  #    foo.o: sub/foo.c sub/foo.h
+  # and will wrap long lines using \ :
+  #    foo.o: sub/foo.c ... \
+  #     sub/foo.h ... \
+  #     ...
+
+  "$@" -MD -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  # Each line is of the form `foo.o: dependent.h',
+  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
+  # Do two passes, one to just change these to
+  # `$object: dependent.h' and one to simply `dependent.h:'.
+  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+  # Some versions of the HPUX 10.20 sed can't process this invocation
+  # correctly.  Breaking it into two sed invocations is a workaround.
+  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
+    sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+tru64)
+   # The Tru64 compiler uses -MD to generate dependencies as a side
+   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+   # dependencies in `foo.d' instead, so we check for that too.
+   # Subdirectories are respected.
+   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+   test "x$dir" = "x$object" && dir=
+   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+
+   if test "$libtool" = yes; then
+      # Dependencies are output in .lo.d with libtool 1.4.
+      # With libtool 1.5 they are output both in $dir.libs/$base.o.d
+      # and in $dir.libs/$base.o.d and $dir$base.o.d.  We process the
+      # latter, because the former will be cleaned when $dir.libs is
+      # erased.
+      tmpdepfile1="$dir.libs/$base.lo.d"
+      tmpdepfile2="$dir$base.o.d"
+      tmpdepfile3="$dir.libs/$base.d"
+      "$@" -Wc,-MD
+   else
+      tmpdepfile1="$dir$base.o.d"
+      tmpdepfile2="$dir$base.d"
+      tmpdepfile3="$dir$base.d"
+      "$@" -MD
+   fi
+
+   stat=$?
+   if test $stat -eq 0; then :
+   else
+      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+      exit $stat
+   fi
+
+   if test -f "$tmpdepfile1"; then
+      tmpdepfile="$tmpdepfile1"
+   elif test -f "$tmpdepfile2"; then
+      tmpdepfile="$tmpdepfile2"
+   else
+      tmpdepfile="$tmpdepfile3"
+   fi
+   if test -f "$tmpdepfile"; then
+      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+      # That's a tab and a space in the [].
+      sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+   else
+      echo "#dummy" > "$depfile"
+   fi
+   rm -f "$tmpdepfile"
+   ;;
+
+#nosideeffect)
+  # This comment above is used by automake to tell side-effect
+  # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout, regardless of -o.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  test -z "$dashmflag" && dashmflag=-M
+  # Require at least two characters before searching for `:'
+  # in the target name.  This is to cope with DOS-style filenames:
+  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
+  "$@" $dashmflag |
+    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+dashXmstdout)
+  # This case only exists to satisfy depend.m4.  It is never actually
+  # run, as this mode is specially recognized in the preamble.
+  exit 1
+  ;;
+
+makedepend)
+  "$@" || exit $?
+  # Remove any Libtool call
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+  # X makedepend
+  shift
+  cleared=no
+  for arg in "$@"; do
+    case $cleared in
+    no)
+      set ""; shift
+      cleared=yes ;;
+    esac
+    case "$arg" in
+    -D*|-I*)
+      set fnord "$@" "$arg"; shift ;;
+    # Strip any option that makedepend may not understand.  Remove
+    # the object too, otherwise makedepend will parse it as a source file.
+    -*|$object)
+      ;;
+    *)
+      set fnord "$@" "$arg"; shift ;;
+    esac
+  done
+  obj_suffix="`echo $object | sed 's/^.*\././'`"
+  touch "$tmpdepfile"
+  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  sed '1,2d' "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile" "$tmpdepfile".bak
+  ;;
+
+cpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test $1 != '--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  "$@" -E |
+    sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+    sed '$ s: \\$::' > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  cat < "$tmpdepfile" >> "$depfile"
+  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+msvisualcpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout, regardless of -o,
+  # because we must use -o when running libtool.
+  "$@" || exit $?
+  IFS=" "
+  for arg
+  do
+    case "$arg" in
+    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+	set fnord "$@"
+	shift
+	shift
+	;;
+    *)
+	set fnord "$@" "$arg"
+	shift
+	shift
+	;;
+    esac
+  done
+  "$@" -E |
+  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
+  echo "	" >> "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+none)
+  exec "$@"
+  ;;
+
+*)
+  echo "Unknown depmode $depmode" 1>&2
+  exit 1
+  ;;
+esac
+
+exit 0
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:

+ 322 - 0
aux_scripts/install-sh

@@ -0,0 +1,322 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2004-07-05.00
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.  It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+chmodcmd="$chmodprog 0755"
+chowncmd=
+chgrpcmd=
+stripcmd=
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=
+dst=
+dir_arg=
+dstarg=
+no_target_directory=
+
+usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+   or: $0 [OPTION]... SRCFILES... DIRECTORY
+   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+   or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+-c         (ignored)
+-d         create directories instead of installing files.
+-g GROUP   $chgrpprog installed files to GROUP.
+-m MODE    $chmodprog installed files to MODE.
+-o USER    $chownprog installed files to USER.
+-s         $stripprog installed files.
+-t DIRECTORY  install into DIRECTORY.
+-T         report an error if DSTFILE is a directory.
+--help     display this help and exit.
+--version  display version info and exit.
+
+Environment variables override the default commands:
+  CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
+"
+
+while test -n "$1"; do
+  case $1 in
+    -c) shift
+        continue;;
+
+    -d) dir_arg=true
+        shift
+        continue;;
+
+    -g) chgrpcmd="$chgrpprog $2"
+        shift
+        shift
+        continue;;
+
+    --help) echo "$usage"; exit 0;;
+
+    -m) chmodcmd="$chmodprog $2"
+        shift
+        shift
+        continue;;
+
+    -o) chowncmd="$chownprog $2"
+        shift
+        shift
+        continue;;
+
+    -s) stripcmd=$stripprog
+        shift
+        continue;;
+
+    -t) dstarg=$2
+	shift
+	shift
+	continue;;
+
+    -T) no_target_directory=true
+	shift
+	continue;;
+
+    --version) echo "$0 $scriptversion"; exit 0;;
+
+    *)  # When -d is used, all remaining arguments are directories to create.
+	# When -t is used, the destination is already specified.
+	test -n "$dir_arg$dstarg" && break
+        # Otherwise, the last argument is the destination.  Remove it from $@.
+	for arg
+	do
+          if test -n "$dstarg"; then
+	    # $@ is not empty: it contains at least $arg.
+	    set fnord "$@" "$dstarg"
+	    shift # fnord
+	  fi
+	  shift # arg
+	  dstarg=$arg
+	done
+	break;;
+  esac
+done
+
+if test -z "$1"; then
+  if test -z "$dir_arg"; then
+    echo "$0: no input file specified." >&2
+    exit 1
+  fi
+  # It's OK to call `install-sh -d' without argument.
+  # This can happen when creating conditional directories.
+  exit 0
+fi
+
+for src
+do
+  # Protect names starting with `-'.
+  case $src in
+    -*) src=./$src ;;
+  esac
+
+  if test -n "$dir_arg"; then
+    dst=$src
+    src=
+
+    if test -d "$dst"; then
+      mkdircmd=:
+      chmodcmd=
+    else
+      mkdircmd=$mkdirprog
+    fi
+  else
+    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+    # might cause directories to be created, which would be especially bad
+    # if $src (and thus $dsttmp) contains '*'.
+    if test ! -f "$src" && test ! -d "$src"; then
+      echo "$0: $src does not exist." >&2
+      exit 1
+    fi
+
+    if test -z "$dstarg"; then
+      echo "$0: no destination specified." >&2
+      exit 1
+    fi
+
+    dst=$dstarg
+    # Protect names starting with `-'.
+    case $dst in
+      -*) dst=./$dst ;;
+    esac
+
+    # If destination is a directory, append the input filename; won't work
+    # if double slashes aren't ignored.
+    if test -d "$dst"; then
+      if test -n "$no_target_directory"; then
+	echo "$0: $dstarg: Is a directory" >&2
+	exit 1
+      fi
+      dst=$dst/`basename "$src"`
+    fi
+  fi
+
+  # This sed command emulates the dirname command.
+  dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+  # Make sure that the destination directory exists.
+
+  # Skip lots of stat calls in the usual case.
+  if test ! -d "$dstdir"; then
+    defaultIFS='
+	 '
+    IFS="${IFS-$defaultIFS}"
+
+    oIFS=$IFS
+    # Some sh's can't handle IFS=/ for some reason.
+    IFS='%'
+    set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
+    IFS=$oIFS
+
+    pathcomp=
+
+    while test $# -ne 0 ; do
+      pathcomp=$pathcomp$1
+      shift
+      if test ! -d "$pathcomp"; then
+        $mkdirprog "$pathcomp"
+	# mkdir can fail with a `File exist' error in case several
+	# install-sh are creating the directory concurrently.  This
+	# is OK.
+	test -d "$pathcomp" || exit
+      fi
+      pathcomp=$pathcomp/
+    done
+  fi
+
+  if test -n "$dir_arg"; then
+    $doit $mkdircmd "$dst" \
+      && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
+      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
+      && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
+      && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
+
+  else
+    dstfile=`basename "$dst"`
+
+    # Make a couple of temp file names in the proper directory.
+    dsttmp=$dstdir/_inst.$$_
+    rmtmp=$dstdir/_rm.$$_
+
+    # Trap to clean up those temp files at exit.
+    trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
+    trap '(exit $?); exit' 1 2 13 15
+
+    # Copy the file name to the temp name.
+    $doit $cpprog "$src" "$dsttmp" &&
+
+    # and set any options; do chmod last to preserve setuid bits.
+    #
+    # If any of these fail, we abort the whole thing.  If we want to
+    # ignore errors from any of these, just make sure not to ignore
+    # errors from the above "$doit $cpprog $src $dsttmp" command.
+    #
+    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
+      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
+      && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
+      && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
+
+    # Now rename the file to the real destination.
+    { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
+      || {
+	   # The rename failed, perhaps because mv can't rename something else
+	   # to itself, or perhaps because mv is so ancient that it does not
+	   # support -f.
+
+	   # Now remove or move aside any old file at destination location.
+	   # We try this two ways since rm can't unlink itself on some
+	   # systems and the destination file might be busy for other
+	   # reasons.  In this case, the final cleanup might fail but the new
+	   # file should still install successfully.
+	   {
+	     if test -f "$dstdir/$dstfile"; then
+	       $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
+	       || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
+	       || {
+		 echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
+		 (exit 1); exit
+	       }
+	     else
+	       :
+	     fi
+	   } &&
+
+	   # Now rename the file to the real destination.
+	   $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+	 }
+    }
+  fi || { (exit 1); exit; }
+done
+
+# The final little trick to "correctly" pass the exit status to the exit trap.
+{
+  (exit 0); exit
+}
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:

File diff suppressed because it is too large
+ 8413 - 0
aux_scripts/ltmain.sh


+ 360 - 0
aux_scripts/missing

@@ -0,0 +1,360 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+
+scriptversion=2005-06-08.21
+
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
+#   Free Software Foundation, Inc.
+# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+  echo 1>&2 "Try \`$0 --help' for more information"
+  exit 1
+fi
+
+run=:
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.ac; then
+  configure_ac=configure.ac
+else
+  configure_ac=configure.in
+fi
+
+msg="missing on your system"
+
+case "$1" in
+--run)
+  # Try to run requested program, and just exit if it succeeds.
+  run=
+  shift
+  "$@" && exit 0
+  # Exit code 63 means version mismatch.  This often happens
+  # when the user try to use an ancient version of a tool on
+  # a file that requires a minimum version.  In this case we
+  # we should proceed has if the program had been absent, or
+  # if --run hadn't been passed.
+  if test $? = 63; then
+    run=:
+    msg="probably too old"
+  fi
+  ;;
+
+  -h|--h|--he|--hel|--help)
+    echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+  -h, --help      display this help and exit
+  -v, --version   output version information and exit
+  --run           try to run the given command, and emulate it if it fails
+
+Supported PROGRAM values:
+  aclocal      touch file \`aclocal.m4'
+  autoconf     touch file \`configure'
+  autoheader   touch file \`config.h.in'
+  automake     touch all \`Makefile.in' files
+  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
+  flex         create \`lex.yy.c', if possible, from existing .c
+  help2man     touch the output file
+  lex          create \`lex.yy.c', if possible, from existing .c
+  makeinfo     touch the output file
+  tar          try tar, gnutar, gtar, then tar without non-portable flags
+  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
+
+Send bug reports to <bug-automake@gnu.org>."
+    exit $?
+    ;;
+
+  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+    echo "missing $scriptversion (GNU Automake)"
+    exit $?
+    ;;
+
+  -*)
+    echo 1>&2 "$0: Unknown \`$1' option"
+    echo 1>&2 "Try \`$0 --help' for more information"
+    exit 1
+    ;;
+
+esac
+
+# Now exit if we have it, but it failed.  Also exit now if we
+# don't have it and --version was passed (most likely to detect
+# the program).
+case "$1" in
+  lex|yacc)
+    # Not GNU programs, they don't have --version.
+    ;;
+
+  tar)
+    if test -n "$run"; then
+       echo 1>&2 "ERROR: \`tar' requires --run"
+       exit 1
+    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+       exit 1
+    fi
+    ;;
+
+  *)
+    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+       # We have it, but it failed.
+       exit 1
+    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+       # Could not run --version or --help.  This is probably someone
+       # running `$TOOL --version' or `$TOOL --help' to check whether
+       # $TOOL exists and not knowing $TOOL uses missing.
+       exit 1
+    fi
+    ;;
+esac
+
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case "$1" in
+  aclocal*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
+         to install the \`Automake' and \`Perl' packages.  Grab them from
+         any GNU archive site."
+    touch aclocal.m4
+    ;;
+
+  autoconf)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`${configure_ac}'.  You might want to install the
+         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
+         archive site."
+    touch configure
+    ;;
+
+  autoheader)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
+         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
+         from any GNU archive site."
+    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
+    test -z "$files" && files="config.h"
+    touch_files=
+    for f in $files; do
+      case "$f" in
+      *:*) touch_files="$touch_files "`echo "$f" |
+				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+      *) touch_files="$touch_files $f.in";;
+      esac
+    done
+    touch $touch_files
+    ;;
+
+  automake*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
+         You might want to install the \`Automake' and \`Perl' packages.
+         Grab them from any GNU archive site."
+    find . -type f -name Makefile.am -print |
+	   sed 's/\.am$/.in/' |
+	   while read f; do touch "$f"; done
+    ;;
+
+  autom4te)
+    echo 1>&2 "\
+WARNING: \`$1' is needed, but is $msg.
+         You might have modified some files without having the
+         proper tools for further handling them.
+         You can get \`$1' as part of \`Autoconf' from any GNU
+         archive site."
+
+    file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
+    test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
+    if test -f "$file"; then
+	touch $file
+    else
+	test -z "$file" || exec >$file
+	echo "#! /bin/sh"
+	echo "# Created by GNU Automake missing as a replacement of"
+	echo "#  $ $@"
+	echo "exit 0"
+	chmod +x $file
+	exit 1
+    fi
+    ;;
+
+  bison|yacc)
+    echo 1>&2 "\
+WARNING: \`$1' $msg.  You should only need it if
+         you modified a \`.y' file.  You may need the \`Bison' package
+         in order for those modifications to take effect.  You can get
+         \`Bison' from any GNU archive site."
+    rm -f y.tab.c y.tab.h
+    if [ $# -ne 1 ]; then
+        eval LASTARG="\${$#}"
+	case "$LASTARG" in
+	*.y)
+	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+	    if [ -f "$SRCFILE" ]; then
+	         cp "$SRCFILE" y.tab.c
+	    fi
+	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+	    if [ -f "$SRCFILE" ]; then
+	         cp "$SRCFILE" y.tab.h
+	    fi
+	  ;;
+	esac
+    fi
+    if [ ! -f y.tab.h ]; then
+	echo >y.tab.h
+    fi
+    if [ ! -f y.tab.c ]; then
+	echo 'main() { return 0; }' >y.tab.c
+    fi
+    ;;
+
+  lex|flex)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified a \`.l' file.  You may need the \`Flex' package
+         in order for those modifications to take effect.  You can get
+         \`Flex' from any GNU archive site."
+    rm -f lex.yy.c
+    if [ $# -ne 1 ]; then
+        eval LASTARG="\${$#}"
+	case "$LASTARG" in
+	*.l)
+	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+	    if [ -f "$SRCFILE" ]; then
+	         cp "$SRCFILE" lex.yy.c
+	    fi
+	  ;;
+	esac
+    fi
+    if [ ! -f lex.yy.c ]; then
+	echo 'main() { return 0; }' >lex.yy.c
+    fi
+    ;;
+
+  help2man)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+	 you modified a dependency of a manual page.  You may need the
+	 \`Help2man' package in order for those modifications to take
+	 effect.  You can get \`Help2man' from any GNU archive site."
+
+    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+    if test -z "$file"; then
+	file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
+    fi
+    if [ -f "$file" ]; then
+	touch $file
+    else
+	test -z "$file" || exec >$file
+	echo ".ab help2man is required to generate this page"
+	exit 1
+    fi
+    ;;
+
+  makeinfo)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified a \`.texi' or \`.texinfo' file, or any other file
+         indirectly affecting the aspect of the manual.  The spurious
+         call might also be the consequence of using a buggy \`make' (AIX,
+         DU, IRIX).  You might want to install the \`Texinfo' package or
+         the \`GNU make' package.  Grab either from any GNU archive site."
+    # The file to touch is that specified with -o ...
+    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+    if test -z "$file"; then
+      # ... or it is the one specified with @setfilename ...
+      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile`
+      # ... or it is derived from the source name (dir/f.texi becomes f.info)
+      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
+    fi
+    # If the file does not exist, the user really needs makeinfo;
+    # let's fail without touching anything.
+    test -f $file || exit 1
+    touch $file
+    ;;
+
+  tar)
+    shift
+
+    # We have already tried tar in the generic part.
+    # Look for gnutar/gtar before invocation to avoid ugly error
+    # messages.
+    if (gnutar --version > /dev/null 2>&1); then
+       gnutar "$@" && exit 0
+    fi
+    if (gtar --version > /dev/null 2>&1); then
+       gtar "$@" && exit 0
+    fi
+    firstarg="$1"
+    if shift; then
+	case "$firstarg" in
+	*o*)
+	    firstarg=`echo "$firstarg" | sed s/o//`
+	    tar "$firstarg" "$@" && exit 0
+	    ;;
+	esac
+	case "$firstarg" in
+	*h*)
+	    firstarg=`echo "$firstarg" | sed s/h//`
+	    tar "$firstarg" "$@" && exit 0
+	    ;;
+	esac
+    fi
+
+    echo 1>&2 "\
+WARNING: I can't seem to be able to run \`tar' with the given arguments.
+         You may want to install GNU tar or Free paxutils, or check the
+         command line arguments."
+    exit 1
+    ;;
+
+  *)
+    echo 1>&2 "\
+WARNING: \`$1' is needed, and is $msg.
+         You might have modified some files without having the
+         proper tools for further handling them.  Check the \`README' file,
+         it often tells you about the needed prerequisites for installing
+         this package.  You may also peek at any GNU archive site, in case
+         some other package would contain this missing \`$1' program."
+    exit 1
+    ;;
+esac
+
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:

+ 46 - 0
bin/clish.cpp

@@ -0,0 +1,46 @@
+//-------------------------------------
+// clish.cpp
+//
+// A simple client for libclish
+//-------------------------------------
+#include "clish/private.h"
+
+static 
+clish_shell_hooks_t my_hooks = 
+{
+    NULL, /* don't worry about init callback */
+    clish_access_callback,
+    NULL, /* don't worry about cmd_line callback */
+    clish_script_callback,
+    NULL, /* don't worry about fini callback */
+    clish_config_callback,
+    NULL  /* don't register any builtin functions */
+};
+//---------------------------------------------------------
+int 
+main(int argc, const char **argv)
+{
+	int            result      = -1;
+	
+    clish_startup(argc,argv);
+    
+    if(argc > 1)
+    {
+        int i = 1;
+        while(argc--)
+        {
+            /* run the commands in the file */
+            result = clish_shell_spawn_from_file(&my_hooks,NULL,argv[i++]);
+        }
+    }
+    else
+    {
+        /* spawn the shell */
+        result = clish_shell_spawn_and_wait(&my_hooks,NULL);
+    }
+
+    clish_shutdown();
+
+ 	return result ? 0 : -1;
+ }
+//---------------------------------------------------------

+ 329 - 0
bin/confd.c

@@ -0,0 +1,329 @@
+/*
+ * clish_config_callback.c
+ *
+ *
+ * Callback hook to execute config operations.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <errno.h>
+#include <assert.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <string.h>
+#include <sys/select.h>
+#include <signal.h>
+
+#include "clish/private.h"
+#include "cliconf/conf.h"
+#include "cliconf/query.h"
+#include "cliconf/buf.h"
+#include "lub/argv.h"
+#include "lub/string.h"
+
+#define CONFD_SOCKET_PATH "/tmp/confd.socket"
+#define CONFD_CONFIG_PATH "/tmp/running-config"
+
+#ifndef UNIX_PATH_MAX
+#define UNIX_PATH_MAX 108
+#endif
+#define MAXMSG 1024
+
+/* Global signal vars */
+static volatile int sigterm = 0;
+static void sighandler(int signo);
+
+static char * process_query(int sock, cliconf_t * conf, char *str);
+int answer_send(int sock, char *command);
+static int dump_running_config(int sock, cliconf_t *conf, query_t *query);
+
+/*--------------------------------------------------------- */
+int main(int argc, char **argv)
+{
+	int retval = 0;
+	unsigned i;
+	char *str;
+	cliconf_t *conf;
+	lub_bintree_t bufs;
+	conf_buf_t *tbuf;
+
+	/* Network vars */
+	int sock;
+	struct sockaddr_un laddr;
+	struct sockaddr_un raddr;
+	fd_set active_fd_set, read_fd_set;
+
+	/* Signal vars */
+	struct sigaction sig_act;
+	sigset_t sig_set;
+
+	/* Set signal handler */
+	sigemptyset(&sig_set);
+	sigaddset(&sig_set, SIGTERM);
+	sigaddset(&sig_set, SIGINT);
+	sigaddset(&sig_set, SIGQUIT);
+	
+	sig_act.sa_flags = 0;
+	sig_act.sa_mask = sig_set;
+	sig_act.sa_handler = &sighandler;
+	sigaction(SIGTERM, &sig_act, NULL);
+	sigaction(SIGINT, &sig_act, NULL);
+	sigaction(SIGQUIT, &sig_act, NULL);
+
+	/* Configuration tree */
+	conf = cliconf_new("", 0);
+
+	/* Initialize the tree of buffers */
+	lub_bintree_init(&bufs,