🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sources.bugs
Article #2258

Re: atty on Sun 3

#2258
From: Michael Glad
Date: Sat, 03 Jun 1989 12:34
59 lines
1951 bytes
I see no need to discuss the compiler flags used in compiling atty 
on Suns.

A few days ago, I compiled atty and tried to run it with the same
disappointing result as reported in this news group. 

I recompiled it using -g and used gdb (the nice GNU debugger) to
locate the crash.

Atty core dumps because it calls abort. It calls abort because an pty
ioctl fails. The ioctl fails because it tries to set terminal modes
on the master side of the pty instead of on the slave side.

I don't know if that's possible on other systems but it won't work on
SunOS 4.0 suns, see the enclosed program:

#include <sys/file.h>
#include <sys/types.h>
#include <sys/termio.h>
#include <sys/termios.h>

/* Michael Glad, glad@daimi.dk, 1989-06-03 */

main(argc,argv)
  int argc;
  char **argv;
  { int s;
    struct termios t;
  
    /* Too lazy to search for a pty, let's hope this one is free */
    /* Change it if not configured in your kernel                */

    if((s=open("/dev/ptyr0",O_RDONLY))<0)
      { perror("couldn't open pty");
        exit(1);
      }

    if(ioctl(s,TCGETS,(char*)&t)<0)
      { perror("ioctl failed");
        exit(1);
      }

    close(s);

    exit(0);

  }

When compiled using gcc or cc it produces the reported error message:

"Inappropriate ioctl for device".

I think atty needs patches for Sun's. I'm not going to do anything
about it as I'm very satisfied with the command editing facilities
in tcsh (a patched csh).

/Michael Glad

glad@daimi.dk
Technical Details
Message-ID: <2461@daimi.dk>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!mcvax!kth!sunic!dkuug!daimi!glad

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!mcvax!kth!sunic!dkuug!daimi!glad
From: glad@daimi.dk (Michael Glad)
Newsgroups: comp.sources.bugs
Subject: Re: atty on Sun 3
Message-ID: <2461@daimi.dk>
Date: 3 Jun 89 12:34:49 GMT
Sender: news@daimi.dk
Reply-To: glad@daimi.dk (Michael Glad)
Organization: DAIMI: Computer Science Department, Aarhus University, Denmark
Lines: 59