|
Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript electronics |
DMDScript - improved testscript.d
attached you will find a better 'testscript.d'
with changes in the following areas:
FLAG PARSING
The -s flag will be silent about banners, can be combined with -v.
The -c(content-type) flag takes what follows the -c ( default is
text/plain ) as a content-type specifier for use in cgi scripts.
ds -ctext/html MyWebPageGenerator.ds
The -- is a flag terminator, remaining strings become arguments.
"echo.ds" is now:
for(var i = 0; i < arguments.length; ){
print(arguments[i]);
if (++i < arguments.length)
print(" ");
}
println();
invoked as: ds.exe -s echo.ds -- hello world!
DEFAULT SCRIPT NAME
If no script name is specified, test is used if the interpreter
is named "ds", otherwise a script in the current directory is selected
based on the name of the interpreter.
On systems where only compiled binaries may be run,
(for example, certain web hosting companies)
this will allow you to pair up a script and its interpreter at the
cost of having multiple copies of the interpreter.
Silent is implied in these contexts as the default banner only
causes the webserver to emit a diagnostic about malformed headers.
SHEBANG
#! (interpreter and arguments) allowed as first line of scripts.
These are quietly converted to / / comments before compilation
Scripts and includes can indicate what to use for default interpreter
see: http://en.wikipedia.org/wiki/Shebang_(Unix)
Includes may specify shebang lines to indicate interpreter
to use if invoked standalone.
This is tested and working with DMD 0.163
Jan 16 2007
|