[net.sources] SCAME - an editor

leif@erix.UUCP (Leif Samuelsson) (02/16/85)

# This is a shell archive.  Remove anything before this line,
# then unpack it by saving it in a file and typing "sh file".
#
# Wrapped by erisun!leif on Sat Feb  9 18:11:04 MET 1985
# Contents:  README Makefile scame.1 config.sample BUGS scame.h k_funcs.h
 
echo x - README
sed 's/^@//' > "README" <<'@//E*O*F README//'
This is the editor called SCAME.

SCAME is just another one of those ersatz EMACS editors.
The purpose has been to make it look as much as possible like
EMACS on TOPS-20 and AMIS on TOPS-10 and VAX/VMS. A lot of
things are still missing, and some new facilities have been
added to make it fit in better with the UNIX philosophy.

HISTORY

SCAME was first implemented in 1980 on a PDP-11/70 running UNIX
v7 at the University of Linkoeping, Sweden. An old version is
still being used there in programming classes (They use EMACS on
DEC-20 and AMIS on DEC-10). The development was later moved,
first to a VAX running BSD 4.1 and most recently to a SUN
running BSD 4.2.

It has compiler switches for several different versions of UNIX,
but only the Berkeley version has been verified (to a degree).
It is not likely that it will run without modifications on a
PDP, especially not one without separate I&D. It is fairly
large, and always keep an entire buffer (file) in core.



HOW TO INSTALL SCAME

-  Move the directory "lib" to be "/usr/lib/scame" or to
   wherever you want it.

-  Copy the file config.sample to be config.h and then edit it
   to make sure that it applies to your installation.
   Define your machine type and UNIX version, as well as paths
   to special files and programs.

-  Finally issue "make scame" and cross your fingers.


TERMINAL TYPES

SCAME uses TERMCAP to handle different terminal types.
The terminal must be a CRT with the following capabilities:
- Clear screen (cl)
- Cursor up (up)
- Direct cursor addressing (cm) OR 
	Cursor home (ho) and Cursor right (nd)

Scame will also use the following, if available:
al - Insert Line
bs - Backspace
bc - Backspace if not ^H
cd - Clear to end of display
ce - Clear to end of line
cr - Carriage Return
cs - Scroll Region
dl - Delete Line
ke - Out of Keypad Transmit mode
ks - Keypad Transmit mode
nl - New Line
so - Enter standout mode
sr - Scroll Reverse
se - Exit standout mode
ti - Start of programs which use cm
te - End of programs which use cm
km - Meta-key	(This is a Boolean field saying that the terminal has
		 a META key which sets the most significant bit. It will
		 set the corresponding SCAME variable Hackmatic to 1 and
		 causes the terminal to run in raw mode)

For more information, read the documentation on TERMCAP in section 5
of the UNIX manual.


TEMPORARY FILES

SCAME uses a number of temporary files which are kept in a common
tmp-directory.  To make SCAME restartable, these files will not be
deleted upon exit.  Therefore, the files are not tied to any
specific invokation of SCAME, but rather to the process that invoked
SCAME (normally the login shell).  A consequence is that the temp-
files will stay in the tmp-directory even after the user logs out,
and will need explicit deletion by somebody.
To do this, a special program called "scame-reaper" is used.
It checks the tmp-directory for any of SCAME's temp-files whose
processes have died and deletes them.  It should be run often enough
to avoid cramming the tmp-directory and at least before every turn
of the process-counter or after restarting the system.  In Linkoping
it is run by "cron" three times a day (3 am, 1pm and 5pm).
This is achieved by including the following line in the file
/usr/lib/crontab:

0	3,13,17	*	*	*	/usr/lib/scame-reaper


BUGS
Plenty. If you find any, please let me know.
Send bug fixes to me, and I will post them to the net.

Here are some I know of already:

On machines without virtual memory, SCAME can't handle
files that are larger than about 44 kchars, due to the fact
that the current buffer is kept in primary memory.

SCAME can be very slow during some operations, very few
optimizations have been made.

There is a lot of documentation missing. (What did I do with it? :-)

THINGS TO COME

These are some things I think will be needed, and I will try
to make them come true one day.

M-T
M-Y
M-Q
C-M-\
C-X C-O
M-X Set Key
M-X Keep Matching Lines
M-X List Matching Lines
M-X Put Macro on Key
Query in kbd macro
Delete Hacking Tabs

Full recognition on all strings would be nice.


