First off the bug should probably be called:
NOBUFFER option ignored in 'open write nobuffer' command for stdout
In the new stream library, the standard streams have their own open method.
The bug comes about because in 3.2.0 all open commands used the parser to
check the options string, but in the new stream library, for the standard
streams, the options string is only checked for NOBUFFER, like so:
if (options != NULL && !Utilities::strCaselessCompare(options, "NOBUFFER"))
so 'write nobuffer' doesn't match.
The whole implementation of the stream library is very clean now, so I
guess the 'advice' I'm looking for is if Rick thinks this is an acceptable
solution, or if he'd prefer it done another way. A minimalist solution is:
if (options != NULL && hasNoBufferOption(options))
/**
* Helper function to determine if opts contains the no buffer option.
*
* @param opts String to search in for NOBUFFER.
*
* @return True if nobuffer, caseless, is in opts, otherwise false.
*/
bool hasNoBufferOption(const char *opts)
{
char *tmp = (char *)malloc(strlen(opts) + 1);
if (tmp == NULL)
{
return false;
}
strcpy(tmp, opts);
Utilities::strupper(tmp);
bool result = strstr(tmp, "NOBUFFER") != NULL ? true : false;
free(tmp);
return result;
}
Another option could be to add a caseless strstr() method to the Utilities
class, but since there has be no need for it in the interpreter so far,
that seems like it might be overkill for this.
There is actually no need to open stdout with write nobuffer because that
is how it would be opened anyway. But, since Gil says this breaks an
existing program, my assumption is it should be fixed.
--
Mark Miesfeld
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Oorexx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-devel