From cse.psu.edu!owner-9fans Fri Sep 27 18:35:20 1996
Received: from cse.psu.edu ([130.203.3.50]) by cannon.ecf.toronto.edu with SMTP id <4184>; Fri, 27 Sep 1996 18:35:11 -0400
Received: from localhost (majordom@localhost) by cse.psu.edu (8.7.5/8.7.3) with SMTP id SAA04361; Fri, 27 Sep 1996 18:35:26 -0400 (EDT)
Received: by claven.cse.psu.edu (bulk_mailer v1.5); Fri, 27 Sep 1996 18:35:07 -0400
Received: (from majordom@localhost) by cse.psu.edu (8.7.5/8.7.3) id SAA04303 for 9fans-outgoing; Fri, 27 Sep 1996 18:34:59 -0400 (EDT)
X-Authentication-Warning: claven.cse.psu.edu: majordom set sender to owner-9fans using -f
Received: from galapagos.cse.psu.edu (root@galapagos.cse.psu.edu [130.203.2.12]) by cse.psu.edu (8.7.5/8.7.3) with SMTP id SAA04299 for <9fans@cse.psu.edu>; Fri, 27 Sep 1996 18:34:55 -0400 (EDT)
Received: by galapagos.cse.psu.edu id <12689>; Fri, 27 Sep 1996 18:33:01 -0400
From:	Scott Schwartz <schwartz@galapagos.cse.psu.edu>
To:	9fans@cse.psu.edu
Subject: ssh for Plan 9
Message-Id: <96Sep27.183301edt.12689@galapagos.cse.psu.edu>
Date:	Fri, 27 Sep 1996 18:32:49 -0400
Sender: owner-9fans@cse.psu.edu
Reply-To: 9fans@cse.psu.edu
Precedence: bulk
Status: R