WARNING

If you would like to hack SCAME, be aware that the code is
unstructured and tricky. There are practically no comments.



COPYRIGHT
=========

All files in this distribution are copyrighted.
It is distributed gratis to anybody for non-commercial,
non-military use.

I would appreciate if installations were reported to me so
I know how widely it is being used. Also if you could keep me
posted about changes, bugs, opinions and statistics.
(e.g. how much you are using it).


	Leif Samuelsson
	Ericsson Information Systems AB
	Advanced Workstations Division
	S-126 25  STOCKHOLM
	SWEDEN

	phone: ..46 8 764 00 00

	..{decvax, philabs}!mcvax!enea!erix!erisun!leif
@//E*O*F README//
chmod u=rw,g=r,o= README
 
echo x - Makefile
sed 's/^@//' > "Makefile" <<'@//E*O*F Makefile//'
CFLAGS= -O
SRC= main.c screen.c scame0.c scame1.c scame2.c io.c files.c strings.c \
	macro.c k_funcs.c x_funcs.c disptab.c help.c search.c vars.c
INC= config.h scame.h k_funcs.h
OBJ= main.o screen.o scame0.o scame1.o scame2.o io.o files.o strings.o \
	macro.o k_funcs.o x_funcs.o disptab.o help.o search.o vars.o
LIB= lib

scame:	$(OBJ)
	$(CC) $(CFLAGS) -o scame $(OBJ) -ltermlib

$(OBJ):	$(INC)

@.c.o:	; $(CC) $(CFLAGS) -c $*.c

scame-reaper:	scame-reaper.c
	$(CC) $(CFLAGS) -o scame-reaper scame-reaper.c

shar:	
	shar -c -v README Makefile scame.1 config.sample BUGS scame.h \
		k_funcs.h > scame.shar.1
	shar -c -v `find $(LIB) -print` tmp > scame.shar.2
	shar -c -v main.c screen.c scame0.c scame1.c > scame.shar.3
	shar -c -v scame2.c strings.c io.c files.c macro.c k_funcs.c \
		> scame.shar.4
	shar -c -v x_funcs.c disptab.c help.c search.c vars.c scame-reaper.c \
		> scame.shar.5
@//E*O*F Makefile//
chmod u=rw,g=r,o= Makefile
 
echo x - scame.1
sed 's/^@//' > "scame.1" <<'@//E*O*F scame.1//'
@.pl 72
@.TH SCAME 1 1985-02-09
@.SH NAME
scame - a screen oriented text editor a la emacs
@.SH SYNOPSIS
@.I scame
[-n] [filename]
@.SH DESCRIPTION
@.PP
If
@.I filename
is specified,
@.I scame
will search through its buffers for it.
If it isn't found, it will be read in into a new buffer.
The flag -n will make 
@.I scame
forget about earlier work, starting with a fresh buffer. This is hardly
ever necessary.
@.PP
@.ta 17
This is the
@.I scame
Command Chart:
@.nf

To get a C-A (Control-A) hold down the 'Ctrl'-key and type an 'A'.

If your terminal has a 'Meta'-key:
To get a M-A (Meta-A) hold down the 'Meta'-key and type an 'A'.
To get a C-M-A (Control-Meta-A) hold down both the 'Ctrl'-key and
the 'Meta'-key and type an 'A'.

If your terminal lacks 'Meta'-key:
To get a M-A (Meta-A) first type an 'Esc' and then an 'A'.
To get a C-M-A (Control-Meta-A) first type a C-Z and then an 'A'.

@.bp
@.I Control Characters:

C-@	^R Set/Pop Mark
C-A	^R Beginning of Line
C-B	^R Backward Character
C-C	^R Exit To Shell
C-D	^R Delete Character
C-E	^R End Of Line
C-F	^R Forward Character
C-G	^R Quit
C-H (Backspace)	^R Backward Character
C-I (Tab)	^R Indent According to Mode
C-J (Linefeed)	^R Indent New Line
C-K	^R Kill Line
C-L	^R New Window
C-M	^R New Line
C-N	^R Down Real Line
C-O	^R Open Line
C-P	^R Up Real Line
C-Q	^R Quoted Insert
C-R	^R Reverse Search
C-S	^R Incremental Search
C-T	^R Transpose Characters
C-U	^R Universal Argument	(Must be in the range 0..32767)
C-V	^R Next Screen
C-W	^R Kill Region
C-X	is a prefix character. See below
C-Y	^R Un-Kill
C-Z	^R Prefix Control-Meta
C-[ (Escape)	^R Prefix Meta
C-\\	^R Prefix Meta
C-_	^R Help
C-^	^R Prefix Control
RubOut	^R Backward Delete Character

@.bp
C-X is a prefix command with these subcommands:

C-X C-B	List Buffers
C-X C-D	^R Directory Display
C-X C-F	Find File
C-X Tab	^R Indent Rigidly
C-X C-L	^R Lowercase Region
C-X C-O	^R Delete Blank Lines
C-X C-S	^R Save File
C-X C-U	^R Uppercase Region
C-X C-V	^R Visit File
C-X C-W	Write File
C-X C-X	^R Exchange Point and Mark
C-X C-Z	^R Exit To Shell
C-X (	^R Start Kbd Macro
C-X )	^R End Kbd Macro
C-X .	^R Set Fill Prefix
C-X 1	^R One Window
C-X 2	^R Two Windows
C-X ;	^R Set Comment Column
C-X =	What Cursor Position
C-X B	Select Buffer
C-X D	^R Dired
C-X E	^R Execute Kbd Macro
C-X H	^R Mark Whole Buffer
C-X K	Kill Buffer
C-X L	^R Count Lines Page
C-X M	Send Mail
C-X O	^R Other Window
C-X R	Read Mail
C-X Z	^R Exit To Shell
C-X ^	^R Grow Window
@.bp
@.I Meta Characters:

M-Return	^R Back to Indentation
M-!	^R Shell Command
M-%	^R Query Replace
M-(	^R Make ()
M-+	^R Invoke Inferior Shell
M-0 .. M-9	^R Autoargument
M-;	^R Indent for Comment
M-<	^R Goto Beginning
M-=	^R Count Lines Region
M->	^R Goto End
M-@	^R Mark Word
M-A	^R Backward Sentence
M-B	^R Backward Word
M-C	^R Uppercase Initial
M-D	^R Kill Word
M-E	^R Forward Sentence
M-F	^R Forward Word
M-G	^R Fill Region
M-I	^R Tab to Tab Stop
M-K	^R Kill Sentence
M-L	^R Lowercase Word
M-M	^R Back to Indentation
M-O	is a prefix character (not documented)
M-T	^R Transpose Words
M-U	^R Uppercase Word
M-V	^R Previous Screen
M-W	^R Copy Region
M-X	Instant Extended Command (see below)
M-\\	^R Delete Horizontal Space
M-^	^R Delete Indentation
M-~	^R Buffer Not Modified
M-RubOut	^R Backward Kill Word


@.I Control-Meta Characters:

C-M-%	^R Query Replace
C-M-L 	^R Log Out
C-M-M	^R Back to Indentation
C-M-T	^R Display Date
C-M-V	^R Scroll Other Window
C-M-W	^R Append Next Kill
C-M-X	Extended Command (same as M-X)
C-M-Z	^R Exit


Most printable characters, i e non-control non-meta characters,
are self-inserting.
@.bp
@.ta 30 38
@.I Extended commands:
(T means toggle)
M-X Ada Mode	For editing ADA programs
M-X Auto Fill Mode	A minor mode, useful when entering text
M-X C Mode	For editing C programs
M-X CBREAK Mode	Enable signals from kbd. OS dependent.
M-X Change Directory	Change the working directory
M-X Check Mail	Tell if there is new mail
M-X Default Mode	Set mode according to file type.
M-X Delete Matching Lines	Delete all lines containing a pattern.
M-X Dired	Call the Dired program (if available).
M-X Find File	Find the buffer with a certain file in it.
M-X Fundamental Mode	When nothing else applies
M-X Insert Character	Given an argument, inserts the character
		with the corresponding ASCII code
M-X Insert File	Asks for a file to insert at point
M-X Kill Buffer	Remove a buffer and its contents.
M-X Lisp Mode	For editing LisP code
M-X List Buffers	Show a list of existing buffers.
M-X Load Kbd Macro	Read keyboard macro from a file.
M-X Overwrite Mode	A minor mode for overwrite instead of insert.
M-X Pascal Mode	For editing Pascal programs.
M-X Push to Shell	Invokes a (temporary) inferior Shell.
M-X Read Mail	Invoke the mail program.
M-X Replace String	Replace from point to end of buffer
		(not query)
M-X Revert File	Restores file from disk
M-X Rot 13 Region	Encrypt/decrypt offensive text.
M-X Save Kbd Macro	Write keyboard macro to a file.
M-X Select Buffer	Change to another buffer.
M-X Send Mail	Mail current buffer to somebody.
M-X Set Key	Put a function on a key.
M-X Set Variable	Given an argument, will change the value
		of a variable
M-X Sort Buffer	Sort all lines in alphabetical order.
M-X Stop	Stop scame temporarily.
M-X Swedish Mode	For editing swedish text
M-X Tabify	Convert spaces into tabs where possible,
		starting from point.
M-X Undo	Try to undo the last command. Only some
		commands may be undone.
M-X View File	Show a file without creating a new buffer.
M-X View Variable	Show the value of a named variable
M-X View Working Directory	Type out the current working directory
M-X Wall Chart	Make a command chart of current bindings.
M-X What Cursor Position	Show stats on the echo-line.
M-X Write File
M-X Write Region	Write out the region to a file.
	(Does not change the current filename).
@.bp
@.ta 23 30 38
@.I Variables:
 (default values within parentheses, L means local to buffer,
M means dependent on Mode)
Auto Fill Mode	(0 L)	Controls the corresponding minor mode.
Auto Push Point Option	(500)	Controls wether to set mark after search.
Bottom Display Margin	(100)	Don't let cursor past this percentage
			of screen.
Comment Column	(33)	Used by M-; to decide where to start
			a comment.
Display Matching Paren	(M L)
Fill Column	(72 L)	Used by Fill Region and Auto Fill Mode to
				decide where to break lines.
Hackmatic		Will be nonzero if the terminal 
			has a META-key.
Mail Check Interval	(100) How often to check for mail. (0 -> never);
Overwrite Mode	(0 L)	Controls the corresponding minor mode.
Quote Char	(17)	Character to quote next char. (Normally ^Q)
Search Backward	(18)	Backward search character in
			Reverse I-Search. (^R)
Search Exit Char	(27)	Character to exit I-Search and do
			nothing. (Escape)
Search Forward	(19)	Forward search character in I-Search. (^S)
System Output Holding	If nonzero, will make scame ignore ^S
	(0)		and ^Q, using C-] for C-S
			and C-^ for C-Q instead.
Tab Self Insert	(0)	Controls the action of TAB when in 
			Pascal or C Mode.
Top Display Margin	(0)	Don't let cursor in this percentage
			of screen.


@.bp
@.fi
@.I Terminal types:

You can specify what kind of terminal you are using by including
the following line in your file .profile (which is executed
every time you log in):

TERM=<terminal type>; export TERM

where <terminal type> is one of the names listed in the file
/etc/termcap

If you are using the C-shell, i\.e\. the one with the % prompt,
you should have the line "set term=<terminal type>" in
the file \.login instead.


@.I Startup scripts
@.br
The file .scamerc is executed the first time
@.I scame
is started
from a particular shell. This is a file containing a keyboard
macro, i.e. the same command sequences that are used from the
keyboard. It is searched for in the current directory, in the
home directory and finally in the SCAMELIB directory.

The easiest way to create this file is to define a keyboard
macro in
@.I scame
and then write it out using M-X Save Kbd
Macro. 


@.I Mode Hooks
@.br
In the same way, the file .scamerc_<modename> is executed
every time a buffer is set to a major mode with name
<modename>. I.e. the file $HOME/.scamerc_pascal is executed
when entering Pascal Mode.


If you run into any problems with
@.I scame,
let me know.
@.br
@.SH DIAGNOSTICS

@.SH FILES
/usr/scame/lib/*
@.br
/usr/scame/tmp/Snnnnnnnnnn.x
@.br
@.SH AUTHOR
Leif Samuelsson 
@.br
leif@erisun.UUCP  or  ..decvax!mcvax!enea!erix!erisun!leif
@//E*O*F scame.1//
chmod u=rw,g=r,o= scame.1
 
echo x - config.sample
sed 's/^@//' > "config.sample" <<'@//E*O*F config.sample//'
/*	SCAME config.h				*/

/*	Revision 1.0.0  1985-02-09		*/

/*	Copyright 1985 by Leif Samuelsson	*/


/* Define one of VAX, PDP11, SUN, HP9000 */
# define VAX

/* Define one of V7, S5, BSD42 */
# define BSD42

/* Locate these directories. Note that TMPDIR must be rw to everyone. */
# define SCAMELIB "/usr/scame/lib"
# define TMPFILE "/usr/scame/tmp/S%05d%05d."
# define MAILDIR "/usr/spool/mail"

/* Locate these programs. If a program does not exist, comment out line. */
# define GREP "/bin/grep"
# define MAIL "/usr/ucb/Mail"
# define SORT "/usr/bin/sort"

/* Define format for naming backup files. */
/* Note that %s is the original filename with path removed. */
#ifdef BSD42
#  define BACKUPNAME "%s.BAK"
#else
#  define BACKUPNAME "%9s.BAK"
#endif

/* Initial value for Mail Check Interval (0 means never) */
#ifdef HP9000
#  define MAILCHECKINTERVAL 0	/* Bug in HP9000 implementation */
#else
#  define MAILCHECKINTERVAL 100
#endif

/* These constants set maximum screen width and height */
# define SCRDIMX 80
# define SCRDIMY 24
@//E*O*F config.sample//
chmod u=rw,g=r,o= config.sample
 
echo x - BUGS
sed 's/^@//' > "BUGS" <<'@//E*O*F BUGS//'
Negative arguments don't work.

Symbolic links are handled badly.

Ownership of files are changed by writefile().

vfile() can't handle binary text

C-U 0 C-X E  Repeat until error, doesn't work.
@//E*O*F BUGS//
chmod u=rw,g=r,o=r BUGS
 
echo x - scame.h
sed 's/^@//' > "scame.h" <<'@//E*O*F scame.h//'
/*	SCAME scame.h				*/

/*	Revision 1.0.0  1985-02-09		*/

/*	Copyright (C) 1985 by Leif Samuelsson	*/


# include "config.h"
# include <stdio.h>
# include <signal.h>
# include <sys/types.h>
# include <sys/stat.h>

typedef int (*funcp)();
typedef char Bool;
/* typedef enum {FALSE, TRUE} Bool; */

/* Some useful macros */
# define min(I,J) ((I) < (J) ? (I) : (J))
# define max(I,J) ((I) > (J) ? (I) : (J))
# define abs(X) ((X) < 0 ? -(X) : (X))
# define sign(X) ((X) >= 0 ? 1 : -1)
# define pswap(I,J) { char *h; h=I; I=J; J=h; }
#ifdef COMMENT
# define upcase(c,nat) ((((c) & 0177) >= 'a' && \
	(((c) & 0177) <= ((nat) ? '}' : 'z'))) ? (c & 0337) : (c))
