Initial commit.

This commit is contained in:
Mid Favila 2022-02-08 15:11:56 -04:00
commit 230e5ec41d
115 changed files with 11471 additions and 0 deletions

27
CHANGES Normal file
View File

@ -0,0 +1,27 @@
2022-02-08 Mid Favila <midfavila@sdf.org>
* Set version to 3.0.2.
* Revert to Makefile build system.
* Remove e-mail handling capabilities.
2013-03-24 Thomas Cort <tcort@se-editor.org>
* Version 3.0.1 released.
* Security Fix: be more careful with the handling of .serc files. Now the
euid of se must match the owner of the file and the file must not be
writable by any other users in order for se to execute it. Thank you
to Matthias Kilian of the OpenBSD project for alerting me to this issue.
2013-03-06 Thomas Cort <tcort@se-editor.org>
* Version 3.0 released.
* Convert the build system to automake/autoconf.
* Modernize the K&R style function prototypes. Resolve compiler warnings.
* Use safer versions of string functions (snprintf, strncpy, etc).
* Rename some functions to avoid naming conflicts (delete, index, etc).
* Port to Linux, BSD, GNU, Haiku, Minix, OpenSolaris, and others.
* Add support for termios, make termio the fallback.
* Drop HARD_TERMS, OLD_SCRATCH, and OLD_GLOB options.
* Remove hardcoded paths, get them from autoconf now.
* Use syslog for optional usage logging instead of a file in /usr/tmp.
* Add a sample .serc file.

6
COPYING Normal file
View File

@ -0,0 +1,6 @@
The se source code and associated files are in the public domain.
There are a few output files from autoconf/automake (configure, Makefile, etc)
which contain copyright notices. Those notices give unlimited permission to
copy and/or distribute the files, with or without modifications, as long as
the notices are preserved.

19
NEWS Normal file
View File

@ -0,0 +1,19 @@
2022.02.08 - Convert to Makefile build system.
2022.02.07 - Forked se 3.0.1.
2013.03.24 - se 3.0.1 has been released. This is a security release. It is
recommended that all users upgrade. The release fixes
insecure handling of .serc files. The new behaviour is
to ignore .serc files that aren't owned by the euid of
the se process and .serc files that are writable by
other users. No other changes are included in this
release. Thank you to Matthias Kilian of the OpenBSD
project for alerting me to this issue.
2013.03.06 - se 3.0 has been released. This release includes major portability
enhancements and build system changes. The old makefile based
build system has been replaced with a slick new autotools
configure script. This, combined with some code modernization,
allows se to build and run on a variety of platforms. See the
ChangeLog for details.

39
README Normal file
View File

@ -0,0 +1,39 @@
MSE, or the Minimal Screen Editor, is a screen-oriented version of the
Unix editor ed. It contains a number of quirks, and is somewhat
idiosyncratic at times, but if you're patient I think you'll find it
rather enjoyable.
When I came across it (looking for an ed with a UI), I decided to start
writing patches removing obsolete and unneeded code - eventually these
will turn into my own version of a screen-oriented ed.
ORIGINAL README FOLLOWS.
-------------------------------------------------------------------------
http://se-editor.org/
This is the source code for the text editor, se ('Screen Editor').
se is a screen oriented version of the classic UNIX text editor ed.
The editor implements many of the commands of ed, but instead of
being line oriented, se is screen oriented.
Se started out as the version of 'ed' that came with the book 'Software
Tools', by Kernighan and Plauger, which was written in Ratfor. On the Pr1me
computers at the School of Information and Computer Science at Georgia Tech,
Dan Forsyth, Perry Flinn, and Alan Akin added all the enhancements suggested
in the exercises in the book, and some more of their own. Jack Waugh made
extensive modifications to turn it into a screen editor; further work was done
by Dan Forsyth. All of this was in an improved Georgia Tech version of Ratfor.
Later, Dan Forsyth, then at Medical Systems Development Corporation,
converted the Ratfor version into C, for Berkeley Unix (4.1 BSD). At Georgia
Tech, Arnold Robbins took the C version and added many new features and
improvements, the most important of which was termcap support and System V
support. The existing help screens were edited and completed at that time, as
well. This was completed in early 1985.
In early 2013, Thomas Cort continued maintenance of se, modernizing
the code base and build system to support current POSIX operating systems.
Thomas' primary motivation is to preserve this bit of computing history.
His goals are to squash any remaining bugs and make se as portable as
possible. No major new features will be added. He can be reached at
tcort@se-editor.org

30
TODO Normal file
View File

@ -0,0 +1,30 @@
This file lists potential improvements for future versions of se.
- Remove code not related to supporting *nix
- Remove any non-portable (ideally POSIX but de facto works too) code
- Remove any code not related specifically to editing (email notifs, etc)
- Adjust line-editing to be more intuitive (maybe use a simple line-edit
library)
- Figure out why there appears to be a line limit on current file. Fix.
- Revert autotools build to makefile-based. [DONE - 2022/2/8]
OLD SE TODO FOLLOWS. ENCLOSED IN BRACKETS ARE NEW NOTES.
-----------------------------------------------------------------
Documentation:
- tutorial (like vimtutor or `C-h t` in emacs) [not necessary]
- texinfo manual [use mandoc]
Port to the following operating systems:
- FreeDOS [just no]
(this is a high cost, low reward target, but it might be
an interesting platform to support).
Other Improvements:
- Better usage() output with useful explainations.
- add a test suite (should be easy since we have scriptse already).

11
help/Makefile.am Normal file
View File

@ -0,0 +1,11 @@
# This file is in the public domain.
helpdir = $(datadir)/@PACKAGE@/help
help_DATA = a abt ah arg2 args b bang bug c cc ccmisc chardel charins colon \
com comdir comsyn d dir e eh elp equal f g h i j k l list ln m \
motion n o o- oa oc od of og oh oi ok ol olm om os ot ou ov ow ox \
oy oz p pat patex q quote r rpt s scan serc shell specl t termchar \
tilde u v w x y z
EXTRA_DIST = $(help_DATA)

406
help/Makefile.in Normal file
View File

@ -0,0 +1,406 @@
# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
# This file is in the public domain.
VPATH = @srcdir@
am__make_dryrun = \
{ \
am__dry=no; \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
*) \
for am__flg in $$MAKEFLAGS; do \
case $$am__flg in \
*=*|--*) ;; \
*n*) am__dry=yes; break;; \
esac; \
done;; \
esac; \
test $$am__dry = yes; \
}
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = help
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(helpdir)"
DATA = $(help_DATA)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTERMCAP = @LIBTERMCAP@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
helpdir = $(datadir)/@PACKAGE@/help
help_DATA = a abt ah arg2 args b bang bug c cc ccmisc chardel charins colon \
com comdir comsyn d dir e eh elp equal f g h i j k l list ln m \
motion n o o- oa oc od of og oh oi ok ol olm om os ot ou ov ow ox \
oy oz p pat patex q quote r rpt s scan serc shell specl t termchar \
tilde u v w x y z
EXTRA_DIST = $(help_DATA)
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign help/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign help/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
install-helpDATA: $(help_DATA)
@$(NORMAL_INSTALL)
@list='$(help_DATA)'; test -n "$(helpdir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(helpdir)'"; \
$(MKDIR_P) "$(DESTDIR)$(helpdir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(helpdir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(helpdir)" || exit $$?; \
done
uninstall-helpDATA:
@$(NORMAL_UNINSTALL)
@list='$(help_DATA)'; test -n "$(helpdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(helpdir)'; $(am__uninstall_files_from_dir)
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(DATA)
installdirs:
for dir in "$(DESTDIR)$(helpdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am: install-helpDATA
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-helpDATA
.MAKE: install-am install-strip
.PHONY: all all-am check check-am clean clean-generic distclean \
distclean-generic distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-helpDATA \
install-html install-html-am install-info install-info-am \
install-man install-pdf install-pdf-am install-ps \
install-ps-am install-strip installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \
uninstall-am uninstall-helpDATA
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

16
help/a Normal file
View File

@ -0,0 +1,16 @@
a -- Append command
default range syntax
. a
"a" is for appending new lines of text after a given line. If
no line number is typed before the "a", text will be appended
after the current line. The last line appended becomes the
current line. To signal the end of the appended text, you
type a "." on a line by itself. Control characters "f", "v",
"l", and "k" work differently for "a" command than for "v".
"a:" works as a one line append (i.e. anything following the
colon is appended after the current line).
To return to the command directory, type "hcomdir."
See also: "hcc" (control characters) and "hc" (change).

12
help/abt Normal file
View File

@ -0,0 +1,12 @@
Abort character
CTRL-F ("Funny Return") character is used to abort a "v"
command before all the specified lines have been modified.
Typing it causes the current line to be restored to its state
of before the "v" command was begun, and causes a return to
the editor's command level.
Type "hv" for a description of the "v" command.
Type "hrpt" for CTRL-F's meaning if in append or command mode.
Type "htermchar" for info about other termination characters.

6
help/ah Normal file
View File

@ -0,0 +1,6 @@
If you're running Berkeley Unix, and you're bored
Type the following command for something enjoyable:
!rogue

16
help/arg2 Normal file
View File

@ -0,0 +1,16 @@
Arguments (cont)
Once the terminal type is established, the remaining arg-
uments are interpreted thus: if the argument begins with a
"-", the rest of it is interpreted as though it appeared after
the "o" in an option command. For example, an argument of
"-w10" acts as a command "ow10". On the other hand, if the
argument does not begin with "-", it is interpreted as a file
name (path- name). The named file is read into the edit
buffer, and its name becomes the remembered file name. If
more than one file is named, the edit buffer will contain the
contents of all the files. If an error is encountered while
interpreting arguments (file not found, illegal option), the
remainder will be ignored.
For invoking command syntax, type "hargs".

9
help/args Normal file
View File

@ -0,0 +1,9 @@
Argument Handling
The syntax for 'se's invoking command is usually given as
se {-<option> | <pathname>}
It is suggested that you set up a command file that will
automatically invoke 'se' with the options that you like.
To see how the remaining arguments are treated, type "harg2".
To return to the general help directory, type "hdir".

7
help/b Normal file
View File

@ -0,0 +1,7 @@
There is no "b" command.
To return to the command directory, type "hcomdir."

11
help/bang Normal file
View File

@ -0,0 +1,11 @@
! --- exclude on markname
default range syntax
1,$ !<m>command
Similar to the "x" prefix, except that "command" is performed
for all lines in the range that do not have the mark name <m>.
To return to the command directory, type "hcomdir".

