www.digitalmars.com         C & C++   DMDScript  

DMDScript - improved testscript.d

attached you will find a better 'testscript.d'
with changes in the following areas:


	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; ){
		    if (++i < arguments.length)
		      print(" ");

	invoked as:   ds.exe -s echo.ds -- hello world!


	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.


	#! (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