# define lowcase(c,nat) ((nat) ? nlocasarr[c] : locasearr[c])
#endif
# define upcase(c,nat)  ((nat) ? nupcasarr[c] : upcasearr[c])
# define lowcase(c,nat) ((((c) & 0177) >= 'A' && \
	(((c) & 0177) <= ((nat) ? ']' : 'Z'))) ? (c | 0040) : (c))
# define NIL (char *) 0
# define FALSE '\0'
# define TRUE '\001'
# define GET 0
# define PUT 1
# define BELL '\007'
# define ESC '\033'
# define DEL '\177'
# define FILENAMESIZE 80
# define MAXBUFS 20
# define BUFNAMESIZE 10
# define GAPSIZE 1000L
# define GAPDIST SCRDIMY*SCRDIMX
# define LASTINPUTSIZE 60	/* Number of input characters remembered */
				/* for the HELP L function */
# define TABWID 8

/* Error codes */
enum errcode_t {A2W, BF, BTF, CCF, FTB, FTF, ILA, ILQ, MTF, NIB, NKM, NSB,
		NSF, NYI, O1W, RKM, SSF, UBK};

/* Major Modes */
enum majormode_t {ADA, C, FUNDAMENTAL, LISP, PASCAL, SWEDISH};

/* Minor Modes */
struct minmodstruct {
	long	autofill,
		overwrite
};

struct gvarstruct {		/* Global Variables */
	long	auto_push_point_option,
		bottom_display_margin,
		cbreak_mode,
		commcol,
		hackmatic,	/* Set by ME in termcap if term has Meta-key */
		mail_check_interval,
		quote_char,
		search_backward,
		search_exit_char,
		search_forward,
		system_output_holding,	/* XX in termcap */
		tab_self_insert,
		top_display_margin;
};

struct tabstruct {
	char *name;
	char *pointer;
};

struct comstruct { char *name; int (*funcp)(); };

extern struct comstruct x_comtab[];

extern funcp disptab[512], c_x_disptab[128], m_o_disptab[128];


/* various quantities */
enum quantity_t {WORD, LINE, SENTENCE, REGION, PARAGRAPH, BUFFER};

struct lvarstruct {
	long	disp_matching_paren,
		fillcolumn;
};

struct bufstruct {
	char name[BUFNAMESIZE];
	char filename[FILENAMESIZE];
	int dot;
	int home;
	enum majormode_t majormode;
	Bool modified;
	time_t mtime;
	struct minmodstruct minormodes;
	struct lvarstruct lvars;
};

extern char 	*sbrk(), *getenv(), *getenv(), *tgetstr();
extern FILE	*popen();

/* variables defined in main.c */
extern char	currentdir[], commandprompt[], *dot, *buf, *z,
		*home, *oldhome, screen[SCRDIMY][SCRDIMX+1],
		oldscreen[SCRDIMY][SCRDIMX+1], *modes[], tempfile[], lastinput[],
		more[], *mark[], fillprefix[], tmpmode_string[], scamelib[],
		*otherdot, *otherhome, *gaps, *gape, kbdmacfile[],
		killbuffile[], *away, *username, mailfile[];
