1*da2e3ebdSchinHere is an overview of the source code organization for ksh93. 2*da2e3ebdSchin 3*da2e3ebdSchinDirectory layout: 4*da2e3ebdSchin 5*da2e3ebdSchin The directory include contains header files for ksh93. 6*da2e3ebdSchin The files nval.h and shell.h are intended to be public 7*da2e3ebdSchin headers and can be used to add runtime builtin command. 8*da2e3ebdSchin The remainder are private. 9*da2e3ebdSchin 10*da2e3ebdSchin The directory data contains readonly data files for ksh93. 11*da2e3ebdSchin 12*da2e3ebdSchin The directory edit contains the code for command line 13*da2e3ebdSchin editing and history. 14*da2e3ebdSchin 15*da2e3ebdSchin The fun directory contains some shell function such as 16*da2e3ebdSchin pushd, popd, and dirs. 17*da2e3ebdSchin 18*da2e3ebdSchin The directory features contains files that are used to generate 19*da2e3ebdSchin header files in the FEATURE directory. Most of these files 20*da2e3ebdSchin are in a format that is processed by iffe. 21*da2e3ebdSchin 22*da2e3ebdSchin The directory bltins contains code for most of the built-in 23*da2e3ebdSchin commands. Additional built-in commands are part of libcmd. 24*da2e3ebdSchin 25*da2e3ebdSchin The directory sh contains most of the code for ksh93. 26*da2e3ebdSchin 27*da2e3ebdSchin The directory tests contains a number of regression tests. 28*da2e3ebdSchin In most cases, when a bug gets fixed, a test is added to 29*da2e3ebdSchin one of these files. The regression tests can be run by 30*da2e3ebdSchin going to this directory and running 31*da2e3ebdSchin SHELL=shell_path shell_path shtests 32*da2e3ebdSchin where shell_path is an absolute pathname for the shell to 33*da2e3ebdSchin be tested. 34*da2e3ebdSchin 35*da2e3ebdSchin The top level directory contains the nmake Makefile, a README, 36*da2e3ebdSchin and several documentation files. The RELEASE file contains 37*da2e3ebdSchin the list of bug fixes and new features since the original 38*da2e3ebdSchin ksh93 release. The file COMPATIBILITY is a list of all 39*da2e3ebdSchin known incompatibilities with ksh88. 40*da2e3ebdSchin 41*da2e3ebdSchin The bash_pre_rc.sh is a startup script used when emulating 42*da2e3ebdSchin bash if the shell is compiled with SHOPT_BASH and the shell 43*da2e3ebdSchin is invoked as bash. The bash emulation is not complete. 44*da2e3ebdSchin 45*da2e3ebdSchinInclude directory: 46*da2e3ebdSchin 1. argnod.h contains the type definitions for command 47*da2e3ebdSchin nodes, io nodes, argument nodes, and for positional 48*da2e3ebdSchin parameters.a It defines the prototypes for 49*da2e3ebdSchin all the positional parameters functions. 50*da2e3ebdSchin 2. builtins.h contains prototypes for builtins as well 51*da2e3ebdSchin as symbolic constants that refer to the name-pairs 52*da2e3ebdSchin that are associated with some of the built-ins. 53*da2e3ebdSchin It also contains prototypes for many of the strings. 54*da2e3ebdSchin 3. defs.h is the catch all for all definitions that 55*da2e3ebdSchin don't fit elsewhere and it includes several other 56*da2e3ebdSchin headers. It defines a strucuture that contains ksh 57*da2e3ebdSchin global data, sh, and a structure that contains per 58*da2e3ebdSchin function data, sh.st. 59*da2e3ebdSchin 4. edit.h contains definitions that are common to both 60*da2e3ebdSchin vi and emacs edit modes. 61*da2e3ebdSchin 5. env.h contains interfaces for creating and modifying 62*da2e3ebdSchin environment variables. 63*da2e3ebdSchin 6. fault.h contains prototypes for signal related 64*da2e3ebdSchin functions and trap and fault handling. 65*da2e3ebdSchin 7. fcin.h contains macro and function definitions for 66*da2e3ebdSchin reading from a file or string. 67*da2e3ebdSchin 8. history.h contains macros and functions definitions 68*da2e3ebdSchin related to history file processing. 69*da2e3ebdSchin 9. jobs.h contains the definitions relating to job 70*da2e3ebdSchin processing and control. 71*da2e3ebdSchin 10. lexstates.h contains the states associated with 72*da2e3ebdSchin lexical processing. 73*da2e3ebdSchin 11. name.h contains the internal definitions related 74*da2e3ebdSchin to name-value pair processing. 75*da2e3ebdSchin 12. national.h contains a few I18N definitions, mostly 76*da2e3ebdSchin obsolete. 77*da2e3ebdSchin 13. nval.h is the public interface to the name-value 78*da2e3ebdSchin pair library that is documented with nval.3. 79*da2e3ebdSchin 14. path.h contains the interface for pathname processing 80*da2e3ebdSchin and pathname searching. 81*da2e3ebdSchin 15. shell.h is the public interface for shell functions 82*da2e3ebdSchin that are documented int shell.3. 83*da2e3ebdSchin 16. shlex.h contains the lexical token definitions and 84*da2e3ebdSchin interfaces for lexical analysis. 85*da2e3ebdSchin 17. shnodes.h contains the definition of the structures 86*da2e3ebdSchin for each of the parse nodes and flags for the attributes. 87*da2e3ebdSchin 18. shtable.h contains some interfaces and functions for 88*da2e3ebdSchin table lookup. 89*da2e3ebdSchin 19. streval.h contains the interface to the arithmetic 90*da2e3ebdSchin functions. 91*da2e3ebdSchin 20. terminal.h is a header file that includes the appropriate 92*da2e3ebdSchin terminal include. 93*da2e3ebdSchin 21. test.h contains the definitions for the test and [[...]] 94*da2e3ebdSchin commands. 95*da2e3ebdSchin 22. timeout.h contains the define constant for the maximum 96*da2e3ebdSchin shell timeout. 97*da2e3ebdSchin 23. ulimit.h includes the appropriate resource header. 98*da2e3ebdSchin 24. variables.h contains symbolic constants for the built-in 99*da2e3ebdSchin shell variables. 100*da2e3ebdSchin 101*da2e3ebdSchinsh directory: 102*da2e3ebdSchin 1. args.c contains functions for parsing shell options 103*da2e3ebdSchin and for processing positional parameters. 104*da2e3ebdSchin 2. arith.c contains callback functions for the streval.c 105*da2e3ebdSchin library and the interface to shell arithmetic. 106*da2e3ebdSchin 3. array.c contains the code for indexed and associative 107*da2e3ebdSchin arrays. 108*da2e3ebdSchin 4. bash.h contains code used when compiling with SHOPT_BASH 109*da2e3ebdSchin to add bash specific features such as shopt. 110*da2e3ebdSchin 5. defs.c contains the data definitions for global symbols. 111*da2e3ebdSchin 6. deparse.c contains code to generate shell script from 112*da2e3ebdSchin a parse tree. 113*da2e3ebdSchin 7. env.c contains code to add and delete environment variables 114*da2e3ebdSchin to an environment list. 115*da2e3ebdSchin 8. expand.c contains code for file name expansion and 116*da2e3ebdSchin file name generation. 117*da2e3ebdSchin 9. fault.c contains code for signal processing, trap 118*da2e3ebdSchin handling and termination. 119*da2e3ebdSchin 10. fcin.c contains code for reading and writing a character 120*da2e3ebdSchin at a time from a file or string. 121*da2e3ebdSchin 11. init.c contains initialization code and callbacks 122*da2e3ebdSchin for get and set functions for built-in variables. 123*da2e3ebdSchin 12. io.o contains code for redirections and managing file 124*da2e3ebdSchin descriptors and file streams. 125*da2e3ebdSchin 13. jobs.c contains the code for job management. 126*da2e3ebdSchin 14. lex.c contains the code for the lexical analyzer. 127*da2e3ebdSchin 15. macro.c contains code for the $ macro expansions, including 128*da2e3ebdSchin here-documents. 129*da2e3ebdSchin 16. main.c contains the calls to initialization, profile 130*da2e3ebdSchin processing and the main evaluation loop as well as 131*da2e3ebdSchin mail processing. 132*da2e3ebdSchin 17. name.c contains the name-value pair routines that are 133*da2e3ebdSchin built on the hash library in libast. 134*da2e3ebdSchin 18. nvdisc.c contains code related to name-value pair disciplines. 135*da2e3ebdSchin 19. nvtree.c contains code for compound variables and for 136*da2e3ebdSchin walking the namespace. 137*da2e3ebdSchin 20. parse.c contains the code for the shell parser. 138*da2e3ebdSchin 21. path.c contains the code for pathname lookup and 139*da2e3ebdSchin some path functions. It also contains the code 140*da2e3ebdSchin that executes commands and scripts. 141*da2e3ebdSchin 22. pmain.c is just a calls sh_main() so that all of the 142*da2e3ebdSchin rest of the shell can be in a shared library. 143*da2e3ebdSchin 23. shcomp.c contains the main program to the shell 144*da2e3ebdSchin compiler. This program parses a script and creates 145*da2e3ebdSchin a file that the shell can read containing the parse tree. 146*da2e3ebdSchin 24. streval.c is an C arithmetic evaluator. 147*da2e3ebdSchin 25. string.c contains some string related functions. 148*da2e3ebdSchin 26. subshell.c contains the code to save and restore 149*da2e3ebdSchin environments so that subshells can run without creating 150*da2e3ebdSchin a new process. 151*da2e3ebdSchin 27. suid_exec.c contains the program from running execute 152*da2e3ebdSchin only and/or setuid/setgid scripts. 153*da2e3ebdSchin 28. tdump.c contains the code to dump a parse tree into 154*da2e3ebdSchin a file. 155*da2e3ebdSchin 29. timers.c contains code for multiple event timeouts. 156*da2e3ebdSchin 30. trestore contians the code for restoring the parse 157*da2e3ebdSchin tree from the file created by tdump. 158*da2e3ebdSchin 31. userinit.c contains a dummy userinit() function. 159*da2e3ebdSchin This is now obsolete with the new version of sh_main(). 160*da2e3ebdSchin 32. waitevent.c contains the sh_waitnotify function so 161*da2e3ebdSchin that builtins can handle processing events when the 162*da2e3ebdSchin shell is waiting for input or for process completion. 163*da2e3ebdSchin 33. xec.c is the main shell executuion loop. 164