| 
					
				 | 
			
			
				@@ -9,6 +9,8 @@ import ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	"strings" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	"syscall" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	"time" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	"golang.org/x/sys/unix" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /* 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -185,6 +187,7 @@ func (d *Door) ReadDropfile(filename string) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	d.config.time_left, err = strconv.Atoi(lines[8]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	d.config.emulation, err = strconv.Atoi(lines[9]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	d.config.node_number, err = strconv.Atoi(lines[10]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	d.READFD = d.config.comm_handle 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	//if d.READFD == 0 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	//	d.WRITEFD = 1 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -235,6 +238,57 @@ func (d *Door) detect() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+func tcgetattr(fd uintptr) (*unix.Termios, error) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	return unix.IoctlGetTermios(int(fd), unix.TCGETS) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+func cfmakeraw(attr *unix.Termios) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	attr.Iflag &^= unix.IGNBRK | unix.BRKINT | unix.ISTRIP | unix.PARMRK | 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		unix.INLCR | unix.IGNCR | unix.ICRNL | unix.IXON 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	attr.Oflag &^= unix.OPOST 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	attr.Cflag &^= unix.CSIZE | unix.PARENB 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	attr.Cflag |= unix.CS8 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	attr.Lflag &^= unix.ECHO | unix.ECHONL | unix.ICANON | unix.IEXTEN | unix.ISIG 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	attr.Cc[unix.VMIN] = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	attr.Cc[unix.VTIME] = 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	/* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		attr.Iflag &^= unix.BRKINT | unix.INLCR | unix.ICRNL | unix.INPCK | unix.ISTRIP | unix.IXON 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		attr.Oflag &^= unix.OPOST 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		attr.Cflag &^= unix.CSIZE | unix.PARENB 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		attr.Cflag |= unix.CS8 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		attr.Lflag &^= unix.ECHO | unix.ICANON | unix.IEXTEN | unix.ISIG 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		attr.Cc[unix.VMIN] = 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		attr.Cc[unix.VTIME] = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+const ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	TCIFLUSH  = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	TCOFLUSH  = 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	TCIOFLUSH = 2 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	TCSANOW   = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	TCSADRAIN = 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	TCSAFLUSH = 2 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// Tcsetattr sets the current serial port settings. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+func tcsetattr(fd, action uintptr, argp *unix.Termios) error { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	var request uintptr 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	switch action { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	case TCSANOW: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		request = unix.TCSETS 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	case TCSADRAIN: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		request = unix.TCSETSW 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	case TCSAFLUSH: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		request = unix.TCSETSF 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	default: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		return unix.EINVAL 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	return unix.IoctlSetTermios(int(fd), uint(request), argp) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 func (d *Door) Init() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	var dropfile string 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -248,9 +302,15 @@ func (d *Door) Init() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	d.ReadDropfile(dropfile) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	fmt.Printf("BBS %s, User %s / Handle %s / File %d\n", d.config.BBSID, d.config.real_name, d.config.handle, d.config.comm_handle) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	fmt.Printf("BBS %s, User %s / Handle %s / File %d\n", d.config.BBSID, d.config.real_name, d.config.handle, d.READFD) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	// putting the linux terminal into raw mode ... 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	// requires golang.org/x/sys/unix  unix.Ioctlgetermios, etc. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	// I'm still getting terminal echo, terminal still not in raw mode (needs CR to submit) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	a, _ := tcgetattr(uintptr(d.READFD)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	cfmakeraw(a) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	_ = tcsetattr(uintptr(d.READFD), TCSANOW, a) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	// _ = tcsetattr(uintptr(d.READFD), TCSAFLUSH, a) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	d.detect() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 |