Thursday, 20 September 2012

Re: [gccsdk] Sys$ReturnCode (was: Parsing wget output)

In message <76bd60d252.martin@blueyonder.co.uk>
Martin Bazley <martin.bazley@blueyonder.co.uk> wrote:

> Ah - I've just discovered that it *will* set Sys$ReturnCode to
> zero/nonzero.

Ah I thought you were already doing that.

> So with a bit more tweaking, it should be possible to
> change MBBack to use that.
>
> However, I did discover that the value of this variable is very
> volatile. How safe is it to read? I'm planning on calling wget in a
> TaskWindow with Wimp_StartTask, and examining the return code once I get
> the TaskCloseDown Wimp message. Is it possible that some other task may
> alter its value between wget quitting and MBBack learning of it,
> assuming that I am not the only program calling Wimp_Poll in the
> desktop?
>
> An alternative solution would be to write a wrapper Obey file and
> Wimp_StartTask that, but I'd rather avoid that.

I would write a small C program launching your wget command via system()
or fork()/execve() and use the return code to set a system variable which
is somehow registered. And call that C program using Wimp_StartTask
TaskWindow instead.

I don't think Sys$ReturnCode is preserved in a TaskWindow context switch.

John.
--
John Tytgat, in his comfy chair at home BASS
John.Tytgat@aaug.net ARM powered, RISC OS driven

_______________________________________________
GCCSDK mailing list gcc@gccsdk.riscos.info
Bugzilla: http://www.riscos.info/bugzilla/index.cgi
List Info: http://www.riscos.info/mailman/listinfo/gcc
Main Page: http://www.riscos.info/index.php/GCCSDK

No comments:

Post a Comment