Update from the author, just onto the vendor-branch by now.
Submitted by: h_mahon@fc.hp.com (Hugh Mahon)
This commit is contained in:
@@ -0,0 +1,117 @@
|
||||
|
||||
|
||||
|
||||
|
||||
The "Artistic License"
|
||||
|
||||
Preamble
|
||||
|
||||
The intent of this document is to state the conditions under which a
|
||||
Package may be copied, such that the Copyright Holder maintains some
|
||||
semblance of artistic control over the development of the package,
|
||||
while giving the users of the package the right to use and distribute
|
||||
the Package in a more-or-less customary fashion, plus the right to make
|
||||
reasonable modifications.
|
||||
|
||||
Definitions:
|
||||
|
||||
"Package" refers to the collection of files distributed by the
|
||||
Copyright Holder, and derivatives of that collection of files
|
||||
created through textual modification.
|
||||
|
||||
"Standard Version" refers to such a Package if it has not been
|
||||
modified, or has been modified in accordance with the wishes
|
||||
of the Copyright Holder.
|
||||
|
||||
"Copyright Holder" is whoever is named in the copyright or
|
||||
copyrights for the package.
|
||||
|
||||
"You" is you, if you're thinking about copying or distributing
|
||||
this Package.
|
||||
|
||||
"Reasonable copying fee" is whatever you can justify on the
|
||||
basis of media cost, duplication charges, time of people involved,
|
||||
and so on. (You will not be required to justify it to the
|
||||
Copyright Holder, but only to the computing community at large
|
||||
as a market that must bear the fee.)
|
||||
|
||||
"Freely Available" means that no fee is charged for the item
|
||||
itself, though there may be fees involved in handling the item.
|
||||
It also means that recipients of the item may redistribute it
|
||||
under the same conditions they received it.
|
||||
|
||||
1. You may make and give away verbatim copies of the source form of the
|
||||
Standard Version of this Package without restriction, provided that you
|
||||
duplicate all of the original copyright notices and associated disclaimers.
|
||||
|
||||
2. You may apply bug fixes, portability fixes and other modifications
|
||||
derived from the Public Domain or from the Copyright Holder. A Package
|
||||
modified in such a way shall still be considered the Standard Version.
|
||||
|
||||
3. You may otherwise modify your copy of this Package in any way, provided
|
||||
that you insert a prominent notice in each changed file stating how and
|
||||
when you changed that file, and provided that you do at least ONE of the
|
||||
following:
|
||||
|
||||
a) place your modifications in the Public Domain or otherwise make them
|
||||
Freely Available, such as by posting said modifications to Usenet or
|
||||
an equivalent medium, or placing the modifications on a major archive
|
||||
site such as uunet.uu.net, or by allowing the Copyright Holder to include
|
||||
your modifications in the Standard Version of the Package.
|
||||
|
||||
b) use the modified Package only within your corporation or organization.
|
||||
|
||||
c) rename any non-standard executables so the names do not conflict
|
||||
with standard executables, which must also be provided, and provide
|
||||
a separate manual page for each non-standard executable that clearly
|
||||
documents how it differs from the Standard Version.
|
||||
|
||||
d) make other distribution arrangements with the Copyright Holder.
|
||||
|
||||
4. You may distribute the programs of this Package in object code or
|
||||
executable form, provided that you do at least ONE of the following:
|
||||
|
||||
a) distribute a Standard Version of the executables and library files,
|
||||
together with instructions (in the manual page or equivalent) on where
|
||||
to get the Standard Version.
|
||||
|
||||
b) accompany the distribution with the machine-readable source of
|
||||
the Package with your modifications.
|
||||
|
||||
c) accompany any non-standard executables with their corresponding
|
||||
Standard Version executables, giving the non-standard executables
|
||||
non-standard names, and clearly documenting the differences in manual
|
||||
pages (or equivalent), together with instructions on where to get
|
||||
the Standard Version.
|
||||
|
||||
d) make other distribution arrangements with the Copyright Holder.
|
||||
|
||||
5. You may charge a reasonable copying fee for any distribution of this
|
||||
Package. You may charge any fee you choose for support of this Package.
|
||||
You may not charge a fee for this Package itself. However,
|
||||
you may distribute this Package in aggregate with other (possibly
|
||||
commercial) programs as part of a larger (possibly commercial) software
|
||||
distribution provided that you do not advertise this Package as a
|
||||
product of your own.
|
||||
|
||||
6. The scripts and library files supplied as input to or produced as
|
||||
output from the programs of this Package do not automatically fall
|
||||
under the copyright of this Package, but belong to whomever generated
|
||||
them, and may be sold commercially, and may be aggregated with this
|
||||
Package.
|
||||
|
||||
7. C subroutines supplied by you and linked into this Package in order
|
||||
to emulate subroutines and variables of the language defined by this
|
||||
Package shall not be considered part of this Package, but are the
|
||||
equivalent of input as in Paragraph 6, provided these subroutines do
|
||||
not change the language in any way that would cause it to fail the
|
||||
regression tests for the language.
|
||||
|
||||
8. The name of the Copyright Holder may not be used to endorse or promote
|
||||
products derived from this software without specific prior written permission.
|
||||
|
||||
9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
The End
|
||||
+24
-17
@@ -1,22 +1,29 @@
|
||||
CFLAGS+= -DCAP -DHAS_NCURSES -DHAS_UNISTD -DHAS_STDARG -DHAS_STDLIB \
|
||||
-DHAS_CTYPE -DHAS_SYS_IOCTL -DHAS_SYS_WAIT -DSLCT_HDR
|
||||
# This is the make file for ee, the "easy editor".
|
||||
#
|
||||
# A file called 'make.local' will be generated which will contain information
|
||||
# specific to the local system, such as if it is a BSD or System V based
|
||||
# version of UNIX, whether or not it has catgets, or select.
|
||||
#
|
||||
# The "install" target ("make install") will copy the ee binary to
|
||||
# the /usr/local/bin directory on the local system. The man page (ee.1)
|
||||
# will be copied into the /usr/local/man/man1 directory.
|
||||
#
|
||||
# The "clean" target ("make clean") will remove the ee and new_curse.o
|
||||
# object files, and the ee binary.
|
||||
#
|
||||
|
||||
PROG= ee
|
||||
SRCS= ee.c
|
||||
LINKS= ${BINDIR}/ee ${BINDIR}/ree
|
||||
DPADD= ee.cat ${LIBNCURSES} ${LIBMYTINFO}
|
||||
LDADD= -lncurses -lmytinfo
|
||||
CLEANFILES+= ee.cat
|
||||
all : localmake buildee
|
||||
|
||||
# I'm not sure if this is kosher, but I don't see any system default just
|
||||
# now.
|
||||
LANG?= en_US.ISO_8859-1
|
||||
buildee :
|
||||
make -f make.local
|
||||
|
||||
ee.cat: ${.CURDIR}/ee.msg
|
||||
gencat -new ee.cat ${.CURDIR}/ee.msg
|
||||
localmake:
|
||||
@./create.make
|
||||
|
||||
afterinstall: ee.cat
|
||||
${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 ee.cat \
|
||||
${DESTDIR}/usr/share/nls/${LANG}/ee.cat
|
||||
install :
|
||||
cp ee /usr/local/bin/ee
|
||||
cp ee.1 /usr/local/man/man1/ee.1
|
||||
|
||||
clean :
|
||||
rm -f ee.o new_curse.o ee
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
THIS MATERIAL IS PROVIDED "AS IS". THERE ARE NO WARRANTIES OF
|
||||
ANY KIND WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS FOR A PARTICULAR PURPOSE. Neither Hewlett-Packard nor
|
||||
Hugh Mahon shall be liable for errors contained herein, nor for
|
||||
incidental or consequential damages in connection with the
|
||||
furnishing, performance or use of this material. Neither
|
||||
Hewlett-Packard nor Hugh Mahon assumes any responsibility for
|
||||
the use or reliability of this software or documentation. This
|
||||
software and documentation is totally UNSUPPORTED. There is no
|
||||
support contract available. Hewlett-Packard has done NO
|
||||
Quality Assurance on ANY of the program or documentation. You
|
||||
may find the quality of the materials inferior to supported
|
||||
materials.
|
||||
|
||||
This software may be distributed under the terms of Larry Wall's
|
||||
Artistic license, a copy of which is included in this distribution.
|
||||
|
||||
This notice must be included with this software and any
|
||||
derivatives.
|
||||
|
||||
Any modifications to this software by anyone but the original author
|
||||
must be so noted.
|
||||
|
||||
|
||||
The editor 'ee' (easy editor) is intended to be a simple, easy to use
|
||||
terminal-based screen oriented editor that requires no instruction to
|
||||
use. Its primary use would be for people who are new to computers, or who
|
||||
use computers only for things like e-mail.
|
||||
|
||||
ee's simplified interface is highlighted by the use of pop-up menus which
|
||||
make it possible for users to carry out tasks without the need to
|
||||
remember commands. An information window at the top of the screen shows
|
||||
the user the operations available with control-keys.
|
||||
|
||||
ee allows users to use full eight-bit characters. If the host system has
|
||||
the capabilities, ee can use message catalogs, which would allow users to
|
||||
translate the message catalog into other languages which use eight-bit
|
||||
characters. See the file ee.i18n.guide for more details.
|
||||
|
||||
ee relies on the virtual memory abilities of the platform it is running on
|
||||
and does not have its own memory management capabilities.
|
||||
|
||||
I am releasing ee because I hate to see new users and non-computer types
|
||||
get frustrated by vi, and would like to see more intuitive interfaces for
|
||||
basic tools (both character-based and graphical) become more pervasive.
|
||||
Terminal capabilities and communication speeds have evolved considerably
|
||||
since the time in which vi's interface was created, allowing much more
|
||||
intuitive interfaces to be used. Since character-based I/O won't be
|
||||
completely replaced by graphical user interfaces for at least a few more
|
||||
years, I'd like to do what I can to make using computers with less
|
||||
glamorous interfaces as easy to use as possible. If terminal interfaces
|
||||
are still used in ten years, I hope neophytes won't still be stuck with
|
||||
only vi.
|
||||
|
||||
For a text editor to be easy to use requires a certain set of abilities. In
|
||||
order for ee to work, a terminal must have the ability to position the cursor
|
||||
on the screen, and should have arrow keys that send unique sequences
|
||||
(multiple characters, the first character is an "escape", octal code
|
||||
'\033'). All of this information needs to be in a database called "terminfo"
|
||||
(System V implementations) or "termcap" (usually used for BSD systems). In
|
||||
case the arrow keys do not transmit unique sequences, motion operations are
|
||||
mapped to control keys as well, but this at least partially defeats the
|
||||
purpose. The curses package is used to handle the I/O which deals with the
|
||||
terminal's capabilities.
|
||||
|
||||
While ee is based on curses, I have included here the source code to
|
||||
new_curse, a subset of curses developed for use with ee. 'curses' often
|
||||
will have a defect that reduces the usefulness of the editor relying upon
|
||||
it.
|
||||
|
||||
The file new_curse.c contains a subset of 'curses', a package for
|
||||
applications to use to handle screen output. Unfortunately, curses
|
||||
varies from system to system, so I developed new_curse to provide
|
||||
consistent behavior across systems. It works on both SystemV and BSD
|
||||
systems, and while it can sometimes be slower than other curses packages,
|
||||
it will get the information on the screen painted correctly more often
|
||||
than vendor supplied curses. Unless problems occur during the building
|
||||
of ee, it is recommended that you use new_curse rather than the curses
|
||||
supplied with your system.
|
||||
|
||||
If you experience problems with data being displayed improperly, check
|
||||
your terminal configuration, especially if you're using a terminal
|
||||
emulator, and make sure that you are using the right terminfo entry
|
||||
before rummaging through code. Terminfo entries often contain
|
||||
inaccuracies, or incomplete information, or may not totally match the
|
||||
terminal or emulator the terminal information is being used with.
|
||||
Complaints that ee isn't working quite right often end up being something
|
||||
else (like the terminal emulator being used).
|
||||
|
||||
Both ee and new_curse were developed using K&R C (also known as "classic
|
||||
C"), but it can also be compiled with ANSI C. You should be able to
|
||||
build ee by simply typing "make". A make file which takes into account
|
||||
the characteristics of your system will be created, and then ee will be
|
||||
built. If there are problems encountered, you will be notified about
|
||||
them.
|
||||
|
||||
ee is the result of several conflicting design goals. While I know that it
|
||||
solves the problems of some users, I also have no doubt that some will decry
|
||||
its lack of more features. I will settle for knowing that ee does fulfill
|
||||
the needs of a minority (but still large number) of users. The goals of ee
|
||||
are:
|
||||
|
||||
1. To be so easy to use as to require no instruction.
|
||||
2. To be easy to compile and, if necessary, port to new platforms
|
||||
by people with relatively little knowledge of C and UNIX.
|
||||
3. To have a minimum number of files to be dealt with, for compile
|
||||
and installation.
|
||||
4. To have enough functionality to be useful to a large number of
|
||||
people.
|
||||
|
||||
Hugh Mahon |___|
|
||||
h_mahon@fc.hp.com | |
|
||||
|\ /|
|
||||
| \/ |
|
||||
|
||||
Executable
+267
@@ -0,0 +1,267 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# This script will determine if the system is a System V or BSD based
|
||||
# UNIX system and create a makefile for ee appropriate for the system.
|
||||
#
|
||||
# $Header: /home/hugh/sources/old_ae/RCS/create.make,v 1.6 1995/08/21 02:25:23 hugh Exp $
|
||||
#
|
||||
|
||||
# test for existence of termcap (exists on both BSD and SysV systems)
|
||||
|
||||
if [ -f /etc/termcap -o -f /usr/share/lib/termcap ]
|
||||
then
|
||||
termcap_exists="TRUE"
|
||||
else
|
||||
termcap_exists=""
|
||||
fi
|
||||
|
||||
# test for terminfo directory (exists on SysV systems)
|
||||
|
||||
if [ -d /usr/lib/terminfo -o -d /usr/share/lib/terminfo ]
|
||||
then
|
||||
terminfo_exists=""
|
||||
else
|
||||
terminfo_exists="-DCAP"
|
||||
fi
|
||||
|
||||
# test for existence of termio header (on SysV systems)
|
||||
|
||||
if [ -f /usr/include/termio.h ]
|
||||
then
|
||||
termio="-DSYS5"
|
||||
else
|
||||
termio=""
|
||||
fi
|
||||
|
||||
# test for sgtty header (on BSD systems)
|
||||
|
||||
if [ -f /usr/include/sgtty.h ]
|
||||
then
|
||||
sgtty="TRUE"
|
||||
else
|
||||
sgtty=""
|
||||
fi
|
||||
|
||||
# look for select call in headers, make sure headers exist
|
||||
|
||||
HEADER_FILES=""
|
||||
|
||||
if [ -f /usr/include/sys/time.h ]
|
||||
then
|
||||
HEADER_FILES="/usr/include/sys/time.h "
|
||||
fi
|
||||
|
||||
if [ -f /usr/include/sys/types.h ]
|
||||
then
|
||||
HEADER_FILES="$HEADER_FILES /usr/include/sys/types.h"
|
||||
fi
|
||||
|
||||
if [ -n "$HEADER_FILES" ]
|
||||
then
|
||||
string="`grep select $HEADER_FILES`"
|
||||
if [ -n "$string" ]
|
||||
then
|
||||
BSD_SELECT="-DBSD_SELECT"
|
||||
else
|
||||
BSD_SELECT=""
|
||||
fi
|
||||
fi
|
||||
|
||||
# check for existence of select.h (on AIX)
|
||||
|
||||
if [ -f /usr/include/sys/select.h ]
|
||||
then
|
||||
select_hdr="-DSLCT_HDR"
|
||||
else
|
||||
select_hdr=""
|
||||
fi
|
||||
|
||||
# check for stdlib.h
|
||||
|
||||
if [ -f /usr/include/stdlib.h ]
|
||||
then
|
||||
HAS_STDLIB=-DHAS_STDLIB
|
||||
else
|
||||
HAS_STDLIB=""
|
||||
fi
|
||||
|
||||
# check for stdarg.h
|
||||
|
||||
if [ -f /usr/include/stdarg.h ]
|
||||
then
|
||||
HAS_STDARG=-DHAS_STDARG
|
||||
else
|
||||
HAS_STDARG=""
|
||||
fi
|
||||
|
||||
# check for unistd.h
|
||||
|
||||
if [ -f /usr/include/unistd.h ]
|
||||
then
|
||||
HAS_UNISTD=-DHAS_UNISTD
|
||||
else
|
||||
HAS_UNISTD=""
|
||||
fi
|
||||
|
||||
# check for ctype.h
|
||||
|
||||
if [ -f /usr/include/ctype.h ]
|
||||
then
|
||||
HAS_CTYPE=-DHAS_CTYPE
|
||||
else
|
||||
HAS_CTYPE=""
|
||||
fi
|
||||
|
||||
# check for sys/ioctl.h
|
||||
|
||||
if [ -f /usr/include/sys/ioctl.h ]
|
||||
then
|
||||
HAS_SYS_IOCTL=-DHAS_SYS_IOCTL
|
||||
else
|
||||
HAS_SYS_IOCTL=""
|
||||
fi
|
||||
|
||||
# check for sys/wait.h
|
||||
|
||||
if [ -f /usr/include/sys/wait.h ]
|
||||
then
|
||||
HAS_SYS_WAIT=-DHAS_SYS_WAIT
|
||||
else
|
||||
HAS_SYS_WAIT=""
|
||||
fi
|
||||
|
||||
# check for localization headers
|
||||
|
||||
if [ -f /usr/include/locale.h -a -f /usr/include/nl_types.h ]
|
||||
then
|
||||
catgets=""
|
||||
else
|
||||
catgets="-DNO_CATGETS"
|
||||
fi
|
||||
|
||||
# make decisions about use of new_curse.c (use of new_curse is recommended
|
||||
# rather than local curses)
|
||||
|
||||
if [ -n "$terminfo_exists" -a -z "$termcap_exists" ]
|
||||
then
|
||||
echo "Neither terminfo or termcap are on this system! "
|
||||
if [ -f /usr/include/curses.h ]
|
||||
then
|
||||
echo "Relying on local curses implementation."
|
||||
else
|
||||
cat <<-EOF
|
||||
Don't know where to find curses, you'll need to modify
|
||||
source code to be able to build!
|
||||
|
||||
Modify the file make.default and build ee by typing:
|
||||
|
||||
make -f make.default
|
||||
|
||||
EOF
|
||||
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TARGET="curses"
|
||||
curses=""
|
||||
else
|
||||
curses="-DNCURSE"
|
||||
TARGET="ee"
|
||||
fi
|
||||
|
||||
if [ -z "$termio" -a -z "$sgtty" ]
|
||||
then
|
||||
echo "Neither termio.h or sgtty.h are on this system! "
|
||||
if [ -f /usr/include/curses.h ]
|
||||
then
|
||||
echo "Relying on local curses implementation."
|
||||
else
|
||||
cat <<-EOF
|
||||
Don't know where to find curses, you'll need to modify
|
||||
source code to be able to build!
|
||||
|
||||
Modify the file make.default and build ee by typing:
|
||||
|
||||
make -f make.default
|
||||
|
||||
EOF
|
||||
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TARGET="curses"
|
||||
curses=""
|
||||
fi
|
||||
|
||||
# check if this is a SunOS system
|
||||
|
||||
if [ -d /usr/5include ]
|
||||
then
|
||||
five_include="-I/usr/5include"
|
||||
else
|
||||
five_include=""
|
||||
fi
|
||||
|
||||
if [ -d /usr/5lib ]
|
||||
then
|
||||
five_lib="-L/usr/5lib"
|
||||
else
|
||||
five_lib=""
|
||||
fi
|
||||
|
||||
|
||||
if [ -n "$CFLAGS" ]
|
||||
then
|
||||
if [ -z "`echo $CFLAGS | grep '[-]g'`" ]
|
||||
then
|
||||
other_cflags="${CFLAGS} -s"
|
||||
else
|
||||
other_cflags="${CFLAGS}"
|
||||
fi
|
||||
else
|
||||
other_cflags="-s"
|
||||
fi
|
||||
|
||||
# time to write the makefile
|
||||
|
||||
echo "Generating make.local"
|
||||
|
||||
if [ -f make.local ]
|
||||
then
|
||||
mv make.local make.lcl.old
|
||||
fi
|
||||
|
||||
echo "DEFINES = $termio $terminfo_exists $BSD_SELECT $catgets $select $curses " > make.local
|
||||
echo "" >> make.local
|
||||
echo "CFLAGS = $HAS_UNISTD $HAS_STDARG $HAS_STDLIB $HAS_CTYPE $HAS_SYS_IOCTL $HAS_SYS_WAIT $five_lib $five_include $select_hdr $other_cflags" >> make.local
|
||||
echo "" >> make.local
|
||||
echo "" >> make.local
|
||||
echo "all : $TARGET" >> make.local
|
||||
|
||||
cat >> make.local << EOF
|
||||
|
||||
curses : ee.c
|
||||
cc ee.c -o ee \$(CFLAGS) -lcurses
|
||||
|
||||
ee : ee.o new_curse.o
|
||||
cc -o ee ee.o new_curse.o \$(CFLAGS)
|
||||
|
||||
ee.o : ee.c new_curse.h
|
||||
cc -c ee.c \$(DEFINES) \$(CFLAGS)
|
||||
|
||||
new_curse.o : new_curse.c new_curse.h
|
||||
cc new_curse.c -c \$(DEFINES) \$(CFLAGS)
|
||||
|
||||
EOF
|
||||
|
||||
if [ -f make.lcl.old ]
|
||||
then
|
||||
diffs="`cmp make.lcl.old make.local`"
|
||||
if [ -n "${diffs}" ]
|
||||
then
|
||||
rm -f ee.o new_curse.o ee
|
||||
fi
|
||||
rm -f make.lcl.old
|
||||
fi
|
||||
|
||||
+28
-7
@@ -4,7 +4,7 @@
|
||||
.\"
|
||||
.\" nroff -man ee.1
|
||||
.\"
|
||||
.\" $Header: /users/hugh/tmp/old_ae/ee.1,v 1.16 1993/06/22 04:18:33 hugh Exp $
|
||||
.\" $Header: /home/hugh/sources/old_ae/RCS/ee.1,v 1.19 1995/11/29 04:03:15 hugh Exp $
|
||||
.\"
|
||||
.\"
|
||||
.TH ee 1 "" "" "" ""
|
||||
@@ -143,7 +143,7 @@ menu, or via the initialization file (see below). The mappings are as follows:
|
||||
^t Move to the top of the text.
|
||||
^u Move to the bottom of the text.
|
||||
^v Move to the next page.
|
||||
^w Delete the word begining at the cursor position.
|
||||
^w Delete the word beginning at the cursor position.
|
||||
^y Prompt for the string to search for.
|
||||
^z Next word.
|
||||
^[ (ESC) Pop up menu.
|
||||
@@ -211,7 +211,7 @@ Read the named \fIfile\fR.
|
||||
Write the text to the named \fIfile\fR.
|
||||
.RE
|
||||
.\"
|
||||
.\" menu options
|
||||
.\" menu operations
|
||||
.\"
|
||||
.SS "Menu Operations"
|
||||
.PP
|
||||
@@ -231,6 +231,9 @@ for moving down to move to the desired items in the menu, then press
|
||||
.B return
|
||||
to perform the indicated task.
|
||||
.PP
|
||||
To the left of each menu item is a letter, which if the corresponding
|
||||
letter is pressed on the keyboard selects that menu entry.
|
||||
.PP
|
||||
The main menu in \fIee\fR is as follows:
|
||||
.RS 4
|
||||
.IP "\fBleave editor\fR"
|
||||
@@ -396,7 +399,7 @@ cursor location. The old information would have to be deleted by the user.
|
||||
.PP
|
||||
Since different users have different preferences, \fIee\fR allows some
|
||||
slight configurability. There are three possible locations for an
|
||||
initialization file for ee: the file \fI/usr/share/misc/init.ee\fR, the
|
||||
initialization file for ee: the file \fI/usr/local/lib/init.ee\fR, the
|
||||
file \fI.init.ee\fR in the user's home directory, or the file \fI.init.ee\fR
|
||||
in the current directory (if different from the home
|
||||
directory). This allows system administrators to set some preferences for
|
||||
@@ -404,7 +407,7 @@ the users on a system-wide basis (for example, the \fBprint\fR command),
|
||||
and the user to customize settings for particular directories (like one
|
||||
for correspondence, and a different directory for programming).
|
||||
.PP
|
||||
The file \fI\/usr/share/misc/init.ee\fR is read first, then
|
||||
The file \fI\/usr/local/lib/init.ee\fR is read first, then
|
||||
\fI$HOME/.init.ee\fR, then \fI.init.ee\fR, with the settings specified by the
|
||||
most recent file read taking precedence.
|
||||
.PP
|
||||
@@ -454,6 +457,24 @@ Turns on emacs key bindings.
|
||||
.IP \fBnoemacs\fR
|
||||
Turns off emacs key bindings.
|
||||
.RE
|
||||
.\"
|
||||
.\" save editor configuration
|
||||
.\"
|
||||
.SS "Save Editor Configuration"
|
||||
.PP
|
||||
When using this entry from the
|
||||
.B settings
|
||||
menu, the user may choose to save the current configuration of
|
||||
the editor (see \fBInitializing ee from a
|
||||
file\fR above) to a file named
|
||||
.I .init.ee
|
||||
in the current directory or the user's home directory. If a file named
|
||||
.I .init.ee
|
||||
already exists, it will be renamed
|
||||
.IR .init.ee.old .
|
||||
.\"
|
||||
.\" Caveats
|
||||
.\"
|
||||
.SH CAVEATS
|
||||
.PP
|
||||
THIS MATERIAL IS PROVIDED "AS IS". THERE ARE
|
||||
@@ -486,7 +507,7 @@ The automatic paragraph formatting operation
|
||||
may be too slow for slower systems.
|
||||
.SH FILES
|
||||
.PP
|
||||
.I /usr/share/misc/init.ee
|
||||
.I /usr/local/lib/init.ee
|
||||
.br
|
||||
.I $HOME/.init.ee
|
||||
.br
|
||||
@@ -501,7 +522,7 @@ This software and documentation contains
|
||||
proprietary information which is protected by
|
||||
copyright. All rights are reserved.
|
||||
.PP
|
||||
Copyright (c) 1990, 1991, 1992, 1993 Hugh Mahon.
|
||||
Copyright (c) 1990, 1991, 1992, 1993, 1995 Hugh Mahon.
|
||||
.SH "SEE ALSO"
|
||||
.PP
|
||||
termcap(4), terminfo(4), environ(5), spell(1), ispell(1), lp(1)
|
||||
|
||||
+443
-112
@@ -49,12 +49,12 @@
|
||||
| proprietary information which is protected by
|
||||
| copyright. All rights are reserved.
|
||||
|
|
||||
| $Header: /home/hugh/sources/old_ae/RCS/ee.c,v 1.78 1995/08/26 16:05:52 hugh Exp $
|
||||
| $Header: /home/hugh/sources/old_ae/RCS/ee.c,v 1.92 1996/05/07 02:48:19 hugh Exp hugh $
|
||||
|
|
||||
*/
|
||||
|
||||
char *ee_copyright_message =
|
||||
"Copyright (c) 1986, 1990, 1991, 1992, 1993, 1994, 1995 Hugh Mahon ";
|
||||
"Copyright (c) 1986, 1990, 1991, 1992, 1993, 1994, 1995, 1996 Hugh Mahon ";
|
||||
|
||||
char *ee_long_notice[] = {
|
||||
"This software and documentation contains",
|
||||
@@ -62,17 +62,13 @@ char *ee_long_notice[] = {
|
||||
"copyright. All rights are reserved."
|
||||
};
|
||||
|
||||
char *version = "@(#) ee, version 1.2.4 $Revision: 1.78 $";
|
||||
char *version = "@(#) ee, version 1.3 $Revision: 1.92 $";
|
||||
|
||||
#ifdef NCURSE
|
||||
#include "new_curse.h"
|
||||
#else
|
||||
#ifdef HAS_NCURSES
|
||||
#include <ncurses.h>
|
||||
#else
|
||||
#include <curses.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <signal.h>
|
||||
#include <fcntl.h>
|
||||
@@ -316,6 +312,7 @@ void sh_command P_((char *string));
|
||||
void set_up_term P_((void));
|
||||
void resize_check P_((void));
|
||||
int menu_op P_((struct menu_entries *));
|
||||
void paint_menu P_((struct menu_entries menu_list[], int max_width, int max_height, int list_size, int top_offset, WINDOW *menu_win, int off_start, int vert_size));
|
||||
void help P_((void));
|
||||
void paint_info_win P_((void));
|
||||
void no_info_window P_((void));
|
||||
@@ -327,6 +324,7 @@ void redraw P_((void));
|
||||
int Blank_Line P_((struct text *test_line));
|
||||
void Format P_((void));
|
||||
void ee_init P_((void));
|
||||
void dump_ee_conf P_((void));
|
||||
void echo_string P_((char *string));
|
||||
void spell_op P_((void));
|
||||
void ispell_op P_((void));
|
||||
@@ -354,13 +352,21 @@ struct menu_entries modes_menu[] = {
|
||||
{"", NULL, NULL, NULL, NULL, -1},
|
||||
{"", NULL, NULL, NULL, NULL, -1},
|
||||
{"", NULL, NULL, NULL, NULL, -1},
|
||||
{"", NULL, NULL, NULL, dump_ee_conf, -1},
|
||||
{NULL, NULL, NULL, NULL, NULL, -1}
|
||||
};
|
||||
|
||||
char *mode_strings[9];
|
||||
char *mode_strings[10];
|
||||
|
||||
#define NUM_MODES_ITEMS 9
|
||||
|
||||
struct menu_entries config_dump_menu[] = {
|
||||
{"", NULL, NULL, NULL, NULL, 0},
|
||||
{"", NULL, NULL, NULL, NULL, -1},
|
||||
{"", NULL, NULL, NULL, NULL, -1},
|
||||
{NULL, NULL, NULL, NULL, NULL, -1}
|
||||
};
|
||||
|
||||
struct menu_entries leave_menu[] = {
|
||||
{"", NULL, NULL, NULL, NULL, -1},
|
||||
{"", NULL, NULL, NULL, finish, -1},
|
||||
@@ -425,6 +431,10 @@ char *command_strings[5];
|
||||
char *commands[30];
|
||||
char *init_strings[20];
|
||||
|
||||
#define MENU_WARN 1
|
||||
|
||||
#define max_alpha_char 36
|
||||
|
||||
/*
|
||||
| Declarations for strings for localization
|
||||
*/
|
||||
@@ -510,6 +520,13 @@ char *EIGHTBIT;
|
||||
char *NOEIGHTBIT;
|
||||
char *EMACS_string;
|
||||
char *NOEMACS_string;
|
||||
char *conf_dump_err_msg;
|
||||
char *conf_dump_success_msg;
|
||||
char *conf_not_saved_msg;
|
||||
char *ree_no_file_msg;
|
||||
char *cancel_string;
|
||||
char *menu_too_lrg_msg;
|
||||
char *more_above_str, *more_below_str;
|
||||
|
||||
#ifndef __STDC__
|
||||
#ifndef HAS_STDLIB
|
||||
@@ -566,6 +583,14 @@ char *argv[];
|
||||
right_margin = COLS - 1;
|
||||
if (top_of_stack == NULL)
|
||||
{
|
||||
if (restrict_mode())
|
||||
{
|
||||
wmove(com_win, 0, 0);
|
||||
werase(com_win);
|
||||
wprintw(com_win, ree_no_file_msg);
|
||||
wrefresh(com_win);
|
||||
edit_abort(0);
|
||||
}
|
||||
wprintw(com_win, no_file_string);
|
||||
wrefresh(com_win);
|
||||
}
|
||||
@@ -890,13 +915,13 @@ int column;
|
||||
}
|
||||
else
|
||||
{
|
||||
waddch(window, character);
|
||||
waddch(window, (unsigned char)character );
|
||||
return(1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
waddch(window, character);
|
||||
waddch(window, (unsigned char)character);
|
||||
return(1);
|
||||
}
|
||||
for (i2 = 0; (string[i2] != (char) NULL) && (((column+i2+1)-horiz_offset) < last_col); i2++)
|
||||
@@ -1774,7 +1799,7 @@ int advance; /* if true, skip leading spaces and tabs */
|
||||
in = wgetch(com_win);
|
||||
if (in == -1)
|
||||
exit(0);
|
||||
if (((in == 8) || (in == 127)) && (g_pos > 0))
|
||||
if (((in == 8) || (in == 127) || (in == KEY_BACKSPACE)) && (g_pos > 0))
|
||||
{
|
||||
tmp_int = g_horz;
|
||||
g_pos--;
|
||||
@@ -1791,7 +1816,7 @@ int advance; /* if true, skip leading spaces and tabs */
|
||||
}
|
||||
nam_str--;
|
||||
}
|
||||
else if ((in != 8) && (in != 127) && (in != '\n') && (in != '\r'))
|
||||
else if ((in != 8) && (in != 127) && (in != '\n') && (in != '\r') && (in < 256))
|
||||
{
|
||||
if (in == '\026') /* control-v, accept next character verbatim */
|
||||
{ /* allows entry of ^m, ^j, and ^h */
|
||||
@@ -2077,11 +2102,8 @@ check_fp() /* open or close files according to flags */
|
||||
curr_line = tmp_line;
|
||||
point = curr_line->line;
|
||||
draw_screen();
|
||||
wmove(com_win, 0, 0);
|
||||
wclrtoeol(com_win);
|
||||
if (input_file)
|
||||
{
|
||||
wprintw(com_win, open_file_msg, in_file_name, line_num);
|
||||
input_file = FALSE;
|
||||
if (start_at_line != NULL)
|
||||
{
|
||||
@@ -2093,6 +2115,8 @@ check_fp() /* open or close files according to flags */
|
||||
}
|
||||
else
|
||||
{
|
||||
wmove(com_win, 0, 0);
|
||||
wclrtoeol(com_win);
|
||||
text_changes = TRUE;
|
||||
if ((tmp_file != NULL) && (*tmp_file != (char) NULL))
|
||||
wprintw(com_win, file_read_fin_msg, tmp_file);
|
||||
@@ -2110,6 +2134,7 @@ char *file_name;
|
||||
int length; /* length of line read by read */
|
||||
int append; /* should text be appended to current line */
|
||||
struct text *temp_line;
|
||||
char ro_flag = FALSE;
|
||||
|
||||
if (recv_file) /* if reading a file */
|
||||
{
|
||||
@@ -2119,7 +2144,10 @@ char *file_name;
|
||||
if (access(file_name, 2)) /* check permission to write */
|
||||
{
|
||||
if ((errno == ENOTDIR) || (errno == EACCES) || (errno == EROFS) || (errno == ETXTBSY) || (errno == EFAULT))
|
||||
{
|
||||
wprintw(com_win, read_only_msg);
|
||||
ro_flag = TRUE;
|
||||
}
|
||||
}
|
||||
wrefresh(com_win);
|
||||
}
|
||||
@@ -2153,6 +2181,8 @@ char *file_name;
|
||||
wmove(com_win, 0, 0);
|
||||
wclrtoeol(com_win);
|
||||
wprintw(com_win, file_read_lines_msg, in_file_name, curr_line->line_number);
|
||||
if (ro_flag)
|
||||
wprintw(com_win, read_only_msg);
|
||||
wrefresh(com_win);
|
||||
}
|
||||
else if (can_read) /* not input_file and file is non-zero size */
|
||||
@@ -3151,9 +3181,11 @@ resize_check()
|
||||
wrefresh(text_win);
|
||||
}
|
||||
|
||||
static char item_alpha[] = "abcdefghijklmnopqrstuvwxyz0123456789 ";
|
||||
|
||||
int
|
||||
menu_op(menu_list)
|
||||
struct menu_entries * menu_list;
|
||||
struct menu_entries menu_list[];
|
||||
{
|
||||
WINDOW *temp_win;
|
||||
int max_width, max_height;
|
||||
@@ -3161,10 +3193,13 @@ struct menu_entries * menu_list;
|
||||
int counter;
|
||||
int length;
|
||||
int input;
|
||||
int temp;
|
||||
int list_size;
|
||||
int top_offset;
|
||||
int temp_int;
|
||||
char *cancel_string = menu_cancel_msg;
|
||||
int top_offset; /* offset from top where menu items start */
|
||||
int vert_pos; /* vertical position */
|
||||
int vert_size; /* vertical size for menu list item display */
|
||||
int off_start = 1; /* offset from start of menu items to start display */
|
||||
|
||||
|
||||
/*
|
||||
| determine number and width of menu items
|
||||
@@ -3173,12 +3208,15 @@ struct menu_entries * menu_list;
|
||||
list_size = 1;
|
||||
while (menu_list[list_size + 1].item_string != NULL)
|
||||
list_size++;
|
||||
max_width = strlen(cancel_string);
|
||||
max_width = 0;
|
||||
for (counter = 0; counter <= list_size; counter++)
|
||||
{
|
||||
if ((length = strlen(menu_list[counter].item_string)) > max_width)
|
||||
max_width = length;
|
||||
}
|
||||
max_width += 3;
|
||||
max_width = max(max_width, strlen(cancel_string));
|
||||
max_width = max(max_width, max(strlen(more_above_str), strlen(more_below_str)));
|
||||
max_width += 6;
|
||||
|
||||
/*
|
||||
@@ -3186,114 +3224,157 @@ struct menu_entries * menu_list;
|
||||
| if not, print error message and return to calling function
|
||||
*/
|
||||
|
||||
if ((LINES < list_size) || (max_width > COLS))
|
||||
if (max_width > COLS)
|
||||
{
|
||||
wmove(com_win, 0, 0);
|
||||
werase(com_win);
|
||||
wprintw(com_win, menu_size_err_msg);
|
||||
wprintw(com_win, menu_too_lrg_msg);
|
||||
wrefresh(com_win);
|
||||
clear_com_win = TRUE;
|
||||
return(0);
|
||||
}
|
||||
|
||||
top_offset = 0;
|
||||
max_height = list_size;
|
||||
|
||||
if (LINES >= (list_size + 8))
|
||||
if (list_size > LINES)
|
||||
{
|
||||
max_height = list_size + 8;
|
||||
max_height = LINES;
|
||||
if (max_height > 11)
|
||||
vert_size = max_height - 8;
|
||||
else
|
||||
vert_size = max_height;
|
||||
}
|
||||
else
|
||||
{
|
||||
vert_size = list_size;
|
||||
max_height = list_size;
|
||||
}
|
||||
|
||||
if (LINES >= (vert_size + 8))
|
||||
{
|
||||
if (menu_list[0].argument != MENU_WARN)
|
||||
max_height = vert_size + 8;
|
||||
else
|
||||
max_height = vert_size + 7;
|
||||
top_offset = 4;
|
||||
}
|
||||
x_off = (COLS - max_width) / 2;
|
||||
y_off = (LINES - max_height - 1) / 2;
|
||||
temp_win = newwin(max_height, max_width, y_off, x_off);
|
||||
keypad(temp_win, TRUE);
|
||||
werase(temp_win);
|
||||
|
||||
/*
|
||||
| output top and bottom portions of menu box only if window
|
||||
| large enough
|
||||
*/
|
||||
paint_menu(menu_list, max_width, max_height, list_size, top_offset, temp_win, off_start, vert_size);
|
||||
|
||||
if (max_height > list_size)
|
||||
{
|
||||
wmove(temp_win, 1, 1);
|
||||
if (!nohighlight)
|
||||
wstandout(temp_win);
|
||||
waddch(temp_win, '+');
|
||||
for (counter = 0; counter < (max_width - 4); counter++)
|
||||
waddch(temp_win, '-');
|
||||
waddch(temp_win, '+');
|
||||
|
||||
wmove(temp_win, (max_height - 2), 1);
|
||||
waddch(temp_win, '+');
|
||||
for (counter = 0; counter < (max_width - 4); counter++)
|
||||
waddch(temp_win, '-');
|
||||
waddch(temp_win, '+');
|
||||
wstandend(temp_win);
|
||||
wmove(temp_win, 2, 3);
|
||||
waddstr(temp_win, menu_list[0].item_string);
|
||||
wmove(temp_win, (max_height - 3), 3);
|
||||
waddstr(temp_win, cancel_string);
|
||||
}
|
||||
if (!nohighlight)
|
||||
wstandout(temp_win);
|
||||
for (counter = 0; counter < (list_size + top_offset); counter++)
|
||||
{
|
||||
if (top_offset == 4)
|
||||
{
|
||||
temp_int = counter + 2;
|
||||
}
|
||||
else
|
||||
temp_int = counter;
|
||||
|
||||
wmove(temp_win, temp_int, 1);
|
||||
waddch(temp_win, '|');
|
||||
wmove(temp_win, temp_int, (max_width - 2));
|
||||
waddch(temp_win, '|');
|
||||
}
|
||||
wstandend(temp_win);
|
||||
for (counter = 1; counter <= list_size; counter++)
|
||||
{
|
||||
wmove(temp_win, (top_offset + counter - 1), 3);
|
||||
waddstr(temp_win, menu_list[counter].item_string);
|
||||
}
|
||||
counter = 1;
|
||||
vert_pos = 0;
|
||||
do
|
||||
{
|
||||
wmove(temp_win, (counter + top_offset - 1), 3);
|
||||
if (off_start > 2)
|
||||
wmove(temp_win, (1 + counter + top_offset - off_start), 3);
|
||||
else
|
||||
wmove(temp_win, (counter + top_offset - off_start), 3);
|
||||
|
||||
wrefresh(temp_win);
|
||||
input = wgetch(temp_win);
|
||||
in = wgetch(temp_win);
|
||||
input = in;
|
||||
if (input == -1)
|
||||
exit(0);
|
||||
switch (input)
|
||||
|
||||
if (((tolower(input) >= 'a') && (tolower(input) <= 'z')) ||
|
||||
((input >= '0') && (input <= '9')))
|
||||
{
|
||||
case ' ': /* space */
|
||||
case '\022': /* ^r, right */
|
||||
case '\004': /* ^d, down */
|
||||
case KEY_RIGHT:
|
||||
case KEY_DOWN:
|
||||
counter++;
|
||||
if (counter > list_size)
|
||||
counter = 1;
|
||||
break;
|
||||
case '\010': /* ^h, backspace*/
|
||||
case '\014': /* ^l, left */
|
||||
case '\025': /* ^u, up */
|
||||
case 127: /* ^?, delete */
|
||||
case KEY_LEFT:
|
||||
case KEY_UP:
|
||||
counter--;
|
||||
if (counter == 0)
|
||||
counter = list_size;
|
||||
break;
|
||||
case '\033': /* escape key */
|
||||
counter = 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
if ((tolower(input) >= 'a') && (tolower(input) <= 'z'))
|
||||
{
|
||||
temp = 1 + tolower(input) - 'a';
|
||||
}
|
||||
else if ((input >= '0') && (input <= '9'))
|
||||
{
|
||||
temp = (2 + 'z' - 'a') + (input - '0');
|
||||
}
|
||||
|
||||
if (temp <= list_size)
|
||||
{
|
||||
input = '\n';
|
||||
counter = temp;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (input)
|
||||
{
|
||||
case ' ': /* space */
|
||||
case '\004': /* ^d, down */
|
||||
case KEY_RIGHT:
|
||||
case KEY_DOWN:
|
||||
counter++;
|
||||
if (counter > list_size)
|
||||
counter = 1;
|
||||
break;
|
||||
case '\010': /* ^h, backspace*/
|
||||
case '\025': /* ^u, up */
|
||||
case 127: /* ^?, delete */
|
||||
case KEY_BACKSPACE:
|
||||
case KEY_LEFT:
|
||||
case KEY_UP:
|
||||
counter--;
|
||||
if (counter == 0)
|
||||
counter = list_size;
|
||||
break;
|
||||
case '\033': /* escape key */
|
||||
if (menu_list[0].argument != MENU_WARN)
|
||||
counter = 0;
|
||||
break;
|
||||
case '\014': /* ^l */
|
||||
case '\022': /* ^r, redraw */
|
||||
paint_menu(menu_list, max_width, max_height,
|
||||
list_size, top_offset, temp_win,
|
||||
off_start, vert_size);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (((list_size - off_start) >= (vert_size - 1)) &&
|
||||
(counter > (off_start + vert_size - 3)) &&
|
||||
(off_start > 1))
|
||||
{
|
||||
if (counter == list_size)
|
||||
off_start = (list_size - vert_size) + 2;
|
||||
else
|
||||
off_start++;
|
||||
|
||||
paint_menu(menu_list, max_width, max_height,
|
||||
list_size, top_offset, temp_win, off_start,
|
||||
vert_size);
|
||||
}
|
||||
else if ((list_size != vert_size) &&
|
||||
(counter > (off_start + vert_size - 2)))
|
||||
{
|
||||
if (counter == list_size)
|
||||
off_start = 2 + (list_size - vert_size);
|
||||
else if (off_start == 1)
|
||||
off_start = 3;
|
||||
else
|
||||
off_start++;
|
||||
|
||||
paint_menu(menu_list, max_width, max_height,
|
||||
list_size, top_offset, temp_win, off_start,
|
||||
vert_size);
|
||||
}
|
||||
else if (counter < off_start)
|
||||
{
|
||||
if (counter <= 2)
|
||||
off_start = 1;
|
||||
else
|
||||
off_start = counter;
|
||||
|
||||
paint_menu(menu_list, max_width, max_height,
|
||||
list_size, top_offset, temp_win, off_start,
|
||||
vert_size);
|
||||
}
|
||||
}
|
||||
while ((input != '\r') && (input != '\n') && (input != '\033'));
|
||||
while ((input != '\r') && (input != '\n') && (counter != 0));
|
||||
|
||||
werase(temp_win);
|
||||
wrefresh(temp_win);
|
||||
@@ -3313,11 +3394,114 @@ struct menu_entries * menu_list;
|
||||
|
||||
if (info_window)
|
||||
paint_info_win();
|
||||
midscreen(scr_vert, point);
|
||||
redraw();
|
||||
|
||||
return(counter);
|
||||
}
|
||||
|
||||
void
|
||||
paint_menu(menu_list, max_width, max_height, list_size, top_offset, menu_win,
|
||||
off_start, vert_size)
|
||||
struct menu_entries menu_list[];
|
||||
int max_width, max_height, list_size, top_offset;
|
||||
WINDOW *menu_win;
|
||||
int off_start, vert_size;
|
||||
{
|
||||
int counter, temp_int;
|
||||
|
||||
werase(menu_win);
|
||||
|
||||
/*
|
||||
| output top and bottom portions of menu box only if window
|
||||
| large enough
|
||||
*/
|
||||
|
||||
if (max_height > vert_size)
|
||||
{
|
||||
wmove(menu_win, 1, 1);
|
||||
if (!nohighlight)
|
||||
wstandout(menu_win);
|
||||
waddch(menu_win, '+');
|
||||
for (counter = 0; counter < (max_width - 4); counter++)
|
||||
waddch(menu_win, '-');
|
||||
waddch(menu_win, '+');
|
||||
|
||||
wmove(menu_win, (max_height - 2), 1);
|
||||
waddch(menu_win, '+');
|
||||
for (counter = 0; counter < (max_width - 4); counter++)
|
||||
waddch(menu_win, '-');
|
||||
waddch(menu_win, '+');
|
||||
wstandend(menu_win);
|
||||
wmove(menu_win, 2, 3);
|
||||
waddstr(menu_win, menu_list[0].item_string);
|
||||
wmove(menu_win, (max_height - 3), 3);
|
||||
if (menu_list[0].argument != MENU_WARN)
|
||||
waddstr(menu_win, cancel_string);
|
||||
}
|
||||
if (!nohighlight)
|
||||
wstandout(menu_win);
|
||||
|
||||
for (counter = 0; counter < (vert_size + top_offset); counter++)
|
||||
{
|
||||
if (top_offset == 4)
|
||||
{
|
||||
temp_int = counter + 2;
|
||||
}
|
||||
else
|
||||
temp_int = counter;
|
||||
|
||||
wmove(menu_win, temp_int, 1);
|
||||
waddch(menu_win, '|');
|
||||
wmove(menu_win, temp_int, (max_width - 2));
|
||||
waddch(menu_win, '|');
|
||||
}
|
||||
wstandend(menu_win);
|
||||
|
||||
if (list_size > vert_size)
|
||||
{
|
||||
if (off_start >= 3)
|
||||
{
|
||||
temp_int = 1;
|
||||
wmove(menu_win, top_offset, 3);
|
||||
waddstr(menu_win, more_above_str);
|
||||
}
|
||||
else
|
||||
temp_int = 0;
|
||||
|
||||
for (counter = off_start;
|
||||
((temp_int + counter - off_start) < (vert_size - 1));
|
||||
counter++)
|
||||
{
|
||||
wmove(menu_win, (top_offset + temp_int +
|
||||
(counter - off_start)), 3);
|
||||
if (list_size > 1)
|
||||
wprintw(menu_win, "%c) ", item_alpha[min((counter - 1), max_alpha_char)]);
|
||||
waddstr(menu_win, menu_list[counter].item_string);
|
||||
}
|
||||
|
||||
wmove(menu_win, (top_offset + (vert_size - 1)), 3);
|
||||
|
||||
if (counter == list_size)
|
||||
{
|
||||
if (list_size > 1)
|
||||
wprintw(menu_win, "%c) ", item_alpha[min((counter - 1), max_alpha_char)]);
|
||||
wprintw(menu_win, menu_list[counter].item_string);
|
||||
}
|
||||
else
|
||||
wprintw(menu_win, more_below_str);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (counter = 1; counter <= list_size; counter++)
|
||||
{
|
||||
wmove(menu_win, (top_offset + counter - 1), 3);
|
||||
if (list_size > 1)
|
||||
wprintw(menu_win, "%c) ", item_alpha[min((counter - 1), max_alpha_char)]);
|
||||
waddstr(menu_win, menu_list[counter].item_string);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
help()
|
||||
{
|
||||
@@ -3780,7 +3964,7 @@ Format() /* format the paragraph according to set margins */
|
||||
}
|
||||
|
||||
char *init_name[3] = {
|
||||
"/usr/share/misc/init.ee",
|
||||
"/usr/local/lib/init.ee",
|
||||
NULL,
|
||||
".init.ee"
|
||||
};
|
||||
@@ -3810,12 +3994,14 @@ ee_init() /* check for init file and read it if it exists */
|
||||
init_file = fopen(init_name[counter], "r");
|
||||
while ((str2 = fgets(string, 512, init_file)) != NULL)
|
||||
{
|
||||
if (unique_test(string, init_strings) != 1)
|
||||
continue;
|
||||
str1 = str2 = string;
|
||||
while (*str2 != '\n')
|
||||
str2++;
|
||||
*str2 = (char) NULL;
|
||||
|
||||
if (unique_test(string, init_strings) != 1)
|
||||
continue;
|
||||
|
||||
if (compare(str1, CASE, FALSE))
|
||||
case_sen = TRUE;
|
||||
else if (compare(str1, NOCASE, FALSE))
|
||||
@@ -3881,6 +4067,109 @@ ee_init() /* check for init file and read it if it exists */
|
||||
free(home);
|
||||
}
|
||||
|
||||
/*
|
||||
| Save current configuration to .init.ee file in the current directory.
|
||||
*/
|
||||
|
||||
void
|
||||
dump_ee_conf()
|
||||
{
|
||||
FILE *init_file;
|
||||
FILE *old_init_file = NULL;
|
||||
char *file_name = ".init.ee";
|
||||
char *home_dir = "~/.init.ee";
|
||||
char buffer[512];
|
||||
struct stat buf;
|
||||
char *string;
|
||||
int length;
|
||||
int option = 0;
|
||||
|
||||
if (restrict_mode())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
option = menu_op(config_dump_menu);
|
||||
|
||||
werase(com_win);
|
||||
wmove(com_win, 0, 0);
|
||||
|
||||
if (option == 0)
|
||||
{
|
||||
wprintw(com_win, conf_not_saved_msg);
|
||||
wrefresh(com_win);
|
||||
return;
|
||||
}
|
||||
else if (option == 2)
|
||||
file_name = resolve_name(home_dir);
|
||||
|
||||
/*
|
||||
| If a .init.ee file exists, move it to .init.ee.old.
|
||||
*/
|
||||
|
||||
if (stat(file_name, &buf) != -1)
|
||||
{
|
||||
sprintf(buffer, "%s.old", file_name);
|
||||
unlink(buffer);
|
||||
link(file_name, buffer);
|
||||
unlink(file_name);
|
||||
old_init_file = fopen(buffer, "r");
|
||||
}
|
||||
|
||||
init_file = fopen(file_name, "w");
|
||||
if (init_file == NULL)
|
||||
{
|
||||
wprintw(com_win, conf_dump_err_msg);
|
||||
wrefresh(com_win);
|
||||
return;
|
||||
}
|
||||
|
||||
if (old_init_file != NULL)
|
||||
{
|
||||
/*
|
||||
| Copy non-configuration info into new .init.ee file.
|
||||
*/
|
||||
while ((string = fgets(buffer, 512, old_init_file)) != NULL)
|
||||
{
|
||||
length = strlen(string);
|
||||
string[length - 1] = (char) NULL;
|
||||
|
||||
if (unique_test(string, init_strings) == 1)
|
||||
{
|
||||
if (compare(string, Echo, FALSE))
|
||||
{
|
||||
fprintf(init_file, "%s\n", string);
|
||||
}
|
||||
}
|
||||
else
|
||||
fprintf(init_file, "%s\n", string);
|
||||
}
|
||||
|
||||
fclose(old_init_file);
|
||||
}
|
||||
|
||||
fprintf(init_file, "%s\n", case_sen ? CASE : NOCASE);
|
||||
fprintf(init_file, "%s\n", expand_tabs ? EXPAND : NOEXPAND);
|
||||
fprintf(init_file, "%s\n", info_window ? INFO : NOINFO );
|
||||
fprintf(init_file, "%s\n", observ_margins ? MARGINS : NOMARGINS );
|
||||
fprintf(init_file, "%s\n", auto_format ? AUTOFORMAT : NOAUTOFORMAT );
|
||||
fprintf(init_file, "%s %s\n", PRINTCOMMAND, print_command);
|
||||
fprintf(init_file, "%s %d\n", RIGHTMARGIN, right_margin);
|
||||
fprintf(init_file, "%s\n", nohighlight ? NOHIGHLIGHT : HIGHLIGHT );
|
||||
fprintf(init_file, "%s\n", eightbit ? EIGHTBIT : NOEIGHTBIT );
|
||||
fprintf(init_file, "%s\n", emacs_keys_mode ? EMACS_string : NOEMACS_string );
|
||||
|
||||
fclose(init_file);
|
||||
|
||||
wprintw(com_win, conf_dump_success_msg, file_name);
|
||||
wrefresh(com_win);
|
||||
|
||||
if ((option == 2) && (file_name != home_dir))
|
||||
{
|
||||
free(file_name);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
echo_string(string) /* echo the given string */
|
||||
char *string;
|
||||
@@ -3985,8 +4274,11 @@ struct text *test_line;
|
||||
int counter;
|
||||
char *pnt;
|
||||
|
||||
if (test_line == NULL)
|
||||
return(0);
|
||||
|
||||
pnt = test_line->line;
|
||||
if ((test_line == NULL) || (pnt == NULL) || (*pnt == (char) NULL) ||
|
||||
if ((pnt == NULL) || (*pnt == (char) NULL) ||
|
||||
(*pnt == '.') || (*pnt == '>'))
|
||||
return(0);
|
||||
|
||||
@@ -4024,6 +4316,7 @@ Auto_Format() /* format the paragraph according to set margins */
|
||||
int leave_loop = FALSE;
|
||||
int status;
|
||||
int counter;
|
||||
char not_blank;
|
||||
char *line;
|
||||
char *tmp_srchstr;
|
||||
char *temp1, *temp2;
|
||||
@@ -4100,6 +4393,8 @@ Auto_Format() /* format the paragraph according to set margins */
|
||||
| will fit in before the margin.
|
||||
*/
|
||||
|
||||
counter = 0;
|
||||
|
||||
while (!leave_loop)
|
||||
{
|
||||
if (position != curr_line->line_length)
|
||||
@@ -4113,6 +4408,8 @@ Auto_Format() /* format the paragraph according to set margins */
|
||||
else
|
||||
right(TRUE);
|
||||
|
||||
not_blank = FALSE;
|
||||
|
||||
/*
|
||||
| fill line if first word on next line will fit
|
||||
| in the line without crossing the margin
|
||||
@@ -4128,10 +4425,27 @@ Auto_Format() /* format the paragraph according to set margins */
|
||||
del_word();
|
||||
if (position != 1)
|
||||
bol();
|
||||
if (Blank_Line(curr_line))
|
||||
|
||||
/*
|
||||
| We know this line was not blank before, so
|
||||
| make sure that it doesn't have one of the
|
||||
| leading characters that indicate the line
|
||||
| should not be modified.
|
||||
|
|
||||
| We also know that this character should not
|
||||
| be left as the first character of this line.
|
||||
*/
|
||||
|
||||
if ((Blank_Line(curr_line)) &&
|
||||
(curr_line->line[0] != '.') &&
|
||||
(curr_line->line[0] != '>'))
|
||||
{
|
||||
del_line();
|
||||
not_blank = FALSE;
|
||||
}
|
||||
else
|
||||
not_blank = TRUE;
|
||||
|
||||
/*
|
||||
| go to end of previous line
|
||||
*/
|
||||
@@ -4168,14 +4482,18 @@ Auto_Format() /* format the paragraph according to set margins */
|
||||
if ((*point == ' ') || (*point == '\t'))
|
||||
adv_word();
|
||||
undel_word();
|
||||
not_blank = TRUE;
|
||||
if (position != 1)
|
||||
bol();
|
||||
left(TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
if (!Blank_Line(curr_line->next_line))
|
||||
if ((!Blank_Line(curr_line->next_line)) || (not_blank))
|
||||
{
|
||||
adv_line();
|
||||
counter++;
|
||||
}
|
||||
else
|
||||
leave_loop = TRUE;
|
||||
}
|
||||
@@ -4184,8 +4502,9 @@ Auto_Format() /* format the paragraph according to set margins */
|
||||
| go back to begin of paragraph, put cursor back to original position
|
||||
*/
|
||||
|
||||
bol();
|
||||
while (!Blank_Line(curr_line->prev_line))
|
||||
if (position != 1)
|
||||
bol();
|
||||
while ((counter-- > 0) || (!Blank_Line(curr_line->prev_line)))
|
||||
bol();
|
||||
|
||||
/*
|
||||
@@ -4316,8 +4635,8 @@ modes_op()
|
||||
}
|
||||
|
||||
char *
|
||||
is_in_string(string, substring) /* a strstr() look-alike for systems without
|
||||
strstr() */
|
||||
is_in_string(string, substring) /* a strchr() look-alike for systems without
|
||||
strchr() */
|
||||
char * string, *substring;
|
||||
{
|
||||
char *full, *sub;
|
||||
@@ -4725,6 +5044,18 @@ strings_init()
|
||||
EMACS_string = catgetlocal( 159, "EMACS");
|
||||
NOEMACS_string = catgetlocal( 160, "NOEMACS");
|
||||
usage4 = catgetlocal( 161, " +# put cursor at line #\n");
|
||||
conf_dump_err_msg = catgetlocal( 162, "unable to open .init.ee for writing, no configuration saved!");
|
||||
conf_dump_success_msg = catgetlocal( 163, "ee configuration saved in file %s");
|
||||
modes_menu[9].item_string = catgetlocal( 164, "save editor configuration");
|
||||
config_dump_menu[0].item_string = catgetlocal( 165, "save ee configuration");
|
||||
config_dump_menu[1].item_string = catgetlocal( 166, "save in current directory");
|
||||
config_dump_menu[2].item_string = catgetlocal( 167, "save in home directory");
|
||||
conf_not_saved_msg = catgetlocal( 168, "ee configuration not saved");
|
||||
ree_no_file_msg = catgetlocal( 169, "must specify a file when invoking ree");
|
||||
cancel_string = catgetlocal( 170, "press Esc to cancel");
|
||||
menu_too_lrg_msg = catgetlocal( 180, "menu too large for window");
|
||||
more_above_str = catgetlocal( 181, "^^more^^");
|
||||
more_below_str = catgetlocal( 182, "VVmoreVV");
|
||||
|
||||
commands[0] = HELP;
|
||||
commands[1] = WRITE;
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
Easy Editor ("ee") provides the ability to translate the messages displayed to
|
||||
the user and the commands entered. This is done via message catalogs,
|
||||
following X/Open standards. ee only supports eight bit characters.
|
||||
|
||||
(The name ee.i18n.guide is for "ee internationalization guide". The i18n
|
||||
abbreviation is used because there are 18 characters between the first
|
||||
letter ("i") and last ("n") of "internationalization".)
|
||||
|
||||
All of the messages, warnings, information, and commands, are contained in the
|
||||
message catalog. Each numbered entry represents an individual string used by
|
||||
ee. Some strings contain formatting information for formatted print
|
||||
statements, which are of the form "%s", or "%d", these must be preserved in
|
||||
the translation, or the correct information will not be displayed. For those
|
||||
strings containing multiple formatting codes, the order of each item must be
|
||||
preserved as well.
|
||||
|
||||
Message content
|
||||
1 title for modes, or settings menu
|
||||
2 - 8 entries for modes menu, each line should be the same length
|
||||
(padded with spaces)
|
||||
9 - 34 other menu titles and entries
|
||||
35 - 56 help screen
|
||||
57 - 61 actions assigned to control keys
|
||||
62 - 66 commands information
|
||||
67 message displayed when info window turned off
|
||||
68 indication that no file name was entered when invoking ee
|
||||
69 prompt for decimal value of character to be entered
|
||||
70 message displaying the print command being invoked
|
||||
71 prompt for command
|
||||
72 prompt for name of file to be written
|
||||
73 prompt for name of file to be read
|
||||
74 string used to display the decimal value of the character
|
||||
the cursor is on
|
||||
75 string displaying an unrecognized command
|
||||
76 string indicating that the command entered is not a unique
|
||||
substring of a valid command
|
||||
77 string indicating the current line number
|
||||
78 string for displaying the length of the line
|
||||
79 string for displaying the name of the file
|
||||
80 - 83 strings showing how to invoke ee, and its options
|
||||
84 message indicating that the file entered is a directory, not a
|
||||
text file
|
||||
85 message informing that the entered file does not yet exist
|
||||
86 message informing that the file can't be opened (because of
|
||||
permission problems)
|
||||
87 message after file has been read with the file name and number
|
||||
of lines read
|
||||
88 message indicating that the file has been read
|
||||
89 message indicating that the file is being read
|
||||
90 message indicating that permissions only allow the file to be
|
||||
read, not written
|
||||
91 message after file has been read with the file name and number
|
||||
of lines read
|
||||
92 prompt for name of file to be saved (used when no name was
|
||||
entered for a file to edit)
|
||||
93 message indicating that the file was not written, since no
|
||||
name was entered at the prompt
|
||||
94 prompt asking user if changes should not be saved ("yes_char"
|
||||
will be expected for affirmative response)
|
||||
95 "yes" character, single character expected to confirm action
|
||||
(can be upper or lower case, will be converted to upper-case
|
||||
during test)
|
||||
96 prompt
|
||||
97 error message
|
||||
98 message indicating that the named file is being written
|
||||
99 message indicating the name of the file written, the number of
|
||||
lines, and the number of characters (order of items must be
|
||||
maintained)
|
||||
100 search in progress message
|
||||
101 message that the string was not found
|
||||
102 prompt for search
|
||||
103 message that string could not be executed
|
||||
104 self-explanatory
|
||||
105 message for menus, indicating that the Escape character will
|
||||
allow the user to exit the menu
|
||||
106 error message indicating the menu won't fit on the screen
|
||||
107 self-explanatory
|
||||
108 prompt for shell command
|
||||
109 message displayed while formatting a paragraph
|
||||
110 string which places message for spell checking at top of
|
||||
buffer (the portions 'list of unrecognized words' and
|
||||
'-=-=-=-=-=-' may be replaced, but the rest must remain the
|
||||
same)
|
||||
111 message informing that spell checking is in progress
|
||||
112 prompt for right margin
|
||||
113 error informing user that operation is not permitted in ree
|
||||
114 string indicating mode is turned 'on' in modes menu
|
||||
115 string indicating mode is turned 'off' in modes menu
|
||||
116 - 131 strings used for commands (some also used for initialization)
|
||||
132 - 144 strings used for initialization
|
||||
145 entry for settings menu for emacs key bindings settings
|
||||
146 - 153 help screen entries for emacs key bindings info
|
||||
154 - 158 info window entries for emacs key bindings info
|
||||
159 string for turning on emacs key bindings in the init file
|
||||
160 string for turning off emacs key bindings in the init file
|
||||
|
||||
Care should be taken when translating commands and initialization keywords
|
||||
because the algorithm used for detecting uniqueness of entered commands
|
||||
will not be able to distinguish words that are not unique before the end
|
||||
of the shorter word, for example, it would not be able to distinguish the
|
||||
command 'abcd' from 'abcde'.
|
||||
|
||||
After translating the messages, use the 'gencat' command to create the compiled
|
||||
catalog used when running the software. The standard syntax would be:
|
||||
|
||||
gencat ee.cat ee.msg
|
||||
|
||||
Where ee.msg is the file containing the translations, and ee.cat is the
|
||||
compiled catalog. If the file ee.cat does not exist, it will be created.
|
||||
Check the documentation for your system for proper syntax.
|
||||
|
||||
Message catalog placement varies from system to system. A common location
|
||||
for message catalogs is in /usr/lib/nls. In this directory are
|
||||
directories with the names of other languages. The default language is
|
||||
'C'. There is also an environment variable, named NLSPATH used to
|
||||
determine where message catalogs can be found. This variable is similar
|
||||
to the PATH variable used for commands, but with some differences. The
|
||||
NLSPATH variable must have the ability to handle different names for
|
||||
languages and the catalog files, so it has field descriptors for these. A
|
||||
typical setting for NLSPATH could be:
|
||||
|
||||
NLSPATH=/usr/lib/nls/%L/%N.cat:/usr/local/lib/nls/%L/%N.cat
|
||||
|
||||
Where "%L" is the field descriptor for the language (obtained from the
|
||||
LANG environment variable) and "%N" is the name of the file (with the
|
||||
".cat" appended by the path variable, it is not passed from the requesting
|
||||
program). The colon (:) is used to separate paths, so in the above
|
||||
example there are two paths possible for message catalogs. You may wish
|
||||
to maintain catalogs for applications that are not supported by your
|
||||
system vendor in a location unique for you, and this is facilitated by the
|
||||
NLSPATH variable. Remember to set and export both the LANG and NLSPATH
|
||||
variables for each user that expects to use localization either in a
|
||||
system-wide profile or in each user's profile. See your system
|
||||
documentation for more information.
|
||||
|
||||
The message catalog supplied with ee also uses the '$quote' directive to
|
||||
specify a quote around strings to ensure proper padding. This directive
|
||||
may not be supported on all systems, and lead to quotes being included in
|
||||
the string used in ee, which will cause incorrect behavior. If the
|
||||
'$quote' directive is not supported by your system's gencat command, edit
|
||||
the msg file to remove the leading and trailing quotation marks.
|
||||
+17
-8
@@ -3,17 +3,18 @@ $ ee.i18n.guide for more information
|
||||
$
|
||||
$ For ee patchlevel 3
|
||||
$
|
||||
$ $Header: /users/hugh/tmp/old_ae/ee.msg,v 1.3 1993/06/22 04:13:35 hugh Exp $
|
||||
$ $Header: /home/hugh/sources/old_ae/RCS/ee.msg,v 1.6 1995/10/16 05:20:50 hugh Exp $
|
||||
$
|
||||
$
|
||||
$set 1
|
||||
$quote "
|
||||
1 "modes menu"
|
||||
2 "tabs to spaces "
|
||||
3 "case sensitive search"
|
||||
4 "margins observed "
|
||||
5 "auto-paragraph format"
|
||||
6 "eightbit characters "
|
||||
7 "info window "
|
||||
2 "tabs to spaces "
|
||||
3 "case sensitive search"
|
||||
4 "margins observed "
|
||||
5 "auto-paragraph format"
|
||||
6 "eightbit characters "
|
||||
7 "info window "
|
||||
8 "right margin "
|
||||
9 "leave menu"
|
||||
10 "save changes"
|
||||
@@ -41,7 +42,7 @@ $quote "
|
||||
32 "settings"
|
||||
33 "search"
|
||||
34 "miscellaneous"
|
||||
35 "Control keys: "
|
||||
35 "Control keys: "
|
||||
36 "^a ascii code ^i tab ^r right "
|
||||
37 "^b bottom of text ^j newline ^t top of text "
|
||||
38 "^c command ^k delete char ^u up "
|
||||
@@ -168,3 +169,11 @@ $quote "
|
||||
159 "EMACS"
|
||||
160 "NOEMACS"
|
||||
161 " +# put cursor at line #\n"
|
||||
162 "unable to open .init.ee for writing, no configuration saved!"
|
||||
163 "ee configuration saved in file %s"
|
||||
164 "save editor configuration"
|
||||
165 "save ee configuration"
|
||||
166 "save in current directory"
|
||||
167 "save in home directory"
|
||||
168 "ee configuration not saved"
|
||||
169 "must specify a file when invoking ree"
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
# This is the make file for ee, the "easy editor".
|
||||
#
|
||||
# If building ee using curses, type "make curses", otherwise new_curse (a
|
||||
# subset of curses that supports ee) will be built and ee will use new_curse
|
||||
# instead of curses.
|
||||
#
|
||||
# The "install" target ("make install") will copy the ee binary to
|
||||
# the /usr/local/bin directory on the local system. The man page (ee.1)
|
||||
# will be copied into the /usr/local/man/man1 directory.
|
||||
#
|
||||
# The "clean" target ("make clean") will remove the ee and new_curse.o
|
||||
# object files, and the ee binary.
|
||||
#
|
||||
# If the system does not have localization routines, use the -DNO_CATGETS
|
||||
# define. If the system supports setlocale(), catopen(), and catgets() and
|
||||
# localization is desired, do not use -DNO_CATGETS.
|
||||
#
|
||||
# DEFINES is used for new_curse.c, and CFLAGS is used for ee.c.
|
||||
#
|
||||
|
||||
# for System V, using new_curse with terminfo
|
||||
DEFINES = -DSYS5 -DNCURSE
|
||||
|
||||
# for BSD, using new_curse with termcap
|
||||
#DEFINES = -DCAP -DNCURSE
|
||||
|
||||
# for BSD systems with select(), using new_curse with termcap, use:
|
||||
#DEFINES = -DCAP -DNCURSE -DBSD_SELECT
|
||||
|
||||
# flags for compilation
|
||||
CFLAGS = -s -DNO_CATGETS
|
||||
|
||||
# For Sun systems, remove the '#' from the front of the next two lines:
|
||||
#DEFINES = -DSYS5 -DNCURSE
|
||||
#CFLAGS = -I/usr/5include -L/usr/5lib -DNO_CATGETS -s
|
||||
|
||||
all : ee
|
||||
|
||||
curses : ee.c
|
||||
cc ee.c -o ee $(CFLAGS) -lcurses
|
||||
|
||||
ee : ee.o new_curse.o
|
||||
cc -o ee ee.o new_curse.o $(CFLAGS)
|
||||
|
||||
ee.o : ee.c new_curse.h
|
||||
cc -c ee.c $(DEFINES) $(CFLAGS)
|
||||
|
||||
new_curse.o : new_curse.c new_curse.h
|
||||
cc new_curse.c -c $(DEFINES) $(CFLAGS)
|
||||
|
||||
install :
|
||||
cp ee /usr/local/bin/ee
|
||||
cp ee.1 /usr/local/man/man1/ee.1
|
||||
|
||||
clean :
|
||||
rm -f ee.o new_curse.o ee
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,256 @@
|
||||
/*
|
||||
| new_curse.h
|
||||
|
|
||||
| A subset of curses developed for use with ae.
|
||||
|
|
||||
| written by Hugh Mahon
|
||||
|
|
||||
| THIS MATERIAL IS PROVIDED "AS IS". THERE ARE
|
||||
| NO WARRANTIES OF ANY KIND WITH REGARD TO THIS
|
||||
| MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
| IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
| FITNESS FOR A PARTICULAR PURPOSE. Neither
|
||||
| Hewlett-Packard nor Hugh Mahon shall be liable
|
||||
| for errors contained herein, nor for
|
||||
| incidental or consequential damages in
|
||||
| connection with the furnishing, performance or
|
||||
| use of this material. Neither Hewlett-Packard
|
||||
| nor Hugh Mahon assumes any responsibility for
|
||||
| the use or reliability of this software or
|
||||
| documentation. This software and
|
||||
| documentation is totally UNSUPPORTED. There
|
||||
| is no support contract available. Hewlett-
|
||||
| Packard has done NO Quality Assurance on ANY
|
||||
| of the program or documentation. You may find
|
||||
| the quality of the materials inferior to
|
||||
| supported materials.
|
||||
|
|
||||
| This software is not a product of Hewlett-Packard, Co., or any
|
||||
| other company. No support is implied or offered with this software.
|
||||
| You've got the source, and you're on your own.
|
||||
|
|
||||
| This software may be distributed under the terms of Larry Wall's
|
||||
| Artistic license, a copy of which is included in this distribution.
|
||||
|
|
||||
| This notice must be included with this software and any derivatives.
|
||||
|
|
||||
| Copyright (c) 1986, 1987, 1988, 1991, 1995 Hugh Mahon
|
||||
| All are rights reserved.
|
||||
|
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef SYS5
|
||||
#include <termio.h>
|
||||
#else
|
||||
#include <sgtty.h>
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#define KEY_BREAK 0401
|
||||
#define KEY_DOWN 0402
|
||||
#define KEY_UP 0403
|
||||
#define KEY_LEFT 0404
|
||||
#define KEY_RIGHT 0405
|
||||
#define KEY_HOME 0406
|
||||
#define KEY_BACKSPACE 0407
|
||||
#define KEY_F0 0410
|
||||
#define KEY_F(n) (KEY_F0+(n))
|
||||
#define KEY_DL 0510
|
||||
#define KEY_IL 0511
|
||||
#define KEY_DC 0512
|
||||
#define KEY_IC 0513
|
||||
#define KEY_EIC 0514
|
||||
#define KEY_CLEAR 0515
|
||||
#define KEY_EOS 0516
|
||||
#define KEY_EOL 0517
|
||||
#define KEY_SF 0520
|
||||
#define KEY_SR 0521
|
||||
#define KEY_NPAGE 0522
|
||||
#define KEY_PPAGE 0523
|
||||
#define KEY_STAB 0524
|
||||
#define KEY_CTAB 0525
|
||||
#define KEY_CATAB 0526
|
||||
#define KEY_ENTER 0527
|
||||
#define KEY_SRESET 0530
|
||||
#define KEY_RESET 0531
|
||||
#define KEY_PRINT 0532
|
||||
#define KEY_LL 0533
|
||||
#define KEY_A1 0534
|
||||
#define KEY_A3 0535
|
||||
#define KEY_B2 0536
|
||||
#define KEY_C1 0537
|
||||
#define KEY_C3 0540
|
||||
#define KEY_BTAB 0541
|
||||
#define KEY_BEG 0542
|
||||
#define KEY_CANCEL 0543
|
||||
#define KEY_CLOSE 0544
|
||||
#define KEY_COMMAND 0545
|
||||
#define KEY_COPY 0546
|
||||
#define KEY_CREATE 0547
|
||||
#define KEY_END 0550
|
||||
#define KEY_EXIT 0551
|
||||
#define KEY_FIND 0552
|
||||
#define KEY_HELP 0553
|
||||
#define KEY_MARK 0554
|
||||
#define KEY_MESSAGE 0555
|
||||
#define KEY_MOVE 0556
|
||||
#define KEY_NEXT 0557
|
||||
#define KEY_OPEN 0560
|
||||
#define KEY_OPTIONS 0561
|
||||
#define KEY_PREVIOUS 0562
|
||||
#define KEY_REDO 0563
|
||||
#define KEY_REFERENCE 0564
|
||||
#define KEY_REFRESH 0565
|
||||
#define KEY_REPLACE 0566
|
||||
#define KEY_RESTART 0567
|
||||
#define KEY_RESUME 0570
|
||||
#define KEY_SAVE 0571
|
||||
#define KEY_SBEG 0572
|
||||
#define KEY_SCANCEL 0573
|
||||
#define KEY_SCOMMAND 0574
|
||||
#define KEY_SCOPY 0575
|
||||
#define KEY_SCREATE 0576
|
||||
#define KEY_SDC 0577
|
||||
#define KEY_SDL 0600
|
||||
#define KEY_SELECT 0601
|
||||
#define KEY_SEND 0602
|
||||
#define KEY_SEOL 0603
|
||||
#define KEY_SEXIT 0604
|
||||
#define KEY_SFIND 0605
|
||||
#define KEY_SHELP 0606
|
||||
#define KEY_SHOME 0607
|
||||
#define KEY_SIC 0610
|
||||
#define KEY_SLEFT 0611
|
||||
#define KEY_SMESSAGE 0612
|
||||
#define KEY_SMOVE 0613
|
||||
#define KEY_SNEXT 0614
|
||||
#define KEY_SOPTIONS 0615
|
||||
#define KEY_SPREVIOUS 0616
|
||||
#define KEY_SPRINT 0617
|
||||
#define KEY_SREDO 0620
|
||||
#define KEY_SREPLACE 0621
|
||||
#define KEY_SRIGHT 0622
|
||||
#define KEY_SRSUME 0623
|
||||
#define KEY_SSAVE 0624
|
||||
#define KEY_SSUSPEND 0625
|
||||
#define KEY_SUNDO 0626
|
||||
#define KEY_SUSPEND 0627
|
||||
#define KEY_UNDO 0630
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
#define A_STANDOUT 0001 /* standout mode */
|
||||
#define SCROLL 1 /* text has been scrolled */
|
||||
#define CLEAR 2 /* window has been cleared */
|
||||
#define CHANGE 3 /* window has been changed */
|
||||
#define UP 1 /* direction of scroll */
|
||||
#define DOWN 2
|
||||
|
||||
struct _line {
|
||||
struct _line *next_screen;
|
||||
struct _line *prev_screen;
|
||||
char *row;
|
||||
char *attributes;
|
||||
int last_char;
|
||||
int changed;
|
||||
int scroll;
|
||||
int number;
|
||||
};
|
||||
|
||||
struct _line *top_of_win;
|
||||
|
||||
typedef struct WIND {
|
||||
int SR; /* starting row */
|
||||
int SC; /* starting column */
|
||||
int LC; /* last column */
|
||||
int LX; /* last cursor column position */
|
||||
int LY; /* last cursor row position */
|
||||
int Attrib; /* attributes active in window */
|
||||
int Num_lines; /* number of lines */
|
||||
int Num_cols; /* number of columns */
|
||||
int scroll_up; /* number of lines moved */
|
||||
int scroll_down;
|
||||
int SCROLL_CLEAR; /* indicates that window has been scrolled or cleared */
|
||||
struct _line *first_line;
|
||||
struct _line **line_array;
|
||||
} WINDOW;
|
||||
|
||||
extern WINDOW *curscr;
|
||||
extern WINDOW *stdscr;
|
||||
|
||||
extern int LINES, COLS;
|
||||
|
||||
#if defined(__STDC__) || defined(__cplusplus)
|
||||
#define P_(s) s
|
||||
#else
|
||||
#define P_(s) ()
|
||||
#endif
|
||||
|
||||
extern void copy_window P_((WINDOW *origin, WINDOW *destination));
|
||||
extern void reinitscr P_((int));
|
||||
extern void initscr P_((void));
|
||||
extern int Get_int P_((void));
|
||||
extern int INFO_PARSE P_((void));
|
||||
extern int AtoI P_((void));
|
||||
extern void Key_Get P_((void));
|
||||
extern struct _line *Screenalloc P_((int columns));
|
||||
extern WINDOW *newwin P_((int lines, int cols, int start_l, int start_c));
|
||||
extern int Operation P_((int Temp_Stack[], int place));
|
||||
extern void Info_Out P_((char *string, int p_list[], int place));
|
||||
extern void wmove P_((WINDOW *window, int row, int column));
|
||||
extern void clear_line P_((struct _line *line, int column, int cols));
|
||||
extern void werase P_((WINDOW *window));
|
||||
extern void wclrtoeol P_((WINDOW *window));
|
||||
extern void wrefresh P_((WINDOW *window));
|
||||
extern void touchwin P_((WINDOW *window));
|
||||
extern void wnoutrefresh P_((WINDOW *window));
|
||||
extern void flushinp P_((void));
|
||||
extern void ungetch P_((int c));
|
||||
extern int wgetch P_((WINDOW *window));
|
||||
extern void Clear P_((int));
|
||||
extern int Get_key P_((int first_char));
|
||||
extern void waddch P_((WINDOW *window, int c));
|
||||
extern void winsertln P_((WINDOW *window));
|
||||
extern void wdeleteln P_((WINDOW *window));
|
||||
extern void wclrtobot P_((WINDOW *window));
|
||||
extern void wstandout P_((WINDOW *window));
|
||||
extern void wstandend P_((WINDOW *window));
|
||||
extern void waddstr P_((WINDOW *window, char *string));
|
||||
extern void clearok P_((WINDOW *window, int flag));
|
||||
extern void echo P_((void));
|
||||
extern void noecho P_((void));
|
||||
extern void raw P_((void));
|
||||
extern void noraw P_((void));
|
||||
extern void nl P_((void));
|
||||
extern void nonl P_((void));
|
||||
extern void saveterm P_((void));
|
||||
extern void fixterm P_((void));
|
||||
extern void resetterm P_((void));
|
||||
extern void nodelay P_((WINDOW *window, int flag));
|
||||
extern void idlok P_((WINDOW *window, int flag));
|
||||
extern void keypad P_((WINDOW *window, int flag));
|
||||
extern void savetty P_((void));
|
||||
extern void resetty P_((void));
|
||||
extern void endwin P_((void));
|
||||
extern void delwin P_((WINDOW *window));
|
||||
extern void wprintw P_((WINDOW *window, const char* format, ...));
|
||||
extern void iout P_((WINDOW *window, int value));
|
||||
extern int Comp_line P_((struct _line *line1, struct _line *line2));
|
||||
extern struct _line *Insert_line P_((int row, int end_row, WINDOW *window));
|
||||
extern struct _line *Delete_line P_((int row, int end_row, WINDOW *window));
|
||||
extern void CLEAR_TO_EOL P_((WINDOW *window, int row, int column));
|
||||
extern int check_delete P_((WINDOW *window, int line, int offset, struct _line *pointer_new, struct _line *pointer_old));
|
||||
extern int check_insert P_((WINDOW *window, int line, int offset, struct _line *pointer_new, struct _line *pointer_old));
|
||||
extern void doupdate P_((void));
|
||||
extern void Position P_((WINDOW *window, int row, int col));
|
||||
extern void Char_del P_((char *line, char *attrib, int offset, int maxlen));
|
||||
extern void Char_ins P_((char *line, char *attrib, int newc, int newatt, int offset, int maxlen));
|
||||
extern void attribute_on P_((void));
|
||||
extern void attribute_off P_((void));
|
||||
extern void Char_out P_((int newc, int newatt, char *line, char *attrib, int offset));
|
||||
|
||||
#undef P_
|
||||
|
||||
Reference in New Issue
Block a user