In <[EMAIL PROTECTED]>, Kailas Ramasamy <[EMAIL PROTECTED]> typed:
> Hi Mike,
> I read through fork() and exec() man pages but I couldn't find anything
> related to
> this. Basically, I want to launch a telnet session from a process and pass
> in
> /dev/console as stdin and stdout.
Well, you don't really need fork(), though fork() follows exec() so
often than some OS's combine them into a single call. And I just
noticed that if you do "man exec", you get the shell's page - you want
exec(3), to get the C calls.
Anyway, the sequence is:
Use open() to get an fd pointing at /dev/console.
Use dup2() to copy that fd to stdin and stdout (and probably stderr).
Use an exec() function to launch telnet.
<mike
> Thanks
> Kailas
>
> On 1/16/07, Mike Meyer <[EMAIL PROTECTED]> wrote:
> >
> > In <[EMAIL PROTECTED]>, Kailas
> > Ramasamy <[EMAIL PROTECTED]> typed:
> > > Hi Mike,
> > > Yes, that what I am planing but I want to do this dynamically. Do you
> > know
> > > how to launch a
> > > telnet session from a process?. How do I pass stdin and stdout to the
> > telnet
> > > from a process?.
> >
> > See the fork() and exec() man pages.
> >
> > <mike
> >
> >
> > > On 1/16/07, Mike Meyer <[EMAIL PROTECTED]> wrote:
> > > >
> > > > In <[EMAIL PROTECTED]>,
> > Kailas
> > > > Ramasamy <[EMAIL PROTECTED]> typed:
> > > > > Hi,
> > > > > Within a FreeBSD system, I want to telnet to another system and
> > bridge
> > > > that
> > > > > session to the
> > > > > console port so that when an user connects to the system via console
> > > > port,
> > > > > it is automatically
> > > > > redirected to other system for I have already established a telnet
> > > > session.
> > > >
> > > > What's wrong with simply leaving a telnet session running on the
> > > > console, maybe with some support to relaunch it should it ever exit?
> > > >
> > > > <mike
> > > > --
> > > > Mike Meyer <[EMAIL PROTECTED]>
> > > > http://www.mired.org/consulting.html
> > > > Independent Network/Unix/Perforce consultant, email for more
> > information.
> > > >
> > > _______________________________________________
> > > [email protected] mailing list
> > > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> > > To unsubscribe, send any mail to "
> > [EMAIL PROTECTED]"
> > >
> >
> > --
> > Mike Meyer <[EMAIL PROTECTED]>
> > http://www.mired.org/consulting.html
> > Independent Network/Unix/Perforce consultant, email for more information.
> >
> Hi Mike,<br>I read through fork() and exec() man pages but I couldn't
> find anything related to<br>this. Basically, I want to launch a telnet
> session from a process and pass in <br>/dev/console as stdin and stdout. <br>
> <br>Thanks<br>Kailas<br><br><div><span class="gmail_quote">On 1/16/07, <b
> class="gmail_sendername">Mike Meyer</b> <<a href="mailto:[EMAIL
> PROTECTED]">[EMAIL PROTECTED]</a>> wrote:</span><blockquote
> class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin:
> 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
> In <<a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>>, Kailas
> Ramasamy <<a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]
> </a>> typed:<br>> Hi Mike,<br>> Yes, that what I am planing but I
> want to do this dynamically. Do you know<br>> how to launch a<br>>
> telnet session from a process?. How do I pass stdin and stdout to the telnet
> <br>> from a process?.<br><br>See the fork() and exec() man
> pages.<br><br> <mike<br><br><br>>
> On 1/16/07, Mike Meyer <<a href="mailto:[EMAIL PROTECTED]">[EMAIL
> PROTECTED]</a>> wrote:<br>> ><br>> > In <
> <a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>>, Kailas<br>>
> > Ramasamy <<a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]
> </a>> typed:<br>> > > Hi,<br>> > > Within a FreeBSD
> system, I want to telnet to another system and bridge<br>> >
> that<br>> > > session to the<br>> > > console port so that
> when an user connects to the system via console
> <br>> > port,<br>> > > it is automatically<br>> > >
> redirected to other system for I have already established a telnet<br>>
> > session.<br>> ><br>> > What's wrong with simply leaving
> a telnet session running on the
> <br>> > console, maybe with some support to relaunch it should it ever
> exit?<br>> ><br>>
> > <mike<br>> >
> --<br>> > Mike Meyer <<a href="mailto:[EMAIL PROTECTED]">[EMAIL
> PROTECTED]</a>>
> <br>> > <a
> href="http://www.mired.org/consulting.html">http://www.mired.org/consulting.html</a><br>>
> > Independent Network/Unix/Perforce consultant, email for more
> information.<br>> ><br>>
> _______________________________________________
> <br>> <a
> href="mailto:[email protected]">[email protected]</a>
> mailing list<br>> <a
> href="http://lists.freebsd.org/mailman/listinfo/freebsd-hackers">http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> </a><br>> To unsubscribe, send any mail to "<a href="mailto:[EMAIL
> PROTECTED]">[EMAIL PROTECTED]</a>"<br>><br><br>--<br>Mike Meyer
> <<a href="mailto:[EMAIL PROTECTED]">
> [EMAIL
> PROTECTED]</a>> <a
>
> href="http://www.mired.org/consulting.html">http://www.mired.org/consulting.html</a><br>Independent
> Network/Unix/Perforce consultant, email for more
> information.<br></blockquote></div>
> <br>
--
Mike Meyer <[EMAIL PROTECTED]> http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"