*BSD News Article 50150


Return to BSD News archive

Newsgroups: comp.unix.bsd.freebsd.misc
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!aggedor.rmit.EDU.AU!goanna.cs.rmit.edu.au!munnari.oz.au!spool.mu.edu!howland.reston.ans.net!newsfeed.internetmci.com!news.sprintlink.net!in2.uu.net!newsfeed.pitt.edu!dsinc!jabber!candle!root
From: root@candle.pha.pa.us (Bruce Momjian)
Subject: Re: non X  Comm Program for BSD?
X-Newsreader: TIN [UNIX 1.3 950726BETA PL0]
Organization: a consultant's basement
Message-ID: <DEEu1v.1JJ@candle.pha.pa.us>
References: <424sbp$nti@bud.shadow.net> <4279mb$a2d@lynet.Lynet.De>
Date: Tue, 5 Sep 1995 02:10:43 GMT
Lines: 262

Uwe Gruentjes (uweg@gfsfs.gfs-hl.de) wrote:
: In article <424sbp$nti@bud.shadow.net>, alam@anshar.shadow.net (Arthur
: Lammoglia) wrote:
: 
: 
: > I am looking for a non X-terminal  communications program for FreeBSD. I tried
: > ftp.cdrom.com , but only found Seyon. If anyone could point me to a source, it
: > would be much appreciated.
: >   art
: 
: Try pcomm. It's a ProComm look-alike (well, sort of ...). Current
: version should be 2.01. There's also minicom somewhere out there.

If you try pcomm, here is a patch which fixes some bugs and allows me to
run it on BSD/OS.

---------------------------------------------------------------------------


From maillist Sun Jun 13 23:16:59 1993
Subject: Porting pcomm 2.0.2
To: bsdi-users@bsdi.com (bsdi maillist (not as root))
Date: Sun, 13 Jun 1993 23:16:59 -40962758 (EDT)
X-Mailer: ELM [version 2.4 PL20]
Content-Type: text
Content-Length: 5175      
Status: OR

Here is a patch to get pcomm 2.0.2 for to BSD/386.

This patch does fix several things:

	adds local/nolocal calls to tty_ucb.  Without it, it can't dial.

	added the FD_* calls to ipc_bsd to properly set file descriptor
		masks.  Fixed initialization bug.  Without these fixes,
		pcomm will not sleep in the select and eat tons of cpu.

	fixed loop of function calls in chg_dir.c

Apply this context diff with 'patch', compile fix.c seperately to fix.o
and add fix.o to the final link.

I may not have done the best job with these patches.  Let me know if
you have problems.  I will contact the author to try and get these fixes
into the final release.  Pcomm 2.0.2 was posted to comp.sources.unix/misc
recently.

Pcomm is a procomm clone, used to dial the modem.

----------------------------------------------------------------------
*** ipc_ucb.c.orig	Sat Jun 12 21:00:53 1993
--- ipc_ucb.c	Sat Jun 12 22:54:42 1993
***************
*** 12,18 ****
  #include "ipc.h"
  
  static char pty_name[12];
! static int fdin_mask, num_fds;
  static struct timeval time_out = {1L, 0L};
  static struct timeval *tp;
  
--- 12,19 ----
  #include "ipc.h"
  
  static char pty_name[12];
! static int num_fds;
! static fd_set fdin_mask;
  static struct timeval time_out = {1L, 0L};
  static struct timeval *tp;
  
