aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKris Kennaway <kris@FreeBSD.org>2000-06-03 09:20:19 +0000
committerKris Kennaway <kris@FreeBSD.org>2000-06-03 09:20:19 +0000
commit87e372b8a2a153de5bb26d9c63440f02c16ab39c (patch)
treecd954394127ade437854c42bd29f4b7aa34b45fd
parent1ae2db81a5827c12029c64c91152d43b045de832 (diff)
downloadsrc-87e372b8a2a153de5bb26d9c63440f02c16ab39c.tar.gz
src-87e372b8a2a153de5bb26d9c63440f02c16ab39c.zip
Import from vendor repository.
Obtained from: OpenBSD
Notes
Notes: svn path=/vendor-crypto/openssh/dist/; revision=61206
-rw-r--r--crypto/openssh/aux.c36
-rw-r--r--crypto/openssh/ssh.h8
2 files changed, 43 insertions, 1 deletions
diff --git a/crypto/openssh/aux.c b/crypto/openssh/aux.c
new file mode 100644
index 000000000000..899142da7167
--- /dev/null
+++ b/crypto/openssh/aux.c
@@ -0,0 +1,36 @@
+#include "includes.h"
+RCSID("$OpenBSD: aux.c,v 1.2 2000/05/17 09:47:59 markus Exp $");
+
+#include "ssh.h"
+
+char *
+chop(char *s)
+{
+ char *t = s;
+ while (*t) {
+ if(*t == '\n' || *t == '\r') {
+ *t = '\0';
+ return s;
+ }
+ t++;
+ }
+ return s;
+
+}
+
+void
+set_nonblock(int fd)
+{
+ int val;
+ val = fcntl(fd, F_GETFL, 0);
+ if (val < 0) {
+ error("fcntl(%d, F_GETFL, 0): %s", fd, strerror(errno));
+ return;
+ }
+ if (val & O_NONBLOCK)
+ return;
+ debug("fd %d setting O_NONBLOCK", fd);
+ val |= O_NONBLOCK;
+ if (fcntl(fd, F_SETFL, val) == -1)
+ error("fcntl(%d, F_SETFL, O_NONBLOCK): %s", fd, strerror(errno));
+}
diff --git a/crypto/openssh/ssh.h b/crypto/openssh/ssh.h
index 0762c964ca26..8f6d1e7d1d9f 100644
--- a/crypto/openssh/ssh.h
+++ b/crypto/openssh/ssh.h
@@ -13,7 +13,7 @@
*
*/
-/* RCSID("$Id: ssh.h,v 1.45 2000/05/08 17:12:16 markus Exp $"); */
+/* RCSID("$Id: ssh.h,v 1.46 2000/05/17 08:20:15 markus Exp $"); */
#ifndef SSH_H
#define SSH_H
@@ -447,6 +447,12 @@ void fatal_remove_cleanup(void (*proc) (void *context), void *context);
*/
char *tilde_expand_filename(const char *filename, uid_t my_uid);
+/* remove newline at end of string */
+char *chop(char *s);
+
+/* set filedescriptor to non-blocking */
+void set_nonblock(int fd);
+
/*
* Performs the interactive session. This handles data transmission between
* the client and the program. Note that the notion of stdin, stdout, and