Levee editor compiled for RetroBSD.

This commit is contained in:
Serge Vakulenko
2015-01-06 13:42:43 -08:00
parent e834303650
commit f33305f894
8 changed files with 161 additions and 49 deletions

View File

@@ -241,6 +241,7 @@ file /bin/login
mode 04755
file /bin/lol
file /bin/ls
file /bin/lv
file /bin/mail
mode 04755
file /bin/make
@@ -781,6 +782,7 @@ file /share/man/cat1/id.0
file /share/man/cat1/la.0
file /share/man/cat1/lcc.0
file /share/man/cat1/ld.0
file /share/man/cat1/lv.0
file /share/man/cat1/passwd.0
file /share/man/cat1/printf.0
file /share/man/cat1/ranlib.0

View File

@@ -12,7 +12,7 @@ CFLAGS += -Werror
# /bin
SUBDIR = adb adc-demo aout ar as awk basic cc chflags chpass \
cpp dc diff emg env fdisk find forth fstat glcdtest \
hostname id la lcc lcpp ld ls login make man med \
hostname id la lcc lcpp ld levee ls login make man med \
more nm passwd picoc portio printf pwm \
rdprof ranlib re renice retroforth scm setty sl \
sed sh smallc smlrc stty sysctl test uname wiznet xargs \

View File

@@ -1 +1 @@
lev
lv

View File

@@ -1,40 +1,40 @@
# makefile for Levee
#
# Public Domain. 1995/03/13 - Steven Schultz
#
TOPSRC = $(shell cd ../../..; pwd)
include $(TOPSRC)/target.mk
exedir=/usr/local/bin
mandir=/usr/local/man
CC=cc
#CFLAGS += -Werror
LIBS += -ltermcap
CFLAGS=-g
LDFLAGS=-g
OBJS = blockio.o display.o editcor.o exec.o find.o \
unixcall.o globals.o insert.o main.o misc.o \
modify.o move.o ucsd.o undo.o wildargs.o \
version.o
MAN = lv.0
OBJS = blockio.o display.o editcor.o exec.o find.o \
unixcall.o globals.o insert.o main.o misc.o \
modify.o move.o ucsd.o undo.o wildargs.o \
version.o
all: lv ${MAN}
lev: $(OBJS)
$(CC) $(LDFLAGS) -o lev $(OBJS) -lcurses
lv: ${OBJS}
${CC} ${LDFLAGS} -o lv.elf ${OBJS} ${LIBS}
${OBJDUMP} -S lv.elf > lv.dis
${SIZE} lv.elf
${ELF2AOUT} lv.elf $@ && rm lv.elf
version.o: version.c VERSION
$(CC) $(CFLAGS) -c -DVERSION=\"`cat VERSION`\" version.c
$(CC) $(CFLAGS) -c -DVERSION=\"`cat VERSION`\" version.c
.SUFFIXES: .0 .1
.1.0:
${MANROFF} $*.1 > $@
clean:
rm -f *.o lev
rm -f *.o *.elf ${MAN} lv *.elf *.dis tags *~
distclean spotless: clean
rm -f Makefile config.cmd config.sub config.h config.mak config.log config.md
install: install.bin install.man
install.bin: lev
/home/sergev/Daily/workdir-2015-01-06/levee-3.5a/config.md $(PREFIX)$(exedir)
/usr/bin/install -s -m 755 lev $(PREFIX)$(exedir)/levee
/bin/ln -s -f levee $(PREFIX)$(exedir)/lv
install.man:
/home/sergev/Daily/workdir-2015-01-06/levee-3.5a/config.md $(PREFIX)$(mandir)/man1
/usr/bin/install -m 444 lv.1 $(PREFIX)$(mandir)/man1/levee.1
echo ".so man1/levee.1" > $(PREFIX)$(mandir)/man1/lv.1
install: all
install lv ${DESTDIR}/bin/
cp lv.0 ${DESTDIR}/share/man/cat1/
# Dependencies

View File

@@ -0,0 +1,56 @@
# makefile for Levee
exedir=/usr/local/bin
mandir=/usr/local/man
CC=cc
CFLAGS=-g
LDFLAGS=-g
OBJS = blockio.o display.o editcor.o exec.o find.o \
unixcall.o globals.o insert.o main.o misc.o \
modify.o move.o ucsd.o undo.o wildargs.o \
version.o
lev: $(OBJS)
$(CC) $(LDFLAGS) -o lev $(OBJS) -lcurses
version.o: version.c VERSION
$(CC) $(CFLAGS) -c -DVERSION=\"`cat VERSION`\" version.c
clean:
rm -f *.o lev
distclean spotless: clean
rm -f Makefile config.cmd config.sub config.h config.mak config.log config.md
install: install.bin install.man
install.bin: lev
/home/sergev/Daily/workdir-2015-01-06/levee-3.5a/config.md $(PREFIX)$(exedir)
/usr/bin/install -s -m 755 lev $(PREFIX)$(exedir)/levee
/bin/ln -s -f levee $(PREFIX)$(exedir)/lv
install.man:
/home/sergev/Daily/workdir-2015-01-06/levee-3.5a/config.md $(PREFIX)$(mandir)/man1
/usr/bin/install -m 444 lv.1 $(PREFIX)$(mandir)/man1/levee.1
echo ".so man1/levee.1" > $(PREFIX)$(mandir)/man1/lv.1
# Dependencies
blockio.o : levee.h extern.h blockio.c config.h
display.o : levee.h extern.h termcap.i display.c config.h
editcor.o : levee.h extern.h editcor.c config.h
exec.o : levee.h extern.h exec.c config.h
find.o : levee.h extern.h grep.h find.c config.h
globals.o : levee.h globals.c config.h
insert.o : levee.h extern.h insert.c config.h
main.o : levee.h extern.h main.c config.h
misc.o : levee.h extern.h misc.c config.h
modify.o : levee.h extern.h grep.h modify.c config.h
move.o : levee.h extern.h move.c config.h
rmxcall.o : levee.h rmxcall.c config.h
ucsd.o : levee.h extern.h ucsd.c config.h
undo.o : levee.h extern.h undo.c config.h
unixcall.o : levee.h extern.h unixcall.c config.h
wildargs.o : levee.h extern.h wildargs.c config.h

