summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-05-03 23:39:53 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-05-03 23:39:53 +0000
commit4529b70b4ca28e6f2120a834c88b3ee2bc2e43f5 (patch)
tree26c2d88d7d8ccf6961373455b68e1e087c211c7b /misc.c
parent3524d697374a37d39e971d96c33080c307304820 (diff)
downloadopenssh-git-4529b70b4ca28e6f2120a834c88b3ee2bc2e43f5.tar.gz
- mouring@cvs.openbsd.org 2001/05/03 23:09:53
[misc.c misc.h scp.c sftp.c] Move colon() and cleanhost() to misc.c where I should I have put it in the first place
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c37
1 files changed, 35 insertions, 2 deletions
diff --git a/misc.c b/misc.c
index feeacb85..e949ded8 100644
--- a/misc.c
+++ b/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.5 2001/04/12 20:09:37 stevesk Exp $ */
+/* $OpenBSD: misc.c,v 1.6 2001/05/03 23:09:52 mouring Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
@@ -25,7 +25,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: misc.c,v 1.5 2001/04/12 20:09:37 stevesk Exp $");
+RCSID("$OpenBSD: misc.c,v 1.6 2001/05/03 23:09:52 mouring Exp $");
#include "misc.h"
#include "log.h"
@@ -131,6 +131,39 @@ int a2port(const char *s)
return port;
}
+char *
+cleanhostname(char *host)
+{
+ if (*host == '[' && host[strlen(host) - 1] == ']') {
+ host[strlen(host) - 1] = '\0';
+ return (host + 1);
+ } else
+ return host;
+}
+
+char *
+colon(char *cp)
+{
+ int flag = 0;
+
+ if (*cp == ':') /* Leading colon is part of file name. */
+ return (0);
+ if (*cp == '[')
+ flag = 1;
+
+ for (; *cp; ++cp) {
+ if (*cp == '@' && *(cp+1) == '[')
+ flag = 1;
+ if (*cp == ']' && *(cp+1) == ':' && flag)
+ return (cp+1);
+ if (*cp == ':' && !flag)
+ return (cp);
+ if (*cp == '/')
+ return (0);
+ }
+ return (0);
+}
+
mysig_t
mysignal(int sig, mysig_t act)
{