1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-24 06:54:13 +00:00
cde/src/cmd/ksh93/DESIGN
Johnothan King a065558291
Fix more compiler warnings, typos and other minor issues (#260)
Many of these changes are minor typo fixes. The other changes
(which are mostly compiler warning fixes) are:

NEWS:
- The --globcasedetect shell option works on older Linux kernels
  when used with FAT32/VFAT file systems, so remove the note about
  it only working with 5.2+ kernels.

src/cmd/ksh93/COMPATIBILITY:
- Update the documentation on function scoping with an addition
  from ksh93v- (this does apply to ksh93u+).

src/cmd/ksh93/edit/emacs.c:
- Check for '_AST_ksh_release', not 'AST_ksh_release'.

src/cmd/INIT/mamake.c,
src/cmd/INIT/ratz.c,
src/cmd/INIT/release.c,
src/cmd/builtin/pty.c:
- Add more uses of UNREACHABLE() and noreturn, this time for the
  build system and pty.

src/cmd/builtin/pty.c,
src/cmd/builtin/array.c,
src/cmd/ksh93/sh/name.c,
src/cmd/ksh93/sh/nvtype.c,
src/cmd/ksh93/sh/suid_exec.c:
- Fix six -Wunused-variable warnings (the name.c nv_arrayptr()
  fixes are also in ksh93v-).
- Remove the unused 'tableval' function to fix a -Wunused-function
  warning.

src/cmd/ksh93/sh/lex.c:
- Remove unused 'SHOPT_DOS' code, which isn't enabled anywhere.
  https://github.com/att/ast/issues/272#issuecomment-354363112

src/cmd/ksh93/bltins/misc.c,
src/cmd/ksh93/bltins/trap.c,
src/cmd/ksh93/bltins/typeset.c:
- Add dictionary generator function declarations for former
  aliases that are now builtins (re: 1fbbeaa1, ef1621c1, 3ba4900e).
- For consistency with the rest of the codebase, use '(void)'
  instead of '()' for print_cpu_times.

src/cmd/ksh93/sh/init.c,
src/lib/libast/path/pathshell.c:
- Move the otherwise unused EXE macro to pathshell() and only
  search for 'sh.exe' on Windows.

src/cmd/ksh93/sh/xec.c,
src/lib/libast/include/ast.h:
- Add an empty definition for inline when compiling with C89.
  This allows the timeval_to_double() function to be inlined.

src/cmd/ksh93/include/shlex.h:
- Remove the unused 'PIPESYM2' macro.

src/cmd/ksh93/tests/pty.sh:
- Add '# err_exit #' to count the regression test added in
  commit 113a9392.

src/lib/libast/disc/sfdcdio.c:
- Move diordwr, dioread, diowrite and dioexcept behind
  '#ifdef F_DIOINFO' to fix one -Wunused-variable warning and
  multiple -Wunused-function warnings (sfdcdio() only uses these
  functions when F_DIOINFO is defined).

src/lib/libast/string/fmtdev.c:
- Fix two -Wimplicit-function-declaration warnings on Linux by
  including sys/sysmacros.h in fmtdev().
2021-04-08 19:58:07 +01:00

171 lines
7.3 KiB
Text

Here is an overview of the source code organization for ksh93.
Directory layout:
The directory include contains header files for ksh93.
The files nval.h and shell.h are intended to be public
headers and can be used to add runtime builtin command.
The remainder are private.
The directory data contains readonly data files for ksh93.
The man pages for built-ins are in builtins.c rather
than included as statics with the implementations in the
bltins directory because some systems don't make static const
data readonly and we want these to be shared by all running
shells.
The directory edit contains the code for command line
editing and history.
The fun directory contains some shell function such as
pushd, popd, and dirs.
The directory features contains files that are used to generate
header files in the FEATURE directory. Most of these files
are in a format that is processed by iffe.
The directory bltins contains code for most of the built-in
commands. Additional built-in commands are part of libcmd.
The directory sh contains most of the code for ksh93.
The directory tests contains a number of regression tests.
In most cases, when a bug gets fixed, a test is added to
one of these files. The regression tests can be run by
going to this directory and running
SHELL=shell_path shell_path shtests
where shell_path is an absolute pathname for the shell to
be tested.
The top level directory contains the nmake Makefile, the
RELEASE file, the ksh93 man file (sh.1) and nval.3 and shell.3
documentation files. The RELEASE file contains the list of bug
fixes and new features since the original ksh93 release. The file
COMPATIBILITY is a list of all known incompatibilities with ksh88.
Include directory:
1. argnod.h contains the type definitions for command
nodes, io nodes, argument nodes, and for positional
parameters. It defines the prototypes for
all the positional parameters functions.
2. builtins.h contains prototypes for builtins as well
as symbolic constants that refer to the name-pairs
that are associated with some of the built-ins.
It also contains prototypes for many of the strings.
3. defs.h is the catch all for all definitions that
don't fit elsewhere and it includes several other
headers. It defines a structure that contains ksh
global data, sh, and a structure that contains per
function data, sh.st.
4. edit.h contains definitions that are common to both
vi and emacs edit modes.
5. fault.h contains prototypes for signal related
functions and trap and fault handling.
6. fcin.h contains macro and function definitions for
reading from a file or string.
7. history.h contains macros and functions definitions
related to history file processing.
8. jobs.h contains the definitions relating to job
processing and control.
9. lexstates.h contains the states associated with
lexical processing.
10. name.h contains the internal definitions related
to name-value pair processing.
11. national.h contains a few I18N definitions, mostly
obsolete.
12. nval.h is the public interface to the name-value
pair library that is documented with nval.3.
13. path.h contains the interface for pathname processing
and pathname searching.
14. shell.h is the public interface for shell functions
that are documented int shell.3.
15. shlex.h contains the lexical token definitions and
interfaces for lexical analysis.
16. shnodes.h contains the definition of the structures
for each of the parse nodes and flags for the attributes.
17. shtable.h contains some interfaces and functions for
table lookup.
18. streval.h contains the interface to the arithmetic
functions.
19. terminal.h is a header file that includes the appropriate
terminal include.
20. test.h contains the definitions for the test and [[ ... ]]
commands.
21. timeout.h contains the define constant for the maximum
shell timeout.
22. ulimit.h includes the appropriate resource header.
23. variables.h contains symbolic constants for the built-in
shell variables.
24. version.h contains the version string for this release.
sh directory:
1. args.c contains functions for parsing shell options
and for processing positional parameters.
2. arith.c contains callback functions for the streval.c
library and the interface to shell arithmetic.
3. array.c contains the code for indexed and associative
arrays.
4. defs.c contains the data definitions for global symbols.
5. deparse.c contains code to generate shell script from
a parse tree.
6. expand.c contains code for file name expansion and
file name generation.
7. fault.c contains code for signal processing, trap
handling and termination.
8. fcin.c contains code for reading and writing a character
at a time from a file or string.
9. init.c contains initialization code and callbacks
for get and set functions for built-in variables.
10. io.o contains code for redirections and managing file
descriptors and file streams.
11. jobs.c contains the code for job management.
12. lex.c contains the code for the lexical analyzer.
13. macro.c contains code for the $ macro expansions, including
here-documents.
14. main.c contains the calls to initialization, profile
processing and the main evaluation loop as well as
mail processing.
15. name.c contains the name-value pair routines that are
built on the hash library in libast.
16. nvdisc.c contains code related to name-value pair disciplines.
17. nvtree.c contains code for compound variables and for
walking the namespace.
18. nvtype.c contains most of the code related to types that
are created with typeset -T.
19. parse.c contains the code for the shell parser.
20. path.c contains the code for pathname lookup and
some path functions. It also contains the code
that executes commands and scripts.
21. pmain.c is just a calls sh_main() so that all of the
rest of the shell can be in a shared library.
22. shcomp.c contains the main program to the shell
compiler. This program parses a script and creates
a file that the shell can read containing the parse tree.
23. streval.c is an C arithmetic evaluator.
24. string.c contains some string related functions.
25. subshell.c contains the code to save and restore
environments so that subshells can run without creating
a new process.
26. suid_exec.c contains the program from running execute
only and/or setuid/setgid scripts.
27. tdump.c contains the code to dump a parse tree into
a file.
28. timers.c contains code for multiple event timeouts.
29. trestore contains the code for restoring the parse
tree from the file created by tdump.
30. userinit.c contains a dummy userinit() function.
This is now obsolete with the new version of sh_main().
31. waitevent.c contains the sh_waitnotify function so
that builtins can handle processing events when the
shell is waiting for input or for process completion.
32. xec.c is the main shell execution loop.
edit directory:
1. completion.c contains code for command and file generation and
completion.
2. edit.c contains common editing and terminal code for vi and
emacs.
3. emacs.c contains code for the emacs editor.
4. hexpand.c contains code for C-shell style history expansions.
5. history.c contains code for creating managing the history file.
6. vi.c contains the code for the vi editor.