[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: hurd/trans/hello.c changes
From: |
Sergiu Ivanov |
Subject: |
Re: hurd/trans/hello.c changes |
Date: |
Thu, 24 Dec 2009 09:59:08 +0200 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
Hello,
On Thu, Dec 24, 2009 at 12:32:53PM +0530, Shakthi Kannan wrote:
> --- On Thu, Dec 24, 2009 at 12:42 AM, Sergiu Ivanov
> | Printing to a file is nothing fancy: the fprintf functions should
> | suffice.
> \--
>
> I would appreciate if I could see a working example. When I use
> fprintf(stdout, "message"); or fprintf(stderr, "error"); in a
> translator, and use it with:
>
> settrans -fgap /tmp/hello hello 1>out 2>err
>
> neither of them are going into out or err, or the console. Probably, I
> am missing something here.
Translators do not normally have standard input or standard output. I
think you could explicitly assign some files to stdin or stdout, but
initially these point to nothing (AIUI), so you have to explicitly
open a file before fprintf-ing to it. As for stderr, I cannot tell
why it won't work, since I've never tried this and, unfourtunately, I
have too little time to check it now :-( (One could attach gdb to the
translator and inspect stderr, for instance.)
Also, I think using absolute paths for opening files for debug output
is better than relative paths, but I don't remember the exact
reasoning. A candidate would be that passive translators do not
always get the working directory you would expect, but I'm not sure
whether this is applicable in you case.
Regards,
Sergiu