Folks who have to connect to a unix system might be interested in
trying out some patches to get ssh to run under Plan 9.  I hacked ssh
(client only, not server or agent) to compile and run using APE
(with the various APE patches I've posted).  A shar file
containing the context diffs from 1.2.14, and a new Makefile, config.h
(APE's ksh can't handle configure scripts, apparently), and some other
stuff, are available in ftp://globin.cse.psu.edu/pub/scott/ssh.shar.gz

I've been running this for a while, and it seems to work.  No
warrantee, use at your own risk, feedback welcome.


From cse.psu.edu!owner-9fans Sun Nov  3 02:40:14 1996
Received: from cse.psu.edu ([130.203.3.50]) by cannon.ecf.toronto.edu with SMTP id <635>; Sun, 3 Nov 1996 02:40:11 -0500
Received: from localhost (majordom@localhost) by cse.psu.edu (8.7.5/8.7.3) with SMTP id CAA00786; Sun, 3 Nov 1996 02:39:28 -0500 (EST)
Received: by claven.cse.psu.edu (bulk_mailer v1.5); Sun, 3 Nov 1996 02:38:11 -0500
Received: (from majordom@localhost) by cse.psu.edu (8.7.5/8.7.3) id CAA00725 for 9fans-outgoing; Sun, 3 Nov 1996 02:37:34 -0500 (EST)
X-Authentication-Warning: claven.cse.psu.edu: majordom set sender to owner-9fans using -f
Received: from galapagos.cse.psu.edu (root@galapagos.cse.psu.edu [130.203.2.12]) by cse.psu.edu (8.7.5/8.7.3) with SMTP id CAA00721 for <9fans@cse.psu.edu>; Sun, 3 Nov 1996 02:37:17 -0500 (EST)
Received: from localhost by galapagos.cse.psu.edu with SMTP id <12686>; Sun, 3 Nov 1996 02:35:31 -0500
To:	9fans@cse.psu.edu
Subject: ssh-1.2.17 patches
Date:	Sun, 3 Nov 1996 02:35:25 -0500
From:	Scott Schwartz <schwartz@galapagos.cse.psu.edu>
Message-Id: <96Nov3.023531est.12686@galapagos.cse.psu.edu>
Sender: owner-9fans@cse.psu.edu
Reply-To: 9fans@cse.psu.edu
Precedence: bulk
Status: R

Hi gang,
  Enclosed are instructions and patches (to ssh and to ape) to
get ssh working under Plan 9.  If someone could try these out
and let me know if I've omitted something, I'd appreciate it.

Summary of changes:

* SSH bugs -- these should be fixed for all platforms

1. gmp-2.0.2-ssh-2/longlong.h needs to have the code inside the 
   #ifdef __GNUC__ moved to longlonggcc.h, and then include that,
   because it contains unterminated string constants which plan9's
   ansi cpp cannot parse.

2. gmp-2.0.2-ssh-2/mpbsd/mtox.c:49 return (char*)str;
   gmp-2.0.2-ssh-2/mpbsd/mtox.c:80 return (char*)str;

3. userfile.c:271 (char*)buf

* Alterations to ssh code

1. configure needs to include stdio.h in confdefs.h.

2. includes.h conditionally includes arpa/inet.h.

3. includes.h includes plan9.h

4. readpass.c:85 conditionally uses "/dev/cons" instead of "/dev/tty"

5. APE should have field for pw_passwd, but since it
   doesn't, ifdef out pw_passwd in ssh.c:581.

6. Plan 9 doesn't use dotfiles by convention; replace .ssh with
   lib/ssh in ssh.h.

7. APE needs to use rresvport() in sshconnect.c:/ssh_create_socket 
   to get a reserved port.  calling that is desirable in general, I think,
   if it is available.

8. don't disable rhosts_rsa_authentication; there's no such thing
   as root.  (why bother with this, anyway?)

9. in ssh.c:740 recognise tty sizes from Plan9's hp termulator.
 
* Extra programs required for Plan 9 -- put these in your bin

1. makeinfo script to do nothing.

2. ncc script to handle -L... args.

* Building it

1. configure kinda works if you say (under ape/psh)
    CC=ncc configure --host=i386-plan9-bsd --with-etcdir=/lib/ssh --disable-asm

2. ksh is busted and runs out of core all the time, so
   configure will get things wrong.  Before you run configure,
   copy the supplied config.cache.plan9 to config.cache, to
   fill in the right values.

3. don't do "make install", unless you set all the configure flags to put
   things in sensible places.  i just copy ssh to bin by hand.

* Remaining bugs

1. the agent stuff doesn't work at all.

2. no server stuff either.

3. it's kinda slow.  defects in select emulation?

4. changes to APE, distributed seperately, are required.

# To unbundle, run this file
echo ape-diffs
sed 's/.//' >ape-diffs <<'//GO.SYSIN DD ape-diffs'
-diff /n/cd/sys/src/ape/lib/ap/plan9/_buf.c ./lib/ap/plan9/_buf.c
-59c59
-< 		_RFORK(RFREND);
----
-> 		_RFORK(RFNAMEG);	/* ideally RFREND */
-diff /n/cd/sys/src/ape/lib/ap/plan9/cfgetospeed.c ./lib/ap/plan9/cfgetospeed.c
-6c6
-< 	return B0;
----
-> 	return B9600;
-18c18
-< 	return B0;
----
-> 	return B9600;
-diff /n/cd/sys/src/ape/lib/ap/plan9/rename.c ./lib/ap/plan9/rename.c
-63c63
-< 		while(n>=0 && (n = _READ(ffd, buf, 8192) > 0))
----
-> 		while(n>=0 && (n = _READ(ffd, buf, 8192)) > 0)
-71a72,77
-> 		if (n == 0) {
-> 			if(_REMOVE(from) < 0){
-> 				_syserrno();
-> 				return -1;
-> 			}
-> 		}
-diff /n/cd/sys/src/ape/lib/ap/plan9/sys9.h ./lib/ap/plan9/sys9.h
-49,50c49,50
-< extern	int	_BIND(char*, char*, int);
-< extern	int	_CHDIR(char*);
----
-> extern	int	_BIND(const char*, const char*, int);
-> extern	int	_CHDIR(const char*);
-60c60
-< extern	int	_MOUNT(int, char*, int, char*);
----
-> extern	int	_MOUNT(int, const char*, int, const char*);
-63c63
-< extern	int	_OPEN(char*, int);
----
-> extern	int	_OPEN(const char*, int);
-66c66
-< extern	int	_REMOVE(char*);
----
-> extern	int	_REMOVE(const char*);
-76c76
-< extern	int	_STAT(char*, char*);
----
-> extern	int	_STAT(const char*, char*);
-79c79
-< extern	int	_WSTAT(char*, char*);
----
-> extern	int	_WSTAT(const char*, char*);
-diff /n/cd/sys/src/ape/lib/ap/plan9/unlink.c ./lib/ap/plan9/unlink.c
-40,44c40
-< 					continue;
-< 				/* reopen remove on close */
-< 				p = strrchr(path, '/');
-< 				if(p == 0)
-< 					fd = _OPEN(db2.name, 64|(f->oflags)); 
----
-> 					p = (char*)path;
-46,48c42,49
-< 					*p = '\0';
-< 					sprintf(newname, "%s/%.8x", path, db2.qid.path);
-< 					fd = _OPEN(newname, 64|(f->oflags));
----
-> 					p = strrchr(path, '/');
-> 					if(p == 0)
-> 						p = db2.name; 
-> 					else {
-> 						*p = '\0';
-> 						sprintf(newname, "%s/%.8x", path, db2.qid.path);
-> 						p = newname;
-> 					}
-50c51,53
-< 				if (fd < 0)
----
-> 				/* reopen remove on close */
-> 				fd = _OPEN(p, 64|(f->oflags)); 
-> 				if(fd < 0)
-53c56
-< 				if (n < 0)
----
-> 				if(n < 0)
-diff /n/cd/sys/src/ape/lib/ap/stdio/strerror.c ./lib/ap/stdio/strerror.c
-57a58
-> 	"Protocol family not supported",
-diff /n/cd/sys/src/ape/lib/bsd/bind.c ./lib/bsd/bind.c
-55c55
-< 		sprintf(msg, "bind %d", lip->sin_port);
----
-> 		sprintf(msg, "bind %d", ntohs(lip->sin_port));
-diff /n/cd/sys/src/ape/lib/bsd/connect.c ./lib/bsd/connect.c
-52c52
-< 				inet_ntoa(rip->sin_addr), rip->sin_port,
----
-> 				inet_ntoa(rip->sin_addr), ntohs(rip->sin_port),
-54c54
-< 				lip->sin_port);
----
-> 				ntohs(lip->sin_port));
-57c57
-< 				rip->sin_port,
----
-> 				ntohs(rip->sin_port),
-diff /n/cd/sys/src/ape/lib/bsd/gethostbyaddr.c ./lib/bsd/gethostbyaddr.c
-23,24c23
-< 	x.s_addr = (addr[0]<<24)|(addr[1]<<16)|(addr[2]<<8)|addr[3];
-< 
----
-> 	memcpy(&x.s_addr, addr, sizeof(x.s_addr));
-diff /n/cd/sys/src/ape/lib/bsd/gethostbyname.c ./lib/bsd/gethostbyname.c
-97a98
-> 			x = ntohl(x);
-diff /n/cd/sys/src/ape/lib/bsd/gettimeofday.c ./lib/bsd/gettimeofday.c
-1a2,5
-> #include <unistd.h>
-> #include <stdlib.h>
-> #include <string.h>
-> #include <fcntl.h>
-4a9,27
-> static int
-> ms(void) 
-> {
-> 	char b[20];
-> 	static int f = -1;
-> 
-> 	/* XXX - should use native plan9 syscalls herein */
-> 	memset(b, 0, sizeof(b));
-> 	if (f < 0) {
-> 		f = open("/dev/msec", O_RDONLY);
-> 		fcntl(f, FD_CLOEXEC, 1);
-> 	}
-> 	if (f >= 0) {
-> 		lseek(f, 0, 0);
-> 		read(f, b, sizeof(b));
-> 	}
-> 	return atol(b) % 1000;
-> }
-> 
-9c32
-< 	tp->tv_usec = 0;
----
-> 	tp->tv_usec = ms() * 1000;
-diff /n/cd/sys/src/ape/lib/bsd/inet_addr.c ./lib/bsd/inet_addr.c
-5a6
-> #include <ctype.h>
-28a30,32
-> 	/* Check for trailing characters */
-> 	if (*p && (!isascii(*p) || !isspace(*p)))
-> 		return (~0L);
-49a54
-> 	x = htonl(x);
-diff /n/cd/sys/src/ape/lib/bsd/inet_ntoa.c ./lib/bsd/inet_ntoa.c
-19c19
-< 	x = in.s_addr;
----
-> 	x = ntohl(in.s_addr);
-diff /n/cd/sys/src/ape/lib/bsd/listen.c ./lib/bsd/listen.c
-139,141c139,146
-< 		if(lip->sin_port >= 0)
-< 			sprintf(msg, "announce %d", lip->sin_port);
-< 		else
----
-> 		if(lip->sin_port >= 0) {
-> 			if (write(cfd, "bind 0", 6) < 0) {
-> 				errno = EGREG;
-> 				close(cfd);
-> 				return -1;
-> 			}
-> 			sprintf(msg, "announce %d", ntohs(lip->sin_port));
-> 		} else
-diff /n/cd/sys/src/ape/lib/bsd/putenv.c ./lib/bsd/putenv.c
-4a5,6
-> #include <stdio.h>
-> static const char env[] = "#e/";
-16c18
-< 		if(n<=0 || n > sizeof(buf)-1)
----
-> 		if(n<=0 || n+sizeof(env) > sizeof(buf)-1)
-18,19c20
-< 		strncpy(buf, s, n);
-< 		buf[n] = 0;
----
-> 		sprintf(buf, "%s%.*s", env, n, s);
-25c26
-< 		if(write(f, buf, n) != n)
----
-> 		if(write(f, value, n) != n)
-diff /n/cd/sys/src/ape/lib/bsd/rresvport.c ./lib/bsd/rresvport.c
-13a14,15
-> #include "priv.h"
-> 
-20a23
-> 	Rock *r;
-24a28,30
-> 	if (r = _sock_findrock(fd, 0))
-> 		r->reserved = 1;
-> #ifdef notdef
-29c35
-< printf("in.sin_port = %d\n", in.sin_port);
----
-> /*printf("in.sin_port = %d\n", in.sin_port);*/
-35a42
-> #endif
//GO.SYSIN DD ape-diffs
echo config.cache.plan9
sed 's/.//' >config.cache.plan9 <<'//GO.SYSIN DD config.cache.plan9'
-# This file is a shell script that caches the results of configure
-# tests run on this system so they can be shared between configure
-# scripts and configure runs.  It is not useful on other systems.
-# If it contains results you don't want to keep, you may remove or edit it.
-#
-# By default, configure uses ./config.cache as the cache file,
-# creating it if it does not exist already.  You can give configure
-# the --cache-file=FILE option to use a different cache file; that is
-# what configure does when it calls configure scripts in
-# subdirectories, so they share the cache.
-# Giving --cache-file=/dev/null disables caching, for debugging configure.
-# config.status only pays attention to the cache file if you give it the
-# --recheck option to rerun configure.
-#
-LIBOBJS='plan9.o'
-ac_cv_c_bigendian=${ac_cv_c_bigendian='no'}
-ac_cv_c_const=${ac_cv_c_const='yes'}
-ac_cv_c_cross=${ac_cv_c_cross='no'}
-ac_cv_c_inline=${ac_cv_c_inline='no'}
-ac_cv_c_stack_direction=${ac_cv_c_stack_direction='-1'}
-ac_cv_c_underscore=${ac_cv_c_underscore='no'}
-ac_cv_func__getpty=${ac_cv_func__getpty='yes'}
-ac_cv_func_alloca=${ac_cv_func_alloca='no'}
-ac_cv_func_clock=${ac_cv_func_clock='yes'}
-ac_cv_func_crypt=${ac_cv_func_crypt='no'}
-ac_cv_func_fchmod=${ac_cv_func_fchmod='no'}
-ac_cv_func_ftruncate=${ac_cv_func_ftruncate='no'}
-ac_cv_func_getdtablesize=${ac_cv_func_getdtablesize='no'}
-ac_cv_func_gethostname=${ac_cv_func_gethostname='no'}
-ac_cv_func_getrusage=${ac_cv_func_getrusage='no'}
-ac_cv_func_gettimeofday=${ac_cv_func_gettimeofday='yes'}
-ac_cv_func_initgroups=${ac_cv_func_initgroups='no'}
-ac_cv_func_innetgr=${ac_cv_func_innetgr='no'}
-ac_cv_func_makeutx=${ac_cv_func_makeutx='no'}
-ac_cv_func_memcpy=${ac_cv_func_memcpy='yes'}
-ac_cv_func_memmove=${ac_cv_func_memmove='yes'}
-ac_cv_func_openpty=${ac_cv_func_openpty='no'}
-ac_cv_func_putenv=${ac_cv_func_putenv='no'}
-ac_cv_func_random=${ac_cv_func_random='no'}
-ac_cv_func_remove=${ac_cv_func_remove='yes'}
-ac_cv_func_revoke=${ac_cv_func_revoke='no'}
-ac_cv_func_setlogin=${ac_cv_func_setlogin='no'}
-ac_cv_func_setpgid=${ac_cv_func_setpgid='no'}
-ac_cv_func_setpgrp=${ac_cv_func_setpgrp='no'}
-ac_cv_func_setsid=${ac_cv_func_setsid='yes'}
-ac_cv_func_socketpair=${ac_cv_func_socketpair='yes'}
-ac_cv_func_strchr=${ac_cv_func_strchr='yes'}
-ac_cv_func_strerror=${ac_cv_func_strerror='yes'}
-ac_cv_func_times=${ac_cv_func_times='yes'}
-ac_cv_func_ulimit=${ac_cv_func_ulimit='no'}
-ac_cv_func_umask=${ac_cv_func_umask='yes'}
-ac_cv_func_vhangup=${ac_cv_func_vhangup='no'}
-ac_cv_gmp_asm_files=${ac_cv_gmp_asm_files=''''}
-ac_cv_gmp_asm_links=${ac_cv_gmp_asm_links=''''}
-ac_cv_gmp_asm_objs=${ac_cv_gmp_asm_objs=''''}
-ac_cv_gmp_asm_status=${ac_cv_gmp_asm_status='disabled'}
-ac_cv_gmp_asm_syntax=${ac_cv_gmp_asm_syntax=''''}
-ac_cv_gmp_asm_syntax_h=${ac_cv_gmp_asm_syntax_h=''''}
-ac_cv_gmp_hostcheck=${ac_cv_gmp_hostcheck=''i386-plan9-bsd . ncc -g    no''}
-ac_cv_gmp_mparam=${ac_cv_gmp_mparam='.././mpn/generic/gmp-mparam.h'}
-ac_cv_gmp_other_files=${ac_cv_gmp_other_files='' .././mpn/generic/inlines.c .././mpn/generic/add_n.c .././mpn/generic/addmul_1.c .././mpn/generic/cmp.c .././mpn/generic/divmod_1.c .././mpn/generic/divrem.c .././mpn/generic/divrem_1.c .././mpn/generic/dump.c .././mpn/generic/lshift.c .././mpn/generic/mod_1.c .././mpn/generic/mul.c .././mpn/generic/mul_1.c .././mpn/generic/mul_n.c .././mpn/generic/random2.c .././mpn/generic/rshift.c .././mpn/generic/sqrtrem.c .././mpn/generic/sub_n.c .././mpn/generic/submul_1.c .././mpn/generic/get_str.c .././mpn/generic/set_str.c .././mpn/generic/scan0.c .././mpn/generic/scan1.c .././mpn/generic/popcount.c .././mpn/generic/hamdist.c .././mpn/generic/gcd_1.c .././mpn/generic/pre_mod_1.c .././mpn/generic/perfsqr.c .././mpn/generic/bdivmod.c .././mpn/generic/gcd.c .././mpn/generic/gcdext.c''}
-ac_cv_gmp_other_links=${ac_cv_gmp_other_links='' inlines.c add_n.c addmul_1.c cmp.c divmod_1.c divrem.c divrem_1.c dump.c lshift.c mod_1.c mul.c mul_1.c mul_n.c random2.c rshift.c sqrtrem.c sub_n.c submul_1.c get_str.c set_str.c scan0.c scan1.c popcount.c hamdist.c gcd_1.c pre_mod_1.c perfsqr.c bdivmod.c gcd.c gcdext.c''}
-ac_cv_gmp_other_objs=${ac_cv_gmp_other_objs='' inlines.o add_n.o addmul_1.o cmp.o divmod_1.o divrem.o divrem_1.o dump.o lshift.o mod_1.o mul.o mul_1.o mul_n.o random2.o rshift.o sqrtrem.o sub_n.o submul_1.o get_str.o set_str.o scan0.o scan1.o popcount.o hamdist.o gcd_1.o pre_mod_1.o perfsqr.o bdivmod.o gcd.o gcdext.o''}
-ac_cv_have_x=${ac_cv_have_x='have_x=no'}
-ac_cv_header_alloca_h=${ac_cv_header_alloca_h='no'}
-ac_cv_header_dirent_dirent_h=${ac_cv_header_dirent_dirent_h='yes'}
-ac_cv_header_lastlog_h=${ac_cv_header_lastlog_h='no'}
-ac_cv_header_machine_endian_h=${ac_cv_header_machine_endian_h='no'}
-ac_cv_header_netinet_in_system_h=${ac_cv_header_netinet_in_system_h='no'}
-ac_cv_header_netinet_in_systm_h=${ac_cv_header_netinet_in_systm_h='no'}
-ac_cv_header_netinet_ip_h=${ac_cv_header_netinet_ip_h='no'}
-ac_cv_header_netinet_tcp_h=${ac_cv_header_netinet_tcp_h='no'}
-ac_cv_header_paths_h=${ac_cv_header_paths_h='no'}
-ac_cv_header_rusage_h=${ac_cv_header_rusage_h='no'}
-ac_cv_header_sgtty_h=${ac_cv_header_sgtty_h='no'}
-ac_cv_header_shadow_h=${ac_cv_header_shadow_h='no'}
-ac_cv_header_stat_broken=${ac_cv_header_stat_broken='no'}
-ac_cv_header_stdc=${ac_cv_header_stdc='yes'}
-ac_cv_header_sys_ioctl_h=${ac_cv_header_sys_ioctl_h='yes'}
-ac_cv_header_sys_select_h=${ac_cv_header_sys_select_h='no'}
-ac_cv_header_sys_time_h=${ac_cv_header_sys_time_h='yes'}
-ac_cv_header_sys_wait_h=${ac_cv_header_sys_wait_h='yes'}
-ac_cv_header_termios_h=${ac_cv_header_termios_h='yes'}
-ac_cv_header_time=${ac_cv_header_time='no'}
-ac_cv_header_ulimit_h=${ac_cv_header_ulimit_h='no'}
-ac_cv_header_unistd_h=${ac_cv_header_unistd_h='yes'}
-ac_cv_header_usersec_h=${ac_cv_header_usersec_h='no'}
-ac_cv_header_utime_h=${ac_cv_header_utime_h='yes'}
-ac_cv_header_utmp_h=${ac_cv_header_utmp_h='no'}
-ac_cv_header_utmpx_h=${ac_cv_header_utmpx_h='no'}
-ac_cv_lib_c_crypt=${ac_cv_lib_c_crypt='no'}
-ac_cv_lib_crypt_crypt=${ac_cv_lib_crypt_crypt='no'}
-ac_cv_lib_dir_opendir=${ac_cv_lib_dir_opendir='no'}
-ac_cv_lib_nsl_main=${ac_cv_lib_nsl_main='no'}
-ac_cv_lib_socket_socket=${ac_cv_lib_socket_socket='no'}
-ac_cv_lib_sun_getpwnam=${ac_cv_lib_sun_getpwnam='no'}
-ac_cv_lib_util_login=${ac_cv_lib_util_login='no'}
-ac_cv_os_cray=${ac_cv_os_cray='no'}
-ac_cv_prog_CC=${ac_cv_prog_CC='ncc'}
-ac_cv_prog_CPP=${ac_cv_prog_CPP=''ncc -E''}
-ac_cv_prog_LN_S=${ac_cv_prog_LN_S='ln'}
-ac_cv_prog_RANLIB=${ac_cv_prog_RANLIB=':'}
-ac_cv_prog_gcc=${ac_cv_prog_gcc='no'}
-ac_cv_prog_make_make_set=${ac_cv_prog_make_make_set='yes'}
-ac_cv_sizeof_int=${ac_cv_sizeof_int='4'}
-ac_cv_sizeof_long=${ac_cv_sizeof_long='4'}
-ac_cv_sizeof_short=${ac_cv_sizeof_short='2'}
-ac_cv_struct_st_blksize=${ac_cv_struct_st_blksize='no'}
-ac_cv_type_mode_t=${ac_cv_type_mode_t='yes'}
-ac_cv_type_off_t=${ac_cv_type_off_t='yes'}
-ac_cv_type_signal=${ac_cv_type_signal='void'}
-ac_cv_type_size_t=${ac_cv_type_size_t='yes'}
-ac_cv_type_uid_t=${ac_cv_type_uid_t='yes'}
//GO.SYSIN DD config.cache.plan9
echo makeinfo
sed 's/.//' >makeinfo <<'//GO.SYSIN DD makeinfo'
-#!/bin/rc
-echo + $*
//GO.SYSIN DD makeinfo
echo ncc
sed 's/.//' >ncc <<'//GO.SYSIN DD ncc'
-#!/bin/rc
-rfork
-for (a) {
-  switch ($a) {
-  case -L/usr/local/lib;
-	# skip
-  case -L*;
-	bind -a `{echo $a | sed 's/^-L//'} /$cputype/lib/ape
-  case *;
-	args=($args $a)
-  }
-}
-exec cc -DPLAN9 $args
//GO.SYSIN DD ncc
echo plan9.c
sed 's/.//' >plan9.c <<'//GO.SYSIN DD plan9.c'
-#include <sys/types.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <termios.h>
-
-int plan9() { return 0; }
-int setsockopt(int s, int t, int u, void* v, int w) { return 0; }
-int getsockopt(int s, int t, int u, void* v, int* w) { return -1; }
-void* getprotobyname(char* p) { return 0; }
-
-static int consctl = -1;
-
-static void cons_init()
-{
-	if (consctl < 0)
-		consctl = open("/dev/consctl", O_WRONLY);
-	if (consctl < 0)
-		perror("can't open consctl");
-}
-
-int plan9_cons_raw()
-{
-	cons_init();
-	return (write(consctl, "rawon", 5) != 5) ? -1 : 0;
-}
-
-int plan9_cons_cooked()
-{
-	cons_init();
-	return (write(consctl, "rawoff", 6) != 6) ? -1 : 0;
-}
-
-int ssh_tcsetattr(int fd, int xxx, const struct termios *t)
-{
-	/* Massive kludge. */
-	return (t->c_lflag & ECHO) ? plan9_cons_cooked() : plan9_cons_raw();
-}
//GO.SYSIN DD plan9.c
echo plan9.h
sed 's/.//' >plan9.h <<'//GO.SYSIN DD plan9.h'
-#define _BSD_EXTENSION
-#define IXANY 0
-#define S_IWRITE 0200
-#define tcsetattr ssh_tcsetattr
-#define d_ino d_name		/* safe if only checked against 0 */
-#define HAVE_SOCK_OPTS		/* for sys/socket.h */
-#define SSH_USER_DIR "lib/ssh"
-#define HAVE_RRESVPORT
//GO.SYSIN DD plan9.h
echo ssh-diffs
sed 's/.//' >ssh-diffs <<'//GO.SYSIN DD ssh-diffs'
-diff /n/tapefs/ssh-1.2.17/configure ./configure
-473a474,475
-> # Plan 9 needs a pragma that stdio happens to give.
-> echo '#include <stdio.h>' >confdefs.h
-3293c3295
-< for ac_func in strerror memmove remove random putenv crypt socketpair
----
-> for ac_func in strerror memmove remove random putenv crypt socketpair plan9
-diff /n/tapefs/ssh-1.2.17/includes.h ./includes.h
-116a117,121
-> #ifdef PLAN9
-> /* this has to come before other things are included */
-> #include <plan9.h>
-> #endif
-> 
-229c234,235
-< #else /* normal system */
----
-> #endif
-> #ifdef HAVE_ARPA_INET_H
-diff /n/tapefs/ssh-1.2.17/readpass.c ./readpass.c
-84a85,87
-> #ifdef PLAN9
->       f = fopen("/dev/cons", "r");
-> #else
-85a89
-> #endif
-diff /n/tapefs/ssh-1.2.17/ssh.c ./ssh.c
-580a581
-> #ifndef PLAN9
-581a583
-> #endif
-606a609
-> #ifndef PLAN9
-612a616
-> #endif
-736a741,748
-> #ifdef PLAN9
->       { char *p;
->         packet_put_int((p = getenv("LINES")) ? atoi(p) : 0);
->         packet_put_int((p = getenv("COLS")) ? atoi(p) : 0);
->         packet_put_int(0);
->         packet_put_int(0);
->       }
-> #else
-740a753
-> #endif /* PLAN9 */
-diff /n/tapefs/ssh-1.2.17/ssh.h ./ssh.h
-167a168
-> #ifndef SSH_USER_DIR
-168a170
-> #endif
-173c175
-< #define SSH_USER_HOSTFILE	"~/.ssh/known_hosts"
----
-> #define SSH_USER_HOSTFILE	"~/" SSH_USER_DIR "/known_hosts"
-177c179
-< #define SSH_CLIENT_SEEDFILE	".ssh/random_seed"
----
-> #define SSH_CLIENT_SEEDFILE	SSH_USER_DIR "/random_seed"
-181c183
-< #define SSH_CLIENT_IDENTITY	".ssh/identity"
----
-> #define SSH_CLIENT_IDENTITY	SSH_USER_DIR "/identity"
-188c190
-< #define SSH_USER_CONFFILE	".ssh/config"
----
-> #define SSH_USER_CONFFILE	SSH_USER_DIR "/config"
-197c199
-< #define SSH_USER_PERMITTED_KEYS	".ssh/authorized_keys"
----
-> #define SSH_USER_PERMITTED_KEYS	SSH_USER_DIR "/authorized_keys"
-203c205
-< #define SSH_USER_RC		".ssh/rc"
----
-> #define SSH_USER_RC		SSH_USER_DIR "/rc"
-diff /n/tapefs/ssh-1.2.17/sshconnect.c ./sshconnect.c
-235a236,241
-> #ifdef HAVE_RRESVPORT
->   if ((sock = rresvport(0)) >= 0)
->     return sock;
->   else
-> #endif
-> 
-diff /n/tapefs/ssh-1.2.17/userfile.c ./userfile.c
-271c271
-<       buffer_append(&packet, buf, bytes);
----
->       buffer_append(&packet, (char*)buf, bytes);
//GO.SYSIN DD ssh-diffs
echo ssh-notes
sed 's/.//' >ssh-notes <<'//GO.SYSIN DD ssh-notes'
-Changes to ssh-1.2.17 for Plan 9 from Bell Labs
-
-* SSH bugs -- these should be fixed for all platforms
-
-1. gmp-2.0.2-ssh-2/longlong.h needs to have the code inside the 
-   #ifdef __GNUC__ moved to longlonggcc.h, and then include that,
-   because it contains unterminated string constants which plan9's
-   ansi cpp cannot parse.
-
-2. gmp-2.0.2-ssh-2/mpbsd/mtox.c:49 return (char*)str;
-   gmp-2.0.2-ssh-2/mpbsd/mtox.c:80 return (char*)str;
-
-3. userfile.c:271 (char*)buf
-
-* Alterations to ssh code
-
-1. configure needs to include stdio.h in confdefs.h.
-
-2. includes.h conditionally includes arpa/inet.h.
-
-3. includes.h includes plan9.h
-
-4. readpass.c:85 conditionally uses "/dev/cons" instead of "/dev/tty"
-
-5. APE should have field for pw_passwd, but since it
-   doesn't, ifdef out pw_passwd in ssh.c:581.
-
-6. Plan 9 doesn't use dotfiles by convention; replace .ssh with
-   lib/ssh in ssh.h.
-
-7. APE needs to use rresvport() in sshconnect.c:/ssh_create_socket 
-   to get a reserved port.  calling that is desirable in general, I think,
-   if it is available.
-
-8. don't disable rhosts_rsa_authentication; there's no such thing
-   as root.  (why bother with this, anyway?)
-
-9. in ssh.c:740 recognise tty sizes from Plan9's hp termulator.
- 
-* Extra programs required for Plan 9 -- put these in your bin
-
-1. makeinfo script to do nothing.
-
-2. ncc script to handle -L... args.
-
-* Building it
-
-1. configure kinda works if you say (under ape/psh)
-    CC=ncc configure --host=i386-plan9-bsd --with-etcdir=/lib/ssh --disable-asm
-
-2. ksh is busted and runs out of core all the time, so
-   configure will get things wrong.  Before you run configure,
-   copy the supplied config.cache.plan9 to config.cache, to
-   fill in the right values.
-
-3. don't do "make install", unless you set all the configure flags to put
-   things in sensible places.  i just copy ssh to bin by hand.
-
-* Remaining bugs
-
-1. the agent stuff doesn't work at all.
-
-2. no server stuff either.
-
-3. it's kinda slow.  defects in select emulation?
-
-4. changes to APE, distributed seperately, are required.
-
//GO.SYSIN DD ssh-notes

