From: "Benoît Rouits" <brouits@free.fr>
To: linux-c-programming@vger.kernel.org
Subject: fgets and ssh
Date: Wed, 11 Apr 2007 14:17:17 +0200 [thread overview]
Message-ID: <1176293837.12452.10.camel@chimay> (raw)
hello,
in a minimal shell tutorial written in C, i have a read_line function
that does:
char* read_line()
{
char* line=NULL;
line=(char*)malloc(512);
line=fgets(line,512,stdin);
return line;
}
then i parse this line to build a correct "argv" to pass to execvp()
everything works well when i use ssh interactively.
The problem i encounter is when i pass a command to ssh into this shell:
ssh -v guest@localhost ls
[...]
guest@localhost's password:
debug1: Authentication succeeded (password).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = fr_FR.utf8
debug1: Sending command: ls
( here the shell waits )
the shell still waits for ls and i have to retype intaractively "ls" to
get the correct result:
ls
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
Desktop
Examples
debug1: channel 0: free: client-session, nchannels 1
debug1: Transferred: stdin 0, stdout 0, stderr 0 bytes in 61.4 seconds
debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 0.0
debug1: Exit status 9
any explanation would be greatly appreciated.
+ben
next reply other threads:[~2007-04-11 12:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-11 12:17 Benoît Rouits [this message]
2007-04-11 14:01 ` fgets and ssh Stephen Kratzer
2007-04-11 15:23 ` fgets and ssh [resolved] Benoît Rouits
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1176293837.12452.10.camel@chimay \
--to=brouits@free.fr \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).