Subject: bin/9667: cu should allow modem dialout w/o softcar
To: None <gnats-bugs@gnats.netbsd.org>
From: John Hawkinson <jhawk@mit.edu>
List: netbsd-bugs
Date: 03/23/2000 10:27:32
>Number:         9667
>Category:       bin
>Synopsis:       cu should allow modem dialout w/o softcar
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 23 10:27:01 2000
>Last-Modified:
>Originator:     John Hawkinson
>Organization:
	MIT
>Release:        NetBSD 1.4.2
>Environment:
	
System: NetBSD zorkmid.mit.edu 1.4.2 NetBSD 1.4.2 (ZORKMID) #1: Wed Mar 22 03:24:44 EST 2000 jhawk@zorkmid.mit.edu:/usr/src/sys/arch/i386/compile/ZORKMID i386


>Description:
	
	PREMISE: The operating system should provide software that allows
connecting to serial ports without editting any configuration files or
installing special software. This should work with modems.

EVALUATION:
	tip fails this test, because using it usefully requires editting
/etc/remote to specify the serial line and baud rate.

	cu almost passes, but still fails, because though it allows
specification of the baud rate and line (e.g. "cu -l /dev/dty03 -s
9600"), it does not allow dialout on modems which do not assert
carrier. This makes it useless for your run of them mill PCMCIA modem,
etc. This can be worked around by editting /etc/ttys and setting
'softcar' on the tty in question, but that is a nasty hack that is
gross and disgusting and fails "do not edit configuration files".

	pppd really ought to pass, but is such an ugly way to
implement a character-based connection that I cannot see myself living
with it.  Namely, "pppd dty03 connect 'xterm -Sxx1'" causes pppd to
set CLOCAL and then pop up an xterm connected to /dev/dty03. This also
requires X. I'm sure there's an innovative solution sitting in the
wings (arcane /bin/sh commands plus named pipes?) . I'd be curious
what it is.

	kermit would pass, but it's not part of the base OS. I include
this here because all the people I've mentioned this to have just said
"use kermit." Obviously because they've been brainwashed by the
incompetance of the core operating system utilities. Charles argues
"tip and cu have arcane, historic interfaces", but Karl Ramm replies
"kermit also has an arcance, historic interface. It's just that
tops-20 was a *friendly* operating system." Hard to sum it up better
than that.

SOLUTION:
	Fix cu support ignoring carrier detect. Relatively straightforward,
all the layers beneath (libuu*) all already support this concept. I wonder
why it was left out of cu?

	*IDEALLY* you'd want a way to turn carrier detect back on
after dialing was successful so that you could detect hangups. I think
that's relatively pie-in-the-sky, and it should be argued that the tty
layer should have a magic way to do that anyhow, so programs don't
have to roll-their-own.

>How-To-Repeat:
	
>Fix:
	

===================================================================
RCS file: gnu/libexec/uucp/cu/RCS/cu.1,v
retrieving revision 1.1
retrieving revision 1.2
diff -c -r1.1 -r1.2
*** gnu/libexec/uucp/cu/cu.1	2000/03/24 07:22:42	1.1
--- gnu/libexec/uucp/cu/cu.1	2000/03/24 07:33:58	1.2
***************
*** 1,4 ****
! ''' $Id: cu.1,v 1.1 2000/03/24 07:22:42 jhawk Exp $
  .TH cu 1 "Taylor UUCP 1.06"
  .SH NAME
  cu \- Call up another system
--- 1,4 ----
! ''' $Id: cu.1,v 1.2 2000/03/24 07:33:58 jhawk Exp $
  .TH cu 1 "Taylor UUCP 1.06"
  .SH NAME
  cu \- Call up another system
***************
*** 230,235 ****
--- 230,238 ----
  .TP 5
  .B \-\-nostop
  Turn off XON/XOFF handling (it is on by default).
+ .TP 5
+ .B \-C, \-\-ignore-carrier
+ Disable carrier detect. Useful for modem dialout.
  .TP 5
  .B \-E char, \-\-escape char
  Set the escape character.  Initially
===================================================================
RCS file: gnu/libexec/uucp/cu/RCS/cu.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -c -r1.1 -r1.2
*** gnu/libexec/uucp/cu/cu.c	2000/03/23 22:58:58	1.1
--- gnu/libexec/uucp/cu/cu.c	2000/03/24 07:33:58	1.2
***************
*** 26,32 ****
  #include "uucp.h"
  
  #if USE_RCS_ID
! const char cu_rcsid[] = "$Id: cu.c,v 1.1 2000/03/23 22:58:58 jhawk Exp $";
  #endif
  
  #include "cu.h"
--- 26,32 ----
  #include "uucp.h"
  
  #if USE_RCS_ID
! const char cu_rcsid[] = "$Id: cu.c,v 1.2 2000/03/24 07:33:58 jhawk Exp $";
  #endif
  
  #include "cu.h"
***************
*** 213,218 ****
--- 213,219 ----
  static const struct option asCulongopts[] =
  {
    { "phone", required_argument, NULL, 'c' },
+   { "ignore-carrier", no_argument, NULL, 'C' },
    { "escape", required_argument, NULL, 'E' },
    { "parity", required_argument, NULL, 2 },
    { "halfduplex", no_argument, NULL, 'h' },
***************
*** 238,243 ****
--- 239,246 ----
  {
    /* -c: phone number.  */
    char *zphone = NULL;
+   /* -C: ignore carrier. */
+   boolean fignore_carrier = FALSE;
    /* -e: even parity.  */
    boolean feven = FALSE;
    /* -l: line.  */
***************
*** 295,301 ****
  	}
      }
  
!   while ((iopt = getopt_long (argc, argv, "a:c:deE:hnI:l:op:s:tvx:z:",
  			      asCulongopts, (int *) NULL)) != EOF)
      {
        switch (iopt)
--- 298,304 ----
  	}
      }
  
!   while ((iopt = getopt_long (argc, argv, "a:c:CdeE:hnI:l:op:s:tvx:z:",
  			      asCulongopts, (int *) NULL)) != EOF)
      {
        switch (iopt)
***************
*** 312,317 ****
--- 315,324 ----
  #endif
  	  break;
  
+ 	case 'C':
+ 	  /* Ignore carrier */
+ 	  fignore_carrier = TRUE; 
+ 
  	case 'e':
  	  /* Even parity.  */
  	  feven = TRUE;
***************
*** 593,598 ****
--- 600,607 ----
  	      sport.uuconf_ttype = UUCONF_PORTTYPE_DIRECT;
  	      sport.uuconf_zprotocols = NULL;
  	      sport.uuconf_qproto_params = NULL;
+ 	      sport.uuconf_u.uuconf_sdirect.uuconf_fcarrier =
+                 !fignore_carrier;
  	      sport.uuconf_ireliable = 0;
  	      sport.uuconf_zlockname = NULL;
  	      sport.uuconf_palloc = NULL;
***************
*** 843,848 ****
--- 852,859 ----
  	   " -s,--speed,--baud speed, -#: Use given speed\n");
    fprintf (stderr,
  	   " -c,--phone phone: Phone number to call\n");
+   fprintf (stderr,
+ 	   " -C,--ignore-carrier: Don't require carrier to connect\n");
    fprintf (stderr,
  	   " -z,--system system: System to call\n");
    fprintf (stderr,
>Audit-Trail:
>Unformatted: