This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Change output stream for printf


I would like to implement a simplified telnet server.
My telnet client doesn't do the local echo and send CR and LF for end of
line.
I need a telnet server which send CR and LF for end of line and not only LF.
This is why I planned to use tty (or pty).

-----Original Message-----
From: Gary Thomas [mailto:gary@mlbassoc.com]
Sent: Tuesday, November 16, 2004 11:26 AM
To: Nicolas Brouard
Cc: Nick Garnett; Andrew Lunn; eCos Discussion
Subject: RE: [ECOS] Change output stream for printf


On Tue, 2004-11-16 at 09:18, Nicolas Brouard wrote:
> Hi,
> I would like to use the tty driver (specially the CYG_TTY_OUT_FLAGS_CRLF
> functionnality) over a socket.
> When I use serial port for printf, I have this simplified callgraph:
> 	printf
> 	-> puts (stdioinlines.cxx)
> 	-> fputs (fputs.cxx)
> 	-> StdioStream::write (stream.cxx)
> 	-> write (io.cxx)
> 	-> dev_fo_write (devfs.cxx)
> 	-> tty_write (tty.c)
> 	-> serial_write (serial.c)
>
> With the socket (after dup2(socket_descriptor, stdout_no)), I have this
> simplified callgraph:
> 	printf
> 	-> puts (stdioinlines.cxx)
> 	-> fputs (fputs.cxx)
> 	-> StdioStream::write (stream.cxx)
> 	-> write (io.cxx)
> 	-> bsd_write (sockio.c)
>
> And I would like to use tty. So how can I have that?
> 	printf
> 	-> puts (stdioinlines.cxx)
> 	-> fputs (fputs.cxx)
> 	-> StdioStream::write (stream.cxx)
> 	-> write (io.cxx)
> 	=> dev_fo_write (devfs.cxx)
> 	=> tty_write (tty.c)
> 	-> bsd_write (sockio.c)

Why would you want to do this?  It would require pseudo-tty (pty)
devices, which are not implemented in eCos (and IMO, need not be)

>
> Another question: I don't find in the sources where is defined printf.
> I found printf(const char *format, ...) which calls vfnprintf, but I
didn't
> find the printf which calls puts. In fact, when I call printf with one
> argument, the second form is used. Where is this defined?

This is GCC - recent versions will turn certain uses of printf() into
calls to puts() instead, presumably as an optimization.

>
> Thanks in advance.
>
> Nicolas Brouard
>


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]