Skip to content
Snippets Groups Projects
Commit 0465ed2a authored by Per Hedbor's avatar Per Hedbor
Browse files

Override write and werror in hilfe

The overriden version uses readline->write to actually print the data.

This is rather convenient when writing asyncronous code in hilfe,
newlines are handled correctly and it interacts fairly well with the
input system.

The overriding is intentionally using add_constant to also override
debug output in modules that are loaded after hilfe is started.
parent 47fd5845
No related branches found
No related tags found
No related merge requests found
...@@ -2516,6 +2516,14 @@ class StdinHilfe ...@@ -2516,6 +2516,14 @@ class StdinHilfe
exit(1); exit(1);
} }
protected int do_write(string a, mixed ... args )
{
if( sizeof( args ) )
a = sprintf(a,@args);
write(a);
return strlen(a);
}
//! Any hilfe statements given in the init array will be executed //! Any hilfe statements given in the init array will be executed
//! once .hilferc has been executed. //! once .hilferc has been executed.
protected void create(void|array(string) init) protected void create(void|array(string) init)
...@@ -2524,6 +2532,9 @@ class StdinHilfe ...@@ -2524,6 +2532,9 @@ class StdinHilfe
write = readline->write; write = readline->write;
::create(); ::create();
add_constant("werror",do_write);
add_constant("write",do_write);
load_hilferc(); load_hilferc();
if(init) map(init, add_buffer); if(init) map(init, add_buffer);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment