summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Bunk <bunk@debian.org>2021-12-27 14:16:45 -0800
committerAdrian Bunk <bunk@debian.org>2021-12-27 14:16:45 -0800
commitb872569b6fa00f8e771ad7927fa448d0ea0eacac (patch)
treedb95367cd19717f9c1f1b851f981eb279f45d84a
parent48271ccd706559aa646282557dcf2e94f7544308 (diff)
beav (1:1.40-18.1) unstable; urgency=medium
* Non-maintainer upload. * debian/rules: Add build-{arch,indep}. (Closes: #998993) [dgit import package beav 1:1.40-18.1]
-rw-r--r--Makefile25
-rw-r--r--beav.163
-rw-r--r--buffer.c6
-rw-r--r--debian/changelog151
-rw-r--r--debian/control26
-rw-r--r--debian/copyright45
-rwxr-xr-xdebian/rules53
-rw-r--r--def.h30
-rw-r--r--display.c67
-rw-r--r--english.c1
-rw-r--r--extend.c25
-rw-r--r--file.c8
-rw-r--r--fileio.c7
-rw-r--r--format.c23
-rw-r--r--kbd.c1
-rw-r--r--language.c1
-rw-r--r--line.c1
-rw-r--r--main.c10
-rw-r--r--prototyp.h12
-rw-r--r--random.c71
-rw-r--r--region.c1
-rw-r--r--search.c3
-rw-r--r--symbol.c199
-rw-r--r--tcap.c7
-rw-r--r--termio.c36
-rw-r--r--text.c2
-rw-r--r--tty.c5
-rw-r--r--ttykbd.c1
-rw-r--r--window.c7
-rw-r--r--word.c2
30 files changed, 725 insertions, 164 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..6bc42bb
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,25 @@
+# This is the makefile for BSD UNIX
+#CFLAGS= -g -DUNIX
+CFLAGS= -g -DUNIX -Wall
+CC=gcc
+
+OFILES= basic.o ebcdic.o fileio.o region.o text.o wangpc.o \
+ buffer.o echo.o language.o main.o search.o tty.o window.o \
+ cinfo.o extend.o kbd.o spawn.o ttyio.o termio.o tcap.o word.o \
+ display.o file.o line.o random.o symbol.o ttykbd.o format.o
+
+
+CFILES= basic.c ebcdic.c fileio.c region.c text.c wangpc.c \
+ buffer.c echo.c language.c main.c search.c tty.c window.c \
+ cinfo.c extend.c kbd.c spawn.c ttyio.c termio.c tcap.c word.c \
+ display.c file.c line.c random.c symbol.c ttykbd.c
+
+HFILES= def.h prototyp.h
+
+beav: $(OFILES)
+ $(CC) $(CFLAGS) $(OFILES) -lncurses -o beav
+
+clean:
+ rm -f *.o beav
+
+(OFILES): $(HFILES)
diff --git a/beav.1 b/beav.1
new file mode 100644
index 0000000..6fe1313
--- /dev/null
+++ b/beav.1
@@ -0,0 +1,63 @@
+.TH BEAV 1 "" "" \" -*- nroff -*-
+.SH NAME
+beav \- binary file editor and viewer
+.SH SYNOPSIS
+.B beav
+[file...]
+.SH DESCRIPTION
+This is a brief description of the minimal set of commands
+that are necessary to start using
+.IR beav
+effectively.
+For more information, review the file /usr/share/doc/beav/beav140.txt.gz.
+.PP
+The \fIfile-visit\fR command,\fB Ctl-X Ctl-V\fR, can be used to read a
+file in for editing. The file can also be read in from the
+command line; \fBbeav <edit_file>\fR.
+.PP
+Data is displayed in one or more windows.
+These commands can be used to navigate around the windows.
+.PP
+.RS
+\fImove-back-char\fB Ctl-B\fB moves left\fR
+.br
+\fImove-back-line\fB Ctl-P\fB moves up\fR
+.br
+\fImove-forw-char\fb Ctl-F\fB moves right\fR
+.br
+\fImove-forw-line\fB Ctl-N\fB moves down\fR
+.br
+\fIwindow-delete\fB Ctl-X 0\fB delete window\fR
+.br
+\fIwindow-expand\fB Ctl-X 1\fB expand window\fR
+.br
+.RE
+.PP
+The \fImove-to-byte\fR command,\fB Ctl-X G\fR, will prompt you for a
+byte position to move to.
+.PP
+These commands will insert a zero byte at the cursor
+position or delete the byte at that position.
+.PP
+.RS
+\fIinsert-unit\fB Ctl-X I\fR
+.br
+\fIdelete-forw-unit\fB Esc D\fR
+.br
+.RE
+.PP
+The \fIfile-save\fR command,\fB Ctl-X Ctl-S\fR, will save the data to
+the file if a change has been made.
+.PP
+The \fIhelp\fR command,\fB Esc ?\fR, will display a list of all
+commands and their current key bindings.
+.PP
+The \fIabort-cmd\fR command,\fB Ctl-G\fR, will abort any command that
+is in operation.
+.PP
+The \fIquit-no-save\fR command,\fB Ctl-X Ctl-C\fR, will exit beav.
+If there is any data that has not been saved you will be warned.
+.PP
+.SH FILES
+/usr/share/doc/beav/beav140.txt.gz
+
diff --git a/buffer.c b/buffer.c
index a2016fb..9adcada 100644
--- a/buffer.c
+++ b/buffer.c
@@ -2,6 +2,8 @@
* Buffer handling.
*/
+#include <string.h>
+#include <stdlib.h>
#include "def.h"
bool onebuf ();
@@ -166,7 +168,7 @@ killbuffer ()
if ((s = ereply (MSG_kill_b, bufn, NBUFN, 0)) != TRUE)
return (s);
- if (s = _killbuffer (bufn))
+ if ((s = _killbuffer (bufn)))
writ_echo (okmsg); /* verbose-ness (jam) */
return (s);
}
@@ -805,7 +807,7 @@ pickone ()
register LINE *lp;
char name[NBUFN + 1];
char buf[3];
- WINDOW *wp;
+ //WINDOW *wp;
lp = curwp->w_dotp; /* get the buffer name from the line */
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..bf37bda
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,151 @@
+beav (1:1.40-18.1) unstable; urgency=medium
+
+ * Non-maintainer upload.
+ * debian/rules: Add build-{arch,indep}. (Closes: #998993)
+
+ -- Adrian Bunk <bunk@debian.org> Tue, 28 Dec 2021 00:16:45 +0200
+
+beav (1:1.40-18) unstable; urgency=low
+
+ * Repackaged with the original 1.40 source so that we get a proper diff.gz.
+ * defs.h:
+ + Removed prototypes for malloc and strcpy/strcat (Closes: #262572).
+
+ -- Sam Hocevar (Debian packages) <sam+deb@zoy.org> Sat, 31 Jul 2004 22:42:19 +0200
+
+beav (1:1.40-17) unstable; urgency=low
+
+ * debian/control:
+ + Set policy to 3.6.1.1.
+ * beav.1:
+ + Fixed documentation location (Closes: #210601).
+ * Fixed warnings everywhere in the code.
+ * main.c:
+ + Added a help string to tell the user how to quit (Closes: #171933).
+ * file.c:
+ + Fixed an overflow in the filename display routine (Closes: #56546).
+ * fileio.c:
+ + Corrected wrong char signedness assumption that caused backup filenames
+ to be mangled (Closes: #46376).
+
+ -- Sam Hocevar (Debian packages) <sam+deb@zoy.org> Tue, 13 Jul 2004 11:36:18 +0200
+
+beav (1:1.40-16) unstable; urgency=low
+
+ * New maintainer (Closes: #227774).
+ * debian/control:
+ + Set policy to 3.6.1.0.
+ + Removed caps in the short description.
+ * debian/copyright:
+ + Added the GPL blurb to the copyright file.
+
+ -- Sam Hocevar (Debian packages) <sam+deb@zoy.org> Tue, 27 Jan 2004 13:22:17 +0100
+
+beav (1:1.40-15) unstable; urgency=low
+
+ * Include patch from James A Morrison for Hurd support.
+ * Update to standards version 3.5.5.
+
+ -- Martin Mitchell <martin@debian.org> Sat, 21 Jul 2001 23:37:20 +1000
+
+beav (1:1.40-14) unstable; urgency=low
+
+ * Update to standards version 3.5.2. (closes: #91113, #91385)
+ * Add build depends. (closes: #70223)
+
+ -- Martin Mitchell <martin@debian.org> Tue, 27 Mar 2001 00:18:25 +1000
+
+beav (1:1.40-13) unstable; urgency=low
+
+ * Update to standards version 2.4.1.
+ * Recompile for ncurses4.
+
+ -- Martin Mitchell <martin@debian.org> Sun, 11 Oct 1998 01:27:50 +1000
+
+beav (1:1.40-12) unstable; urgency=low
+
+ * Fix missing separator in debian/rules. (#25766)
+
+ -- Martin Mitchell <martin@debian.org> Sat, 29 Aug 1998 18:27:04 +1000
+
+beav (1:1.40-11) unstable; urgency=low
+
+ * Include patch for 32 bit float handling. (#5043)
+ (Thanks Randy Gobbel)
+
+ -- Martin Mitchell <martin@debian.org> Sat, 13 Dec 1997 19:37:23 +1100
+
+beav (1:1.40-10) unstable; urgency=low
+
+ * Edit control file description to conform with policy. (#3558)
+
+ -- Martin Mitchell <martin@debian.org> Wed, 3 Dec 1997 01:15:55 +1100
+
+beav (1:1.40-9) unstable; urgency=low
+
+ * New maintainer.
+ * Strip beav binary.
+
+ -- Martin Mitchell <martin@debian.org> Wed, 26 Nov 1997 16:56:02 +1100
+
+beav (1:1.40-8.1) unstable; urgency=low
+
+ * Non-maintainer release.
+ * Use epoch in version.
+
+ -- Martin Mitchell <martin@debian.org> Tue, 4 Nov 1997 01:55:32 +1100
+
+beav (1.40-7.1) unstable; urgency=low
+
+ * Non-maintainer release.
+ * Libc6 compile.
+ * Update from pre 2.0.0.0 standards.
+
+ -- Martin Mitchell <martin@debian.org> Thu, 30 Oct 1997 15:05:31 +1100
+
+Modifications to the beav140- package for debian linux
+
+Changes by Bill Mitchell <mitchell@mdd.comm.mot.com>
+
+1. Added debian.* files.
+2. Added Makefile
+ (It's makefile.bsd with -DBSD removed and some flags changed)
+3. Added beav.1
+
+Changes for beav-140-2
+
+1. Changed debian.rules to Ian Murdock format.
+ Made related changes in debian.control.
+
+2. Added some bolding of beav commands in beav.1.
+
+3. Added beav.1
+
+Changes for beav-140-3
+
+1. Cleaned up control file description and extended description.
+
+Changes for beav-140-4
+
+Priority: Routine
+Changes: Administrative changes
+ Changed beav.1 file mode from 755 to 644
+ Added "SECTION: editors" to control file
+
+Changes for beav-140-5
+ elf package
+ * rebuilt for elf
+
+Changes for beav-140-6
+ elf package
+ * rebuilt using ncurses shared lib
+ * changed ncurses-runtime dependency to ncurses3.0
+
+Changes for beav-140-7
+ elf package
+ * source package multi-architecture compatability changes
+
+Local variables:
+mode: debian-changelog
+End:
+
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..53c0b89
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,26 @@
+Source: beav
+Section: editors
+Priority: optional
+Build-Depends: libncurses-dev
+Maintainer: Sam Hocevar (Debian packages) <sam+deb@zoy.org>
+Standards-Version: 3.6.1.1
+
+Package: beav
+Architecture: any
+Depends: ${shlibs:Depends}
+Description: binary editor and viewer
+ beav (Binary Editor And Viewer) is an editor for binary files containing
+ arbitrary data. Text file editors, on the other hand, expect the files they
+ edit to contain textual data, and/or to be formatted in a certain way (e.g.
+ lines of printable characters delimited by newline characters).
+ .
+ With beav, you can edit a file in HEX, ASCII, EBCDIC, OCTAL, DECIMAL, and
+ BINARY. You can display but not edit data in FLOAT mode. You can search or
+ search and replace in any of these modes. Data can be displayed in BYTE,
+ WORD, or DOUBLE WORD formats. While displaying WORDS or DOUBLE WORDS the
+ data can be displayed in INTEL's or MOTOROLA's byte ordering. Data of any
+ length can be inserted at any point in the file. The source of this data
+ can be the keyboard, another buffer, or a file. Any data that is being
+ displayed can be sent to a printer in the displayed format. Files that are
+ bigger than memory can be handled.
+
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..248fe6e
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,45 @@
+
+debian beav is under the GNU General Public License (GPL).
+
+The following is an email from beav's author confirming this:
+
+---- 8< ----
+To: mitchell@mdd.comm.mot.com
+Subject: Re: beav for debian linux
+Date: Wed, 30 Nov 94 11:41:24 EST
+Message-Id: <9411301141.aa03389@preilley.wiis.wang.com>
+Content-Length: 559
+X-Lines: 10
+Status: RO
+X-Status:
+
+Thank you for your work on BEAV. I do intend to use the GNU copyright
+in the future. You can put the current BEAV under GNU now if
+you would like. I have a list of things to do to BEAV so a new
+release in not imminent. The current version is 1.40 for your
+information. Hope this helps.
+Pete.
+-->>>>>>>>>> Peter Reilley ..... pvr@wiis.wang.com ..... KA1LAT <<<<<<<<<<<--
+ BEAV, the best binary file editor w/src. For info finger pvr@das.wang.com
+ Knocked while you were out
+ - Opportunity
+---- 8< ----
+
+This program is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2, or (at your option) any
+later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
+
+On Debian GNU/Linux systems, the complete text of the GNU General
+Public License can be found in `/usr/share/common-licenses/GPL'.
+
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..321f143
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,53 @@
+#! /usr/bin/make -f
+#
+# Debian rules extensively rewritten by Martin Mitchell <martin@debian.org>
+
+CFLAGS = -O2 -g -Wall -DUNIX -DNOPROTO
+LDFLAGS = -s
+ARCH = $(shell dpkg --print-installation-architecture)
+STRIP=strip --strip-unneeded --remove-section=.note --remove-section=.comment
+
+build:
+# Builds the binary package.
+ make CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)"
+ touch build
+
+clean:
+# Undoes the effect of `make -f debian/rules build'.
+ rm -f build
+ rm -rf debian/tmp debian/substvars debian/files debian/*~
+ rm -f *.o beav core
+
+binary-indep: checkroot build
+ $(checkdir)
+# There are no architecture-independent files to be uploaded
+# generated by this package. If there were any they would be
+# made here.
+
+binary-arch: checkroot build
+ test -f build || make -f debian.rules build
+ rm -rf debian/tmp
+ install -d -g root -m 755 -o root debian/tmp/usr/share/doc/beav debian/tmp/DEBIAN debian/tmp/usr/bin debian/tmp/usr/share/man/man1
+ install -g root -m 755 -o root beav debian/tmp/usr/bin/beav
+ $(STRIP) debian/tmp/usr/bin/beav
+ install -g root -m 644 -o root beav.1 debian/tmp/usr/share/man/man1/beav.1
+ gzip -9v debian/tmp/usr/share/man/man1/*
+ cp debian/changelog debian/tmp/usr/share/doc/beav/changelog.Debian
+ cp beav140.txt debian/tmp/usr/share/doc/beav
+ gzip -9v debian/tmp/usr/share/doc/beav/*
+ cp debian/copyright debian/tmp/usr/share/doc/beav
+ dpkg-shlibdeps debian/tmp/usr/bin/beav
+ dpkg-gencontrol -isp
+ chown -R root.root debian/tmp
+ chmod -R g-ws debian/tmp
+ dpkg --build debian/tmp ..
+
+binary: binary-indep binary-arch
+
+checkroot:
+ $(checkdir)
+ test root = "`whoami`"
+
+build-arch: build
+build-indep: build
+.PHONY: build build-arch build-indep binary binary-arch binary-indep clean checkroot
diff --git a/def.h b/def.h
index 251a871..206277f 100644
--- a/def.h
+++ b/def.h
@@ -9,11 +9,13 @@
* The most common reason to edit this file would be to zap
* the definition of CVMVAS or BACKUP.
*/
+#ifndef DEF_DEF
+#define DEF_DEF
#define LINT_ARGS 1 /* enable lint type checking */
-#include "stdio.h"
+#include <stdio.h>
#ifdef UNIX
-#include "sys/types.h"
+#include <sys/types.h>
#endif /* UNIX */
#define BACKUP 1 /* Make backup file. */
@@ -39,6 +41,7 @@
#define D8 uchar /* this had better be a 8 bit quantity */
#define D16 ushort /* this had better be a 16 bit quantity */
#define D32 ulong /* this had better be a 32 bit quantity */
+#define F32 float /* this had better be a 32 bit quantity */
#define D64 double /* this had better be a 64 bit quantity */
/* this define is reserved for the address of a location in the buffer */
@@ -131,9 +134,9 @@
* Table sizes, etc.
*/
#define NSHASH 31 /* Symbol table hash size. */
-#define NFILEN 256 /* Length, file name. */
-#define NBUFN 13 /* Length, buffer name. */
-#define NFILE 12 /* Length, file name. */ /* krw */
+#define NFILEN 4096 /* Length, file name. */
+#define NBUFN 4097 /* Length, buffer name. */
+#define NFILE 4096 /* Length, file name. */ /* krw */
#define NKBDM 256 /* Length, keyboard macro. */
#define NMSG 512 /* Length, message buffer. */
#define NPAT 80 /* Length, pattern. */
@@ -269,9 +272,9 @@
#define _L 0x04 /* Lower case letter. */
#define _C 0x08 /* Control. */
-#define ISCTRL(c) ((cinfo[(c)]&_C)!=0)
-#define ISUPPER(c) ((cinfo[(c)]&_U)!=0)
-#define ISLOWER(c) ((cinfo[(c)]&_L)!=0)
+#define ISCTRL(c) ((cinfo[(int)(c)]&_C)!=0)
+#define ISUPPER(c) ((cinfo[(int)(c)]&_U)!=0)
+#define ISLOWER(c) ((cinfo[(int)(c)]&_L)!=0)
#define TOUPPER(c) ((c)-0x20)
#define TOLOWER(c) ((c)+0x20)
@@ -295,6 +298,9 @@
#define R_BYTE_FMT(wp) (wp -> w_fmt_ptr -> r_byte_fmt)
#define R_POSITIONS(wp) (wp -> w_fmt_ptr -> r_positions)
+struct vid;
+
+
/*
* The symbol table links editing functions
* to names. Entries in the key map point at the symbol
@@ -557,13 +563,7 @@ extern int flush_count;
extern int rowb;
extern char file_off_bad;
-/*
- * Standard I/O.
- */
-extern char *malloc ();
-extern char *strcpy ();
-extern char *strcat ();
-
#ifndef NOPROTO
#include "prototyp.h"
#endif /* NOPROTO */
+#endif
diff --git a/display.c b/display.c
index b8a46bb..0e18d31 100644
--- a/display.c
+++ b/display.c
@@ -9,11 +9,14 @@
* both off, the terminal is a VT52.
*/
+#include <stdlib.h>
+#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "def.h"
D64 get_double ();
+F32 get_float ();
D32 get_long ();
D16 get_int ();
void writ_echo ();
@@ -23,7 +26,6 @@ uint fill_buf ();
uint get_currow ();
uint get_curcol ();
#ifndef NOPROTO
-struct vid;
void ucopy (struct vid *vvp, struct vid *pvp);
void uline (int row, struct vid *vvp, struct vid *pvp);
#else
@@ -40,6 +42,7 @@ extern char MSG_11lX[];
extern char MSG_11lo[];
extern char MSG_11ld[];
extern char MSG_116e[];
+extern char MSG_106e[];
extern char MSG_03o[];
extern char MSG_06o[];
extern char MSG_011lo[];
@@ -67,6 +70,7 @@ extern char MSG_curs_oct[];
extern char MSG_siz_8[];
extern char MSG_siz_16[];
extern char MSG_siz_32[];
+extern char MSG_siz_64[];
extern char MSG_siz_null[];
extern char MSG_int_shift[];
extern char MSG_mot_shift[];
@@ -170,6 +174,8 @@ vtinit ()
exit (1); /* can't continue */
}
+ memset(video, 0, sizeof (VIDEO) * 2 * nrow);
+
vp = &video[0];
for (i = 0; i < nrow; ++i)
{
@@ -481,6 +487,21 @@ bin_to_text (bin_buf, txt_buf, len, fmt_ptr)
break;
#if FLOAT_DISP
case FLOAT:
+ switch (size)
+ {
+ case DWORDS:
+ {
+ k = 0;
+ for (i = 0; i < len; i += sizeof (F32))
+ {
+ F32 temp_d;
+
+ temp_d = get_float (&bin_buf[i]);
+ sprintf (&txt_buf[posn[k++]], MSG_106e, temp_d);
+ }
+ }
+ break;
+ case DOUBLES:
{
/*
* The Intel floating point representation is;
@@ -502,6 +523,8 @@ bin_to_text (bin_buf, txt_buf, len, fmt_ptr)
}
}
break;
+ }
+ break;
#endif
case HEX:
switch (size)
@@ -673,11 +696,45 @@ get_long (w_buf)
}
#if FLOAT_DISP
+
/*
-* Get an double from the buffer.
+* Get a float from the buffer.
* Perform the Intel byte shuffle if necessary
*/
+F32
+get_float (w_buf)
+ uchar *w_buf;
+
+{
+ uchar temp_float[sizeof (F32)];
+ F32 *fp;
+ int i, siz;
+
+ fp = (F32 *) temp_float;
+ siz = sizeof (F32);
+
+ if (curwp->w_intel_mode)
+ {
+ for (i = 0; i <= siz-1; i++)
+ {
+ temp_float[i] = 0xff & w_buf[i];
+ }
+ }
+ else
+ {
+ for (i = 0; i <= siz-1; i++)
+ {
+ temp_float[(siz - 1) - i] = 0xff & w_buf[i];
+ }
+ }
+ return (*fp);
+}
+
+/*
+* Get a double from the buffer.
+* Perform the Intel byte shuffle if necessary
+*/
D64
get_double (w_buf)
uchar *w_buf;
@@ -698,7 +755,7 @@ get_double (w_buf)
}
else
{
- for (i = 0; i <= 7; i++)
+ for (i = 0; i <= siz-1; i++)
{
temp_doub[(siz - 1) - i] = 0xff & w_buf[i];
}
@@ -1246,6 +1303,7 @@ modeline (wp)
if ((mode == HEX) ||
(mode == DECIMAL) ||
+ (mode == FLOAT) ||
(mode == OCTAL))
{
switch (size)
@@ -1259,6 +1317,9 @@ modeline (wp)
case DWORDS:
sprintf (posn_buf, MSG_siz_32);
break;
+ case DOUBLES:
+ sprintf (posn_buf, MSG_siz_64);
+ break;
#if RUNCHK
default:
writ_echo (ERR_disp_6);
diff --git a/english.c b/english.c
index c124d10..ff0acd0 100644
--- a/english.c
+++ b/english.c
@@ -258,6 +258,7 @@ char MSG_show_save_buf[] = "show-save-buf";
char MSG_unit_size1[] = "display-bytes";
char MSG_unit_size2[] = "display-words";
char MSG_unit_size4[] = "display-double-words";
+char MSG_unit_size8[] = "display-quad-words";
char MSG_reposition_window[] = "window-reposition";
char MSG_set_mark[] = "mark-set";
char MSG_goto_eob[] = "move-to-end";
diff --git a/extend.c b/extend.c
index c6689e7..6620a97 100644
--- a/extend.c
+++ b/extend.c
@@ -1,6 +1,7 @@
/*
* Extended (M-X) commands.
*/
+#include <string.h>
#include "def.h"
extern char MSG_not_now[];
@@ -25,10 +26,10 @@ extern char MSG_unk_rc[];
char *flook ();
-static char *bindnm =
-{
- 0
-}; /* file name for customized key bindings */
+//static char *bindnm =
+//{
+// 0
+//}; /* file name for customized key bindings */
#endif
/*
@@ -240,7 +241,7 @@ wallchart (f, n, k)
if ((sp->s_modify & SBOUND) == 0) /* comment out default binding */
buf[0] = '#';
cp2 = sp->s_name; /* Add function name. */
- while (*cp1++ = *cp2++)
+ while ((*cp1++ = *cp2++))
;
cp1--;
while (cp1 < &buf[HKEY]) /* Goto column 32. */
@@ -269,7 +270,7 @@ wallchart (f, n, k)
*cp1++ = ' ';
buf[0] = '#';
cp2 = sp->s_name; /* Add function name. */
- while (*cp1++ = *cp2++)
+ while ((*cp1++ = *cp2++))
;
cp1--;
while (cp1 < &buf[HENDCOL])
@@ -373,7 +374,7 @@ check_extend (sfname)
if (fname == NULL)
return;
- if (bindf = fopen (fname, "r"))
+ if ((bindf = fopen (fname, "r")))
{
char buffr[80];
char *buffp;
@@ -409,7 +410,7 @@ check_extend (sfname)
}
else
{
- if (sp = symlookup (funcname))
+ if ((sp = symlookup (funcname)))
{
if (binding[keyval] != NULL) /* Unbind old, and */
--binding[keyval]->s_nkey;
@@ -439,7 +440,7 @@ flook (fname, hflag)
register char *home; /* path to home directory */
register char *path; /* environmental PATH variable */
register char *sp; /* pointer into path spec */
- register int i; /* index */
+ //register int i; /* index */
static char fspec[NFILEN * 2]; /* full path spec to search */
char *getenv ();
FILE *bindf;
@@ -456,7 +457,7 @@ flook (fname, hflag)
strcat (fspec, fname);
/* and try it out */
- if (bindf = fopen (fspec, "r"))
+ if ((bindf = fopen (fspec, "r")))
{
fclose (bindf);
return (fspec);
@@ -465,7 +466,7 @@ flook (fname, hflag)
}
/* always try the current directory first */
- if (bindf = fopen (fname, "r"))
+ if ((bindf = fopen (fname, "r")))
{
fclose (bindf);
return (fname);
@@ -490,7 +491,7 @@ flook (fname, hflag)
strcat (fspec, fname);
/* and try it out */
- if (bindf = fopen (fspec, "r"))
+ if ((bindf = fopen (fspec, "r")))
{
fclose (bindf);
return (fspec);
diff --git a/file.c b/file.c
index 3bdfbed..baee574 100644
--- a/file.c
+++ b/file.c
@@ -1,6 +1,7 @@
/*
* File commands.
*/
+#include <string.h>
#include <sys/types.h>
#include <fcntl.h>
#include <sys/stat.h>
@@ -329,7 +330,10 @@ readin (fname, start, end)
bp->b_flag &= ~BFCHG; /* No change. */
#endif
if ((start == 0L) && (end == MAXPOS))
- strcpy (bp->b_fname, fname);
+ {
+ strncpy (bp->b_fname, fname, NFILEN);
+ bp->b_fname[NFILEN - 1] = '\0';
+ }
else
strcpy (bp->b_fname, MSG_null);
bp->b_file_size = 0;
@@ -337,7 +341,7 @@ readin (fname, start, end)
if ((s = ffropen (fname)) == FIOERR || s == FIOFNF) /* jam */
goto out;
bp->b_file_size = file_len (); /* get the file lenth */
- sprintf (buf, MSG_reading, fname); /* jam */
+ snprintf (buf, NCOL, MSG_reading, fname); /* jam */
writ_echo (buf);
temp = ffseek (start);
if (temp != start)
diff --git a/fileio.c b/fileio.c
index f38c9f2..0f301ca 100644
--- a/fileio.c
+++ b/fileio.c
@@ -3,6 +3,7 @@
*/
#ifdef UNIX
+#include <unistd.h>
#include <sys/types.h>
#include <fcntl.h>
#include <sys/stat.h>
@@ -249,9 +250,9 @@ bool
fbackupfile (fname)
char *fname;
{
- char backname[NFILEN];
- char *source, *backup;
- char buf[NCOL];
+ unsigned char backname[NFILEN];
+ unsigned char *source, *backup;
+ unsigned char buf[NCOL];
source = fname;
backup = backname;
diff --git a/format.c b/format.c
index 75667f7..e9e7b21 100644
--- a/format.c
+++ b/format.c
@@ -171,10 +171,29 @@ uchar decimal_s_32_posn[] =
};
ROW_FMT decimal_s_32_fmt =
{
- DECIMAL, DWORDS, 4, 16, 4, 4, 10, TRUE, decimal_l_str, decimal_l_str, decimal_str,
+ DECIMAL, DWORDS, 4, 16, 4, 4, 12, TRUE, decimal_l_str, decimal_l_str, decimal_str,
decimal_s_32_posn, 0};
#if FLOAT_DISP
+uchar float_32_posn[] =
+{
+ FC, FC + 16, FC + 32, FC + 48
+};
+
+ROW_FMT float_32_fmt =
+{
+ FLOAT, DWORDS, 4, 16, 4, 4, 12, TRUE, float_str, decimal_l_str, decimal_str,
+ float_32_posn, 0};
+
+uchar float_s_32_posn[] =
+{
+ FS, FS + 17
+};
+ROW_FMT float_s_32_fmt =
+{
+ FLOAT, DWORDS, 4, 16, 4, 4, 14, TRUE, float_str, decimal_l_str, decimal_str,
+ float_s_32_posn, 0};
+
uchar float_64_posn[] =
{
FC, FC + 32
@@ -338,6 +357,8 @@ init_fmt ()
decimal_32_fmt.r_srch_fmt = &decimal_s_32_fmt;
decimal_s_32_fmt.r_srch_fmt = &decimal_32_fmt;
#if FLOAT_DISP
+ float_32_fmt.r_srch_fmt = &float_s_32_fmt;
+ float_s_32_fmt.r_srch_fmt = &float_32_fmt;
float_64_fmt.r_srch_fmt = &float_s_64_fmt;
float_s_64_fmt.r_srch_fmt = &float_64_fmt;
#endif
diff --git a/kbd.c b/kbd.c
index 46b061b..5bd9058 100644
--- a/kbd.c
+++ b/kbd.c
@@ -1,6 +1,7 @@
/* KBD.C
* Terminal independent keyboard handling.
*/
+#include <string.h>
#include "def.h"
char *keystrings ();
diff --git a/language.c b/language.c
index c124d10..ff0acd0 100644
--- a/language.c
+++ b/language.c
@@ -258,6 +258,7 @@ char MSG_show_save_buf[] = "show-save-buf";
char MSG_unit_size1[] = "display-bytes";
char MSG_unit_size2[] = "display-words";
char MSG_unit_size4[] = "display-double-words";
+char MSG_unit_size8[] = "display-quad-words";
char MSG_reposition_window[] = "window-reposition";
char MSG_set_mark[] = "mark-set";
char MSG_goto_eob[] = "move-to-end";
diff --git a/line.c b/line.c
index 093fb33..151e4d0 100644
--- a/line.c
+++ b/line.c
@@ -18,6 +18,7 @@
* nonsense.
*/
+#include <stdlib.h>
#include "def.h"
void l_fix_up ();
diff --git a/main.c b/main.c
index 9e24bf6..11f8f85 100644
--- a/main.c
+++ b/main.c
@@ -35,6 +35,7 @@
*
* Mainline, macro commands.
*/
+#include <stdlib.h>
#include "def.h"
bool execute ();
@@ -98,7 +99,7 @@ int flush_count = 0;
int flush_num = 500;
int auto_update = 0;
-void
+int
main (argc, argv)
char *argv[];
int argc;
@@ -109,7 +110,7 @@ main (argc, argv)
register int n;
register int mflag;
char bname[NBUFN];
- char initfile[NFILEN];
+ //char initfile[NFILEN];
#if MSDOS
is_wang (); /* Check for computer type */
@@ -143,7 +144,7 @@ main (argc, argv)
check_extend (NULL); /* check for extended keys */
#endif
- if (argc == 1)
+ if (argc <= 1)
{
edinit (bname);
eerase ();
@@ -182,6 +183,8 @@ main (argc, argv)
save_buf_init (); /* initialize save buffer */
lastflag = 0; /* Fake last flags. */
+ writ_echo ("Welcome to BEAV. Esc-? for help, Ctrl-C to quit.");
+
loop:
update ();
c = getkey ();
@@ -389,6 +392,7 @@ quit (f, n, k)
{
vttidy ();
+ printf("\n");
exit (GOOD);
}
diff --git a/prototyp.h b/prototyp.h
index d484ad2..6b4f6f5 100644
--- a/prototyp.h
+++ b/prototyp.h
@@ -1,3 +1,8 @@
+#ifndef PROTOTYP_DEF
+#define PROTOTYP_DEF
+
+#include "def.h"
+
extern char backchar (int f, int n, int k);
extern char forwchar (int f, int n, int k);
extern char move_ptr (struct WINDOW *wp, long len, char dot, char fix, char rel);
@@ -116,7 +121,7 @@ extern char ldelete (unsigned long n_bytes, int kflag);
extern void lreplace (int n, char c);
extern char lrepl_str (int plen, struct LINE *rstr, struct LINE *mstr);
extern void l_fix_up (struct LINE *line);
-extern void main (int argc, char **argv);
+extern int main (int argc, char **argv);
extern char execute (int c, int f, int n);
extern void edinit (char *bname);
extern char flush_all (void);
@@ -151,6 +156,7 @@ extern char backdel (int f, int n, int k);
extern char dispsize1 (void);
extern char dispsize2 (void);
extern char dispsize4 (void);
+extern char dispsize8 (void);
extern char dispswapbyte (int f, int n, int k);
extern char yank (int f, int n, int k);
extern char linkwind (void);
@@ -203,7 +209,9 @@ extern int getkbd (void);
extern void ttykeymapinit (void);
extern char *keystrings (int key);
extern void is_wang (void);
+#ifdef MSDOS
extern int getsysconfig (union REGS *outregs, struct SREGS *segregs);
+#endif
extern char getscreenstate (void);
extern char reposition (void);
extern char nextwind (void);
@@ -222,3 +230,5 @@ extern char backunit (int f, int n, int k);
extern char forwunit (int f, int n, int k);
extern char delfunit (int f, int n, int k);
extern char delbunit (int f, int n, int k);
+
+#endif
diff --git a/random.c b/random.c
index adf9358..53ede64 100644
--- a/random.c
+++ b/random.c
@@ -6,11 +6,13 @@
* that they are all command processors.
*/
+#include <string.h>
#include "def.h"
char backdel ();
bool fill_out ();
void bad_key ();
+F32 get_float ();
D64 get_double ();
@@ -24,6 +26,7 @@ extern char MSG_03u[];
extern char MSG_05u[];
extern char MSG_010lu[];
extern char MSG_116e[];
+extern char MSG_106e[];
extern char MSG_lnk[];
extern char MSG_unlink[];
extern char MSG_link[];
@@ -59,6 +62,7 @@ extern ROW_FMT decimal_8_fmt;
extern ROW_FMT decimal_16_fmt;
extern ROW_FMT decimal_32_fmt;
#if FLOAT_DISP
+extern ROW_FMT float_32_fmt;
extern ROW_FMT float_64_fmt;
#endif
extern ROW_FMT hex_8_fmt;
@@ -138,7 +142,7 @@ twiddle ()
register LINE *dotp;
register short doto;
- char b_per_u, f_buf[4], s_buf[4], i;
+ unsigned char b_per_u, f_buf[4], s_buf[4], i;
dotp = curwp->w_dotp;
doto = curwp->w_doto;
@@ -154,7 +158,7 @@ twiddle ()
/* pick up first unit byte by byte */
for (i = 0; i < b_per_u; i++)
{
- f_buf[i] = DOT_CHAR (curwp);
+ f_buf[(int)i] = DOT_CHAR (curwp);
move_ptr (curwp, 1L, TRUE, FALSE, TRUE);
}
/* move to the end of the second unit */
@@ -168,14 +172,14 @@ twiddle ()
/* pick up second unit (reverse order) and deposit second unit */
for (i = 0; i < b_per_u; i++)
{
- s_buf[i] = DOT_CHAR (curwp);
- DOT_CHAR (curwp) = f_buf[b_per_u - 1 - i];
+ s_buf[(int)i] = DOT_CHAR (curwp);
+ DOT_CHAR (curwp) = f_buf[(int)b_per_u - 1 - i];
move_ptr (curwp, -1L, TRUE, FALSE, TRUE);
}
/* deposit first unit */
for (i = 0; i < b_per_u; i++)
{
- DOT_CHAR (curwp) = s_buf[i];
+ DOT_CHAR (curwp) = s_buf[(int)i];
move_ptr (curwp, -1L, TRUE, FALSE, TRUE);
}
curwp->w_dotp = dotp;
@@ -567,7 +571,7 @@ selfinsert (f, n, k)
/* get a text representation of the float */
sprintf (text_buf, MSG_116e, d_val);
/* insert the character that was typed */
- text_buf[u_offs] = c;
+ text_buf[(int)u_offs] = c;
/* see if scanf get get back a good number */
/************************************************
@@ -601,7 +605,7 @@ selfinsert (f, n, k)
ptr = (D8 *) & d_val;
move_ptr (curwp, 1L, TRUE, FALSE, TRUE); /* step forward one byte */
- DOT_CHAR (curwp) = ptr[i] & 0xff;
+ DOT_CHAR (curwp) = ptr[(int)i] & 0xff;
}
/* restore dot position */
@@ -704,15 +708,15 @@ dec_chr_ok (char_buf, max_str, chr, pos)
if ((chr < '0') || (chr > '9'))
return (FALSE);
- char_buf[pos] = chr; /* insert typed char */
+ char_buf[(int)pos] = chr; /* insert typed char */
/* check if number is too big */
- for (i = 0; max_str[i] != 0; i++)
+ for (i = 0; max_str[(int)i] != 0; i++)
{
- if (char_buf[i] < max_str[i])
+ if (char_buf[(int)i] < max_str[(int)i])
break; /* if char is smaller then must be ok */
- if (char_buf[i] > max_str[i])
+ if (char_buf[(int)i] > max_str[(int)i])
return (FALSE); /* val is too large; ERROR */
}
return (TRUE);
@@ -767,7 +771,15 @@ ebcdicmode ()
bool
floatmode ()
{
+ switch (curwp->w_fmt_ptr->r_size)
+ {
+ case DWORDS:
+ curwp->w_fmt_ptr = &float_32_fmt;
+ break;
+ case DOUBLES:
curwp->w_fmt_ptr = &float_64_fmt;
+ break;
+ }
set_mode_vars ();
return (TRUE);
}
@@ -1148,6 +1160,43 @@ dispsize4 ()
curwp->w_fmt_ptr = &binary_32_fmt;
break;
+ case FLOAT:
+ curwp->w_fmt_ptr = &float_32_fmt;
+ break;
+
+ default:
+ return (TRUE);
+ break;
+ }
+
+ /* if we are in the middle of a search then use the proper format struc */
+ if (read_pat_mode)
+ curwp->w_fmt_ptr = curwp->w_fmt_ptr->r_srch_fmt;
+
+ move_ptr (curwp, 0L, TRUE, TRUE, TRUE);
+ wind_on_dot (curwp);
+ curwp->w_flag = WFHARD;
+ update ();
+ return (TRUE);
+}
+
+/*
+* Change the size of the display unit to double.
+* Adjust byte shift to the allowable range.
+* Normally bound to "META-8".
+*/
+bool
+dispsize8 ()
+{
+ curwp->w_disp_shift = 0; /* shift to 0 when changing size */
+ curwp->w_unit_offset = 0; /* go to end of unit */
+
+ switch ((uchar) (R_TYPE (curwp)))
+ {
+ case FLOAT:
+ curwp->w_fmt_ptr = &float_64_fmt;
+ break;
+
default:
return (TRUE);
break;
diff --git a/region.c b/region.c
index 069ef2b..904f909 100644
--- a/region.c
+++ b/region.c
@@ -6,6 +6,7 @@
* commands. Some functions are just for
* internal use.
*/
+#include <string.h>
#include "def.h"
bool getregion ();
diff --git a/search.c b/search.c
index 9b2d06f..84853e7 100644
--- a/search.c
+++ b/search.c
@@ -4,6 +4,7 @@
* search commands (both plain and incremental searches
* are supported) and the query-replace command.
*/
+#include <string.h>
#include "def.h"
char replaceit ();
@@ -239,7 +240,7 @@ queryrepl (f, n, k)
srch_mode = FALSE;
rplc_mode = TRUE;
cur_prompt = MSG_sch_str;
- if (s = readpattern ())
+ if ((s = readpattern ()))
{
replaceit ();
}
diff --git a/symbol.c b/symbol.c
index 57b20b8..858e020 100644
--- a/symbol.c
+++ b/symbol.c
@@ -4,6 +4,8 @@
* The terminal specific parts of building the
* keymap has been moved to a better place.
*/
+#include <stdlib.h>
+#include <string.h>
#include "def.h"
void keyadd ();
@@ -78,6 +80,7 @@ extern char MSG_display_version[];
extern char MSG_unit_size1[];
extern char MSG_unit_size2[];
extern char MSG_unit_size4[];
+extern char MSG_unit_size8[];
extern char MSG_reposition_window[];
extern char MSG_set_mark[];
extern char MSG_goto_eob[];
@@ -200,6 +203,7 @@ extern char binarymode (); /* display BINARY data */
extern char dispsize1 (); /* display in BYTE format */
extern char dispsize2 (); /* display in WORD format */
extern char dispsize4 (); /* display in DWORD format*/
+extern char dispsize8 (); /* display in DOUBLE format*/
extern char dispswapbyte (); /* Display swaped bytes pvr */
extern char yank (); /* Yank back from killbuffer. */
extern char linkwind (); /* Link all windows on one buffer. */
@@ -275,105 +279,106 @@ typedef struct
*/
KEY key[] =
{
- KCTRL | 'A', dispshift, MSG_byte_shift, 0,
- KCTRL | 'B', backchar, MSG_back_char, SSRCH | SRPLC,
- KCTRL | 'C', quit, MSG_quit, 0, /* pvr */
- KCTRL | 'D', forwdel, MSG_forw_del_char, SMOD | SSIZE | SSRCH | SRPLC,
- KCTRL | 'E', dispswapbyte, MSG_toggle_swap, SSRCH | SRPLC, /* pvr */
- KCTRL | 'F', forwchar, MSG_forw_char, SSRCH | SRPLC,
- KCTRL | 'G', ctrlg, MSG_abort, SSRCH | SRPLC,
- KCTRL | 'I', selfinsert, MSG_ins_self, SMOD | SSRCH | SRPLC,
- KCTRL | 'H', backdel, MSG_back_del_char, SMOD | SSIZE | SSRCH | SRPLC,
- KCTRL | 'L', refresh, MSG_refresh, SSRCH | SRPLC,
- KCTRL | 'N', forwline, MSG_forw_line, SSRCH | SRPLC,
- KCTRL | 'P', backline, MSG_back_line, SSRCH | SRPLC,
- KCTRL | 'Q', quote, MSG_quote, 0,
- KCTRL | 'R', recall, MSG_recall, SSRCH | SRPLC,
- KCTRL | 'T', twiddle, MSG_twiddle, SMOD | SSRCH | SRPLC,
- KCTRL | 'V', forwpage, MSG_forw_page, SRPLC,
- KCTRL | 'W', killregion, MSG_kill_region, SMOD | SSIZE,
- KCTRL | 'Y', yank, MSG_yank, SMOD | SSIZE,
- KCTRL | 'Z', mvdnwind, MSG_down_window, 0, /* fitz */
- KCTLX | KCTRL | 'A', insert_toggle, MSG_ins_toggle, SSRCH | SRPLC,
- KCTLX | KCTRL | 'B', listbuffers, MSG_display_buffers, 0,
- KCTLX | KCTRL | 'C', quit, MSG_quit, 0,
- KCTLX | KCTRL | 'E', flushnquit, MSG_exit_flush_all, 0, /* fitz */
- KCTLX | KCTRL | 'F', filename, MSG_set_file_name, SMOD, /* jam */
- KCTLX | KCTRL | 'I', fileinsert, MSG_file_insert, SMOD | SSIZE,
- KCTLX | KCTRL | 'L', bufsizlock, MSG_buf_size_lock, 0,
- KCTLX | KCTRL | 'M', flush_all, MSG_flush_all, 0,
- KCTLX | KCTRL | 'N', mvdnwind, MSG_down_window, 0,
- KCTLX | KCTRL | 'P', mvupwind, MSG_up_window, 0,
- KCTLX | KCTRL | 'R', fileread, MSG_file_read, 0,
- KCTLX | KCTRL | 'S', filesave, MSG_file_save, 0,
- KCTLX | KCTRL | 'V', filevisit, MSG_file_visit, 0,
- KCTLX | KCTRL | 'W', filewrite, MSG_file_write, 0,
- KCTLX | KCTRL | 'X', swapmark, MSG_swap_dot_and_mark, 0,
- KCTLX | KCTRL | 'Z', shrinkwind, MSG_shrink_window, 0,
- KCTLX | '=', showcpos, MSG_display_position, 0,
- KCTLX | '(', ctlxlp, MSG_start_macro, 0,
- KCTLX | ')', ctlxrp, MSG_end_macro, 0,
- KCTLX | '?', help, MSG_help, 0,
- KCTLX | '0', delwind, MSG_del_window, 0,
- KCTLX | '1', onlywind, MSG_only_window, 0,
- KCTLX | '2', splitwind, MSG_split_window, 0,
- KCTLX | 'B', usebuffer, MSG_use_buffer, 0,
- KCTLX | 'C', spawncli, MSG_spawn_cli, 0, /* fitz */
- KCTLX | 'E', ctlxe, MSG_execute_macro, 0,
- KCTLX | 'G', gotoline, MSG_goto_line, 0,
- KCTLX | 'I', insertunit, MSG_ins_unit, SMOD | SSIZE | SSRCH | SRPLC,
- KCTLX | 'K', killbuffer, MSG_kill_buffer, 0,
- KCTLX | 'L', load_extend, MSG_load_bindings, 0,
- KCTLX | 'N', nextwind, MSG_forw_window, 0,
- KCTLX | 'P', prevwind, MSG_back_window, 0,
- KCTLX | 'V', viewfile, MSG_view_file, 0, /* jam */
- KCTLX | 'Z', enlargewind, MSG_enlarge_window, 0,
- KMETA | KCTRL | 'A', asciimode, MSG_ascii_mode, SSRCH | SRPLC, /* pvr */
- KMETA | KCTRL | 'B', binarymode, MSG_binary_mode, SSRCH | SRPLC, /* pvr */
- KMETA | KCTRL | 'D', decimalmode, MSG_decimal_mode, SSRCH | SRPLC, /* pvr */
- KMETA | KCTRL | 'E', ebcdicmode, MSG_ebcdic_mode, SSRCH | SRPLC, /* pvr */
+ { KCTRL | 'A', dispshift, MSG_byte_shift, 0 },
+ { KCTRL | 'B', backchar, MSG_back_char, SSRCH | SRPLC },
+ { KCTRL | 'C', quit, MSG_quit, 0 }, /* pvr */
+ { KCTRL | 'D', forwdel, MSG_forw_del_char, SMOD | SSIZE | SSRCH | SRPLC },
+ { KCTRL | 'E', dispswapbyte, MSG_toggle_swap, SSRCH | SRPLC }, /* pvr */
+ { KCTRL | 'F', forwchar, MSG_forw_char, SSRCH | SRPLC },
+ { KCTRL | 'G', ctrlg, MSG_abort, SSRCH | SRPLC },
+ { KCTRL | 'I', selfinsert, MSG_ins_self, SMOD | SSRCH | SRPLC },
+ { KCTRL | 'H', backdel, MSG_back_del_char, SMOD | SSIZE | SSRCH | SRPLC },
+ { KCTRL | 'L', refresh, MSG_refresh, SSRCH | SRPLC },
+ { KCTRL | 'N', forwline, MSG_forw_line, SSRCH | SRPLC },
+ { KCTRL | 'P', backline, MSG_back_line, SSRCH | SRPLC },
+ { KCTRL | 'Q', quote, MSG_quote, 0 },
+ { KCTRL | 'R', recall, MSG_recall, SSRCH | SRPLC },
+ { KCTRL | 'T', twiddle, MSG_twiddle, SMOD | SSRCH | SRPLC },
+ { KCTRL | 'V', forwpage, MSG_forw_page, SRPLC },
+ { KCTRL | 'W', killregion, MSG_kill_region, SMOD | SSIZE },
+ { KCTRL | 'Y', yank, MSG_yank, SMOD | SSIZE },
+ { KCTRL | 'Z', mvdnwind, MSG_down_window, 0 }, /* fitz */
+ { KCTLX | KCTRL | 'A', insert_toggle, MSG_ins_toggle, SSRCH | SRPLC },
+ { KCTLX | KCTRL | 'B', listbuffers, MSG_display_buffers, 0 },
+ { KCTLX | KCTRL | 'C', quit, MSG_quit, 0 },
+ { KCTLX | KCTRL | 'E', flushnquit, MSG_exit_flush_all, 0 }, /* fitz */
+ { KCTLX | KCTRL | 'F', filename, MSG_set_file_name, SMOD }, /* jam */
+ { KCTLX | KCTRL | 'I', fileinsert, MSG_file_insert, SMOD | SSIZE },
+ { KCTLX | KCTRL | 'L', bufsizlock, MSG_buf_size_lock, 0 },
+ { KCTLX | KCTRL | 'M', flush_all, MSG_flush_all, 0 },
+ { KCTLX | KCTRL | 'N', mvdnwind, MSG_down_window, 0 },
+ { KCTLX | KCTRL | 'P', mvupwind, MSG_up_window, 0 },
+ { KCTLX | KCTRL | 'R', fileread, MSG_file_read, 0 },
+ { KCTLX | KCTRL | 'S', filesave, MSG_file_save, 0 },
+ { KCTLX | KCTRL | 'V', filevisit, MSG_file_visit, 0 },
+ { KCTLX | KCTRL | 'W', filewrite, MSG_file_write, 0 },
+ { KCTLX | KCTRL | 'X', swapmark, MSG_swap_dot_and_mark, 0 },
+ { KCTLX | KCTRL | 'Z', shrinkwind, MSG_shrink_window, 0 },
+ { KCTLX | '=', showcpos, MSG_display_position, 0 },
+ { KCTLX | '(', ctlxlp, MSG_start_macro, 0 },
+ { KCTLX | ')', ctlxrp, MSG_end_macro, 0 },
+ { KCTLX | '?', help, MSG_help, 0 },
+ { KCTLX | '0', delwind, MSG_del_window, 0 },
+ { KCTLX | '1', onlywind, MSG_only_window, 0 },
+ { KCTLX | '2', splitwind, MSG_split_window, 0 },
+ { KCTLX | 'B', usebuffer, MSG_use_buffer, 0 },
+ { KCTLX | 'C', spawncli, MSG_spawn_cli, 0 }, /* fitz */
+ { KCTLX | 'E', ctlxe, MSG_execute_macro, 0 },
+ { KCTLX | 'G', gotoline, MSG_goto_line, 0 },
+ { KCTLX | 'I', insertunit, MSG_ins_unit, SMOD | SSIZE | SSRCH | SRPLC },
+ { KCTLX | 'K', killbuffer, MSG_kill_buffer, 0 },
+ { KCTLX | 'L', load_extend, MSG_load_bindings, 0 },
+ { KCTLX | 'N', nextwind, MSG_forw_window, 0 },
+ { KCTLX | 'P', prevwind, MSG_back_window, 0 },
+ { KCTLX | 'V', viewfile, MSG_view_file, 0 }, /* jam */
+ { KCTLX | 'Z', enlargewind, MSG_enlarge_window, 0 },
+ { KMETA | KCTRL | 'A', asciimode, MSG_ascii_mode, SSRCH | SRPLC }, /* pvr */
+ { KMETA | KCTRL | 'B', binarymode, MSG_binary_mode, SSRCH | SRPLC }, /* pvr */
+ { KMETA | KCTRL | 'D', decimalmode, MSG_decimal_mode, SSRCH | SRPLC }, /* pvr */
+ { KMETA | KCTRL | 'E', ebcdicmode, MSG_ebcdic_mode, SSRCH | SRPLC }, /* pvr */
#if FLOAT_DISP
- KMETA | KCTRL | 'F', floatmode, MSG_float_mode, SSRCH | SRPLC, /* pvr */
+ { KMETA | KCTRL | 'F', floatmode, MSG_float_mode, SSRCH | SRPLC }, /* pvr */
#endif
- KMETA | KCTRL | 'H', hexmode, MSG_hex_mode, SSRCH | SRPLC, /* pvr */
- KMETA | KCTRL | 'K', delbunit, MSG_back_del_unit, SMOD | SSIZE | SSRCH | SRPLC,
- KMETA | KCTRL | 'N', buffername, MSG_buffer_name, 0,
- KMETA | KCTRL | 'O', octalmode, MSG_octal_mode, SSRCH | SRPLC, /* pvr */
- KMETA | KCTRL | 'P', n_way_combine, MSG_n_combine, SSIZE | SMOD, /* pvr */
- KMETA | KCTRL | 'R', screen_rows, MSG_scr_row, 0, /* pvr */
- KMETA | KCTRL | 'S', n_way_split, MSG_n_split, 0, /* pvr */
- KMETA | KCTRL | 'V', showversion, MSG_display_version, 0,
- KMETA | KCTRL | 'W', showsavebuf, MSG_show_save_buf, 0,
- KMETA | '1', dispsize1, MSG_unit_size1, SSRCH | SRPLC, /* pvr */
- KMETA | '2', dispsize2, MSG_unit_size2, SSRCH | SRPLC, /* pvr */
- KMETA | '4', dispsize4, MSG_unit_size4, SSRCH | SRPLC, /* pvr */
- KMETA | '!', reposition, MSG_reposition_window, 0,
- KMETA | '.', setmark, MSG_set_mark, 0,
- KMETA | '>', gotoeob, MSG_goto_eob, SSRCH | SRPLC,
- KMETA | '<', gotobob, MSG_goto_bob, SSRCH | SRPLC,
- KMETA | '+', next_buf, MSG_next_buff, 0,
- KMETA | '-', prev_buf, MSG_prev_buff, 0,
- KMETA | '%', queryrepl, MSG_query_replace, SMOD,
- KMETA | '?', wallchart, MSG_display_bindings, 0,
- KMETA | 'A', autosave, MSG_auto_save, 0,
- KMETA | 'B', backunit, MSG_back_unit, SSRCH | SRPLC,
- KMETA | 'C', compare, MSG_compare, 0,
- KMETA | 'D', delfunit, MSG_forw_del_unit, SMOD | SSIZE | SSRCH | SRPLC,
- KMETA | 'F', forwunit, MSG_forw_unit, SSRCH | SRPLC,
- KMETA | 'G', use_buffer, MSG_use_buffer_split, 0,
- KMETA | 'K', bindtokey, MSG_bind_to_key, 0,
- KMETA | 'L', linkwind, MSG_link_windows, 0,
- KMETA | 'O', save_region, MSG_save_region, 0,
- KMETA | 'P', print, MSG_print, 0,
- KMETA | 'R', backsearch, MSG_back_search, 0,
- KMETA | 'S', forwsearch, MSG_forw_search, 0,
- KMETA | 'T', searchagain, MSG_search_again, 0,
- KMETA | 'U', file_visit, MSG_file_visit_split, 0,
- KMETA | 'V', backpage, MSG_back_page, SRPLC,
- KMETA | 'W', copyregion, MSG_copy_region, 0,
- KMETA | 'X', extend, MSG_extended_command, 0,
- KMETA | 'Y', yank_buffer, MSG_yank_buffer, SMOD | SSIZE,
- KMETA | 'Z', mvupwind, MSG_up_window, 0
+ { KMETA | KCTRL | 'H', hexmode, MSG_hex_mode, SSRCH | SRPLC }, /* pvr */
+ { KMETA | KCTRL | 'K', delbunit, MSG_back_del_unit, SMOD | SSIZE | SSRCH | SRPLC },
+ { KMETA | KCTRL | 'N', buffername, MSG_buffer_name, 0 },
+ { KMETA | KCTRL | 'O', octalmode, MSG_octal_mode, SSRCH | SRPLC }, /* pvr */
+ { KMETA | KCTRL | 'P', n_way_combine, MSG_n_combine, SSIZE | SMOD }, /* pvr */
+ { KMETA | KCTRL | 'R', screen_rows, MSG_scr_row, 0 }, /* pvr */
+ { KMETA | KCTRL | 'S', n_way_split, MSG_n_split, 0 }, /* pvr */
+ { KMETA | KCTRL | 'V', showversion, MSG_display_version, 0 },
+ { KMETA | KCTRL | 'W', showsavebuf, MSG_show_save_buf, 0 },
+ { KMETA | '1', dispsize1, MSG_unit_size1, SSRCH | SRPLC }, /* pvr */
+ { KMETA | '2', dispsize2, MSG_unit_size2, SSRCH | SRPLC }, /* pvr */
+ { KMETA | '4', dispsize4, MSG_unit_size4, SSRCH | SRPLC }, /* pvr */
+ { KMETA | '8', dispsize8, MSG_unit_size8, SSRCH | SRPLC }, /* pvr */
+ { KMETA | '!', reposition, MSG_reposition_window, 0 },
+ { KMETA | '.', setmark, MSG_set_mark, 0 },
+ { KMETA | '>', gotoeob, MSG_goto_eob, SSRCH | SRPLC },
+ { KMETA | '<', gotobob, MSG_goto_bob, SSRCH | SRPLC },
+ { KMETA | '+', next_buf, MSG_next_buff, 0 },
+ { KMETA | '-', prev_buf, MSG_prev_buff, 0 },
+ { KMETA | '%', queryrepl, MSG_query_replace, SMOD },
+ { KMETA | '?', wallchart, MSG_display_bindings, 0 },
+ { KMETA | 'A', autosave, MSG_auto_save, 0 },
+ { KMETA | 'B', backunit, MSG_back_unit, SSRCH | SRPLC },
+ { KMETA | 'C', compare, MSG_compare, 0 },
+ { KMETA | 'D', delfunit, MSG_forw_del_unit, SMOD | SSIZE | SSRCH | SRPLC },
+ { KMETA | 'F', forwunit, MSG_forw_unit, SSRCH | SRPLC },
+ { KMETA | 'G', use_buffer, MSG_use_buffer_split, 0 },
+ { KMETA | 'K', bindtokey, MSG_bind_to_key, 0 },
+ { KMETA | 'L', linkwind, MSG_link_windows, 0 },
+ { KMETA | 'O', save_region, MSG_save_region, 0 },
+ { KMETA | 'P', print, MSG_print, 0 },
+ { KMETA | 'R', backsearch, MSG_back_search, 0 },
+ { KMETA | 'S', forwsearch, MSG_forw_search, 0 },
+ { KMETA | 'T', searchagain, MSG_search_again, 0 },
+ { KMETA | 'U', file_visit, MSG_file_visit_split, 0 },
+ { KMETA | 'V', backpage, MSG_back_page, SRPLC },
+ { KMETA | 'W', copyregion, MSG_copy_region, 0 },
+ { KMETA | 'X', extend, MSG_extended_command, 0 },
+ { KMETA | 'Y', yank_buffer, MSG_yank_buffer, SMOD | SSIZE },
+ { KMETA | 'Z', mvupwind, MSG_up_window, 0 }
};
#define NKEY (sizeof(key) / sizeof(key[0]))
diff --git a/tcap.c b/tcap.c
index 50de2a2..c7508f3 100644
--- a/tcap.c
+++ b/tcap.c
@@ -2,7 +2,10 @@
for beav
*/
+#include <term.h>
+#include <stdlib.h>
#include "def.h"
+#include "prototyp.h"
#ifdef UNIX
@@ -78,7 +81,7 @@ tcapopen ()
if ((tgetent (tcbuf, tv_stype)) != 1)
{
- sprintf (err_str, "Unknown terminal type %s!\r", tv_stype);
+ sprintf (err_str, "Unknown terminal type %s!\n", tv_stype);
puts (err_str);
ttclose (); /* fix in 1.13 */
exit (1);
@@ -110,7 +113,7 @@ tcapopen ()
ttclose (); /* fix in 1.13 */
exit (1);
}
- printf ("nrow %d, ncol %d\n", nrow, ncol);
+ printf ("nrow %d, ncol %d\r", nrow, ncol);
if ((ncol = (short) tgetnum ("co")) == -1)
{
diff --git a/termio.c b/termio.c
index 1be69bf..453a03f 100644
--- a/termio.c
+++ b/termio.c
@@ -8,6 +8,8 @@
#ifdef UNIX /* System V */
+#include <unistd.h>
+#include <errno.h>
#include <stdio.h>
#include <signal.h>
#ifdef BSD
@@ -26,7 +28,11 @@
#include <sgtty.h>
#define O_NDELAY O_NONBLOCK
#else
-#include <termio.h>
+#ifdef __GLIBC__
+#include <termios.h>
+#else
+#include <termio.h>
+#endif /* __GLIBC__ */
#endif /* MINIX */
#endif /* OS2 */
#endif /* BSD */
@@ -52,14 +58,20 @@ struct sgttyb otermio; /* original terminal characteristics */
struct sgttyb ntermio; /* charactoristics to use inside */
struct tchars tchars, tcharsorig;
#else
+#ifdef __GLIBC__
+#include <sys/ioctl.h>
+struct termios otermio;
+struct termios ntermio;
+#else
struct termio otermio; /* original terminal characteristics */
struct termio ntermio; /* charactoristics to use inside */
+#endif /* __GLIBC__ */
#endif /* MINIX */
#endif /* OS2 */
#endif /* BSD */
#ifndef OS2
-extern errno; /* System error number -- Necessary when compiling in BSD 1.13 */
+//extern errno; /* System error number -- Necessary when compiling in BSD 1.13 */
#endif
int nrow; /* Terminal size, rows. */
@@ -102,7 +114,7 @@ ttopen ()
{
nrow = ttysize.ts_lines;
ncol = ttysize.ts_cols;
-#endif
+#endif /* ULTRIX */
}
else
{
@@ -125,15 +137,23 @@ ttopen ()
tchars.t_stopc = tchars.t_eofc = tchars.t_brkc = -1;
ioctl (0, TIOCSETC, &tchars);
#else
+#ifdef __GLIBC__
+ tcgetattr(0,&otermio);
+#else
ioctl (0, TCGETA, &otermio);/* save old settings */
+ ntermio.c_line = otermio.c_line;
+#endif
ntermio.c_iflag = 0; /* setup new settings */
ntermio.c_oflag = 0;
ntermio.c_cflag = otermio.c_cflag;
ntermio.c_lflag = 0;
- ntermio.c_line = otermio.c_line;
ntermio.c_cc[VMIN] = 1;
ntermio.c_cc[VTIME] = 0;
+#ifdef __GLIBC__
+ tcsetattr(0,TCSANOW,&ntermio);
+#else
ioctl (0, TCSETAW, &ntermio); /* and activate them */
+#endif
#endif /* MINIX */
kbdflgs = fcntl (0, F_GETFL, 0);
kbdpoll = FALSE;
@@ -166,7 +186,11 @@ ttclose ()
ioctl (0, TIOCSETC, &tcharsorig) == -1)
printf ("closing ioctl on dev 0 failure, error = %d\n", errno);
#else
+#ifdef __GLIBC__
+ if( tcsetattr(0,TCSANOW,&otermio) == -1)
+#else
if (ioctl (0, TCSETAW, &otermio) == -1) /* restore terminal settings */
+#endif
printf ("closing ioctl on dev 0 failure, error = %d\n", errno);
#endif /* MINIX */
if (fcntl (0, F_SETFL, kbdflgs) == -1)
@@ -271,7 +295,7 @@ static int chr = -1;
#endif
#endif
-ttgetc ()
+int ttgetc ()
{
#ifdef OS2
#ifdef __EMX__
@@ -333,7 +357,7 @@ ttgetc ()
/* typahead(): Check to see if any characters are already in the
keyboard buffer
*/
-ttkeyready ()
+int ttkeyready ()
{
#ifdef OS2
#ifdef __EMX__
diff --git a/text.c b/text.c
index 6f68816..921c815 100644
--- a/text.c
+++ b/text.c
@@ -24,12 +24,14 @@ char MSG_03u[] = "%03u";
char MSG_05u[] = "%05u";
char MSG_010lu[] = "%010lu";
char MSG_116e[] = "%+1.16e";
+char MSG_106e[] = "%+1.6e";
char MSG_02X[] = "%02X";
char MSG_04X[] = "%04X";
char MSG_08lX[] = "%08lX";
char MSG_siz_8[] = " 8 ";
char MSG_siz_16[] = " 16";
char MSG_siz_32[] = " 32";
+char MSG_siz_64[] = " 64";
char MSG_siz_null[] = " ";
char MSG_int_shift[] = " S%X";
char MSG_mot_shift[] = " %X";
diff --git a/tty.c b/tty.c
index f0eb880..2cb74a1 100644
--- a/tty.c
+++ b/tty.c
@@ -16,6 +16,9 @@ void ttcolor ();
extern void tcapopen ();
extern void tcapclose (); /* DR */
extern void tcapmove ();
+extern void tcapeeop ();
+extern void tcapeeol ();
+extern void tcaprev ();
#ifdef MSDOS
#include "dos.h"
@@ -118,8 +121,8 @@ ttmove (row, col)
void
tteeol ()
{
- char col, row, i;
#ifdef MSDOS
+ char col, row, i;
union REGS regs;
if (ibm_pc)
diff --git a/ttykbd.c b/ttykbd.c
index 261bda7..415a2c0 100644
--- a/ttykbd.c
+++ b/ttykbd.c
@@ -67,6 +67,7 @@ extern char MSG_display_version[];
extern char MSG_unit_size1[];
extern char MSG_unit_size2[];
extern char MSG_unit_size4[];
+extern char MSG_unit_size8[];
extern char MSG_reposition_window[];
extern char MSG_set_mark[];
extern char MSG_goto_eob[];
diff --git a/window.c b/window.c
index 0c54ae0..e5ef8e6 100644
--- a/window.c
+++ b/window.c
@@ -1,6 +1,7 @@
/*
* Window handling.
*/
+#include <stdlib.h>
#include "def.h"
bool mvupwind ();
@@ -288,9 +289,9 @@ splitwind ()
register WINDOW *wp;
register int ntru;
register int ntrl;
- register int ntrd;
- register WINDOW *wp1;
- register WINDOW *wp2;
+ //register int ntrd;
+ //register WINDOW *wp1;
+ //register WINDOW *wp2;
char buf[NCOL], buf1[NCOL];
if (curwp->w_ntrows < MIN_WIN_ROWS)
diff --git a/word.c b/word.c
index 10584a6..6d7f431 100644
--- a/word.c
+++ b/word.c
@@ -23,7 +23,7 @@ char
backunit (f, n, k)
int f, n, k;
{
- char ret;
+ char ret = 0;
if (n < 0)
return (forwunit (f, -n, KRANDOM));