10
help/bug Normal file
View File

@ -0,0 +1,10 @@
There is a limit (MAXLINE - 2) on the number of characters
in a line. Se's MAXLINE is currently 512, so this isn't too much
of a problem.
If a filename is absent when invoked, all of the
options are not processed.
To go all the way back to the general help display, type "h".
To go back to the general help directory, type "hdir."

14
help/c Normal file
View File

@ -0,0 +1,14 @@
c -- Change command
default range syntax
.,. c
"c" first deletes the range of lines determined by the line
numbers (default ".,."), then enters append mode so that you
can type lines to replace the deleted lines. Append mode is
terminated with a dot on a line by itself, as with the Append
command. "c:" works as a one line change (i.e. what is after
the colon replaces the current line).
To return to the command directory, type "hcomdir."
See also "ha" and "hd"

13
help/cc Normal file
View File

@ -0,0 +1,13 @@
Control characters can be used for correcting typing mistakes,
for correcting commands that have incurred an error message,
or for editing the edit buffer ("inline editing") via the "v"
command. The novice should be told right away that hitting
the DEL or RUBOUT key is a way to erase an erroneous command.
General Help Directory. . . . . . . . . . . . . . hdir
Other Control Characters. . . . . . . . . . . . . hccmisc
Character Insertion Control Characters. . . . . . hcharins
Termination Control Characters. . . . . . . . . . htermchar
Character Deletion Control Characters . . . . . . hchardel
Cursor Motion Control Characters. . . . . . . . . hmotion

11
help/ccmisc Normal file
View File

@ -0,0 +1,11 @@
Miscellaneous Control Characters
CTRL-Z toggles an indicator that acts as a "shift lock",
controlling case mapping on alphabetics typed.
CTRL-Q signals the editor that you suspect that for some
reason the screen is garbaged. The response is to clear and
restore the screen.
Type "hcc" to get back to the control character directory.

12
help/chardel Normal file
View File

@ -0,0 +1,12 @@
Character Deletion Control Characters
Gobble one character
to left of cursor CTRL-U
at cursor CTRL-R
Gobble all characters
to left of cursor CTRL-Y
at and to right of cursor CTRL-T
on entire line DEL (a. k. a. RUBOUT)
"hdir" gets you back to the general help directory.
Type "hcc" to get back to the control character directory.

14
help/charins Normal file
View File

@ -0,0 +1,14 @@
Character Insertion Control Characters
CTRL-C inserts a blank at the cursor position.
CTRL-X inserts blanks to the next tab stop at the cursor position.
CTRL-A toggles Insert Mode.
When Insert Mode is in effect, any printing character typed is
inserted into the line, with characters at and to the right of
the cursor moving over to make room. When Insert Mode is not
in effect, any printing character typed will replace (overlay)
the character at the cursor.
To return to the directory of control characters, type "hcc".

12
help/colon Normal file
View File

@ -0,0 +1,12 @@
: -- Page command
default range syntax
. :
":" is for paging the active area one page (n-1 lines)
forward.
For paging backward, see "hp"
See also: "hcc" (control characters) and "hc" (change).
To return to the command directory, type "hcomdir."

10
help/com Normal file
View File

@ -0,0 +1,10 @@
Commands
When the "cmd>" prompt appears near the bottom of the screen,
a command may be typed. Commands work for the most part the
same way as commands to 'ed', the Unix system text editor with
which you may be familiar.
To return to the general help directory, type "hdir".
For information about specific commands, type "hcomdir".
For details on command syntax, type "hcomsyn".

18
help/comdir Normal file
View File

@ -0,0 +1,18 @@
Command Directory
The following are the full names of one-letter commands
Append Change Delete Enter File Global
Help Insert Join marK Locate Move Name
Option Page Quit Read Substitute To
Undelete oVerlay Write eXclude translYterate
For info about one of these commands, type "h" followed by
whichever letter is capitalized in the command name above.
Other commands and their help commands are:
print value hequal global on mark hquote
miscellany hz exclude on mark htilde
shell escape hshell .serc file hserc
There are still more commands; to see them type "hspecl".

14
help/comsyn Normal file
View File

@ -0,0 +1,14 @@
Command Syntax
A command consists of an optional list of LINE NUMBERS,
followed by a COMMAND LETTER, possibly followed by parameters
allowed or required for a specific command. Preceeding all
this, there can be a GLOBAL PREFIX preceeded optionally by a
list of line numbers. Hence the whole syntax is:
[[<list>]<global prefix>][<list>]<command letter>[<stuff>]
For general information about commands, type "hcom".
For information about specific commands, type "hcomdir".
For GLOBAL PREFIX syntax and semantics, type "hg".
For LINE NUMBER LIST syntax and semantics, type "hlist".

14
help/d Normal file
View File

@ -0,0 +1,14 @@
d -- Delete command
default range syntax
.,. d
"d" is used to delete lines of text from the buffer. The
lines in the range specified by the line number list are
deleted. The positioning of the current line pointer after
execution of the "d" command is controlled by the "d" option;
see "hod". The normal behavior is to make the first line
AFTER the lines deleted the new current line.
To return to the command directory, type "hcomdir."
See also "hod".

10
help/dir Normal file
View File

@ -0,0 +1,10 @@
HELP DIRECTORY
To go back to the general description, type "h"
For info on the 'se' invoking command, type "hargs"
For a discussion of commands, type "hcom"
For a description of 'se's problems, type "hbug"
To learn about control characters, type "hcc"
For info on options, type "ho"

16
help/e Normal file
View File

@ -0,0 +1,16 @@
e -- Enter command
default range syntax
n/a e[! | x] [file name]
"e" prevents one from having to exit and reenter the editor to
edit a different file. "e" empties the edit buffer, reads a
file, and resets the remembered file name. If [file name] is
omitted, the remembered file name is used. [!] is used to
override a check made to prevent you from accidently losing a
buffer that has not been saved (same as in "q"). [x] is used
to turn tab expansion on when reading the file in. Se will
expand environment variables that start with $ in file names.
To return to the command directory, type "hcomdir."
See also: "hq"

11
help/eh Normal file
View File

@ -0,0 +1,11 @@
You are standing at the end of a road before a small brick building.
around you is a forest. A small stream flows out of the building and
down a gully.
You are inside a building, a well house for a large spring.
There are some keys on the ground here.
There is a shiny brass lamp nearby.

17
help/elp Normal file
View File

@ -0,0 +1,17 @@
Help
You are using 'se', the Georgia Tech screen editor which is
based upon the editor described in the book SOFTWARE TOOLS, by
Brian W. Kernighan and P. J. Plauger (Addison-Wesley,
1976). The screen-oriented modifications (and some others)
are by Jack Waugh and Perry Flinn. Dan Forsyth translated
the Ratfor into C. Arnold Robbins modified the editor to use
the Berkeley termlib library, making the editor terminal inde-
pendant. Most of this 'help' is courtesy of Bob Gordon of
Prime Research, as amended by Arnold Robbins. The descrip-
tion before you now is invoked by the "h" (help) command.
For a description of the 'help' command, type "hh".
Find out what the help command can tell you - type "hdir".
This is version 3.0. It is maintained by tcort@se-editor.org

12
help/equal Normal file
View File

@ -0,0 +1,12 @@
= -- Display Line Number command
default range syntax
. =
"=" is for determining the number of the current line
that you are editing.
To return to the command directory, type "hcomdir."
See also: "hoa"

16
help/f Normal file
View File

@ -0,0 +1,16 @@
f -- File command
default range syntax
n/a f [file name]
"f" is used to print or reset the name of the current file
being edited. f [file name] resets the name for the current
file. This filename is used by the "w", "e", and "r" com-
mands when no parameters are provided. f does not change
the "ok" toggle. f with no parameters prints out the remem-
bered name. In file names, Se will expand any enviroment
variables that start with a $.
To return to the command directory, type "hcomdir." See
also: "he", "hw", "hr", and "hok".

14
help/g Normal file
View File

@ -0,0 +1,14 @@
g -- Global command
default range syntax
1,$ g/pattern/command
"g" is used to perform an editing command on all lines that
match the "pattern". "pattern" is any legal pattern and
command is an editor command. The "x" command is the converse
of "g" and performs the command on all lines that do not match
the pattern. The "/" may be any character.
To return to the command directory, type "hcomdir."
See also: "hx" and "hpat".

12
help/h Normal file
View File

@ -0,0 +1,12 @@
h -- Help command
default range syntax
n/a h[ null | parameter]
Typing "h" followed by any character string simply displays
the contents of the se help script of that name at the top of
the screen (provided the script exists). The scripts are
files in the directory '/usr/local/share/se/help'. If the
scriptname is omitted, "elp" is assumed.
To see a general directory of help scripts, type "hdir".

18
help/i Normal file
View File

@ -0,0 +1,18 @@
i -- Insert command
default range syntax
. i
"i" is for inserting new lines of text before a given line.
If no line number is typed before the "i", text will be
inserted before the current line. Lines are continually
inserted before the original line, which has the same effect
as append does. To signal the end of the inserted text, you
only need to type a "." on a line by itself. Control
characters "f", "v", "l", and "k" work differently for "i"
command than for "v". "i:" works as a one line insert, similar
to "a:".
To return to the command directory, type "hcomdir."
See also: "hcc" (control characters) and "hc" (change) and
"ha".

15
help/j Normal file
View File

@ -0,0 +1,15 @@
j -- Join command
default range syntax
^,. j[/string[/]]
"j" is used to join the specified lines into a single line.
If "string" is present, it is inserted between each pair of
lines joined. If not, a single blank is used. "j/" is the
same "j//", i.e., no string at all will be inserted between
the joined lines. The "/" may be any character. The
trailing delimiter is optional.
To return to the command directory, type "hcomdir."

12
help/k Normal file
View File

@ -0,0 +1,12 @@
k -- marK command
default range syntax
.,. k<single-character-name>
"k" is used to mark lines with the given name.
If no character is provided, the current label(s) in the
range are removed.
To return to the command directory, type "hcomdir."
See also: "hln" and "hn".

16
help/l Normal file
View File

@ -0,0 +1,16 @@
l -- Locate command
default range syntax
none l
The Locate command places the system name into the status
line (e.g. "gatech" or "gitpyr"). This is so that you
can tell what machine you are using from within the screen
editor. This is particularly useful for installations with
many machines that can run the editor, where you are able
to switch back and forth between them, and become confused
as to where you are at a given moment.
To return to the command directory, type "hcomdir."