***************
*** 20,37 ****
  ipc_init(tty_fd, cmd_fd)
  int tty_fd, cmd_fd;
  {
! 	int fdout, fdin, fdex;
  
! 	fdout = 0;
! 	fdex = 0;
! 	fdin_mask = 1;			/* the keyboard */
  	num_fds = 1;
  	if (tty_fd != -1) {		/* the TTY */
! 		fdin_mask |= (1 << tty_fd);
  		num_fds = tty_fd +1;
  	}
  	if (cmd_fd != -1) {		/* the shell script */
! 		fdin_mask |= (1 << cmd_fd);
  		if (cmd_fd > tty_fd)
  			num_fds = cmd_fd +1;
  		tp = &time_out;
--- 21,39 ----
  ipc_init(tty_fd, cmd_fd)
  int tty_fd, cmd_fd;
  {
! 	fd_set fdout, fdin, fdex;
  
! 	FD_ZERO(&fdout);
! 	FD_ZERO(&fdex);
! 	FD_ZERO(&fdin_mask);
! 	FD_SET(0,&fdin_mask);			/* the keyboard */
  	num_fds = 1;
  	if (tty_fd != -1) {		/* the TTY */
! 		FD_SET(tty_fd,&fdin_mask);
  		num_fds = tty_fd +1;
  	}
  	if (cmd_fd != -1) {		/* the shell script */
! 		FD_SET(cmd_fd,&fdin_mask);
  		if (cmd_fd > tty_fd)
  			num_fds = cmd_fd +1;
  		tp = &time_out;
***************
*** 45,63 ****
  ipc_poll(tty_fd, cmd_fd)
  int tty_fd, cmd_fd;
  {
! 	int ret_code, fdout, fdin, fdex;
  
  	ret_code = 0;
  	fdin = fdin_mask;
  	select(num_fds, &fdin, &fdout, &fdex, tp);
! 
! 	if (fdin & 1)
  		ret_code |= KEY_READY;
  
! 	if (tty_fd != -1 && (fdin & (1 << tty_fd)))
  		ret_code |= TTY_READY;
  
! 	if (cmd_fd != -1 && (fdin & (1 << cmd_fd)))
  		ret_code |= CMD_READY;
  
  	return(ret_code);
--- 47,68 ----
  ipc_poll(tty_fd, cmd_fd)
  int tty_fd, cmd_fd;
  {
! 	int ret_code;
! 	fd_set fdout, fdin, fdex;
  
  	ret_code = 0;
+ 	FD_ZERO(&fdout);
+ 	FD_ZERO(&fdex);
  	fdin = fdin_mask;
  	select(num_fds, &fdin, &fdout, &fdex, tp);
! 	
! 	if (FD_ISSET(0,&fdin))
  		ret_code |= KEY_READY;
  
! 	if (tty_fd != -1 && FD_ISSET(tty_fd,&fdin))
  		ret_code |= TTY_READY;
  
! 	if (cmd_fd != -1 && FD_ISSET(cmd_fd,&fdin))
  		ret_code |= CMD_READY;
  
  	return(ret_code);
***************
*** 71,84 ****
  ipc_update(tty_fd, cmd_fd)
  int tty_fd, cmd_fd;
  {
! 	fdin_mask = 1;
  	num_fds = 1;
  	if (tty_fd != -1) {
! 		fdin_mask |= (1 << tty_fd);
  		num_fds = tty_fd +1;
  	}
  	if (cmd_fd != -1) {
! 		fdin_mask |= (1 << cmd_fd);
  		if (cmd_fd > tty_fd)
  			num_fds = cmd_fd +1;
  		tp = &time_out;
--- 76,90 ----
  ipc_update(tty_fd, cmd_fd)
  int tty_fd, cmd_fd;
  {
! 	FD_ZERO(&fdin_mask);
! 	FD_SET(0,&fdin_mask);
  	num_fds = 1;
  	if (tty_fd != -1) {
! 		FD_SET(tty_fd,&fdin_mask);
  		num_fds = tty_fd +1;
  	}
  	if (cmd_fd != -1) {
! 		FD_SET(cmd_fd,&fdin_mask);
  		if (cmd_fd > tty_fd)
  			num_fds = cmd_fd +1;
  		tp = &time_out;
*** chg_dir.c.orig	Mon May 17 22:04:49 1993
--- chg_dir.c	Mon May 17 22:05:34 1993
***************
*** 56,62 ****
  	return;
  }
  
! #ifdef BSD
  /*
   * Get the current working directory, AT&T style.  Well... not really, it
   * doesn't handle a NULL pointer for the buffer.
--- 56,62 ----
  	return;
  }
  
! #ifdef 0 /*BSD bjm */
  /*
   * Get the current working directory, AT&T style.  Well... not really, it
   * doesn't handle a NULL pointer for the buffer.
*** tty_ucb.c.orig	Sun Jun 13 23:08:43 1993
--- tty_ucb.c	Sun Jun 13 23:08:11 1993
***************
*** 30,35 ****
--- 30,36 ----
  		ioctl(fd, TIOCGETP, &hold);
  		first = 0;
  	}
+ 	set_bsd_local(fd);
  					/* get the current settings */
  	ioctl(fd, TIOCGETP, &tbuf);
  					/* set some beginning values */
***************
*** 117,122 ****
--- 118,124 ----
  	extern int fd;
  
  	ioctl(fd, TIOCSETP, &hold);
+  	set_bsd_nolocal(fd);
  	return;
  }
  
*** /dev/null	Sun Jun 13 22:45:35 1993
--- fix.c	Wed May 19 17:03:53 1993
***************
*** 0 ****
--- 1,22 ----
+ #include <stdio.h>
+ #include <sys/termios.h>
+ 
+ set_bsd_local(fd)
+ int fd;
+ {
+ 	struct termios t;
+ 
+ 	tcgetattr(fd, &t);
+ 	t.c_cflag |= CLOCAL;
+ 	tcsetattr(fd, TCSANOW, &t);
+ }
+ 
+ set_bsd_nolocal(fd)
+ int fd;
+ {
+ 	struct termios t;
+ 
+ 	tcgetattr(fd, &t);
+ 	t.c_cflag &= ~CLOCAL;
+ 	tcsetattr(fd, TCSANOW, &t);
+ }


-- 
Bruce Momjian                          |  830 Blythe Avenue
root@candle.pha.pa.us                  |  Drexel Hill, Pennsylvania 19026 
  +  If your life is a hard drive,     |  (610) 353-9879(w) 
  +  Christ can be your backup.        |  (610) 853-3000(h)