Rc Functions
To date, the CSA libraries provide the functions listed below. Providing documentation for all of them in this document is going to be a major effort. In the meantime please refer to the explanatory comments that are contained in the library files, and to the example programs.
csaAssign
csaAuth.send
csaAwk
csaAwk.cgi
csaBugReport
csaCheck.special
csaChop
csaCleanup
csaClient
csaCollapse
csaCommit
csaConceal
csaCookie.set
csaDebug
csaExit
csaExit.bdata
csaExit.cdata
csaExit.pcdata
csaExit.env
csaExit.fault
csaExit.http
csaExit.location
csaExit.needauth
csaExit.ok
csaExit.session
csaExit.table
csaExit.value
csaGetArgs
csaHttp.header
csaHttp.referrers
csaHttp.status
csaIndex
csaIsConfirmed
csaIsDate
csaIsFullPath
csaIsInteractive
csaIsWeb
csaLoadLib
csaLock
csaMkTemp
csaNew
csaOnCommit
csaOpen
csaPrintMsg
csaSession.set
csaSetClear
csaSetTime
csaSource
csaStatus
csaSubshell
csaSum
csaSwap
csaSystem
csaTemplate
csaTest.set
csaTest.unset
csaTplProc
csaTrapFile
csaTrue
csaUniq
csaUnlist
csaUnlock
Shell function overrides.
The
rc shell, on which CSA is largely based, exports all names and function definitions to the program environment by default. Function definitions, in particular, may cause the environment to become really big and cluttered. To try and mitigate this problem, different CSA shell libraries often re-define previously defined shell functions. For instance, the
csaExit.fault function is defined in both
mainlib.rc and
cgilib.rc. In all cases the function serves the same purpose: exiting on errors. The way it accomplishes its job, however, may be different in the three cases. A command-line shell script will only load
mainlib.rc, and the version of
csaExit.fault contained in that library will simply exit non-zero (after doing some housekeeping) if called in that context. A CGI program, however, beside loading
mainlib.rc will also load
cgilib.rc. This second library will provide its own re-definition of
csaExit.fault. The latter, if called by the CGI program, will do the housekeeping, send an error HTML page to the client and exit non-zero. In this way, that is by re-using the same function names for different context-specific code, I managed to:
- keep the program API simple and consistent across different contexts.
- keep the program environment small, as each re-definition replaces the previous one.
Trackbacks (1) |
New trackback |
Print
Copyright (c) 2007 Carlo Strozzi, Some Rights Reserved
This page can be reproduced with any means, provided that each
copy retains this copyright notice.