[comp.unix.wizards] Porting the BSD 4.3 Tahoe distribution to System V

jiii@visdc.UUCP (John E Van Deusen III) (02/10/89)

I am attempting to port some of the BSD 4.3 Tahoe software to a Unix V.0
(Uniplus+) machine.  In posting the following questions, I assume that
the porting problems are of interest to more people than just me:

     A: Is there is any documentation, especially of the include files,
        somewhere in the release.  Any man(1) entries?

     B: What is the difference between the ioctl(2) system call
        utilizing the <termio.h> include file and the ioctl(2) call
        using <sttyb.h>.  My system has both include files, but they are
        clearly not compatible.  I have no documentation for sgttyb.h on
        my machine and including both in the same source file causes
        complaints about redefining things.  My version of sgtty.h does
        not define CBREAK.  Is CBREAK equivalent to RAW?

     C: The BDS software, (for libcurses), uses a stty() system call
        with a pointer to a sgtty structure.  I have stty() in the libc
        archive, but it is not documented.  The result of using it seems
        to be a hung terminal.  To make the BSD software work, does
        everything have to be rewritten in terms of ioctl() calls and
        termio.h defines?

     D: The BSD software often deals directly with variables defined in
        stdio.h.  The scanw.c routine of libcurses, contains the line
        junk._flag = _IOREAD|_IOSTRG; What does _IOSTRG mean?  Is is
        equivalent to _IOMYBUF?
--
John E Van Deusen III, PO Box 9283, Boise, ID  83707, (208) 343-1865

uunet!visdc!jiii

guy@auspex.UUCP (Guy Harris) (02/11/89)

>     A: Is there is any documentation, especially of the include files,
>        somewhere in the release.  Any man(1) entries?

If by "the release" you mean "4.3-tahoe", check out "/usr/src/man".

>     B: What is the difference between the ioctl(2) system call
>        utilizing the <termio.h> include file and the ioctl(2) call
>        using <sttyb.h>.  My system has both include files, but they are
>        clearly not compatible.  I have no documentation for sgttyb.h on
>        my machine and including both in the same source file causes
>        complaints about redefining things.  My version of sgtty.h does
>        not define CBREAK.  Is CBREAK equivalent to RAW?

Oh boy.  Your system probably has the S5 version of the <sgttyb.h>-style
"ioctl"s, which are not compatible with the V7 ones that BSD uses.  You
probably want to rewrite the tty-munging code.

CBREAK is not equivalent to RAW; RAW turns off all input and output
processing, while CBREAK merely turns off erase/kill processing. 
Turning CBREAK on is equivalent to turning ICANON off in the
<termio.h>-style "ioctl"s.

>     C: The BDS software, (for libcurses), uses a stty() system call
>        with a pointer to a sgtty structure.  I have stty() in the libc
>        archive, but it is not documented.  The result of using it seems
>        to be a hung terminal.  To make the BSD software work, does
>        everything have to be rewritten in terms of ioctl() calls and
>        termio.h defines?

See above.  Yes, you probably want rewrite it all in therms of the
<termio.h> stuff.  "stty" is an old V6ism that in V7 and S3/S5 turned
into the TIOCSETP "ioctl" (and "gtty" is another old V6ism that in V7
and S3/S5 turned into TIOCGETP). 

>     D: The BSD software often deals directly with variables defined in
>        stdio.h.  The scanw.c routine of libcurses, contains the line
>        junk._flag = _IOREAD|_IOSTRG; What does _IOSTRG mean?  Is is
>        equivalent to _IOMYBUF?

_IOSTRG means "this buffer is a string, not a file; don't try doing I/O
on it."  I think the S5 equivalent is setting "junk._file" to _NFILE.