15
help/list Normal file
View File

@ -0,0 +1,15 @@
List (of line numbers)
A line number list consists of one or more LINE NUMBERs sep-
arated with commas or semicolons. The last two line numbers
in the list usually specify the scope of a command. For
example, "5,7d" means delete lines 5 through 7. If the list
consists of only one line number, it is equivalant to a list
with that line number written twice with a comma separating.
The sense of the semicolon is to set the CURRENT LINE POINTER
to the value of the line number before the semicolon before
evaluating the line number after it, whose value may depend
upon the value of the current line pointer.
For command syntax, type "hcomsyn".
For LINE NUMBER syntax and semantics, type "hln".

17
help/ln Normal file
View File

@ -0,0 +1,17 @@
Line Numbers
A LINE NUMBER refers to a line in the edit buffer. The
lines are always numbered sequentially starting with 1. A
line number can be expressed as an integer, as "." meaning
the CURRENT LINE, "^" or "-" meaning the line before the
current line, "$" meaning the last line, as a PATTERN
enclosed in "/" slashes for a forward scan, as a pattern
enclosed in "?" question marks for a backward scan, as a
MARK NAME preceeded by "<" for a backward search or by ">"
for a forward search, or as any additive combination of the
above by joining them with operators "+", "-", or nothing
(meaning "+").
Type "hlist" for line number list syntax.
For details on scans and searches, type "hscan".

12
help/m Normal file
View File

@ -0,0 +1,12 @@
m -- Move command
default range syntax
.,. from-here,to-here m there
"m" is used to move lines form one place in the buffer to
another.
To return to the command directory, type "hcomdir."
See also "ht"

14
help/motion Normal file
View File

@ -0,0 +1,14 @@
Cursor Motion Control Characters
Moving the cursor one position:
left CTRL-H
right CTRL-G
up CTRL-D
down CTRL-K
Moving to the next tab stop:
left CTRL-E
right CTRL-I
Moving all the way to the left: CTRL-W
Moving to the current right end of the line: CTRL-O
Type "hcc" for general information about control characters.

11
help/n Normal file
View File

@ -0,0 +1,11 @@
n -- Name command
default range syntax
.,. n<single-character-name>
"n" is used to uniquely mark a line. if the same mark name is
already on other lines, it will be removed from them.
To return to the command directory, type "hcomdir." See also
"hk" and "hln"

15
help/o Normal file
View File

@ -0,0 +1,15 @@
o -- Option
The "o" (option) command allows any of several variables that
affect the editor's behavior to be set or tested. The
behavior of the "o" command depends upon what is typed after
the "o".
To find out about specific options, type "hoa", "hoc", "hod",
"hof", "hog", "hoh", "hoi", "hok", "hol", "holm", "hom", "hos",
"hot", "hou", "hov", "how", "hox", "hoy", "hoz", or "ho-".
To see how to set options with the command that invokes 'se',
type "hargs".
To return to the command directory, type "hcomdir".

16
help/o- Normal file
View File

@ -0,0 +1,16 @@
o- -- Option - (dash)
default range syntax
1,$ o-[line number]
The "-" option controls the placement on the screen of a row
of dashes, which normally is off the screen above the top line
or hiding behind the bottom line of the help display. The
"window" through which you look at the edit buffer is the por-
tion of the screen BELOW the row of dashes but above the
command line (when it exists) or status line at the bottom.
"o-" alone puts the row of dashes above the top line; "o-"
followed by a SINGLE TERM line number puts it in place of the
line referred to on the screen, if possible.
For general information about the option command, type "ho".

17
help/oa Normal file
View File

@ -0,0 +1,17 @@
oa -- Option Absolute
default range syntax
1,$ oa
"oa" toggles the Absolute line numbers flag, which determines
whether the numbers in the left margin shall be absolute line
numbers, or the (usually capital) letters that refer to lines
by the position at which they are being displayed on the
screen. In any case, the current line is always shown as "."
(with the "->" arrow to make it easy to find), the first line
in the buffer is labeled "1", and the last, "$" (when not
"."). Lines can be referred to by letter ONLY when the
letters appear in the left margin.
For general information about the option command, type "ho".
See also "hln" for how lines can be referred to in commands.

16
help/oc Normal file
View File

@ -0,0 +1,16 @@
oc -- Option Case
default range syntax
1,$ oc
The "c" (case) option toggles the same case mapping flag that
is toggled by the CTRL-Z control character, but also changes
the marginal line letters to lower case (or back to upper), so
that typing a shifted letter will still refer to a line, and
typing an unshifted letter will do for a command letter. This
is useful for handling large amounts of upper case text, such
as Fortran programs.
For general information about the option command, type "ho".
See also "hoa".
Fortraners see also "hof".

16
help/od Normal file
View File

@ -0,0 +1,16 @@
od -- Option Delete
default range syntax
1,$ od[<|>]
The "d" option is for Delete direction. Typing "od<" fixes it
so that after you give a "d" command, the line BEFORE the
group of lines deleted becomes the current line (.). Typing
"od>" resets the normal behavior, in which the current line
pointer is always positioned AFTER the group of lines deleted
by the "d" command, if possible (Deleting the last line makes
the new last line the current line). Typing "od" alone
queries the delete direction flag, causing ">" or "<" to be
displayed.
For general information about the option command, type "ho".

16
help/of Normal file
View File

@ -0,0 +1,16 @@
of -- Option Fortran
default range syntax
1,$ of
Typing "of" turns on a package of options considered
convenient for editing Fortran. The warning column is set
to 72, and tab spacing is set to 7 +3 so that tabbing once
gets you to column 7. Tab expansion is also turned on
(XTABS). To undo "of" it is necessary to type "ot+3" and
"ox".
For general information about the option command, type "ho".
See also "oa".

16
help/og Normal file
View File

@ -0,0 +1,16 @@
og -- Option Global
default range syntax
1,$ og
The "g" option controls the behavior of the Substitute command
when it is under the control of a Global command. Initially,
if a substitute inside a global command fails, se will not con-
tinue with the rest of the lines which might succeed. If "og"
is given, then the global substitute will continue, and lines
which failed will not be affected. Succesive "og" commands will
toggle this behavior. An explanatory message is placed in the
status line.
For general information about the option command, type "ho".

17
help/oh Normal file
View File

@ -0,0 +1,17 @@
oh -- Option Hardware Insert/Delete
default range syntax
1,$ oh
The "h" option controls the use of hardware line
insert/delete on terminals that have that capability. By
default, line insert/delete will be used if available. It
is occasionally useful to turn this option off when using
the editor on a terminal which can't keep up, or if the com-
munications lines may be scrambling the control characters.
Each successive "oh" merely toggles a switch within the
editor. An explanatory message is placed in the status
line.
For general information about the option command, type "ho".

13
help/oi Normal file
View File

@ -0,0 +1,13 @@
oi -- Option Indent
default range syntax
1, $ oi[a | <indent>]
"oi" selects the indent value for lines inserted with "a" and
"i" commands (initially 1). "a" selects auto-indent which sets
the indent to the value which equals the indent of the previ-
ous line. If neither "a" nor "<indent>" is specified, the
current value of indent is displayed.
For general information about the option command, type "ho".

12
help/ok Normal file
View File

@ -0,0 +1,12 @@
ok -- Option OK
default range syntax
1,$ ok
Typing "ok" simply tests the flag that indicates whether the
edit buffer has been saved since the last change was made to
it. "Saved" or "Not saved" is accordingly displayed in the
remark field at the bottom of the screen.
To return to the option directory, type "ho".
See also "hq".

14
help/ol Normal file
View File

@ -0,0 +1,14 @@
ol -- Option Line
default range syntax
1,$ ol[$ | . | # | BLANK]
The "l" option is the Line number monitoring option. Typing
"l" followed by "$" constantly displays the last line number
in the file (current length of the file). Typing "l" followed
by "." constantly displays the current line number. This
usually make sense only in conjunction with the "oa" option,
that uses letters for line names.
For general information about the option command, type "ho".
See also: "hoa" and "hequal".

14
help/olm Normal file
View File

@ -0,0 +1,14 @@
olm -- Option Line Margin
default range syntax
1,$ olm[<col>]
Sets the left margin to <col> which must be a positive integer.
This shifts the entire screen to the left; the characters that
were in columns 1 through <col> - 1 will not be visible. You
may continue editing in the normal fashion. To reset your screen
to normal, enter the command "olm 1". If <col> is omitted, the
current left margin column is displayed in the status line.
For general information about the options command, type "ho".

18
help/om Normal file
View File

@ -0,0 +1,18 @@
om -- Option Mail
default range syntax
1,$ om
"om" is an option which allows the user control over whether
or not he will be notified about pending mail. Typing "om"
simply toggles the switch controlling notification.
The default is for the editor to notify the user about his
mail. The mail box which the editor uses is taken from the
environment variable MAIL. If the mail box exists, but is empty
the user will not be notified.
To read your mail, use a shell escape on whichever of the fol-
lowing programs is appropriate:
Mail msg mail

15
help/os Normal file
View File

@ -0,0 +1,15 @@
os --- option source
default range syntax
1,$ s[as | c | d | data | f | h | n | nr | nroff | p | r | s]
This option sets other options for case, tabs, etc.
as, s -- assembler files c -- C files
d, data -- data files f -- fortran files
h -- header files n,nr,nroff -- nroff source files
p -- pascal files r -- ratfor files
See the manual page for details.
For general information about the options command, type "ho".

17
help/ot Normal file
View File

@ -0,0 +1,17 @@
ot -- Option Tab
range syntax
1,$ ot[[[+]integer [+]integer]]
"ot+3" sets the spacing between tab stops. The default value
when 'se' comes up is 3. Typing "ot" by itself causes the
current value of the parameter to be displayed. As an example
of how tabs are spaced out, if ot+6 is in effect, tab stops are
at 7, 13, 19, etc.
Variable tabs can be set by typing "ot 5 13 24 .. ". if you
do not prefer equally spaced ones.
See also "hof".
For general information about the option command, type "ho".
For more about the use of tab stops, type "hmotion".

17
help/ou Normal file
View File

@ -0,0 +1,17 @@
ou -- Option Unprintable
default range syntax
1,$ ou[character]
The "u" option is for monitoring unprintable characters.
Typing "ou" by itself will return the current character used
to display unprintable characters. If it is ' ' (blank), then
unprintable characters are not checked and may mess up the
display. Typing "oux" where "x" is a printable character will
turn on character checking and display "x" everytime an
unprintable character is encountered. Unprintable characters
are not disturbed in the file, but can be "edited" out.
See also hccmisc for refreshing the display.
For general information about the option command, type "ho".

14
help/ov Normal file
View File

@ -0,0 +1,14 @@
ov -- oVerlay Option
default range syntax
1,$ ov[integer]
The "v" option is the overlay column number. Typing "ov"
followed by a space and a number sets the column that the
cursor will be positioned at when issuing the "v" command.
Typing "ov $" will position the cursor at the end of the line.
Typing "ov" by itself will display the current value.
See also hmotion.
For general information about the option command, type "ho".

14
help/ow Normal file
View File

@ -0,0 +1,14 @@
ow -- Option Warning
default range syntax
1,$ ow[integer]
The "w" option is the Warning column number. Typing "ow"
followed by a number sets the warning column threshold; simply
typing "ow" causes its current value to be displayed. When
you are about to type into a column of equal or greater number
than the warning column, the number of the column you are
about to type into is displayed on the bottom line along with
the string "col ".
For general information about the option command, type "ho".

16
help/ox Normal file
View File

@ -0,0 +1,16 @@
ox -- toggle tab compression/expansion
default range syntax
. ox
"ox" turns compression of tabs on or off. If a file
has tabs in it, they will be expanded if compres-
sion is on. Otherwise they will be left alone, and
will show up as the default unprintable character.
The message "XTABS" will be displayed in the status
line if tab compression is on.
Type "hdir" to go back to the general help directory.
Type "ho" for help on the option command.

15
help/oy Normal file
View File

@ -0,0 +1,15 @@
oy --- option encrYption
default range syntax
1,$ oy[key]
This option allows you to edit encrypted files. oy followed by a key
will cause e, r, and w, commands to encrypt and decrypt files using
crypt(1). oy will toggle the current encryption setting. If there
is no current key, se will ask you for one. If encryption is turned
on, it will be turned off. Encryption in indicated by the message
"ENCRYPT" in the status line. The key is never shown on your screen.
Type "ho" for help on the option command.
Type "hdir" to go back to the general help directory.

12
help/oz Normal file
View File

@ -0,0 +1,12 @@
oz -- option sleep (zzzz's)
default range syntax
1,$ oz
If you are running "sh", this option has absolutely no effect at
all. If you are running the "csh", this option will suspend se
in the background. Se will issue a warning if the buffer has
not been saved, when this is done.
For general information about the option command, type "ho".

14
help/p Normal file
View File

@ -0,0 +1,14 @@
p -- Print/Previous screen command
default range syntax
see below [range] p
"p" prints a range of lines or the previous screen (when no
range is provided). The line pointer is set to the last line
printed (a new screen may be printed). When the previous
screen is printed, the first line on the current screen be-
comes the line pointer, usually the last line on the screen
(exception is when the first page is printed).
To return to the command directory, type "hcomdir."
See also "hspecl"

15
help/pat Normal file
View File

@ -0,0 +1,15 @@
A PATTERN is a string of characters that specifies a set of
possible strings of characters that are said to MATCH the
pattern. Most characters in patterns stand for themselves,
but there are metacharacters: "." that matches any
character, "*" that along with the previous character, matches
any number of repetitions of it (including none), "^" for
beginning of line, "$" for end of line, and characters in
brackets "[]" to match any of the characters. The special
sense of metacharacters and of the delimiters in which the
pattern is enclosed can always be turned off by preceeding
them with the escape character "\".
See also "hs", "hg", "hx" for uses of patterns.
For the use of patterns in line numbers, type "hscan".
For examples of pattern matches, type "hpatex".

13
help/patex Normal file
View File

@ -0,0 +1,13 @@
PATTERN MATCHES DOESN'T MATCH
"test" "testfoo" "foobar"
"test$" "footest" "test "
"$" anything
"ab*c" "abbbbbbc" "bbbbbbc"
"ab*c" "ac cur" "ab*c"
"^abc" "abcac" "bcabc"
"abc^" "abc^d" "ab*c"
"a[bcd]*e" "abddceab" "eeeaaa"
"a[bcd]*e" "aaaeee" "bcdbcde"
For general info about patterns, type "hpat".

14
help/q Normal file
View File

@ -0,0 +1,14 @@
q -- Quit command
default range syntax
n/a q
"q" is used to quit the screen editor and return to system
command level. If changes have been made to the buffer since
the last write ("w"), you will be asked if you really want to
quit. If so, just do another "q" command (RETURN is all that
required).
To return to the command directory, type "hcomdir."
See also: "hok".

10
help/quote Normal file
View File

@ -0,0 +1,10 @@
' --- global on markname
default range syntax
1,$ '<m>command
Similar to the "g" prefix, except that "command" is performed
for all lines in the range that have the mark name <m>.
To return to the command directory, type "hcomdir".

12
help/r Normal file
View File

@ -0,0 +1,12 @@
r -- Read command
default range syntax
. r [file name]
"r" is used to read a file into the buffer at (after) the
named place (range field). If no file name is provided, the
current file name (as identified by the "f" command) is used.
Se expand environment variables occuring in file names.
To return to the command directory, type "hcomdir."
See also: "hf" and "he".

10
help/rpt Normal file
View File

@ -0,0 +1,10 @@
The CTRL-F ("Funny Return") key can be used for repeating
lines while in Append Mode or in Command Mode. Typing it will
cause the line to be terminated without chopping any
characters off, and will set a flag that will inhibit erasure
of the command after it is completed, so that the same line
may be easily re- entered.
Type "htermchar" for info about other termination characters.
Type "habt" to see what CTRL-F does in overlay mode.

16
help/s Normal file
View File

@ -0,0 +1,16 @@
s -- Substitute command
default range syntax
.,. s/change-this/to-this[/][g]
The pattern "change-this" is matched on each line within the
range and the string "to-this" is substituted for it. If [g]
is used, all occurrences of the "change-this" pattern are
changed. If "change-this" is empty, the most recent pattern
from this command (e.g. within the range field) or a previous
command is used. If "to-this" is a '%', the previous replace-
ment pattern is used. The "/" may be any character. The trail-
ing delimiter is optional.
To return to the command directory, type "hcomdir."
See also: "hln" and "hpat".

15
help/scan Normal file
View File

@ -0,0 +1,15 @@
For line number syntax, type "hln".
For details about PATTERNs, type "hpat".
A line number term consisting of a PATTERN between slashes
causes a scan to begin with the line after the current line.
If the last line is encountered, the scan continues with line
1. The current line is the last to be examined. The line
referred to is the first line encountered in the scan that
contains a match for the pattern. If the entire buffer
contains no match, then an error is flagged. If the pattern
is enclosed in question marks, the scan is in the reverse
direction and begins with the line just before the current
line, and wraps around to the last line after line 1 is
examined. ">" and "<" mark name searches proceed in the same
wraparound fashion.

15
help/serc Normal file
View File

@ -0,0 +1,15 @@
serc -- $HOME/.serc -- Se Initialization File
The file $HOME/.serc, if it exists, is read when se starts up.
If a line begins with a '#', it is treated as a comment and is
ignored. It is useful for setting personal options without
the user having to type them in on the command line or use a
special shell file or alias. Here is a sample .serc file:
# turn on unix mode, tabs every 8 columns, auto indent
opu
ot+8
oia
Command line options ALWAYS override any options set by commands
in the .serc file.

17
help/shell Normal file
View File

@ -0,0 +1,17 @@
! --- shell escape
default range syntax
1,$ ![<Unix command>]
The user's choice of shell is taken from the $SHELL environment vari-
able and used to execute <Unix command> if it is present. Otherwise,
an interactive shell is created. A leading ! is replaced by the pre-
vious shell command. Thus !! executes the previous command. An
unescaped % is replaced by the saved file name. An expanded shell
command is echoed before it is executed. After an interactive shell
exits, the screen is immediately redrawn. If a command was run, the
results are left on the screen, and the user must type a return to
redraw the editing window.
To return to the command directory, type "hcomdir".

13
help/specl Normal file
View File

@ -0,0 +1,13 @@
The "=" command displays the last line number in the line
number list (default ".") as a number. For example, "="
prints the line number of the current line, or "$=" prints the
line number of the last line (the number of lines).
The ":" command, with no preceeding line numbers, moves the
window so that the next screenful of text is visible. With a
line number, it makes the window begin at the referenced line.
The top line in the window becomes the current line.
For general information about commands, type "hcom".
For a description of command syntax, type "hcomsyn".
To see a directory of the other commands, type "hcomdir".

11
help/t Normal file
View File

@ -0,0 +1,11 @@
t -- To command
default range syntax
.,. from-here,to-here t after-here
Reproduce the block of lines identified by the range field of
the command and place them after the named line.
To return to the command directory, type "hcomdir."
See also: "hm".

11
help/termchar Normal file
View File

@ -0,0 +1,11 @@
Command Terminating Control Characters
The Carriage Return character terminates a command, but first
erases any characters at and to the right of the cursor.
CTRL-V, on the other hand, skips the cursor to the right end
of the line, then terminates it. The "Funny Return" character
CTRL-F serves different purposes depending on what routine is
soliciting the command.
For more about CTRL-F, see "habt" and "hrpt".
The general control character directory is "hcc".

10
help/tilde Normal file
View File

@ -0,0 +1,10 @@
~ --- exclude on markname
default range syntax
1,$ ~<m>command
Similar to the "x" prefix, except that "command" is performed
for all lines in the range that do not have the mark name <m>.
To return to the command directory, type "hcomdir".

18
help/u Normal file
View File

@ -0,0 +1,18 @@
u -- Undo command.
default range syntax
. u[d]
1. "u" is used to undo modifications to a line immediately
after changes are made. E.g. if you substituted "pat" for
"hat" in a line, to reverse that operation immediately, simply
type "u" (RETURN).
2. "ud" is used to restore a group of lines that have been
delete E.g. if "n,md" deletes lines n thru m, then if you
position the curser to line n-1 and issue "ud" the deleted
lines will appear. (Or you can set the od toggle to od< so
that the line pointer is automatically set to n-1.
To return to the command directory, type "hcomdir."
See also: "hd" and "hod".

11
help/v Normal file
View File

@ -0,0 +1,11 @@
v -- oVerlay command
default range syntax
.,. v
Inline editing mode is entered using this command. The curser
is positioned at the column set by the "ov" command. Inline
editing may now be performed using control characters.
To return to the command directory, type "hcomdir."
See also: "hcc" and "hmotion".

15
help/w Normal file
View File

@ -0,0 +1,15 @@
w -- Write command
default range syntax
1,$ w[! | + | >] [file name]
"w" writes the buffer to a file. If issued without a file
name the current file name is used. If "f" was used to change
the file name or if a file name was given, a new file will be
created and written unless the file already exits which causes
a warning. The warning may be bypassed using "w!". Options
[+] or [>] mean to append to the file instead of writing over
it. Se expands environment variables occuring in file names.
To return to the command directory, type "hcomdir."
See also: "hf", "hok".

14
help/x Normal file
View File

@ -0,0 +1,14 @@
x -- Global exclude on pattern
default range syntax
1,$ x/pattern/command
"x" is used to perform an editing command on all lines that
do not match the "pattern". "pattern" is any legal pattern and
command is an editor command. The "g" command is the converse
of "x" and performs the command on all lines that do match the
pattern. The "/" may be any character.
To return to the command directory, type "hcomdir."
See also: "hg" and "hpat".

11
help/y Normal file
View File

@ -0,0 +1,11 @@
y -- translYterate command
default range syntax
.,. y/from-range/to-range[/]
Characters in the "from-range" are converted to their
corresponding characters in the "to-range". The "/" may be an
character. The trailing delimiter is optional.
To return to the command directory, type "hcomdir."
See also: "hs".

18
help/z Normal file
View File

@ -0,0 +1,18 @@
z -- do special extended things
default range syntax
lines must be given line,line z <option> <stuff>
The z command command is used for doing special extended
things. Currently, the only option available is b, to draw
a box into the buffer. It works as follows:
lin,lin zb<left>[,<right>][<char>]
The two <lin>s specify where in the buffer to put the box,
<left> and <right> tell which column to which column, and
the <char> is the character to use to draw the box. As an
example,
.,.+4zb10,50*
draws a box, OVER the text that is there. Try it on some
BLANK lines.

5
man/Makefile.am Normal file
View File

@ -0,0 +1,5 @@
# This file is in the public domain.
man_MANS = se.1 scriptse.1
EXTRA_DIST = $(man_MANS)

438
man/Makefile.in Normal file
View File

@ -0,0 +1,438 @@
# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
# This file is in the public domain.
VPATH = @srcdir@
am__make_dryrun = \
{ \
am__dry=no; \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
*) \
for am__flg in $$MAKEFLAGS; do \
case $$am__flg in \
*=*|--*) ;; \
*n*) am__dry=yes; break;; \
esac; \
done;; \
esac; \
test $$am__dry = yes; \
}
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = man
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
man1dir = $(mandir)/man1
am__installdirs = "$(DESTDIR)$(man1dir)"
NROFF = nroff
MANS = $(man_MANS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTERMCAP = @LIBTERMCAP@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
man_MANS = se.1 scriptse.1
EXTRA_DIST = $(man_MANS)
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign man/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign man/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
install-man1: $(man_MANS)
@$(NORMAL_INSTALL)
@list1=''; \
list2='$(man_MANS)'; \
test -n "$(man1dir)" \
&& test -n "`echo $$list1$$list2`" \
|| exit 0; \
echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \
$(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \
{ for i in $$list1; do echo "$$i"; done; \
if test -n "$$list2"; then \
for i in $$list2; do echo "$$i"; done \
| sed -n '/\.1[a-z]*$$/p'; \
fi; \
} | while read p; do \
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; echo "$$p"; \
done | \
sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
sed 'N;N;s,\n, ,g' | { \
list=; while read file base inst; do \
if test "$$base" = "$$inst"; then list="$$list $$file"; else \
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \
fi; \
done; \
for i in $$list; do echo "$$i"; done | $(am__base_list) | \
while read files; do \
test -z "$$files" || { \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \
done; }
uninstall-man1:
@$(NORMAL_UNINSTALL)
@list=''; test -n "$(man1dir)" || exit 0; \
files=`{ for i in $$list; do echo "$$i"; done; \
l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
sed -n '/\.1[a-z]*$$/p'; \
} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir)
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
distdir: $(DISTFILES)
@list='$(MANS)'; if test -n "$$list"; then \
list=`for p in $$list; do \
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \
if test -n "$$list" && \
grep 'ab help2man is required to generate this page' $$list >/dev/null; then \
echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \
grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \
echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \
echo " typically \`make maintainer-clean' will remove them" >&2; \
exit 1; \
else :; fi; \
else :; fi
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(MANS)
installdirs:
for dir in "$(DESTDIR)$(man1dir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am: install-man
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man: install-man1
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-man
uninstall-man: uninstall-man1
.MAKE: install-am install-strip
.PHONY: all all-am check check-am clean clean-generic distclean \
distclean-generic distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-man1 install-pdf install-pdf-am install-ps \
install-ps-am install-strip installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \
uninstall-am uninstall-man uninstall-man1
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

67
man/scriptse.1 Normal file
View File

@ -0,0 +1,67 @@
.\"
.\" scriptse.1 man page
.\"
.\" This file is in the public domain.
.\"
.TH SCRIPTSE 1 local
.SH NAME
scriptse \- make scripts for se
.SH SYNOPSIS
.B scriptse
[
.B \-d
]
< script_file |
.B se
[ & ]
.SH DESCRIPTION
.I Scriptse
reads standard input, and writes standard output.
It is a simple filter which turns newlines ('\en') into carriage
returns ('\er') for
.IR se (1).
This allows
.I se
to be run from a prepared script.
.I Se
can then be fired off into the background, if you wish.
.PP
After each carriage return,
.I scriptse
adds an ASCII DEL character ('\e177').
This is so that command lines which fail will be erased,
and the next command can then be executed.
If it did not, command lines would get concatenated together, and they
would simply continue to fail.
Ultimately, the editor would run out of input buffer and start to
contiunuously ring the bell on the terminal.
With the DEL character, each command line is executed on its own.
.PP
.I Scriptse
takes one option, \-d.
If this option is used,
.I scriptse
will
.I not
add the ASCII DEL after each carriage return.
This is useful for program which want to turn newlines into carraige
returns.
.PP
If you do use a script, either sit back and watch it run, or redirect
the output into a file (or
.BR /dev/null ,
if you are confident).
.SH SEE ALSO
.IR se (1).
.SH CAVEATS
.PP
It is rather difficult to interrupt
.I se
when it is running, so editor scripts should write their
changed buffer to a new file, in case something goes wrong.
.SH BUGS
.PP
Does no checking for any of
.IR se 's
control characters.
If you put control characters into a script, you are taking your chances.

1344
man/se.1 Normal file

File diff suppressed because it is too large Load Diff

70
src/ascii.h Normal file
View File

@ -0,0 +1,70 @@
/*
** ascii.h
**
** definitions of ASCII mnemonics and synonyms.
** This file is part of mse, under GPLv3.
*/
#ifndef __ASCII_H
#define __ASCII_H
#define NUL '\0'
#define SOH '\001'
#define STX '\002'
#define ETX '\003'
#define EOT '\004'
#define ENQ '\005'
#define ACK '\006'
#define BEL '\007'
#define BS '\010'
#define HT '\011'
#define LF '\012'
#define VT '\013'
#define FF '\014'
#define CR '\015'
#define SO '\016'
#define SI '\017'
#define DLE '\020'
#define DC1 '\021'
#define DC2 '\022'
#define DC3 '\023'
#define DC4 '\024'
#define NAK '\025'
#define SYN '\026'
#define ETB '\027'
#define CAN '\030'
#define EM '\031'
#define SUB '\032'
#define ESC '\033'
#define FS '\034'
#define GS '\035'
#define RS '\036'
#define US '\037'
#define SP '\040'
#define DEL '\177'
#define CTRL_A SOH
#define CTRL_B STX
#define CTRL_C ETX
#define CTRL_D EOT
#define CTRL_E ENQ
#define CTRL_F ACK
#define CTRL_G BEL
#define CTRL_H BS
#define CTRL_I HT
#define CTRL_J LF
#define CTRL_K VT
#define CTRL_L FF
#define CTRL_M CR
#define CTRL_N SO
#define CTRL_O SI
#define CTRL_P DLE
#define CTRL_Q DC1
#define CTRL_R DC2
#define CTRL_S DC3
#define CTRL_T DC4
#define CTRL_U NAK
#define CTRL_V SYN
#define CTRL_W ETB
#define CTRL_X CAN
#define CTRL_Y EM
#define CTRL_Z SUB
#endif

193
src/changetty.c Normal file
View File

@ -0,0 +1,193 @@
/*
** changetty.c
**
** Localize in one place all the data and functions
** needed to change to and from cbreak mode for
** the se screen editor.
**
** Only functions available to rest of se are:
** ttyedit(), ttynormal(), and getspeed().
**
** If USG is defined, we use the System V TTY driver.
** Otherwise (the default) we use the Berkeley terminal driver.
**
** If we are using System V, then the Release 2 version does not
** need ospeed. If not release 2, we assume Release 1 that someone
** have moved the BSD termlib to.
**
** This file is part of mse, under GPLv3.
*/
#include "config.h"
#include "ascii.h"
#include "constdefs.h"
#include "changetty.h"
#include "main.h"
#ifdef HAVE_TERMIOS_H
#include <termios.h>
#else
/* fallback to termio */
#ifdef HAVE_TERMIO_H
#include <termio.h>
#endif
#endif
extern short ospeed; /* from the termlib library */
static int set_ospeed = NO;
static TTYINFO OldTtyInfo; /* initial state of terminal */
static TTYINFO NewTtyInfo; /* modified state for editing */
static int first = YES; /* first time anything called */
void init(void)
{
if (gttyinfo(1, &OldTtyInfo) == -1) /* get current state */
{
error (NO, "couldn't get TTY info from system. get help!\n");
}
NewTtyInfo = OldTtyInfo; /* copy it */
mttyinfo(&NewTtyInfo); /* change, but don't reset terminal */
/* really should check the return value here ... */
}
void ttyedit(void) /* set the terminal to correct modes for editing */
{
if (first == YES)
{
first = NO;
init();
}
sttyinfo(1, &NewTtyInfo); /* make the change */
/* really should check the return value here too ... */
}
void ttynormal(void) /* set the terminal to correct modes for normal use */
{
if (first)
{
first = NO;
init();
}
sttyinfo(1, &OldTtyInfo); /* make the change */
}
/* getspeed --- find out the terminal speed in characters/second */
/* this routine only used if terminal types are hardwired */
/* into se, however, since it will be in an archive, the */
/* loader won't grab it if it isn't needed. */
int getspeed(int fd)
{
int i;
TTYINFO ttybuf;
static struct brstruct {
int unixrate;
int cps;
int baudrate;
} stab[] = {
B0, 0, 0,
B50, 5, 50,
B75, 8, 75,
B110, 10, 110,
B134, 14, 134,
B150, 15, 150,
B200, 20, 200,
B300, 30, 300,
B600, 60, 600,
B1200, 120, 1200,
B1800, 180, 1800,
B2400, 240, 2400,
B4800, 480, 4800,
B9600, 960, 9600
};
if (first) /* might as well set it here, too */
{
first = NO;
init();
}
if (gttyinfo(fd, &ttybuf) == -1)
{
return 960;
}
for (i = 0; i < sizeof(stab) / sizeof(struct brstruct); i++)
{
if (stab[i].unixrate == (ttybuf.c_cflag & 017))
{
return stab[i].cps;
}
}
return 960;
}
/* gttyinfo --- make all necessary calls to obtain terminal status */
int gttyinfo(int fd, TTYINFO *buf)
{
#ifdef HAVE_TCGETATTR
if (tcgetattr(fd, buf))
{
return -1;
}
#else
if (ioctl(fd, TCGETA, buf) < 0)
{
return -1;
}
#endif
if (set_ospeed == NO)
{
set_ospeed = YES;
ospeed = buf->c_cflag & 017;
}
return 0;
}
/* mttyinfo --- modify a TTYINFO structure for interactive operation */
int mttyinfo(TTYINFO *buf)
{
buf->c_cc[0] = DLE; /* interrupt */
buf->c_cc[1] = -1; /* ignore quit */
buf->c_cc[4] = 1; /* min # chars to read */
buf->c_cc[5] = 1; /* min time to wait */
buf->c_iflag &= ~(INLCR|IGNCR|ICRNL); /* allow CR to come thru */
buf->c_lflag |= ISIG|NOFLSH; /* keep these bits */
buf->c_lflag &= ~(ICANON|ECHO|ECHOE|ECHOK|ECHONL
#ifdef XCASE
|XCASE
#endif
);
return 0;
}
/* sttyinfo --- make all necessary calls to set terminal status */
int sttyinfo(int fd, TTYINFO *buf)
{
#ifdef HAVE_TCSETATTR
if (tcsetattr(fd, TCSANOW, buf) < 0)
#else
if (ioctl(fd, TCSETAW, buf) < 0)
#endif
{
return -1;
} else {
return 0;
}
}

29
src/changetty.h Normal file
View File

@ -0,0 +1,29 @@
/*
** changetty.h
**
** This file is part of mse, under GPLv3.
*/
#ifndef __CHANGETTY_H
#define __CHANGETTY_H
#ifdef HAVE_TERMIOS_H
#include <termios.h>
typedef struct termios TTYINFO;
#else
/* fallback to termio */
#ifdef HAVE_TERMIO_H
#include <termio.h>
typedef struct termio TTYINFO;
#endif /* HAVE_TERMIO_H */
#endif /* HAVE_TERMIOS_H */
void init(void);
void ttyedit(void);
void ttynormal(void);
int getspeed(int fd);
int gttyinfo(int fd, TTYINFO *buf);
int mttyinfo(TTYINFO *buf);
int sttyinfo(int fd, TTYINFO *buf);
#endif

77
src/config.h Normal file
View File

@ -0,0 +1,77 @@
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the `bsd' library (-lbsd). */
/* #undef HAVE_LIBBSD */
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the `tcgetattr' function. */
#define HAVE_TCGETATTR 1
/* Define to 1 if you have the `tcsetattr' function. */
#define HAVE_TCSETATTR 1
/* Define to 1 if you have the <termcap.h> header file. */
#define HAVE_TERMCAP_H 1
/* Define to 1 if you have the <termios.h> header file. */
#define HAVE_TERMIOS_H 1
/* Define to 1 if you have the <termio.h> header file. */
/* #undef HAVE_TERMIO_H */
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* log every time se is invoked */
/* #undef LOG_USAGE */
/* Name of package */
#define PACKAGE "se"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "tcort@se-editor.org"
/* Define to the full name of this package. */
#define PACKAGE_NAME "se"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "se 3.0.1"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "se"
/* Define to the home page for this package. */
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "3.0.1"
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Version number of package */
#define VERSION "3.0.1"

16
src/constdefs.h Normal file
View File

@ -0,0 +1,16 @@
/*
** constdefs.h
**
** Standard macro definitions for se screen editor
**
** This file is part of mse, under GPLv3.
*/
#ifndef __CONSTDEFS_H
#define __CONSTDEFS_H
#define EOS '\0'
#define ERR (-3)
#define OK (-2)
#define NO 0
#define YES 1
#endif

1473
src/docmd1.c Normal file

File diff suppressed because it is too large Load Diff

27
src/docmd1.h Normal file
View File

@ -0,0 +1,27 @@
/*
** docmd1.h
**
** This file is part of mse, under GPLv3.
*/
#ifndef __DOCMD1_H
#define __DOCMD1_H
#include <stdio.h>
int docmd(char lin[], int i, int glob, int *status);
void dohelp(char lin[], int *i, int *status);
int doopt(char lin[], int *i);
int domark(char kname);
int doprnt(int from, int to);
int doread(int line, char *file, int tflag);
int dosopt(char lin[]);
int dotlit(char sub[], int allbut);
int doundo(int dflg, int *status);
int dowrit(int from, int to, char *file, int aflag, int fflag, int tflag);
char *expand_env(char *file);
FILE *crypt_open(char *file, char *mode);
void crypt_close(FILE *fp);
void getkey(void);
#endif

867
src/docmd2.c Normal file
View File

@ -0,0 +1,867 @@
/*
** docmd2.c
**
** routines to actually execute commands
**
** This file is part of mse, under GPLv3.
*/
#include "config.h"
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include "se.h"
#include "changetty.h"
#include "docmd1.h"
#include "docmd2.h"
#include "edit.h"
#include "extern.h"
#include "main.h"
#include "misc.h"
#include "pat.h"
#include "scratch.h"
#include "screen.h"
#include "term.h"
/* append --- append lines after "line" */
int append (int line, char str[])
{
char lin[MAXLINE];
char term;
int ret;
int len, i, dpos, dotseen;
Curln = line;
if (str[0] == ':') /* text to be added is in the command line */
ret = inject (&str[1]);
else
{
Cmdrow = Toprow + (Curln - Topln) + 1; /* 1 below Curln */
lin[0] = EOS;
if (Indent > 0 || line <= 0)
len = max (0, Indent - 1);
else /* do auto indent */
{
LINEDESC *k;
k = se_gettxt (line);
for (len = 0; Txt[len] == ' '; len++)
;
}
dpos = len; /* position for terminating '.' */
for (ret = NOSTATUS; ret == NOSTATUS; )
{
if (! hwinsdel()) /* do it the old, slow way */
{
if (Cmdrow > Botrow)
{
Cmdrow = Toprow + 1;
cprow (Botrow, Toprow);
adjust_window (Curln, Curln);
if (First_affected > Topln)
First_affected = Topln;
}
clrrow (Cmdrow);
if (Cmdrow < Botrow)
clrrow (Cmdrow + 1);
}
else /* try to be smart about it */
{
if (Cmdrow > Botrow)
{
Cmdrow--;
dellines (Toprow, 1);
inslines (Cmdrow, 1);
Topln++;
}
else
{
dellines (Botrow, 1);
inslines (Cmdrow, 1);
}
}
prompt ("apd>");
do
getcmd (lin, Firstcol, &len, &term);
while (term == CURSOR_UP || term == CURSOR_DOWN
|| term == CURSOR_SAME);
dotseen = 0;
if (lin[0] == '.' && lin[1] == '\n' && lin[2] == EOS)
dotseen = 1;
for (i = 0; i < dpos && lin[i] == ' '; i++)
;
if (i == dpos && lin[dpos] == '.' && lin[dpos + 1] == '\n'
&& lin[dpos+2] == EOS)
dotseen = 1;
if (dotseen)
{
if (hwinsdel())
{
dellines (Cmdrow, 1);
inslines (Botrow, 1);
}
ret = OK;
}
else if (inject (lin) == ERR)
ret = ERR;
else /* inject occured */
prompt (""); /* erase prompt */
Cmdrow++;
if (term != FUNNY)
{
if (Indent > 0)
len = Indent - 1;
else /* do auto indent */
for (len = 0; lin[len] == ' '; len++)
;
dpos = len;
lin[0] = EOS;
}
}
Cmdrow = Botrow + 1;
if (hwinsdel()) /* since we take control */
{ /* of the screen, we're sure */
Sctop = Topln; /* it's still OK */
for (i = 0; i < Sclen; i++)
Scline[i] = Sctop + i <= Lastln ? i : -1;
}
}
if (Curln == 0 && Lastln > 0) /* for 0a or 1i followed by "." */
Curln = 1;
if (First_affected > line)
First_affected = line;
tflush ();
return (ret);
}
/* copy --- copy line1 through line2 after line3 */
int copy (int line3)
{
int i;
int ret;
LINEDESC *ptr3, *after3, *k;
ret = ERR;
if (Line1 <= 0)
Errcode = EORANGE;
else
{
ret = OK;
Curln = line3;
k = getind (Line1);
for (i = Line1; i <= Line2; i++)
{
gtxt (k);
if (inject (Txt) == ERR || intrpt ())
{
ret = ERR;
break;
}
if (Line1 < line3)
k++;
else
k += 2;
/*
* inject calls blkmove, which will shift the
* lines down one in the array, so we add two
* instead of one to get to the next line.
*/
}
First_affected = min (First_affected, line3 + 1);
}
return (ret);
}
/* delete --- delete lines from through to */
int se_delete (int from, int to, int *status)
{
LINEDESC *k1, *k2, *j1, *j2, *l1;
if (from <= 0) /* can't delete line 0 */
{
*status = ERR;
Errcode = EORANGE;
}
else
{
if (First_affected > from)
First_affected = from;
blkmove (from, to, MAXBUF - 1); /* stick at end of buffer */
Lastln -= to - from + 1; /* adjust number of last line */
Curln = prevln (from);
Lost_lines += Limcnt;
Limcnt = to - from + 1; /* number of lines "deleted" */
/* point at first deleted */
Limbo = &Buf[MAXBUF - (to - from + 1)];
*status = OK;
svdel (from, to - from + 1);
Buffer_changed = YES;
}
return (*status);
}
/* join --- join a group of lines into a single line */
int join (char sub[])
{
char new[MAXLINE];
int l, line, sublen;
int ret;
LINEDESC *k;
ret = OK;
if (Line1 <= 0)
{
Errcode = EORANGE;
return (ERR);
}
sublen = strlen (sub) + 1; /* length of separator & EOS */
line = Line1;
k = getind (line);
gtxt (k);
move_ (Txt, new, (int) k -> Lineleng); /* move in first chunk */
l = k -> Lineleng;
for (line++; line <= Line2; line++)
{
if (intrpt ())
return (ERR);
if (new[l - 2] == '\n') /* zap the NEWLINE */
l--;
k = NEXTLINE(k); /* get the next line */
gtxt (k);
if (l + sublen - 1 + k -> Lineleng - 1 > MAXLINE) /* won't fit */
{
Errcode = E2LONG;
return (ERR);
}
move_ (sub, &new[l - 1], sublen); /* insert separator string */
l += sublen - 1;
move_ (Txt, &new[l - 1], (int) k -> Lineleng); /* move next line */
l += k -> Lineleng - 1;
}
Curln = Line2; /* all this will replace line1 through line2 */
ret = inject (new); /* inject the new line */
if (ret == OK)
ret = se_delete (Line1, Line2, &ret); /* delete old lines */
Curln++;
if (First_affected > Curln)
First_affected = Curln;
return (ret);
}
/* move --- move line1 through line2 after line3 */
int move (int line3)
{
LINEDESC *k0, *k1, *k2, *k3, *k4, *k5;
if (Line1 <= 0)
{
Errcode = EORANGE;
return (ERR);
}
if (Line1 <= line3 && line3 <= Line2)
{
Errcode = EINSIDEOUT;
return (ERR);
}
blkmove (Line1, Line2, line3);
if (line3 > Line1)
{
Curln = line3;
}
else
Curln = line3 + (Line2 - Line1 + 1);
Buffer_changed = YES;
First_affected = min (First_affected, min (Line1, line3));
return (OK);
}
/* overlay --- let user edit lines directly */
void overlay (int *status)
{
char savtxt[MAXLINE], term, kname;
static char empty[] = "\n";
int lng, vcol, lcurln, scurln;
LINEDESC *indx;
*status = OK;
if (Line1 == 0)
{
Curln = 0;
*status = inject (empty);
if (*status == ERR)
return;
First_affected = 1;
Line1 = 1;
Line2++;
}
for (lcurln = Line1; lcurln <= Line2; lcurln++)
{
Curln = lcurln;
vcol = Overlay_col - 1;
do {
adjust_window (Curln, Curln);
updscreen ();
Cmdrow = Curln - Topln + Toprow;
indx = se_gettxt (Curln);
lng = indx -> Lineleng;
if (Txt[lng - 2] == '\n') /* clobber newline */
lng--;
if (vcol < 0)
vcol = lng - 1;
while (lng - 1 < vcol)
{
Txt[lng - 1] = ' ';
lng++;
}
Txt[lng - 1] = '\n';
Txt[lng] = EOS;
move_ (Txt, savtxt, lng + 1); /* make a copy of the line */
getcmd (Txt, Firstcol, &vcol, &term);
if (term == FUNNY)
{
if (First_affected > Curln)
First_affected = Curln;
Cmdrow = Botrow + 1;
return;
}
if (strcmp (Txt, savtxt) != 0) /* was line changed? */
{
kname = indx -> Markname;
se_delete (Curln, Curln, status);
scurln = Curln;
if (*status == OK)
*status = inject (Txt);
if (*status == ERR)
{
Cmdrow = Botrow + 1;
return;
}
indx = getind (nextln (scurln));
indx -> Markname = kname;
}
else
{ /* in case end-of-line is moved */
if (First_affected > Curln)
First_affected = Curln;
}
switch (term) {
case CURSOR_UP:
if (Curln > 1)
Curln--;
else
Curln = Lastln;
break;
case CURSOR_DOWN:
if (Curln < Lastln)
Curln++;
else
Curln = min (1, Lastln);
break;
case CURSOR_SAME:
vcol = 0;
break;
}
} while (term == CURSOR_UP ||
term == CURSOR_DOWN ||
term == CURSOR_SAME);
}
Cmdrow = Botrow + 1;
return;
}
/* subst --- substitute "sub" for occurrences of pattern */
int subst (char sub[], int gflag, int glob)
{
char new[MAXLINE], kname;
int line, m, k, lastm;
int j, junk, status, subbed, ret;
int tagbeg[10], tagend[10];
LINEDESC *inx;
if (Globals && glob)
ret = OK;
else
ret = ERR;
if (Line1 <= 0)
{
Errcode = EORANGE;
return (ERR);
}
/* the following code has been removed for your protection
se_index() occasionally grabs newlines out of the character class
counter in a pattern. for example [0-9] doesn't work due to this
if (se_index (Pat, '\n') != -1) # never delete NEWLINE
{
Errcode = EBADPAT;
return (ERR);
}
*/
for (line = Line1; line <= Line2; line++)
{
if (intrpt ())
break;
j = 0;
subbed = NO;
inx = se_gettxt (line);
lastm = -1;
for (k = 0; Txt[k] != EOS; )
{
for (m = 1; m <= 9; m++)
{
tagbeg[m] = -1;
tagend[m] = -1;
}
if (gflag == YES || subbed == NO)
m = amatch (Txt, k, Pat, &tagbeg[1], &tagend[1]);
else
m = -1;
if (m > -1 && lastm != m) /* replace matched text */
{
subbed = YES;
tagbeg[0] = k;
tagend[0] = m;
catsub (Txt, tagbeg, tagend, sub, new, &j, MAXLINE);
lastm = m;
}
if (m == -1 || m == k) /* no match or null match */
{
junk = addset (Txt[k], new, &j, MAXLINE);
k++;
}
else
k = m; /* skip matched text */
}
if (subbed == YES)
{
if (addset (EOS, new, &j, MAXLINE) == NO)
{
ret = ERR;
Errcode = E2LONG;
break;
}
kname = inx -> Markname;
se_delete (line, line, &status); /* remembers dot */
ret = inject (new);
if (First_affected > Curln)
First_affected = Curln;
if (ret == ERR)
break;
inx = getind (Curln);
inx -> Markname = kname;
ret = OK;
Buffer_changed = YES;
}
else /* subbed == NO */
Errcode = ENOMATCH;
}
return (ret);
}
/* uniquely_name --- mark-name line; make sure no other line has same name */
void uniquely_name (char kname, int *status)
{
int line;
LINEDESC *k;
defalt (Curln, Curln);
if (Line1 <= 0)
{
*status = ERR;
Errcode = EORANGE;
return;
}
*status = OK;
line = 0;
k = Line0;
do {
line++;
k = NEXTLINE(k);
if (line == Line2)
k -> Markname = kname;
else if (k -> Markname == kname)
k -> Markname = DEFAULTNAME;
} while (line < Lastln);
return;
}
/* draw_box --- draw or erase a box at coordinates in command line */
int draw_box (char lin[], int *i)
{
int left, right, col, len;
int junk;
LINEDESC *k;
char text[MAXLINE];
char kname, ch;
left = ctoi (lin, i);
if (left <= 0 || left > MAXLINE)
{
Errcode = EBADCOL;
return (ERR);
}
if (lin[*i] == ',')
{
(*i)++;
SKIPBL (lin, *i);
right = ctoi (lin, i);
if (right <= 0 || right >= MAXLINE || left > right)
{
Errcode = EBADCOL;
return (ERR);
}
}
else
right = left;
SKIPBL (lin, *i);
if (lin[*i] == '\n')
ch = ' ';
else
ch = lin[(*i)++];
if (lin[*i] != '\n')
{
Errcode = EEGARB;
return (ERR);
}
if (Line1 <= 0)
{
Errcode = EORANGE;
return (ERR);
}
for (Curln = Line1; Curln <= Line2; Curln++)
{
k = se_gettxt (Curln);
len = k -> Lineleng;
move_ (Txt, text, len);
if (text[len - 2] == '\n')
col = len - 1;
else
col = len;
while (col <= right)
{
text[col - 1] = ' ';
col++;
}
text[col - 1] = '\n';
text[col] = EOS;
if (Curln == Line1 || Curln == Line2)
for (col = left; col <= right; col++)
text[col - 1] = ch;
else
{
text[left - 1] = ch;
text[right - 1] = ch;
}
if (strcmp (text, Txt) != 0)
{
kname = k -> Markname;
if (se_delete (Curln, Curln, &junk) == ERR
|| inject (text) == ERR)
return (ERR);
k = getind (Curln);
k -> Markname = kname;
Buffer_changed = YES;
}
}
Curln = Line1; /* move to top of box */
if (First_affected > Curln)
First_affected = Curln;
adjust_window (Curln, Curln);
updscreen ();
return (OK);
}
/* dfltsopt --- set the 's' option to the extension on the file name */
void dfltsopt (char name[])
{
int i;
for (i = strlen (name) - 1; i >= 0; i--)
if (name[i] == '.')
{
dosopt (&name[i + 1]);
break;
}
if (i < 0)
dosopt ("");
}
/* doshell --- escape to the Shell to run one or more Unix commands */
/*
** emulate vi: if running just a shell, redraw the screen as
** soon as the shell exits. if running a program, let the user
** redraw the screen when he/she is ready.
**
** also emulate USG Unix 5.0 ed: a ! as the first character is
** replaced by the previous shell command; an unescaped % is replaced
** by the saved file name. The expanded command is echoed.
*/
#define DEFAULT_PATH SHELL
#define DEF_SHELL (rindex(DEFAULT_PATH, '/') ? rindex(DEFAULT_PATH, '/') + 1 : NULL)
int doshell (char lin[], int *pi)
{
int rc;
int forkstatus, childstatus;
void (*save_quit)(int);
void (*save_int)(int);
int i, auto_redraw;
char *path, *name, *p;
char new_command[MAXLINE];
int j, k;
static char sav_com[MAXLINE] = "";
int expanded = NO;
if (Nlines == 0) /* use normal 'ed' behavior */
{
tflush (); /* flush out the terminal output */
position_cursor (Nrows - 1, 0); /* bottom left corner */
if ((p = getenv ("SHELL")) == NULL || strcmp (p, DEFAULT_PATH) == 0)
{
path = DEFAULT_PATH;
name = DEF_SHELL; /* default */
}
/* on Berkeley systems, check the other shell */
else if (strcmp (p, "/bin/sh") == 0)
{
path = "/bin/sh";
name = "sh";
}
else
{
if (p[0] == '/') /* full pathname there */
{
/* work backwards to find just name */
path = p;
i = strlen (p);
while (p[i] != '/')
i--;
i++; /* skip '/' */
name = &p[i];
}
else
{
char buf[MAXLINE];
memset(buf, '\0', MAXLINE);
snprintf (buf, MAXLINE-1,
"unknown shell, using %s",
DEF_SHELL);
remark (buf);
path = DEFAULT_PATH;
name = DEF_SHELL;
}
}
auto_redraw = (lin[*pi] == '\n') ? YES : NO;
/* build command, checking for leading !, and % anywhere */
if (lin[*pi] == '!')
{
if (sav_com[0] != EOS)
{
for (j = 0; sav_com[j] != EOS; j++)
new_command[j] = sav_com[j];
if (new_command[j-1] == '\n')
j--;
(*pi)++;
expanded = YES;
}
else
{
Errcode = ENOCMD;
return (ERR);
}
}
else
j = 0;
for (i = *pi; lin[i] != EOS; i++)
{
if (lin[i] == ESCAPE)
{
if (lin[i+1] != '%')
{
new_command[j++] = ESCAPE;
new_command[j++] = lin[++i];
}
else
new_command[j++] = lin[++i];
}
else if (lin[i] == '%')
{
for (k = 0; Savfil[k] != EOS; k++)
new_command[j++] = Savfil[k];
expanded = YES;
}
else
new_command[j++] = lin[i];
}
if (new_command[j-1] == '\n')
j--;
new_command[j] = EOS;
memset (sav_com, EOS, MAXLINE);
strncpy (sav_com, new_command, MAXLINE-1); /* save it */
ttynormal ();
t_exit ();
rc = write (1, "\n\n", 2); /* clear out a line */
if (rc == -1)
{
Errcode = ESTUPID;
return ERR;
}
forkstatus = fork();
if (forkstatus == -1) /* the fork failed */
{
ttyedit ();
t_init ();
Errcode = ECANTFORK;
return ERR;
}
if (forkstatus == 0) /* we're in the child process */
{
signal (SIGINT, SIG_DFL);
signal (SIGQUIT, SIG_DFL);
if (strcmp (name, "sh") != 0) /* not /bin/sh */
{
signal (SIGTSTP, SIG_DFL);
}
else
{
signal (SIGTSTP, SIG_IGN);
}
if (auto_redraw) /* no params; run a shell */
{
execl (path, name, NULL);
_exit (RETERR); /* exec failed, notify parent */
}
else
{
if (expanded) /* echo it */
{
printf ("%s\n", new_command);
}
execl (path, name, "-c", new_command, NULL);
_exit (RETERR);
}
}
/* we're in the parent process here */
save_int = signal (SIGINT, SIG_IGN); /* ignore interrupts */
save_quit = signal (SIGQUIT, SIG_IGN);
while (wait (&childstatus) != forkstatus)
;
save_int = signal (SIGINT, save_int); /* catch interupts */
save_quit = signal (SIGQUIT, save_quit);
rc = write (1, "\n\n", 2); /* clear out some message space */
if (rc == -1)
{
Errcode = ESTUPID;
return ERR;
}
Currow = Nrows - 1;
Curcol = 0;
if ((childstatus >> 8) != 0)
{
ttyedit ();
t_init ();
Errcode = ENOSHELL;
return ERR;
}
/* a la vi: */
if (! auto_redraw)
{
int c;
printf ("type return to continue: ");
while ((c = getchar()) != '\n' && c != EOF)
;
}
ttyedit ();
t_init ();
restore_screen ();
return OK;
}
else
{
remark ("Not implemented yet");
}
return OK;
}

22
src/docmd2.h Normal file
View File

@ -0,0 +1,22 @@
/*
** docmd2.h
**
** This file is part of mse, under GPLv3.
*/
#ifndef __DOCMD2_H
#define __DOCMD2_H
int append (int line, char str[]);
int copy (int line3);
int se_delete (int from, int to, int *status);
int join (char sub[]);
int move (int line3);
void overlay (int *status);
int subst (char sub[], int gflag, int glob);
void uniquely_name (char kname, int *status);
int draw_box (char lin[], int *i);
void dfltsopt (char name[]);
int doshell (char lin[], int *pi);
#endif

1374
src/edit.c Normal file

File diff suppressed because it is too large Load Diff

38
src/edit.h Normal file
View File

@ -0,0 +1,38 @@
/*
** edit.h
**
** This file is part of mse, under GPLv3.
*/
#ifndef __EDIT_H
#define __EDIT_H
#include <stdio.h>
void edit(int argc, char *argv[]);
int getlst(char lin[], int *i, int *status);
int getnum(char lin[], int *i, int *pnum, int *status);
int getone(char lin[], int *i, int *num, int *status);
int ckglob(char lin[], int *i, int *status);
int doglob(char lin[], int *i, int *cursav, int *status);
int ckchar(char ch, char altch, char lin[], int *i, int *flag, int *status);
int ckp(char lin[], int i, int *pflag, int *status);
int ckupd(char lin[], int *i, char cmd, int *status);
void defalt(int def1, int def2);
int getfn(char lin[], int i, char filename[], size_t filenamesize);
int getkn(char lin[], int *i, char *kname, char dfltnm);
int getrange(char array[], int *k, char set[], int size, int *allbut);
int getrhs(char lin[], int *i, char sub[], size_t subsize, int *gflag);
int getstr(char lin[], int *i, char dst[], int maxdst);
int getwrd(char line[], int *i, char word[], int size);
int knscan(int way, int *num);
int makset(char array[], int *k, char set[], size_t size);
int optpat(char lin[], int *i);
int ptscan(int way, int *num);
int settab(char str[]);
void serc(void);
int serc_safe (char *path);
char *sysname(void);
void log_usage(void);
#endif

108
src/extern.h Normal file
View File

@ -0,0 +1,108 @@
/*
** extern.h
**
** external data definitions
** for the screen editor
**
** This file is part of mse, under GPLv3.
*/
#ifndef __EXTERN_H
#define __EXTERN_H
/* Concerning line numbers: */
extern int Line1; /* first line number on command */
extern int Line2; /* second line number on command */
extern int Nlines; /* number of line numbers specified */
extern int Curln; /* current line; value of dot */
extern int Lastln; /* last line; value of dollar */
/* Concerning patterns: */
extern char Pat[MAXPAT]; /* saved pattern */
/* Concerning the text of lines: */
extern char Txt[MAXLINE]; /* text of current line */
/* Concerning file names: */
extern char Savfil[MAXLINE]; /* remembered file name */
/* Concerning line descriptors: */
extern LINEDESC Buf[MAXBUF];
extern LINEDESC *Line0; /* head of list of line descriptors */
/* Concerning the 'undo' command: */
extern LINEDESC *Limbo; /* head of limbo list for undo */
extern int Limcnt; /* number of lines in limbo list */
/* Concerning the scratch file: */
extern int Scr; /* scratch file descriptor */
extern unsigned Scrend; /* end of info on scratch file */
extern char Scrname[MAXLINE]; /* name of scratch file */
extern int Lost_lines; /* number of garbage lines in scratch file */
/* Concerning miscellaneous variables */
extern int Buffer_changed; /* YES if buffer changed since last write */
extern int Errcode; /* cause of most recent error */
extern int Saverrcode; /* cause of previous error */
extern int Probation; /* YES if unsaved buffer can be destroyed */
extern int Argno; /* command line argument pointer */
extern char Last_char_scanned; /* last char scanned with ctl-s or -l */
extern char Peekc; /* push a SKIP_RIGHT if adding delimiters */
extern int Reading; /* are we doing terminal input? */
/* Concerning options: */
extern int Tabstops[MAXLINE]; /* array of tab stops */
extern char Unprintable; /* char to print for unprintable chars */
extern int Absnos; /* use absolute numbers in margin */
extern int Nchoise; /* choice of line number for cont. display */
extern int Overlay_col; /* initial cursor column for 'v' command */
extern int Warncol; /* where to turn on column warning */
extern int Firstcol; /* leftmost column to display */
extern int Indent; /* indent col; 0=same as previous line */
extern int Globals; /* substitutes in a global don't fail */
extern int No_hardware; /* never use hardware insert/delete */
/* Concerning the screen format: */
extern char Screen_image[MAXROWS][MAXCOLS];
extern char Msgalloc[MAXCOLS]; /* column allocation of status line */
extern int Nrows; /* number of rows on screen */
extern int Ncols; /* number of columns on screen */
extern int Currow; /* vertical cursor coordinate */
extern int Curcol; /* horizontal cursor coordinate */
extern int Toprow; /* top row of window field on screen */
extern int Botrow; /* bottom row of window field on screen */
extern int Cmdrow; /* row number of command line */
extern int Topln; /* line number of first line on screen */
extern int Insert_mode; /* flag to specify character insertion */
extern int Invert_case; /* flag to specify case mapping on input */
extern int First_affected; /* number of first line affected by cmd */
extern int Rel_a; /* char to use for first alpha line number */
extern int Rel_z; /* char to use for last alpha line number */
extern int Scline[MAXROWS]; /* lines currently on screen (rel to Sctop) */
extern int Sctop; /* first line currently on screen */
extern int Sclen; /* number of lines currently on screen */
extern char Blanks[MAXCOLS]; /* all blanks for filling in lines on screen */
extern char Tobuf[MAXTOBUF]; /* buffer for collecting terminal output */
extern char *Tobp; /* pointer to last used part of Tobuf */
/* Concerning interrupts: */
extern int Int_caught; /* caught a SIGINT from user */
extern int Hup_caught; /* caught a SIGHUP when phone line dropped */
extern int Catching_stops; /* catching or ignoring SIGTSTP's? */
/* Concerning file encryption: */
extern int Crypting; /* doing file encryption? */
extern char Key[KEYSIZE]; /* encryption key */
#endif

Some files were not shown because too many files have changed in this diff Show More