extern Bool	killing, typing, xarg, xxarg, defining_kbd_mac, quiet,
		updateflag, echobusy, control_prefix, meta_prefix, savearg,
		pop_pending, savehpos;
extern int	cmdchar, screenlen, screenwidth, cury, curx, linpos,
		noofbufs, bufno, oldbuf, pipeup[], pipedown[], ppid, uid,
		lstindex, wintop, winbot, windows, otherbuf,
		upcasearr[], nupcasarr[],
		kbdmfd, execfd, oldhpos, recursive_level;
extern long	arg, bufsize, chkmailcnt;
extern struct bufstruct buftab[], cb;
extern struct gvarstruct gvars;



/* procedures defined in scame0.c */
extern		echo(), outchar(), cur(), update(), tmodlin(), stty(),
		findxy(), delchar(), insertstr(), refresh(), pushpopmark(),
		prevscreen(), closegap(), whatcursorposition(),
		comment(), extended(), markquant(), rot13_region(), stop(),
		findmode(),insertfile(), revertfile();
extern int	inchar(), instring();
extern long	backchar();
extern Bool	insertc(), getfilename(), incbuf(), gapto();

/* variables in scame1.c */
extern char	oldsstr[];


/* procedures defined in scame1.c */
extern		clearecho(), selectbuffer(),
		exec(), tabify(), savescame(), help(),
		listbuffers(), fixbuftab(), findfile(), kbuffer(),
		hangup(), vfile(), apropos();
extern Bool	restart(), wtmp(), rtmp(), typeout(), getbuffer();


/* procedures defined in search.c */
extern void	isearch(), queryreplace(), replace();
extern Bool	search();


/* variables defined in io.c */
extern int 	hpos, vpos;
extern char	*AL, *CE, *CS, *DL;

/* procedures defined in io.c */
extern		setupterm(), inittypeaheadcheck(), cls(), cleol(), cur(),
		pchar(), pstring(), outchar(), strnout(), strnprep(),
		invmod(), vt100a(), ttypad(), errmes(), echo(), push(),
 		unget(), gettermtype(), ttycbreak(), blockmove(), vtscroll();
extern Bool	typeahead();
extern int 	instring(), inchar(), getline();
extern short	yesorno();
extern char	*func_name(), *key_name();
extern funcp	getfuncname();
/* variables in scame2.c */
extern char	oldshellcommand[], oldmailname[];

/* procedures in scame2.c  */
extern 	changedir(), viewworkingdir(), delblanklines(),
	shellcommand(), flush_matching_lines(),
	onewindow(), twowindows(), otherwindow(), scrollotherwindow(),
	growwindow(), sortbuf(), saveforundo(), undo(), viewfile(),
	writeregion(), fillregion(), justifyregion(), setfcol(),
	breakline();

/* macro.c */

extern	definekbdmac(), savekbdmac(), loadkbdmac(), execfile();

/* x_funcs.c */
extern	x_adamode(), x_autofillmode(), x_ovwrtmode(), x_cbreakmode(),
	x_checkmail(), x_cmode(), x_dired(),
	x_flush_matching_lines(), x_fundamentalmode(),
	x_inschr(), x_insertfile(), x_lispmode(), x_loadkbdmac(),
	x_pascalmode(), x_replace(), x_revert_file(),
	x_savekbdmac(), x_set_key(),
	x_setvariable(), x_sortbuf(),
	x_swedishmode(), x_tabify(), x_viewfile(),
	x_wallchart(), x_rot13_region();

/* vars.c */
extern	setvariable(), viewvariable();

/* files.c */
extern		buildfilename(), cleanfilename();
extern Bool	fileexists(), filnprep(), filncpy(), filncat();
extern time_t	filemodified();
extern off_t	filesize();
#ifndef BSD4_2
extern Bool	getwd();
#endif

/* Procedures in strings.c */

extern		basename(), initupcase();
extern int	strsize(), strsub();
extern Bool	strneq(), isblank(), endofquantp();
extern char	*index(), *rindex();
@//E*O*F scame.h//
chmod u=rw,g=,o= scame.h
 
echo x - k_funcs.h
sed 's/^@//' > "k_funcs.h" <<'@//E*O*F k_funcs.h//'
/*	SCAME k_funcs.h				*/

/*	Revision 1.0.0  1985-02-09		*/

/*	Copyright 1985 by Leif Samuelsson	*/

extern int
	k_appendnextkill(), k_ascii(), k_backchar(),
	k_backdelchar(), k_backkillword(), k_backtoindent(),
	k_backword(), k_begofbuf(), k_begli(),
	k_begse(), k_bell(),
	k_c_m_prefix(), k_c_prefix(), k_c_x_dispatch(),
	k_capitalizeword(), k_comment(), k_copyregion(),
	k_cntlpg(), k_countlregion(), k_delblanklines(),
	k_delchar(), k_delhorizspace(), k_delindent(), k_digit(),
	k_dired(), k_dispdate(), k_downline(), k_edt_0(),
	k_edt_8(), k_edt_comma(), k_edt_dash(), k_edt_pf4(),
	k_enddefkbdmac(), k_endofbuf(), k_endli(),
	k_endse(), k_exchgdotmark(), k_executekbdmac(),
	k_exit(), k_exit_to_shell(), k_extended(), k_fillregion(),
	k_findfile(), k_forwchar(), k_forwword(), k_growwindow(),
	k_help(), k_indentregion(), k_indnewline(), k_insertc(),
	k_instab(), k_isearch(), k_killbuffer(), k_killline(),
	k_killregion(), k_killsentence(), k_killword(),
	k_listbuffers(), k_listdir(), k_logout(),
	k_lowcaseregion(), k_locasw(), k_m_o_dispatch(),
	k_m_prefix(), k_mailbuffer(), k_makeparens(),
	k_markbuffer(), k_markword(), k_metadigit(), k_negarg(), k_newline(),
	k_newwindow(), k_nextscreen(), k_notmodified(),
	k_onewindow(), k_openline(), k_otherwindow(),
	k_prevscreen(), k_push(), k_pushpopmark(),
	k_queryreplace(), k_quote(), k_readmail(),
	k_risearch(), k_savefile(), k_scrollotherwindow(),
	k_selectbuffer(), k_setcommcol(), k_setfcol(),
	k_setfillprefix(), k_shellcmd(), k_sis(),
	k_startdefkbdmac(), k_tab(), k_transchar(), k_trnsword(),
	k_twowindows(),
	k_ubk(), k_univarg(), k_upcaseregion(), k_upcwd(),
	k_upline(), k_visitfile(), k_void(), k_whatcursorpos(),
	k_writefile(), k_yank();
@//E*O*F k_funcs.h//
chmod u=rw,g=r,o= k_funcs.h
 
echo Inspecting for damage in transit...
temp=/tmp/shar$$; dtemp=/tmp/.shar$$
trap "rm -f $temp $dtemp; exit" 0 1 2 3 15
cat > $temp <<\!!!
     158     838    4756 README
      27     121     890 Makefile
     299    1501    8401 scame.1
      41     169    1041 config.sample
       9      30     196 BUGS
     218     771    6220 scame.h
      40     125    1712 k_funcs.h
     792    3555   23216 total
!!!
wc  README Makefile scame.1 config.sample BUGS scame.h k_funcs.h | sed 's=[^ ]*/==' | diff -b $temp - >$dtemp
if [ -s $dtemp ]
then echo "Ouch [diff of wc output]:" ; cat $dtemp
else echo "No problems found."
fi
exit 0