BEAV, a full featured binary file editor, part 01 of 11
Peter Reilley
pvr at wang.com
Thu Feb 28 07:39:46 AEST 1991
This is the first public release of BEAV (Binary Editor And Viewer),
a full featured binary file editor. Just about any operation that
you could want to do to a binary file is possible with BEAV. You
can insert or delete in the middle of a file thereby changing it's size.
You can display and edit data in hex, octal, decimal, binary, ascii,
or ebcdic formats. You can display data in byte, word, or long word
formats in either Intel or Motorola byte ordering. You can send the
formatted display mode to a file or printer.
BEAV is based on the source for emacs for display and keyboard handling
functions. The binary file handling and display formats are special
to BEAV. There is a full manual included in this release. There
are makefiles for unix and MSC 5.1 under DOS. The old Wang PC is
supported. This release is for unix. The def_unix.h file is the
header for unix and the def_dos.h file is the header for dos. Rename
the appropriate .h file to def.h to convert to your os. This has
been tested on 286 and 386 PC's under SCO UNIX and XENIX as well
as under UNIX on a MIPS system.
I am willing to maintain BEAV and will entertain suggestions for
modifications and/or bug fixes. I can be reached at;
pvr at wang.com
or at;
Peter Reilley
19 Heritage Cir.
Hudson, N.H. 03051
-----> CUT HERE <-----> CUT HERE <-----> CUT HERE <-----> CUT HERE <-----
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of archive 1 (of 11)."
# Contents: cinfo.c ebcdic.c editor.lnk fileio.c kbd.c lintfunc.dec
# machine.c makefile makefile.286 makefile.dos makefile.unix
# region.c spawn.c tcap.c termio.c tty.c ttyio.c wangpc.c word.c
# Wrapped by pvr at elf on Wed Feb 27 14:16:45 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'cinfo.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'cinfo.c'\"
else
echo shar: Extracting \"'cinfo.c'\" \(2700 characters\)
sed "s/^X//" >'cinfo.c' <<'END_OF_FILE'
X/*
X* Character class tables.
X* Do it yourself character classification
X* macros, that understand the multinational character set,
X* and let me ask some questions the standard macros (in
X* ctype.h) don't let you ask.
X*/
X#define LINT_ARGS 1 /* enable lint type checking */
X#include "def.h"
X#include "lintfunc.dec"
X/*
X* This table, indexed by a character drawn
X* from the 256 member character set, is used by my
X* own character type macros to answer questions about the
X* type of a character. It handles the full multinational
X* character set, and lets me ask some questions that the
X* standard "ctype" macros cannot ask.
X*/
Xchar cinfo[256] =
X{
X
X _C, _C, _C, _C, /* 0x0X */
X _C, _C, _C, _C,
X _C, _C, _C, _C,
X _C, _C, _C, _C,
X _C, _C, _C, _C, /* 0x1X */
X _C, _C, _C, _C,
X _C, _C, _C, _C,
X _C, _C, _C, _C,
X 0, 0, 0, 0, /* 0x2X */
X _W, 0, 0, _W,
X 0, 0, 0, 0,
X 0, 0, 0, 0,
X _W, _W, _W, _W, /* 0x3X */
X _W, _W, _W, _W,
X _W, _W, 0, 0,
X 0, 0, 0, 0,
X 0, _U | _W, _U | _W, _U | _W,/* 0x4X */
X _U | _W, _U | _W, _U | _W, _U | _W,
X _U | _W, _U | _W, _U | _W, _U | _W,
X _U | _W, _U | _W, _U | _W, _U | _W,
X _U | _W, _U | _W, _U | _W, _U | _W,/* 0x5X */
X _U | _W, _U | _W, _U | _W, _U | _W,
X _U | _W, _U | _W, _U | _W, 0,
X 0, 0, 0, _W,
X 0, _L | _W, _L | _W, _L | _W,/* 0x6X */
X _L | _W, _L | _W, _L | _W, _L | _W,
X _L | _W, _L | _W, _L | _W, _L | _W,
X _L | _W, _L | _W, _L | _W, _L | _W,
X _L | _W, _L | _W, _L | _W, _L | _W,/* 0x7X */
X _L | _W, _L | _W, _L | _W, _L | _W,
X _L | _W, _L | _W, _L | _W, 0,
X 0, 0, 0, _C,
X 0, 0, 0, 0, /* 0x8X */
X 0, 0, 0, 0,
X 0, 0, 0, 0,
X 0, 0, 0, 0,
X 0, 0, 0, 0, /* 0x9X */
X 0, 0, 0, 0,
X 0, 0, 0, 0,
X 0, 0, 0, 0,
X 0, 0, 0, 0, /* 0xAX */
X 0, 0, 0, 0,
X 0, 0, 0, 0,
X 0, 0, 0, 0,
X 0, 0, 0, 0, /* 0xBX */
X 0, 0, 0, 0,
X 0, 0, 0, 0,
X 0, 0, 0, 0,
X _U | _W, _U | _W, _U | _W, _U | _W,/* 0xCX */
X _U | _W, _U | _W, _U | _W, _U | _W,
X _U | _W, _U | _W, _U | _W, _U | _W,
X _U | _W, _U | _W, _U | _W, _U | _W,
X 0, _U | _W, _U | _W, _U | _W,/* 0xDX */
X _U | _W, _U | _W, _U | _W, _U | _W,
X _U | _W, _U | _W, _U | _W, _U | _W,
X _U | _W, _U | _W, 0, _W,
X _L | _W, _L | _W, _L | _W, _L | _W,/* 0xEX */
X _L | _W, _L | _W, _L | _W, _L | _W,
X _L | _W, _L | _W, _L | _W, _L | _W,
X _L | _W, _L | _W, _L | _W, _L | _W,
X 0, _L | _W, _L | _W, _L | _W,/* 0xFX */
X _L | _W, _L | _W, _L | _W, _L | _W,
X _L | _W, _L | _W, _L | _W, _L | _W,
X _L | _W, _L | _W, 0, 0
X}
X ;
END_OF_FILE
if test 2700 -ne `wc -c <'cinfo.c'`; then
echo shar: \"'cinfo.c'\" unpacked with wrong size!
fi
chmod +x 'cinfo.c'
# end of 'cinfo.c'
fi
if test -f 'ebcdic.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'ebcdic.c'\"
else
echo shar: Extracting \"'ebcdic.c'\" \(2681 characters\)
sed "s/^X//" >'ebcdic.c' <<'END_OF_FILE'
X
X#define LINT_ARGS 1 /* enable lint type checking */
X#include "def.h"
X
Xextern char ERR_ebcdic[];
X
X#include "lintfunc.dec"
X/* Function definitions */
X
X/* This table defines the translation from EBCDIC code to ASCII. */
X
Xchar ebcdic_table[] =
X{0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E,/* 00-07 */
X 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E,/* 08-0F */
X 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E,/* 10-17 */
X 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E,/* 18-1F */
X 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E,/* 20-27 */
X 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E,/* 28-2F */
X 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E,/* 30-37 */
X 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E,/* 38-3F */
X 0x20, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E,/* 40-47 */
X 0x2E, 0x2E, 0x2E, 0x2E, 0x3C, 0x28, 0x2B, 0x2E,/* 48-4F */
X 0x26, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E,/* 50-57 */
X 0x2E, 0x2E, 0x21, 0x24, 0x2A, 0x29, 0x3B, 0x5E,/* 58-5F */
X 0x2D, 0x2F, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E,/* 60-67 */
X 0x2E, 0x2E, 0x7C, 0x2E, 0x25, 0x5F, 0x3E, 0x3F,/* 68-6F */
X 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x27, 0x2E, 0x2E,/* 70-77 */
X 0x2E, 0x60, 0x3A, 0x23, 0x40, 0x2C, 0x3D, 0x22,/* 78-7F */
X 0x2E, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,/* 80-87 */
X 0x68, 0x69, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E,/* 88-8F */
X 0x2E, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70,/* 90-97 */
X 0x71, 0x72, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E,/* 98-9F */
X 0x2E, 0x7E, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,/* A0-A7 */
X 0x79, 0x7A, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E,/* A8-AF */
X 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E,/* B0-B7 */
X 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E,/* B8-BF */
X 0x7B, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,/* C0-C7 */
X 0x48, 0x49, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E,/* C8-CF */
X 0x7D, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50,/* D0-D7 */
X 0x51, 0x52, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E,/* D8-DF */
X 0x5C, 0x2E, 0X53, 0x54, 0x55, 0x56, 0x57, 0x58,/* E0-E7 */
X 0x59, 0x5A, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E,/* E8-EF */
X 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,/* F0-F7 */
X 0x38, 0x39, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E, 0x2E/* F8-FF */
X};
X
X/* convert a ASCII character to an EBCDIC character */
Xchar to_ebcdic (ch)
X
Xchar ch;
X{
X int cnt;
X char buf[70], buf1[70];
X
X for (cnt = 0; cnt < sizeof (ebcdic_table); cnt++)
X {
X if (ch == ebcdic_table[cnt])
X return (cnt);
X }
X sprintf (buf1, ERR_ebcdic, R_BYTE_FMT(curwp));
X sprintf (buf, buf1, ch);
X writ_echo(buf);
X return (0);
X}
END_OF_FILE
if test 2681 -ne `wc -c <'ebcdic.c'`; then
echo shar: \"'ebcdic.c'\" unpacked with wrong size!
fi
chmod +x 'ebcdic.c'
# end of 'ebcdic.c'
fi
if test -f 'editor.lnk' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'editor.lnk'\"
else
echo shar: Extracting \"'editor.lnk'\" \(193 characters\)
sed "s/^X//" >'editor.lnk' <<'END_OF_FILE'
XBASIC +BUFFER +CINFO +DISPLAY +ECHO +EXTEND + EBCDIC +
XFILE +FILEIO +FORMAT +KBD +LINE +MAIN +RANDOM +REGION +
XSEARCH +SPAWN +SYMBOL +TEXT +TTY +TTYIO +TTYKBD +
XWINDOW +WORD + WANGPC
XBEAV.EXE;
END_OF_FILE
if test 193 -ne `wc -c <'editor.lnk'`; then
echo shar: \"'editor.lnk'\" unpacked with wrong size!
fi
chmod +x 'editor.lnk'
# end of 'editor.lnk'
fi
if test -f 'fileio.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'fileio.c'\"
else
echo shar: Extracting \"'fileio.c'\" \(4689 characters\)
sed "s/^X//" >'fileio.c' <<'END_OF_FILE'
X/*
X* MS-DOS file I/O.
X*/
X#include <sys/types.h>
X#include "def.h"
X#if UNIX
X#include <fcntl.h>
X#include <sys/stat.h>
X#endif
X
Xextern char MSG_cnt_wr[];
Xextern char MSG_wr_io_er[];
Xextern char MSG_rd_er[];
Xextern char MSG_bak[];
Xextern char MSG_backup[];
Xextern char MSG_back_er[];
Xextern char MSG_back_of[];
X
X#include "lintfunc.dec"
X
X#if MSDOS
Xstatic FILE * ffp;
X#endif
X
X#if UNIX
Xstatic int ffp;
X#endif
X
X/*
X* Open a file for reading.
X*/
Xchar ffropen (fn)
Xchar *fn;
X{
X#if MSDOS
X if ((ffp = fopen (fn, "rb")) == NULL)/* pvr */
X return (FIOERR);;
X return (FIOSUC);
X#endif
X#if UNIX
X if ((ffp = open (fn, O_RDONLY)) == -1)/* pvr */
X return (FIOERR);;
X return (FIOSUC);
X#endif
X}
X/*
X* Get the file length
X*/
XA32 file_len ()
X {
X#if MSDOS
X return (filelength (fileno (ffp)));
X#endif
X#if UNIX
X struct stat st;
X
X if (fstat (ffp, &st) == -1)
X return (-1);
X return (st.st_size);
X#endif
X }
X
X/*
X* Open a file for writing.
X* Return TRUE if all is well, and
X* FALSE on error (cannot create).
X*/
Xchar ffwopen (fn)
Xchar *fn;
X{
X#if MSDOS
X if ((ffp = fopen (fn, "wb")) == NULL)/* pvr */
X {
X writ_echo (MSG_cnt_wr);
X return (FIOERR);
X }
X return (FIOSUC);
X#endif
X#if UNIX
X if ((ffp = open (fn, O_WRONLY | O_CREAT)) == -1)/* pvr */
X return (FIOERR);;
X return (FIOSUC);
X#endif
X}
X
X/*
X* Close a file.
X* Should look at the status.
X*/
Xchar ffclose ()
X{
X#if MSDOS
X fclose (ffp);
X#endif
X#if UNIX
X close (ffp);
X#endif
X return (FIOSUC);
X}
X
X/*
X* Write a line to the already
X* opened file. The "buf" points to the
X* buffer, and the "nbuf" is its length. pvr
X* Return the status.
X*/
Xchar ffputline (buf, nbuf)
Xregister char buf[];
Xint nbuf;
X{
X register int i;
X
X#if MSDOS
X i = fwrite (buf, 1, nbuf, ffp);
X#endif
X#if UNIX
X i = write (ffp, buf, nbuf);
X#endif
X
X if ((i != nbuf)
X#if MSDOS
X || (ferror (ffp) != FALSE))
X#else
X )
X#endif
X {
X writ_echo (MSG_wr_io_er);
X return (FIOERR);
X }
X return (FIOSUC);
X}
X
X/*
X* Read a line from a file, and store the bytes
X* in the supplied buffer. Stop on end of file or after 'nbuf' characters. pvr
X* the first byte in the buffer is the length in bytes.
X*/
Xchar ffgetline (buf, nbuf, rbuf)
Xregister char *buf;
Xregister int *rbuf, nbuf;
X{
X
X register int c;
X register int i;
X
X#if MSDOS
X *rbuf = fread (buf, 1, nbuf, ffp);
X#endif
X
X#if UNIX
X *rbuf = read (ffp, buf, nbuf);
X#endif
X
X /* End of file. */
X#if MSDOS
X if (ferror (ffp) != FALSE)
X {
X writ_echo (MSG_rd_er);
X return (FIOERR);
X }
X#endif
X if (*rbuf == 0)
X return (FIOEOF);
X
X return (FIOSUC);
X}
X
X/*
X* Seek to specified position in file.
X* Return the actual position in the file.
X*/
XA32 ffseek (posn)
X A32 posn;
X {
X#if MSDOS
X fseek (ffp, posn, SEEK_SET);
X return (ftell (ffp));
X#endif
X#if UNIX
X return (lseek (ffp, posn, 0));
X#endif
X }
X
X/*
X* Some backup user on MS-DOS might want
X* to determine some rule for doing backups on that
X* system, and fix this. I don't use MS-DOS, so I don't
X* know what the right rules would be. Return TRUE so
X* the caller does not abort a write.
X*/
X#if BACKUP
Xbool fbackupfile (fname)
Xchar *fname;
X{
X FILE * backupfile;
X char backname[128];
X char *source,
X *backup;
X extern char time_string[];
X char buf[80];
X
X source = fname;
X backup = backname;
X while ((*source > 0) && (*source != '.'))
X {
X *backup = *source;
X backup++;
X source++;
X *backup = 0;
X }
X strcat (backname, MSG_bak);
X sprintf (buf, MSG_backup, fname, backname);
X writ_echo (buf);
X unlink (backname);
X#if MSDOS
X if (rename (backname, fname) > 0)
X#else
X if ((link (fname, backname) != 0) || (unlink (fname) != 0))
X#endif
X {
X sprintf (buf, MSG_back_er, fname, backname);
X writ_echo (buf);
X return (FALSE);
X }
X return (TRUE); /* Hack. */
X}
X
X#endif
X
X/*
X* The string "fn" is a file name.
X* Perform any required case adjustments. All systems
X* we deal with so far have case insensitive file systems.
X* We zap everything to lower case. The problem we are trying
X* to solve is getting 2 buffers holding the same file if
X* you visit one of them with the "caps lock" key down.
X* On UNIX file names are dual case, so we leave
X* everything alone.
X*/
Xvoid adjustcase (fn)
Xregister char *fn;
X{
X register int c;
X
X while ((c = *fn) != 0)
X {
X if (c >= 'A' && c <= 'Z')
X *fn = c + 'a' - 'A';
X ++fn;
X }
X}
X
X
END_OF_FILE
if test 4689 -ne `wc -c <'fileio.c'`; then
echo shar: \"'fileio.c'\" unpacked with wrong size!
fi
chmod +x 'fileio.c'
# end of 'fileio.c'
fi
if test -f 'kbd.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'kbd.c'\"
else
echo shar: Extracting \"'kbd.c'\" \(4475 characters\)
sed "s/^X//" >'kbd.c' <<'END_OF_FILE'
X/* KBD.C
X* Terminal independent keyboard handling.
X*/
X#define LINT_ARGS 1 /* enable lint type checking */
X#include "def.h"
X
Xchar *keystrings ();
X
Xextern char MSG_tab[];
Xextern char MSG_ret[];
Xextern char MSG_bksp[];
Xextern char MSG_space[];
Xextern char MSG_rubout[];
X
X#include "lintfunc.dec"
X/*
X* Read in a key, doing the terminal
X* independent prefix handling. The terminal specific
X* "getkbd" routine gets the first swing, and may return
X* one of the special codes used by the special keys
X* on the keyboard. The "getkbd" routine returns the
X* C0 controls as received; this routine moves them to
X* the right spot in 11 bit code.
X*/
Xint getkey ()
X{
X
X register int c;
X c = getkbd ();
X if (c == METACH) /* M- */
X c = KMETA | getctl ();
X else if (c == CTRLCH) /* C- */
X c = KCTRL | getctl ();
X else if (c == CTMECH) /* C-M- */
X c = KCTRL | KMETA | getctl ();
X else if (c >= 0x00 && c <= 0x1F)/* Relocate control. */
X c = KCTRL | (c + '@');
X
X if (c == (KCTRL | 'X')) /* C-X */
X c = KCTLX | getctl ();
X return (c);
X}
X
X
X/*
X* Used above.
X*/
Xint getctl ()
X{
X
X register int c;
X
X#if 1
X c = getkbd ();
X if (c == METACH) /* M- */
X c = KMETA | getctl ();
X else
X if (c == CTRLCH) /* C- */
X c = KCTRL | getctl ();
X else
X if (c == CTMECH) /* C-M- */
X c = KCTRL | KMETA | getctl ();
X else
X if (c >= 0x00 && c <= 0x1F)/* Relocate control. */
X c = KCTRL | (c + '@');
X#else
X c = getkey (); /* Note recursion */
X if (ISLOWER (c & 0xFF))
X c = (c & ~0xFF) | TOUPPER (c & 0xFF);
X if (c >= 0x00 && c <= 0x1F) /* Relocate control. */
X c = KCTRL | (c + '@');
X#endif
X if (ISLOWER (c & 0xFF))
X c = (c & ~0xFF) | TOUPPER (c & 0xFF);
X return (c);
X}
X
X
X/*
X* Transform a key code into a name,
X* using a table for the special keys and combination
X* of some hard code and some general processing for
X* the rest. None of this code is terminal specific any
X* more. This makes adding keys easier.
X*/
Xvoid keyname (cp, k)
Xregister char *cp;
Xregister int k;
X{
X register char *np;
X char nbuf[3];
X
X static char hex[] =
X {
X '0', '1', '2', '3',
X '4', '5', '6', '7',
X '8', '9', 'A', 'B',
X 'C', 'D', 'E', 'F'
X };
X
X if (k & 0x80)
X {
X if ((np = keystrings (k)) != NULL)
X {
X if ((k & KMETA) != 0)
X {
X *cp++ = 'E';
X *cp++ = 's';
X *cp++ = 'c';
X *cp++ = ' ';
X }
X strcpy (cp, np);
X }
X else
X *cp = 0; /* null string */
X return;
X }
X
X if ((k & KCTLX) != 0)
X {
X /* Ctl-X prefix. */
X *cp++ = 'C';
X *cp++ = 't';
X *cp++ = 'l';
X *cp++ = '-';
X *cp++ = 'X';
X *cp++ = ' ';
X k &= ~KCTLX;
X }
X
X if ((k & KMETA) != 0)
X {
X /* Add Esc- mark. */
X *cp++ = 'E';
X *cp++ = 's';
X *cp++ = 'c';
X *cp++ = ' ';
X k &= ~KMETA;
X }
X
X if (k == (KCTRL | 'I'))/* Some specials. */
X np = MSG_tab;
X else
X {
X if (k == (KCTRL | 'M'))
X np = MSG_ret;
X else if (k == (KCTRL | 'H'))
X np = MSG_bksp;
X else if (k == ' ')
X np = MSG_space;
X else if (k == 0x7F)
X np = MSG_rubout;
X else
X {
X if ((k & KCTRL) != 0)
X {
X /* Add Ctl- mark. */
X *cp++ = 'C';
X *cp++ = 't';
X *cp++ = 'l';
X *cp++ = '-';
X }
X np = &nbuf[0];
X if (((k & KCHAR) >= 0x20 && (k & KCHAR) <= 0x7E)
X || ((k & KCHAR) >= 0xA0 && (k & KCHAR) <= 0xFE))
X {
X nbuf[0] = k & KCHAR;/* Graphic. */
X nbuf[1] = 0;
X }
X else
X {
X /* Non graphic. */
X nbuf[0] = hex[(k >> 4) & 0x0F];
X nbuf[1] = hex[k & 0x0F];
X nbuf[2] = 0;
X }
X }
X }
X strcpy (cp, np);
X}
X
END_OF_FILE
if test 4475 -ne `wc -c <'kbd.c'`; then
echo shar: \"'kbd.c'\" unpacked with wrong size!
fi
chmod +x 'kbd.c'
# end of 'kbd.c'
fi
if test -f 'lintfunc.dec' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'lintfunc.dec'\"
else
echo shar: Extracting \"'lintfunc.dec'\" \(25 characters\)
sed "s/^X//" >'lintfunc.dec' <<'END_OF_FILE'
X/* Dummy include file */
END_OF_FILE
if test 25 -ne `wc -c <'lintfunc.dec'`; then
echo shar: \"'lintfunc.dec'\" unpacked with wrong size!
fi
# end of 'lintfunc.dec'
fi
if test -f 'machine.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'machine.c'\"
else
echo shar: Extracting \"'machine.c'\" \(2190 characters\)
sed "s/^X//" >'machine.c' <<'END_OF_FILE'
X/* This program sniffs around to see what type of MSDOS computer
X it is running in
X*/
X
X/* Checks what type of machine it is running in and returns
X 0 if unknown
X 1 if Wang PC
X 2 if Wang APC
X 3 if IBM PC/XT
X 4 if IBM PC/AT
X 5 if IBM PC Jr
X 6 if IBM PC
X 7 if Wang Laptop
X 8 if Wang PC200
X 9 if Wang PC300
X 10 if IBM PS/2
X*/
Xint host_mach()
X{
Xunsigned char far *memptr;
Xunsigned char c;
Xint i, match;
Xstatic char wang_pc[]={"WANG PROFE"};
Xstatic char wang_apc[]={"WANG ADVAN"};
Xstatic char wang_lap[]={"WANG"};
X
X/* test for Wang PC */
Xmemptr = (unsigned char far *)0xFC003FC2L;
Xmatch = 1;
Xfor (i=0;(i<10 && match!=0);i++)
X {
X if(*memptr != wang_pc[i])
X match=0;
X memptr++;
X }
Xif(match ==1)
X return(1);
X
X/* test for Wang APC */
Xmemptr = (unsigned char far *)0xFC003FC2L;
Xmatch = 1;
Xfor (i=0;(i<10 && match!=0);i++)
X {
X if(*memptr != wang_apc[i])
X match=0;
X memptr++;
X }
Xif(match ==1)
X return(2);
X
X/* test for Wang Laptop */
Xmemptr = (unsigned char far *)0xFC003FC2L;
Xmatch = 1;
Xfor (i=0;(i<4 && match!=0);i++)
X {
X if(*memptr != wang_pc[i])
X match=0;
X memptr++;
X }
Xif(match ==1)
X /* I should really do an INT 88h func 0 now to verify for sure
X but I'm too lazy!
X */
X return(7);
X
X/* Must be an IBM or clone */
Xmemptr = (unsigned char far *)0xF000FFFEL;
Xc = *memptr;
X
Xswitch(c)
X {
Xcase 0xFC: /* IBM AT or clone */
X /* for the moment a PC200 is the same as an AT */
X return(4);
X
Xcase 0xFD: /* IBM PC Jr */
X return(5);
X
Xcase 0xFE: /* IBM XT or clone */
X return(3);
X
Xcase 0xFF: /* IBM PC or clone */
X return(6);
X
X }
X
Xreturn(0);
X}
X
X
X
Xmain()
X{
Xint machine;
X
Xmachine = host_mach();
X
Xprintf("This is a ");
Xswitch(machine)
X {
Xcase 0: printf("unknown type of machine\n");
X break;
Xcase 1: printf("Wang PC\n");
X break;
Xcase 2: printf("Wang Advanced PC\n");
X break;
Xcase 3: printf("IBM PC/XT\n");
X break;
Xcase 4: printf("IBM PC/AT\n");
X break;
Xcase 5: printf("IBM PC Jr\n");
X break;
Xcase 6: printf("IBM PC \n");
X break;
Xcase 7: printf("Wang LapTop\n");
X break;
X }
X
X}
END_OF_FILE
if test 2190 -ne `wc -c <'machine.c'`; then
echo shar: \"'machine.c'\" unpacked with wrong size!
fi
chmod +x 'machine.c'
# end of 'machine.c'
fi
if test -f 'makefile' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'makefile'\"
else
echo shar: Extracting \"'makefile'\" \(608 characters\)
sed "s/^X//" >'makefile' <<'END_OF_FILE'
XCFLAGS= -O
X
XOFILES= basic.o ebcdic.o fileio.o region.o text.o wangpc.o \
X buffer.o echo.o main.o search.o tty.o window.o \
X cinfo.o extend.o kbd.o spawn.o ttyio.o termio.o tcap.o word.o \
X display.o file.o line.o random.o symbol.o ttykbd.o format.o
X
X
XCFILES= basic.c ebcdic.c fileio.c region.c text.c wangpc.c \
X buffer.c echo.c format.c main.c search.c tty.c window.c \
X cinfo.c extend.c kbd.c spawn.c ttyio.c termio.c tcap.c word.c \
X display.c file.c line.c random.c symbol.c ttykbd.c
X
XHFILES= def.h
X
Xbeav: $(OFILES)
X $(CC) $(CFLAGS) $(OFILES) -ltermcap -lc -o beav
X
X(OFILES): $(HFILES)
END_OF_FILE
if test 608 -ne `wc -c <'makefile'`; then
echo shar: \"'makefile'\" unpacked with wrong size!
fi
# end of 'makefile'
fi
if test -f 'makefile.286' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'makefile.286'\"
else
echo shar: Extracting \"'makefile.286'\" \(647 characters\)
sed "s/^X//" >'makefile.286' <<'END_OF_FILE'
X# This is a makefile for 286 xenix
XCFLAGS= -O -Ml
X
XOFILES= basic.o ebcdic.o fileio.o region.o text.o wangpc.o \
X buffer.o echo.o main.o search.o tty.o window.o \
X cinfo.o extend.o kbd.o spawn.o ttyio.o termio.o tcap.o word.o \
X display.o file.o line.o random.o symbol.o ttykbd.o format.o
X
X
XCFILES= basic.c ebcdic.c fileio.c region.c text.c wangpc.c \
X buffer.c echo.c format.c main.c search.c tty.c window.c \
X cinfo.c extend.c kbd.c spawn.c ttyio.c termio.c tcap.c word.c \
X display.c file.c line.c random.c symbol.c ttykbd.c
X
XHFILES= def.h
X
Xbeav: $(OFILES)
X $(CC) $(CFLAGS) $(OFILES) -ltermcap -lc -o beav
X
X(OFILES): $(HFILES)
END_OF_FILE
if test 647 -ne `wc -c <'makefile.286'`; then
echo shar: \"'makefile.286'\" unpacked with wrong size!
fi
# end of 'makefile.286'
fi
if test -f 'makefile.dos' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'makefile.dos'\"
else
echo shar: Extracting \"'makefile.dos'\" \(1889 characters\)
sed "s/^X//" >'makefile.dos' <<'END_OF_FILE'
X# make BEAV MSC 5.1
X
XBASIC.OBJ: BASIC.C DEF.H LINTFUNC.DEC
X CL -c -Ml BASIC.C ;
X
XBUFFER.OBJ: BUFFER.C DEF.H LINTFUNC.DEC
X CL -c -Ml BUFFER.C ;
X
XCINFO.OBJ: CINFO.C DEF.H LINTFUNC.DEC
X CL -c -Ml CINFO.C ;
X
XDISPLAY.OBJ: DISPLAY.C DEF.H LINTFUNC.DEC
X CL -c -Ml DISPLAY.C ;
X
XEBCDIC.OBJ: EBCDIC.C DEF.H LINTFUNC.DEC
X CL -c -Ml EBCDIC.C ;
X
XECHO.OBJ: ECHO.C DEF.H LINTFUNC.DEC
X CL -c -Ml ECHO.C ;
X
XEXTEND.OBJ: EXTEND.C DEF.H LINTFUNC.DEC
X CL -c -Ml EXTEND.C ;
X
XFILE.OBJ: FILE.C DEF.H LINTFUNC.DEC
X CL -c -Ml FILE.C ;
X
XFILEIO.OBJ: FILEIO.C DEF.H LINTFUNC.DEC
X CL -c -Ml FILEIO.C ;
X
XFORMAT.OBJ: FORMAT.C DEF.H LINTFUNC.DEC
X CL -c -Ml FORMAT.C ;
X
XKBD.OBJ: KBD.C DEF.H LINTFUNC.DEC
X CL -c -Ml KBD.C ;
X
XLINE.OBJ: LINE.C DEF.H LINTFUNC.DEC
X CL -c -Ml LINE.C ;
X
XMAIN.OBJ: MAIN.C DEF.H LINTFUNC.DEC
X CL -c -Ml MAIN.C ;
X
XRANDOM.OBJ: RANDOM.C DEF.H LINTFUNC.DEC
X CL -c -Ml RANDOM.C ;
X
XREGION.OBJ: REGION.C DEF.H LINTFUNC.DEC
X CL -c -Ml REGION.C ;
X
XSEARCH.OBJ: SEARCH.C DEF.H LINTFUNC.DEC
X CL -c -Ml SEARCH.C ;
X
XSPAWN.OBJ: SPAWN.C DEF.H LINTFUNC.DEC
X CL -c -Ml SPAWN.C ;
X
XSYMBOL.OBJ: SYMBOL.C DEF.H LINTFUNC.DEC
X CL -c -Ml SYMBOL.C ;
X
XTEXT.OBJ: TEXT.C DEF.H LINTFUNC.DEC
X CL -c -Ml TEXT.C ;
X
XTTY.OBJ: TTY.C DEF.H LINTFUNC.DEC
X CL -c -Ml TTY.C ;
X
XTTYIO.OBJ: TTYIO.C DEF.H LINTFUNC.DEC
X CL -c -Ml TTYIO.C ;
X
XTTYKBD.OBJ: TTYKBD.C DEF.H LINTFUNC.DEC
X CL -c -Ml TTYKBD.C ;
X
XWANGPC.OBJ: WANGPC.C DEF.H LINTFUNC.DEC
X CL -c -Ml WANGPC.C ;
X
XWINDOW.OBJ: WINDOW.C DEF.H LINTFUNC.DEC
X CL -c -Ml WINDOW.C ;
X
XWORD.OBJ: WORD.C DEF.H LINTFUNC.DEC
X CL -c -Ml WORD.C ;
X
XBEAV.EXE: BASIC.OBJ BUFFER.OBJ CINFO.OBJ DISPLAY.OBJ ECHO.OBJ EXTEND.OBJ \
X EBCDIC.OBJ FILE.OBJ FILEIO.OBJ FORMAT.OBJ KBD.OBJ LINE.OBJ \
X MAIN.OBJ RANDOM.OBJ TEXT.OBJ \
X REGION.OBJ SEARCH.OBJ SPAWN.OBJ SYMBOL.OBJ TTY.OBJ TTYIO.OBJ \
X TTYKBD.OBJ WINDOW.OBJ WORD.OBJ WANGPC.OBJ
X LINK @editor.lnk
X
X
X
X
END_OF_FILE
if test 1889 -ne `wc -c <'makefile.dos'`; then
echo shar: \"'makefile.dos'\" unpacked with wrong size!
fi
# end of 'makefile.dos'
fi
if test -f 'makefile.unix' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'makefile.unix'\"
else
echo shar: Extracting \"'makefile.unix'\" \(608 characters\)
sed "s/^X//" >'makefile.unix' <<'END_OF_FILE'
XCFLAGS= -O
X
XOFILES= basic.o ebcdic.o fileio.o region.o text.o wangpc.o \
X buffer.o echo.o main.o search.o tty.o window.o \
X cinfo.o extend.o kbd.o spawn.o ttyio.o termio.o tcap.o word.o \
X display.o file.o line.o random.o symbol.o ttykbd.o format.o
X
X
XCFILES= basic.c ebcdic.c fileio.c region.c text.c wangpc.c \
X buffer.c echo.c format.c main.c search.c tty.c window.c \
X cinfo.c extend.c kbd.c spawn.c ttyio.c termio.c tcap.c word.c \
X display.c file.c line.c random.c symbol.c ttykbd.c
X
XHFILES= def.h
X
Xbeav: $(OFILES)
X $(CC) $(CFLAGS) $(OFILES) -ltermcap -lc -o beav
X
X(OFILES): $(HFILES)
END_OF_FILE
if test 608 -ne `wc -c <'makefile.unix'`; then
echo shar: \"'makefile.unix'\" unpacked with wrong size!
fi
# end of 'makefile.unix'
fi
if test -f 'region.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'region.c'\"
else
echo shar: Extracting \"'region.c'\" \(4582 characters\)
sed "s/^X//" >'region.c' <<'END_OF_FILE'
X/*
X* Region based commands.
X* The routines in this file
X* deal with the region, that magic space
X* between "." and mark. Some functions are
X* commands. Some functions are just for
X* internal use.
X*/
X#include "def.h"
X
Xbool setsize ();
Xbool getregion ();
X
X
Xextern char MSG_reg_lrg[];
Xextern char MSG_sv_in_b[];
Xextern char MSG_sav_slf[];
Xextern char MSG_no_mark[];
X
X#include "lintfunc.dec"
X/*
X* Kill the region. Ask "getregion"
X* to figure out the bounds of the region.
X* Move "." to the start, and kill the characters.
X*/
Xchar killregion (f, n, k)
X{
X register char s;
X REGION region;
X int error;
X
X if ((s = getregion (®ion)) != TRUE)
X return (s);
X if ((lastflag & CFKILL) == 0)/* This is a kill type */
X kdelete (); /* clean out k-buffer */
X thisflag |= CFKILL; /* kill buffer stuff. */
X curwp -> w_dotp = region.r_linep;
X curwp -> w_doto = region.r_offset;
X error = ldelete (region.r_size, TRUE);
X writ_echo (okmsg);
X return (error);
X}
X
X
X/*
X* Copy all of the characters in the
X* region to the kill buffer. Don't move dot
X* at all. This is a bit like a kill region followed
X* by a yank.
X*/
Xchar copyregion (f, n, k)
X{
X register LINE * linep;
X register int loffs;
X register char s;
X REGION region;
X
X if ((s = getregion (®ion)) != TRUE)
X return (s);
X if ((lastflag & CFKILL) == 0)/* Kill type command. */
X kdelete ();
X thisflag |= CFKILL;
X linep = region.r_linep; /* Current line. */
X loffs = region.r_offset; /* Current offset. */
X while (region.r_size--)
X {
X if (loffs == llength (linep))
X {
X /* End of line. */
X if ((s = kinsert ('\n')) != TRUE)
X return (s);
X linep = lforw (linep);
X loffs = 0;
X }
X else
X {
X /* Middle of line. */
X if ((s = kinsert (lgetc (linep, loffs))) != TRUE)
X return (s);
X ++loffs;
X }
X }
X writ_echo (okmsg);
X return (TRUE);
X}
X
X/*
X* This routine figures out the bound of the region
X* in the current window, and stores the results into the fields
X* of the REGION structure. Dot and mark are usually close together,
X* but I don't know the order. The size is kept in a long. At the
X* end, after the size is figured out, it is assigned to the size
X* field of the region structure. If this assignment loses any bits,
X* then we print an error. This is "type independent" overflow
X* checking. All of the callers of this routine should be ready to
X* get an ABORT status, because I might add a "if regions is big,
X* ask before clobberring" flag.
X*/
Xbool getregion (rp)
Xregister REGION * rp;
X{
X if (curwp -> w_markp == NULL)
X {
X writ_echo (MSG_no_mark);
X return (FALSE);
X }
X
X if (DOT_POS(curwp) < MARK_POS(curwp))
X {
X rp -> r_linep = curwp -> w_dotp;
X rp -> r_offset = curwp -> w_doto;
X rp -> r_size = (int)(MARK_POS(curwp) - DOT_POS(curwp));
X }
X else
X {
X rp -> r_linep = curwp -> w_markp;
X rp -> r_offset = curwp -> w_marko;
X rp -> r_size = (int)(DOT_POS(curwp) - MARK_POS(curwp));
X }
X return (TRUE);
X}
X
X/*
X* Set size, and check for overflow.
X*/
Xbool setsize (rp, size)
Xregister REGION * rp;
Xregister long size;
X{
X rp -> r_size = size;
X if (rp -> r_size != size)
X {
X writ_echo (MSG_reg_lrg);
X return (FALSE);
X }
X return (TRUE);
X}
X
X
X/* save some region in a buffer
X* (use _usebuffer to handle non-existent buffers)
X*
X* hack as it uses kill buffer to transfer stuff (quick and dirty!)
X* and doesn't do clever things at all with dot in destination buffer!
X*/
Xchar save_region (f, n, k)
X{
X char bufn[NBUFN];
X char oldbufn[NBUFN];
X register char s;
X
X if ((s = ereply (MSG_sv_in_b, bufn, NBUFN, NULL)) != TRUE)
X return (s);
X
X if (strcmp (bufn, curbp -> b_bname) == 0)
X {
X writ_echo (MSG_sav_slf);
X return (FALSE);
X }
X
X /* save this name for ughly reversal */
X strcpy (oldbufn, curbp -> b_bname);
X
X /* copy stuff using killbuffer as work space - hack !! * than move it to
X named place using yank - Quick AND Dirty */
X copyregion (f, n, k);
X _usebuffer (bufn);
X curbp -> b_flag |= BFSAV; /* mark as a saved buffer */
X
X yank (f, n, k);
X kdelete (); /* clean out kill buffer */
X _usebuffer (oldbufn);
X writ_echo (okmsg);
X return (TRUE);
X}
X
X
END_OF_FILE
if test 4582 -ne `wc -c <'region.c'`; then
echo shar: \"'region.c'\" unpacked with wrong size!
fi
chmod +x 'region.c'
# end of 'region.c'
fi
if test -f 'spawn.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'spawn.c'\"
else
echo shar: Extracting \"'spawn.c'\" \(1534 characters\)
sed "s/^X//" >'spawn.c' <<'END_OF_FILE'
X/*
X* MS-DOS spawn command.com
X*/
X#include "def.h"
X
Xextern char MSG_shell[];
Xextern char MSG_def_shell[];
Xextern char MSG_pmpt[];
Xextern char MSG_pt[];
Xextern char MSG_pme[];
Xextern char MSG_null[];
X
X#include "lintfunc.dec"
X/* #include <dos.h> */
X#if MSDOS
X#include "process.h"
X#endif
Xchar *cspec = NULL; /* Command string. */
Xchar *pspec = NULL;
X
X/*
X* Create a subjob with a copy
X* of the command intrepreter in it. When the
X* command interpreter exits, mark the screen as
X* garbage so that you do a full repaint.
X*/
Xbool spawncli (f, n, k)
X{
X#if MSDOS
X
X char *getenv ();
X char old_prompt[128];
X char prompt_line[128];
X
X ttcolor (CTEXT); /* Normal color. */
X ttmove (nrow - 1, 0); /* Last line. */
X ttflush ();
X ttcooked ();
X#ifndef IBM
X strcpy (prompt_line, MSG_pmpt);
X pspec = getenv (MSG_pt);
X strcpy (old_prompt, pspec);
X strcat (prompt_line, pspec);
X if (strlen (prompt_line - strlen (MSG_pme)) >= 64)
X /* VERY rude, but setenv not found */
X {
X if (putenv (MSG_pmpt) == -1)
X exit (1);
X }
X else
X if (putenv (prompt_line) == -1)
X exit (1);
X
X#endif
X if (!cspec && !(cspec = getenv (MSG_shell)))/* jam */
X cspec = MSG_def_shell;
X spawnl (P_WAIT, cspec, MSG_null, NULL);
X putenv (MSG_pme);
X if (putenv (old_prompt) == -1)
X exit (1);
X ttraw ();
X sgarbf = TRUE;
X#endif
X return (TRUE);
X}
X
END_OF_FILE
if test 1534 -ne `wc -c <'spawn.c'`; then
echo shar: \"'spawn.c'\" unpacked with wrong size!
fi
chmod +x 'spawn.c'
# end of 'spawn.c'
fi
if test -f 'tcap.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'tcap.c'\"
else
echo shar: Extracting \"'tcap.c'\" \(2339 characters\)
sed "s/^X//" >'tcap.c' <<'END_OF_FILE'
X/* tcap: Unix V5, V7 and BS4.2 Termcap video driver
X for beav
X*/
X
X#include "def.h"
X
X#if UNIX
X
X#define MARGIN 8
X#define SCRSIZ 64
X#define NPAUSE 10 /* # times thru update to pause */
X#define BEL 0x07
X#define ESC 0x1B
X
Xextern int ttgetc();
Xextern int ttputc();
Xextern int tgetnum();
Xextern int ttflush();
Xextern int ttclose();
Xextern int tput();
Xextern char *tgoto();
X#if COLOR
Xextern int tcapfcol();
Xextern int tcapbcol();
X#endif
X
X#define TCAPSLEN 315
Xchar tcapbuf[TCAPSLEN];
Xchar *UP, PC, *CM, *CE, *CL, *SO, *SE;
X
Xtcapopen()
X{
X char *getenv();
X char *t, *p, *tgetstr();
X char tcbuf[1024];
X char *tv_stype;
X char err_str[72];
X
X if ((tv_stype = getenv("TERM")) == NULL)
X {
X puts("Environment variable TERM not defined!");
X exit(1);
X }
X
X if ((tgetent(tcbuf, tv_stype)) != 1)
X {
X sprintf(err_str, "Unknown terminal type %s!", tv_stype);
X puts(err_str);
X exit(1);
X }
X
X
X if ((nrow=(short)tgetnum("li")-1) == -1){
X puts("termcap entry incomplete (lines)");
X exit(1);
X }
X
X if ((ncol=(short)tgetnum("co")) == -1){
X puts("Termcap entry incomplete (columns)");
X exit(1);
X }
X
X p = tcapbuf;
X t = tgetstr("pc", &p);
X if(t)
X PC = *t;
X
X CL = tgetstr("cl", &p);
X CM = tgetstr("cm", &p);
X CE = tgetstr("ce", &p);
X UP = tgetstr("up", &p);
X SE = tgetstr("se", &p);
X SO = tgetstr("so", &p);
X
X if(CL == NULL || CM == NULL || UP == NULL)
X {
X puts("Incomplete termcap entry\n");
X exit(1);
X }
X
X if (p >= &tcapbuf[TCAPSLEN])
X {
X puts("Terminal description too big!\n");
X exit(1);
X }
X}
X
Xtcapmove(row, col)
Xregister int row, col;
X{
X putpad(tgoto(CM, col, row));
X}
X
Xtcapeeol()
X{
X putpad(CE);
X}
X
Xtcapeeop()
X{
X putpad(CL);
X}
X
Xtcaprev(state) /* change reverse video status */
Xint state; /* FALSE = normal video, TRUE = reverse video */
X
X{
X static int revstate = FALSE;
X if (state) {
X if (SO != NULL)
X putpad(SO);
X } else
X if (SE != NULL)
X putpad(SE);
X}
X
Xputpad(str)
Xchar *str;
X{
X tputs(str, 1, ttputc);
X}
X
Xputnpad(str, n)
Xchar *str;
X{
X tputs(str, n, ttputc);
X}
X
X#endif
END_OF_FILE
if test 2339 -ne `wc -c <'tcap.c'`; then
echo shar: \"'tcap.c'\" unpacked with wrong size!
fi
# end of 'tcap.c'
fi
if test -f 'termio.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'termio.c'\"
else
echo shar: Extracting \"'termio.c'\" \(3413 characters\)
sed "s/^X//" >'termio.c' <<'END_OF_FILE'
X/*
X * The functions in this file negotiate with the operating system for
X * characters, and write characters in a barely buffered fashion on the display.
X * All operating systems.
X */
X
X#include "def.h"
X
X#if UNIX /* System V */
X
X#include <stdio.h>
X#include <signal.h>
X#include <termio.h>
X#include <errno.h>
X#include <fcntl.h>
Xint kbdflgs; /* saved keyboard fd flags */
Xint kbdpoll; /* in O_NDELAY mode */
Xint kbdqp; /* there is a char in kbdq */
Xchar kbdq; /* char we've already read */
Xstruct termio otermio; /* original terminal characteristics */
Xstruct termio ntermio; /* charactoristics to use inside */
X
Xint nrow; /* Terminal size, rows. */
Xint ncol; /* Terminal size, columns. */
X
X/*
X * This function is called once to set up the terminal device streams.
X * On VMS, it translates TT until it finds the terminal, then assigns
X * a channel to it and sets it raw. On CPM it is a no-op.
X */
Xttopen()
X{
X ioctl(0, TCGETA, &otermio); /* save old settings */
X ntermio.c_iflag = 0; /* setup new settings */
X ntermio.c_oflag = 0;
X ntermio.c_cflag = otermio.c_cflag;
X ntermio.c_lflag = 0;
X ntermio.c_line = otermio.c_line;
X ntermio.c_cc[VMIN] = 1;
X ntermio.c_cc[VTIME] = 0;
X ioctl(0, TCSETAW, &ntermio); /* and activate them */
X kbdflgs = fcntl( 0, F_GETFL, 0 );
X kbdpoll = FALSE;
X /* on all screens we are not sure of the initial position
X of the cursor */
X ttrow = 999;
X ttcol = 999;
X nrow = NROW;
X ncol = NCOL;
X}
X
X/*
X * This function gets called just before we go back home to the command
X * interpreter. On VMS it puts the terminal back in a reasonable state.
X * Another no-operation on CPM.
X */
Xttclose()
X{
X if (ioctl(0, TCSETAW, &otermio) == -1) /* restore terminal settings */
X printf ("closing ioctl on dev 0 failure, error = %d\n", errno);
X if (fcntl(0, F_SETFL, kbdflgs) == -1)
X printf ("closing fcntl on dev 0 failure, error = %d\n", errno);
X}
X
X/*
X * Write a character to the display. On VMS, terminal output is buffered, and
X * we just put the characters in the big array, after checking for overflow.
X * On CPM terminal I/O unbuffered, so we just write the byte out. Ditto on
X * MS-DOS (use the very very raw console output routine).
X */
Xttputc(c)
X{
X fputc(c, stdout);
X}
X
X/*
X * Flush terminal buffer. Does real work where the terminal output is buffered
X * up. A no-operation on systems where byte at a time terminal I/O is done.
X */
Xttflush()
X{
X fflush(stdout);
X}
X
X/*
X * Read a character from the terminal, performing no editing and doing no echo
X * at all. More complex in VMS that almost anyplace else, which figures. Very
X * simple on CPM, because the system can do exactly what you want.
X */
Xttgetc()
X{
X if( kbdqp )
X kbdqp = FALSE;
X else
X {
X if( kbdpoll && fcntl( 0, F_SETFL, kbdflgs ) < 0 )
X return FALSE;
X kbdpoll = FALSE;
X while (read(0, &kbdq, 1) != 1)
X ;
X }
X return ( kbdq & 127 );
X}
X
X/* typahead(): Check to see if any characters are already in the
X keyboard buffer
X*/
Xttkeyready ()
X{
X if( !kbdqp )
X {
X if( !kbdpoll && fcntl( 0, F_SETFL, kbdflgs | O_NDELAY ) < 0 )
X return(FALSE);
X kbdqp = (1 == read( 0, &kbdq, 1 ));
X }
X return ( kbdqp );
X}
X#endif
X
END_OF_FILE
if test 3413 -ne `wc -c <'termio.c'`; then
echo shar: \"'termio.c'\" unpacked with wrong size!
fi
# end of 'termio.c'
fi
if test -f 'tty.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'tty.c'\"
else
echo shar: Extracting \"'tty.c'\" \(6930 characters\)
sed "s/^X//" >'tty.c' <<'END_OF_FILE'
X/*
X* Wang PC terminal display TTY.C
X*
X*/
X#include "def.h"
X
Xvoid ttinit ();
Xvoid tttidy ();
Xvoid ttmove ();
Xvoid tteeol ();
Xvoid tteeop ();
Xvoid ttbeep ();
Xvoid asciiparm ();
Xvoid ttnowindow (); /* stub */
Xvoid ttcolor ();
Xextern void tcapopen ();
Xextern void tcapmove ();
X
X#if GOSLING
Xvoid ttinsl ();
Xvoid ttdell ();
X#endif
X
X#include "lintfunc.dec"
X#if MSDOS
X#include "dos.h"
Xextern bool ibm_pc, mem_map;
X#endif
X#define BEL 0x07 /* BEL character. */
X#define ESC 0x1B /* ESC character. */
X
Xextern int ttrow;
Xextern int ttcol;
Xextern int tttop;
Xextern int ttbot;
Xextern int tthue;
X
Xint tceeol = 3; /* Costs. */
Xint rowb = NROW;
X
X/*
X* Initialize the terminal when the editor
X* gets started up.
X*/
Xvoid ttinit ()
X{
X#if MSDOS
X ttraw ();
X#endif
X#if UNIX
X tcapopen();
X#endif
X}
X
X/*
X* Clean up the terminal, in anticipation of
X* a return to the command interpreter.
X*/
Xvoid tttidy ()
X{
X#if MSDOS
X ttcooked ();
X#endif
X}
X
X/*
X* Move the cursor to the specified
X* origin 0 row and column position. Try to
X* optimize out extra moves; redisplay may
X* have left the cursor in the right
X* location last time!
X*/
Xvoid ttmove (row, col)
X{
X#if MSDOS
X union REGS regs;
X
X/* Move in both axes */
X if (ibm_pc)
X {
X regs.h.ah = 2;
X regs.h.dh = (char)row;
X regs.h.dl = (char)col;
X regs.h.bh = 0;
X int86 (0x10, ®s, ®s); /* set cursor position */
X }
X else
X#endif
X#if UNIX
X tcapmove(row, col);
X#endif
X#if ANSI
X {
X ttputc (ESC);
X ttputc ('[');
X asciiparm (row + 1);
X ttputc (';');
X asciiparm (col + 1);
X ttputc ('H');
X }
X#endif
X ttrow = row;
X ttcol = col;
X}
X
X/*
X* Erase to end of line.
X*/
Xvoid tteeol ()
X{
X char col, row, i;
X#if MSDOS
X union REGS regs;
X
X if (ibm_pc)
X {
X regs.h.ah = 3;
X regs.h.bh = 0;
X int86 (0x10, ®s, ®s); /* get cursor position */
X col = regs.h.dl;
X row = regs.h.dh;
X for (i = col ; i < (NCOL - 1); i++)
X {
X regs.h.ah = 0x0e;
X regs.h.bl = 0;
X regs.h.bh = 0;
X regs.h.al = ' ';
X int86 (0x10, ®s, ®s); /* set cursor position */
X }
X /* put cursor back to original position */
X regs.h.ah = 2;
X regs.h.bh = 0;
X regs.h.dl = col;
X regs.h.dh = row;
X int86 (0x10, ®s, ®s); /* get cursor position */
X }
X else
X#endif
X#if ANSI
X {
X ttputc (ESC);
X ttputc ('[');
X#if MSDOS
X if (ibm_pc)
X ttputc ('0'); /* this is necessary in IBM PC's */
X#endif
X ttputc ('K');
X }
X#endif
X#if UNIX
X tcapeeol();
X#endif
X }
X
X/*
X* Erase to end of page.
X* only ever used when cursor is at 0,0, so IBM screen erase
X* is same as eop
X*/
Xvoid tteeop ()
X{
X#if MSDOS
X union REGS regs;
X char i, j;
X
X if (ibm_pc)
X {
X for (j = 0 ; j < nrow; j++)
X {
X for (i = 0 ; i < NCOL; i++)
X {
X regs.h.ah = 0x0e;
X regs.h.bl = 0;
X regs.h.bh = 0;
X regs.h.al = ' ';
X int86 (0x10, ®s, ®s); /* set cursor position */
X }
X }
X }
X else
X#endif
X#if ANSI
X {
X ttcolor (CTEXT);
X ttputc (ESC);
X ttputc ('[');
X#if MSDOS
X if (ibm_pc)
X ttputc ('0');
X else
X#endif
X ttputc ('2');
X ttputc ('J');
X }
X#endif
X#if UNIX
X tcapeeop();
X#endif
X}
X
X/*
X* Make a noise.
X*/
Xvoid ttbeep ()
X{
X ttputc (BEL);
X ttflush ();
X}
X
X/*
X* Convert a number to decimal
X* ascii, and write it out. Used to
X* deal with numeric arguments.
X*/
Xvoid asciiparm (n)
Xregister int n;
X{
X register int q;
X
X q = n / 10;
X if (q != 0)
X asciiparm (q);
X ttputc ((n % 10) + '0');
X}
X
X#if GOSLING
X/*
X* Insert a block of blank lines onto the
X* screen, using a scrolling region that starts at row
X* "row" and extends down to row "bot". Deal with the one
X* line case, which is a little bit special, with special
X* case code.
X*/
Xvoid ttinsl (row, bot, nchunk)
X{
X if (row == bot)
X {
X /* Funny case. */
X if (nchunk != 1)
X abort ();
X ttmove (row, 0);
X tteeol ();
X }
X else
X {
X /* General case. */
X ttputc (ESC);
X ttputc ('/');
X asciiparm (row + 1);
X ttputc (';');
X asciiparm (bot + 1);
X ttputc (';');
X asciiparm (nchunk);
X ttputc (';');
X ttputc ('0');
X ttputc ('S');
X }
X}
X
X/*
X* Delete a block of lines, with the uppermost
X* line at row "row", in a screen slice that extends to
X* row "bot". The "nchunk" is the number of lines that have
X* to be deleted. Watch for the pathalogical 1 line case,
X* where the scroll region is *not* the way to do it.
X* The block delete is used by the slightly more
X* optimal display code.
X*/
Xvoid ttdell (row, bot, nchunk)
X{
X if (row == bot)
X {
X /* Funny case. */
X if (nchunk != 1)
X abort ();
X ttmove (row, 0);
X tteeol ();
X }
X else
X {
X /* General case. */
X ttputc (ESC);
X ttputc ('/');
X asciiparm (row + 1);
X ttputc (';');
X asciiparm (bot + 1);
X ttputc (';');
X asciiparm (nchunk);
X ttputc (';');
X ttputc ('1');
X ttputc ('S');
X }
X}
X#endif
X
X/*
X* Switch to full screen scroll. This is
X* used by "spawn.c" just before is suspends the
X* editor, and by "display.c" when it is getting ready
X* to exit. This is a no-op.
X*/
Xvoid ttnowindow (){}
X
X/*
X* Set the current writing color to the
X* specified color. Watch for color changes that are
X* not going to do anything (the color is already right)
X* and don't send anything to the display.
X*/
Xvoid ttcolor (color)
Xregister int color;
X{
X#if MSDOS
X if (mem_map)
X {
X tthue = color; /* Save the color. */
X return;
X }
X#endif
X#if UNIX
X if (color == CTEXT)
X tcaprev (FALSE);
X else
X tcaprev (TRUE);
X tthue = color; /* Save the color. */
X#endif
X#if ANSI
X if (color != tthue)
X {
X if (color == CTEXT)
X { /* Normal video. */
X ttputc (ESC);
X ttputc ('[');
X ttputc ('0');
X ttputc ('m');
X }
X else
X if (color == CMODE)
X { /* Reverse video. */
X ttputc (ESC);
X ttputc ('[');
X ttputc ('7');
X ttputc ('m');
X }
X tthue = color; /* Save the color. */
X }
X#endif
X}
END_OF_FILE
if test 6930 -ne `wc -c <'tty.c'`; then
echo shar: \"'tty.c'\" unpacked with wrong size!
fi
chmod +x 'tty.c'
# end of 'tty.c'
fi
if test -f 'ttyio.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'ttyio.c'\"
else
echo shar: Extracting \"'ttyio.c'\" \(3603 characters\)
sed "s/^X//" >'ttyio.c' <<'END_OF_FILE'
X/*
X*
X* MS-DOS terminal I/O. TTYIO.C
X*/
X#if MSDOS
X#include "def.h"
X
Xvoid ttopen ();
Xvoid ttclose (); /* stub */
Xvoid ttputc ();
Xvoid putline ();
Xvoid ttflush (); /* stub */
Xint ttkeyready ();
Xint ttgetc ();
Xvoid ttraw ();
Xvoid ttcooked ();
Xint set_crt_type ();
X#if RUNCHK
Xchar ERR_bd_pl[];
X#endif
X#include "lintfunc.dec"
X#include "dos.h"
X
Xint slot;
Xint scr_type;
X#define SCREEN_PORT (video_port)
Xstatic int video_port =
X{0x1010
X};
X
Xextern bool wang_pc;
Xextern bool ibm_pc;
Xint nrow; /* Terminal size, rows. */
Xint ncol; /* Terminal size, columns. */
Xint last_key;
X
X/*
X* Initialization.
X* Almost no operation in MS-DOS.
X*/
Xvoid ttopen ()
X{
X if (wang_pc && !ibm_pc)
X set_crt_type ();
X nrow = NROW;
X ncol = NCOL;
X}
X
Xvoid ttclose ()
X{
X}
X/*
X* Write character.
X*/
Xvoid ttputc (c)
X{
X bdos (6, c, 0);
X}
X
Xvoid putline (row, startcol, stringsize, string)
Xint row,
X startcol,
X stringsize;
Xchar *string;
X{
X extern int tthue;
X unsigned short *screen;
X int x,
X attribute;
X char c_row, c_col, i;
X union REGS regs;
X
X if (ibm_pc)
X {
X c_row = row - 1;
X c_col = startcol - 1;
X for (i = 0; i < stringsize; i++)
X {
X regs.h.ah = 2;
X regs.h.dh = c_row;
X regs.h.dl= c_col;
X regs.h.bh = 0;
X int86 (0x10, ®s, ®s); /* set cursor position */
X
X if (tthue == CTEXT)
X regs.h.bl = 0x07;
X if (tthue == CMODE)
X regs.h.bl = 0x70;
X regs.h.ah = 9;
X regs.h.bh = 0;
X regs.h.al = string[i];
X regs.x.cx= 1;
X int86 (0x10, ®s, ®s); /* set cursor position */
X c_col++;
X }
X }
X else if (wang_pc)
X {
X if (tthue == CTEXT)
X attribute = 0x00;
X else
X attribute = 0x02;
X
X x = stringsize;
X screen = (unsigned short *) WANG_CHARACTER_SCREEN;
X screen += ((row - 1) * 80) + startcol - 1;
X outp (SCREEN_PORT, 01);
X while (x--)
X {
X *screen = (*string++ << 8) | attribute;
X screen++;
X }
X outp (SCREEN_PORT, 00);
X }
X}
X
X/*
X* return with a TRUE if key was struck.
X*/
Xint ttkeyready ()
X{
X int cnt;
X
X if (last_key != 0)
X return (1);
X
X last_key = bdos (6, 0xff, 0);
X last_key &= 0xff;
X if (last_key == 0)
X return (0);
X else
X return (1);
X}
X
X/*
X* Read character.
X*/
Xint ttgetc ()
X{
X int c;
X if (last_key != 0)
X {
X c = last_key;
X last_key = 0;
X return (c);
X }
X ttcooked ();
X c = (bdos (7, 0, 0) & 0xFF);
X ttraw ();
X return (c);
X}
X
X/* disable nasty cntrl-c during disk io!
X*/
Xvoid ttraw ()
X{
X union REGS inregs, outregs;
X
X inregs.h.al = 1;
X inregs.h.ah = 0x33;
X inregs.h.dl = 0;
X intdos (&inregs, &outregs);
X/*
X cntrlcoff();
X*/
X}
X
X/* re enable cntrl-c for keyboard
X*/
Xvoid ttcooked ()
X{
X union REGS inregs, outregs;
X
X inregs.h.al = 1;
X inregs.h.ah = 0x33;
X intdos (&inregs, &outregs);
X inregs.h.dl = 1;
X/*
X cntrlcon();
X*/
X}
X
X/* switch physical monitors
X*/
Xstatic char str[] =
X{0x1b, '/', 1, 's'
X};
X
Xint set_crt_type ()
X{
X char active_screen;
X
X active_screen = getscreenstate ();
X slot = active_screen & 0x0f;
X scr_type = (active_screen & 0x70) >> 4;
X video_port = 0x1010 | (slot << 8);
X}
X#endif
END_OF_FILE
if test 3603 -ne `wc -c <'ttyio.c'`; then
echo shar: \"'ttyio.c'\" unpacked with wrong size!
fi
chmod +x 'ttyio.c'
# end of 'ttyio.c'
fi
if test -f 'wangpc.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'wangpc.c'\"
else
echo shar: Extracting \"'wangpc.c'\" \(3557 characters\)
sed "s/^X//" >'wangpc.c' <<'END_OF_FILE'
X#define LINT_ARGS 1 /* enable lint type checking */
X#include "def.h"
X#include "lintfunc.dec"
X#if MSDOS
X#include "dos.h"
X
Xtypedef struct SCREENINFO
X{
X unsigned char state;
X unsigned char scanoff;
X unsigned short bufseg;
X unsigned char colors;
X unsigned char row;
X unsigned char col;
X unsigned char attr;
X unsigned char auxmod;
X unsigned char auxmod2;
X} SCREENINFO;
X
Xtypedef struct SYSCONFIG
X{
X unsigned short version;
X unsigned short memsize;
X unsigned short reserved[2];
X unsigned short screen_count;
X unsigned short screens[4];
X} SYSCONFIG;
X
X#define SENDCHAR 6
X#define SENDLINE 0x0d
X#define BIOS 0x88
X#define GETSYSCON 1
X
Xbool wang_pc = FALSE;
Xbool ibm_pc = FALSE;
Xbool mem_map = FALSE;
X
Xvoid is_wang ()
X {
X union REGS inregs, outregs;
X struct SREGS segregs;
X unsigned char far *memptr;
X unsigned char c;
X int i;
X static char wang_id[] = {"WANG"};
X static char ret_str[6];
X char *chr_ptr;
X
X chr_ptr = ret_str;
X /* test for Wang PC */
X memptr = (unsigned char far *)0xFC003FC2L;
X wang_pc = TRUE;
X for (i=0;(i<4 && wang_pc);i++)
X {
X if(*memptr != wang_id[i])
X wang_pc = FALSE;
X memptr++;
X }
X
X if (wang_pc)
X {
X mem_map = TRUE;
X ret_str[0] = 0xFF; /* set to known value */
X mem_map = TRUE;
X inregs.h.al = 0x02;
X inregs.h.ah = 0x44;
X inregs.x.bx = 0;
X inregs.x.cx = 1;
X inregs.x.dx = FP_OFF (chr_ptr);
X segregs.ds = FP_SEG (chr_ptr);
X
X int86x (0x21, &inregs, &outregs, &segregs);
X if (ret_str[0] == 0x11)
X {
X ibm_pc = TRUE;
X return;
X }
X ibm_pc = FALSE;
X return;
X }
X
X /* Must be an IBM or clone */
X memptr = (unsigned char far *)0xF000FFFEL;
X c = *memptr;
X switch(c)
X {
X case 0xFC: /* IBM AT or clone */
X case 0xFD: /* IBM PC Jr */
X case 0xFE: /* IBM XT or clone */
X case 0xFF: /* IBM PC or clone */
X mem_map = TRUE;
X ibm_pc = TRUE;
X return;
X }
X }
X
Xint getsysconfig (outregs, segregs)
X union REGS * outregs;
Xstruct SREGS *segregs;
X{
X union REGS inregs;
X
X inregs.h.al = GETSYSCON;
X
X int86x (BIOS, &inregs, outregs, segregs);
X}
X
Xchar getscreenstate ()
X{
X struct SREGS segregs;
X union REGS outregs;
X
X struct SYSCONFIG *config;
X struct SCREENINFO *screeninfo;
X unsigned short *shortptr;
X unsigned int screen_count;
X
X getsysconfig (&outregs, &segregs);
X
X /* set pointer to force register info into a long pointer. */
X shortptr = (unsigned short *) & config;
X
X /* Offset is first, it comes back in BX */
X *shortptr = (unsigned short) outregs.x.bx;
X shortptr++;
X
X /* segment is in ES */
X *shortptr = (unsigned short) segregs.es;
X
X /* Now, the config pointer should be set to the config table. */
X/* printf("Version = %04x \n",config->version);
X printf("Memsize = %04x \n",config->memsize);
X printf("Screens = %04x \n",config->screen_count);
X*/
X screen_count = config -> screen_count;
X while (screen_count)
X {
X shortptr = (unsigned short *) & screeninfo;
X *shortptr = (unsigned short) config -> screens[screen_count - 1];
X shortptr++;
X *shortptr = (unsigned short) segregs.es;
X if (screeninfo -> state & 0x80)
X break;
X screen_count--;
X }
X return (screeninfo -> state);
X}
X#endif
END_OF_FILE
if test 3557 -ne `wc -c <'wangpc.c'`; then
echo shar: \"'wangpc.c'\" unpacked with wrong size!
fi
chmod +x 'wangpc.c'
# end of 'wangpc.c'
fi
if test -f 'word.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'word.c'\"
else
echo shar: Extracting \"'word.c'\" \(3025 characters\)
sed "s/^X//" >'word.c' <<'END_OF_FILE'
X/*
X* Word mode commands.
X* The routines in this file
X* implement commands that work unit at
X* a time. There are all sorts of unit mode
X* commands. If I do any sentence and/or paragraph
X* mode commands, they are likely to be put in
X* this file.
X*/
X#define LINT_ARGS 1 /* enable lint type checking */
X#include "def.h"
X
Xchar forwunit ();
X
X#include "lintfunc.dec"
X/*
X* Move the cursor backward by
X* "n" units. All of the details of motion
X* are performed by the "backchar" and "forwchar"
X* routines. Error if you try to move beyond
X* the buffers.
X*/
Xchar backunit (f, n, k)
X{
X char ret;
X
X if (n < 0)
X return (forwunit (f, -n, KRANDOM));
X
X curwp -> w_unit_offset = 0;
X while (n--)
X {
X ret = move_ptr (curwp, -(long)R_B_PER_U(curwp), TRUE, TRUE, TRUE);
X }
X wind_on_dot (curwp);
X curwp -> w_flag |= WFMODE; /* update mode line */
X return (ret);
X}
X
X
X/*
X* Move the cursor forward by
X* the specified number of units. All of the
X* motion is done by "forwchar". Error if you
X* try and move beyond the buffer's end.
X*/
Xchar forwunit (f, n, k)
X{
X
X if (n < 0)
X return (backunit (f, -n, KRANDOM));
X
X curwp -> w_unit_offset = 0;
X while (n--)
X {
X move_ptr (curwp, (long)R_B_PER_U(curwp), TRUE, TRUE, TRUE);
X }
X wind_on_dot (curwp);
X curwp -> w_flag |= WFMODE; /* update mode line */
X return (TRUE);
X}
X
X
X/*
X* Kill forward by "n" units. The rules for final
X* status are now different. It is not considered an error
X* to delete fewer units than you asked. This lets you say
X* "kill lots of units" and have the command stop in a reasonable
X* way when it hits the end of the buffer.
X*/
Xbool delfunit (f, n, k)
X{
X register LINE * dotp;
X register int doto;
X
X if (n < 0)
X return (FALSE);
X if ((lastflag & CFKILL) == 0)/* Purge kill buffer. */
X kdelete ();
X thisflag |= CFKILL;
X while (n--)
X {
X ldelete (R_B_PER_U(curwp), TRUE);
X }
X curwp -> w_flag |= WFHARD;
X curwp -> w_unit_offset = 0;
X return (TRUE);
X}
X
X
X/*
X* Kill backwards by "n" units. The rules
X* for success and failure are now different, to prevent
X* strange behavior at the start of the buffer. The command
X* only fails if something goes wrong with the actual delete
X* of the characters. It is successful even if no characters
X* are deleted, or if you say delete 5 units, and there are
X* only 4 units left. I considered making the first call
X* to "backchar" special, but decided that that would just
X* be wierd. Normally this is bound to "M-Rubout" and
X* to "M-Backspace".
X*/
Xbool delbunit (f, n, k)
X{
X int size;
X
X if (n < 0)
X return (FALSE);
X if ((lastflag & CFKILL) == 0)/* Purge kill buffer. */
X kdelete ();
X thisflag |= CFKILL;
X size = R_B_PER_U(curwp);
X while (n--)
X {
X if (move_ptr (curwp, -((long)size), TRUE, TRUE, TRUE))
X ldelete (size, TRUE);
X }
X curwp -> w_flag |= WFHARD;
X return (TRUE);
X}
X
END_OF_FILE
if test 3025 -ne `wc -c <'word.c'`; then
echo shar: \"'word.c'\" unpacked with wrong size!
fi
chmod +x 'word.c'
# end of 'word.c'
fi
echo shar: End of archive 1 \(of 11\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked all 11 archives.
rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
echo You still need to unpack the following archives:
echo " " ${MISSING}
fi
## End of shell archive.
exit 0
More information about the Alt.sources
mailing list