Re: Linux command-line-oriented programs in Euphoria

new topic     » goto parent     » topic index » view thread      » older message » newer message

Chris Burch wrote:
> 
> Hi
> 
> Like a lot of things with euphoria, there is a work around. Try this (Linux
> tested!)
> 
> }}}
<eucode>
> include dll.e
> 
> sequence tmp
> 
> tmp = sprintf("Hello world", {})
> 
> system("echo " & tmp, 0)
> 
> free_console()
> 
> </eucode>
{{{

> 
> Ncurses writes to a created window, whereas system writes to the 'cooked'
> terminal
> screen (if you know ncurses, you what I just said).
> 
> So you could do all your output using system calls, then when your program
> exited,
> the output would appear.
> 
> Hope this helps
> 
> Chris
> 
> <a
> href="http://members.aol.com/chriscrylex/euphoria.htm">http://members.aol.com/chriscrylex/euphoria.htm</a>
> <a href="http://uboard.proboards32.com/">http://uboard.proboards32.com/</a>
> <a
> href="http://members.aol.com/chriscrylex/EUSQLite/eusql.html">http://members.aol.com/chriscrylex/EUSQLite/eusql.html</a>


In that case can you use:
procedure puts(integer tmp_fn, sequence txt)
 system("echo " & sprintf(txt, {}), 0)
end procedure

puts(1, "Hello")


or even:
procedure old_puts(integer tmp_fn, sequence txt)
 puts(tmp_fn, txt)
end procedure

procedure puts(integer tmp_fn, sequence txt)
 if tmp_fn = 1 then
  system("echo " & sprintf(txt, {}), 0)
 else
  old_puts(tmp_fn, txt)
 end if
end procedure

puts(1, "Hello")

to totally replace it.

Obviously, the top rouitne doesn't need tmp_fn but it means that it is
compatible...

Thanks,
 Alex

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu