From: Alex Liu (aliu@aludra.usc.edu)
Date: 09/17/92


From: aliu@aludra.usc.edu (Alex Liu)
Subject: Re: Compiling sc-6.21; What is Linux?
Date: 16 Sep 1992 22:20:37 -0700

lcd@ais.org (Leon Dent) writes:

>I want to try to compile sc (ver 6.21). I 've seen messages
>to the effect that is works except for the arrow keys.

SC v6.21 does work. With nearly NO changes. The arrow keys do
work with some mucking on the termcap.

>I don't know what to select amongst the many system options.

I compiled SC v6.21 using the following options; (See Makefile)
DOBACKUPS=-DDOBACKUPS
SIGVOID=-DSIGVOID
RINT=-DRINT
RE_COMP=-DRE_COMP
DFLT_PAGER=-DDFLT_PAGER=\"more\"
SAVE=-DSAVENAME=\"$(NAME).bak\"
CRYPT=-DCRYPT_PATH=\"/usr/bin/crypt\"
YACC=bison -y
YTAB=y.tab

The other options are left blank. You might need to tweak these
a bit. (Obviously you need bison)

For the system defines I used:

CFLAGS= -O6 -DBSD42 -DPOSIX
LDFLAGS= -O6 -s -N
CC=gcc
LIB=-lm -lcurses -ltermcap

Now, you must edit the definition of exit. If you use those system
defines, exit is declare as int while the system includes declare it
as void. Easy to fix.

Also, SIGBUS is not defined by Linux. So in the file sc.c you should put:

#ifdef SIGBUS
        signal(SIGBUS,doquit);
#endif

Compile and enjoy.

At first you wont be able to use the cursor keys. To get those things
working you must edit the termcap. The termcap initialization string will
turn the arrow keys from standard to application mode. As default the
arrow keys are standard, and return:
        UP: ^[ [ A DOWN : ^[ [ B
        LEFT: ^[ [ D RIGHT : ^[ [ C
And that is what is defined in the termcap for the console. (Look up
the "con-unk" termcap entry)
But curses will initialize the terminal to do switch to application mode,
that makes the keys return:
        UP: ^[ O A DOWN: ^[ O B
        LEFT: ^[ O D RIGHT: ^[ O C
So, if you really want to use the arrow keys, you simply go to the termcap
and change those ku, kd, kl and kr definitons from standard to application
escapes, and you got it working!

I sent this information to the guy that is supposedly in charge of
porting SC (not much of a port if you ask me :-) so hopefully he
will post a new version. The version posted to tsx-11 is Scv5.x
which is ancient.

>This begs another question; What system is Linux closest to?
>What (if any ) system (bsd, sysv etc...) is it trying to emulate?

Linux is POSIX compliant, and has BSD and SYSV extensions. So in other
words you could pick either one and there is a good chance that it would
work. Allthough, when it comes to TTY control is more close to SYSV and
POSIX, while when it comes to IPC is more close to BSD. (Hopefully this
will change SOON, and you could just randomly pick BSD or SYSV and have
a perfectly working system. As you can see from the changes needed to get
SC6.21 to compile, Linux is pretty close to most standard Unix systems)

>Leon Dent
>lcd@ais.org

-- 
_____________________________________________________________________________
Alejandro Liu           |EMail: aliu@usc.edu |All mispellings are intentional
1551A Ridgecrest Apt A  |Voice: 213-264-9400 |Anything mentioned here is not
Monterrey Park, CA91754 |                    |necessarily true.