aboutsummaryrefslogtreecommitdiff
path: root/sample.c
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2005-08-19 11:12:29 +0000
committerAris Adamantiadis <aris@0xbadc0de.be>2005-08-19 11:12:29 +0000
commitf23685f92b91aa53546a81bf7793c38a45df15d3 (patch)
tree026ff7769a0fd003d8930d421f5146bf731f97d3 /sample.c
parentd95242d2cde747151953387053a9649bd525d265 (diff)
downloadlibssh-f23685f92b91aa53546a81bf7793c38a45df15d3.tar.gz
libssh-f23685f92b91aa53546a81bf7793c38a45df15d3.tar.xz
libssh-f23685f92b91aa53546a81bf7793c38a45df15d3.zip
stdint.patch, debug_output.patch, ssh_12_select.patch,
solaris_7.patch and args_in_decl.patch from Norbert. git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@12 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'sample.c')
-rw-r--r--sample.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/sample.c b/sample.c
index 43a0b2ab..d1c0fb47 100644
--- a/sample.c
+++ b/sample.c
@@ -12,6 +12,7 @@ The goal is to show the API in action. It's not a reference on how terminal
clients must be made or how a client should react.
*/
+#include "config.h"
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
@@ -20,7 +21,9 @@ clients must be made or how a client should react.
#include <sys/select.h>
#include <sys/time.h>
+#ifdef HAVE_PTY_H
#include <pty.h>
+#endif
#include <signal.h>
#include <errno.h>
#include <libssh/libssh.h>
@@ -77,6 +80,17 @@ int opts(int argc, char **argv){
return 0;
}
+#ifndef HAVE_PTY_H
+static void cfmakeraw(struct termios *termios_p){
+ termios_p->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
+ termios_p->c_oflag &= ~OPOST;
+ termios_p->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
+ termios_p->c_cflag &= ~(CSIZE|PARENB);
+ termios_p->c_cflag |= CS8;
+}
+#endif
+
+
void do_cleanup(){
tcsetattr(0,TCSANOW,&terminal);
}