View File

@@ -5,25 +5,22 @@
#ifndef __AC_LEVEE_D
#define __AC_LEVEE_D 1
// Size of editor data buffer.
#define SIZE 16000
#define OS_LINUX 1
//#define SIZE 256000
#define OS_UNIX 1
#define HAVE_STRING_H 1
#define HAVE_MEMSET 1
#define HAVE_STRCHR 1
#define HAVE_BASENAME 1
#define HAVE_LIBGEN_H 1
#define HAVE_SIGNAL_H 1
#define HAVE_SIGNAL 1
#define HAVE_TGETENT 1
#define HAVE_TERMCAP_H 1
#define USE_TERMCAP 1
#define HAVE_MVCUR 1
#define mvcur __mvcur
#define HAVE_TERMIOS_H 1
#define HAVE_TCGETATTR 1
#define PATH_FIND "/usr/bin/find"
#define PATH_FIND "/bin/find"
#define PATH_SED "/bin/sed"
#endif/* __AC_LEVEE_D */

View File

@@ -216,7 +216,11 @@ tc_init()
#else
#include <stdlib.h>
#include <termcap.h>
#ifdef HAVE_TERMCAP_H
# include <termcap.h>
#else
# include <term.h>
#endif
#include <string.h>
#include <sys/ioctl.h>

View File

@@ -25,17 +25,15 @@
#ifdef OS_UNIX
#include "extern.h"
#include <termios.h>
#ifdef HAVE_TERMIOS_H
# include <termios.h>
#endif
#include <string.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/ioctl.h>
#if USE_TERMCAP
#include <termcap.h>
#endif
int
min(a,b)
int a, b;
@@ -53,13 +51,8 @@ int a, b;
void strput(s)
char *s;
{
#if USE_TERMCAP
if (s)
tputs(s, 1, putchar);
#else
if (s)
write(1, s, strlen(s));
#endif
}
#if !HAVE_BASENAME
@@ -76,6 +69,9 @@ char *s;
}
#endif
static int ioset = 0;
#ifdef HAVE_TERMIOS_H
#if !HAVE_TCGETATTR
#define tcgetattr(fd,t) ioctl(fd, TCGETS, t)
@@ -83,8 +79,6 @@ char *s;
#define TCSANOW TCSETAF
#endif
static int ioset = 0;
static struct termios old;
void
@@ -118,6 +112,65 @@ fixcon()
}
}
#else /* HAVE_TERMIOS_H */
static struct sgttyb old;
static struct tchars oldtchars;
static struct ltchars oldltchars;
void
initcon()
{
struct tchars new_tc;
struct ltchars new_ltc;
struct sgttyb new;
if (!ioset) {
ioctl(0, TIOCGETC, &oldtchars);
ioctl(0, TIOCGLTC, &oldltchars);
/* get editing keys */
Erasechar = 0177;
eraseline = 'U' & 037;
new_tc = oldtchars;
new_tc.t_eofc = -1; /* end-of-file */
new_tc.t_quitc = -1; /* quit */
new_tc.t_intrc = -1; /* interrupt */
new_ltc = oldltchars;
new_ltc.t_suspc = -1; /* stop process */
new_ltc.t_dsuspc = -1; /* delayed stop process */
new_ltc.t_rprntc = -1; /* reprint line */
new_ltc.t_flushc = -1; /* flush output */
new_ltc.t_werasc = -1; /* word erase */
new_ltc.t_lnextc = -1; /* literal next character */
ioctl(0, TIOCSETC, &new_tc);
ioctl(0, TIOCSLTC, &new_ltc);
ioctl(0, TIOCGETP, &old);
new = old;
new.sg_flags &= ~(ECHO | CRMOD | XTABS | RAW);
new.sg_flags |= CBREAK;
ioctl(0, TIOCSETP, &new);
ioset = 1;
}
}
void
fixcon()
{
if (ioset) {
ioctl(0, TIOCSETP, &old);
ioctl(0, TIOCSETC, &oldtchars);
ioctl(0, TIOCSLTC, &oldltchars);
ioset = 0;
}
}
#endif /* HAVE_TERMIOS_H */
int
getKey()
{