bvi-1.3.2.src.tar.gz

This commit is contained in:
Gerhard Bürgmann 2005-01-07 00:00:00 +00:00 committed by Vincent Batts
parent 16baacb54f
commit 12a0ed970c
63 changed files with 2580 additions and 1159 deletions

17
CHANGES
View File

@ -1,3 +1,20 @@
New in release 1.3.2
====================
* configure: checking term.h and ncurses/term.h
* cast in bmore.c in putline();
* ported to compile under DJGPP v2.0 w/ PDCURSES (by simoN)
* fixed multiple file handling for "bmore" (by simoN)
* renamed several local screen processing routines to avoid compiler conflicts
* several minor fixes to "bmore" code (by simoN)
* reset tty after CTRL-C in bmore
* -c option in bmore (clear before displaying)
* -n num option in bmore (display the indicated number of lines in each
screenful
* -w num option in bmore (display the indicated number of bytes in each
line)
New in release 1.3.1 New in release 1.3.1
==================== ====================

View File

@ -9,13 +9,14 @@ Claudio Nieder <claudio@chili.symmetrix.ch> Makefile
Nico Schmidt <Nico.Schmidt@ipk.fhg.de> r-bug fix Nico Schmidt <Nico.Schmidt@ipk.fhg.de> r-bug fix
Steve Waltner <swaltner@lsil.com> Mac OS X support Steve Waltner <swaltner@lsil.com> Mac OS X support
Andre Wobst <Andre.Wobst@Physik.Uni-Augsburg.de> AIX fixes Andre Wobst <Andre.Wobst@Physik.Uni-Augsburg.de> AIX fixes
SimoN <simontdd@netzero.net> bmore: subshell support fixes SimoN <simontdd@netzero.net> bmore: subshell support fixes, DJGPP support
Packages: Packages:
Christian "naddy" Weisgerber <naddy@mips.rhein-neckar.de> Source RPM Christian "naddy" Weisgerber <naddy@mips.rhein-neckar.de> Source RPM
Christian Kurz <shorty@jupiter.rhein-neckar.de> Debian package Christian Kurz <shorty@jupiter.rhein-neckar.de> Debian package
Stijn de Bekker <stijn@debekker.org> Debian package Stijn de Bekker <stijn@debekker.org> Debian package
Troy Engel <tengel@sonic.net> i386 RPM package Troy Engel <tengel@sonic.net> i386 RPM package
Thomas Steudten <thomas@steudten.com> RH alpha and x86 RPM package
Doc: Doc:
Sven Guckes <guckes@math.fu-berlin.de> Sven Guckes <guckes@math.fu-berlin.de>

View File

@ -6,8 +6,8 @@
# "autoconf" program (constructs like "@foo@" will get replaced in the # "autoconf" program (constructs like "@foo@" will get replaced in the
# actual Makefile. # actual Makefile.
# #
# Copyright (c) 1996-2000 by Gerhard Buergmann # Copyright (c) 1996-2003 by Gerhard Buergmann
# Gerhard.Buergmann@altavista.net # gerhard@puon.at
# #
# 1996-01-18 V 1.0.0 # 1996-01-18 V 1.0.0
# 1999-01-15 V 1.1.0 # 1999-01-15 V 1.1.0
@ -15,6 +15,7 @@
# 1999-10-22 V 1.2.0 # 1999-10-22 V 1.2.0
# 2000-05-31 V 1.3.0 beta # 2000-05-31 V 1.3.0 beta
# 2000-10-01 V 1.3.0 final # 2000-10-01 V 1.3.0 final
# 2003-07-03 V 1.3.2
# #
############################################### ###############################################
@ -24,7 +25,7 @@ exec_prefix = @exec_prefix@
bindir = $(DESTDIR)@bindir@ bindir = $(DESTDIR)@bindir@
mandir = $(DESTDIR)@mandir@ mandir = $(DESTDIR)@mandir@
datadir = $(DESTDIR)@datadir@ libdir = $(DESTDIR)@libdir@
man1dir = $(mandir)/man1 man1dir = $(mandir)/man1
@ -57,7 +58,7 @@ bmore: $(BMOBJ)
$(CC) $(CFLAGS) $(DEFS) -c $< $(CC) $(CFLAGS) $(DEFS) -c $<
bmore.o: bmore.c bmore.o: bmore.c
$(CC) $(CFLAGS) $(DEFS) -DHELPFILE=\"$(datadir)/bmore.help\" -c $< $(CC) $(CFLAGS) $(DEFS) -DHELPFILE=\"$(libdir)/bmore.help\" -c $<
install: all installdirs install: all installdirs
@ -65,14 +66,14 @@ install: all installdirs
@$(INSTALL_DATA) bvi.1 bmore.1 $(man1dir) @$(INSTALL_DATA) bvi.1 bmore.1 $(man1dir)
@$(INSTALL_PROGRAM) -s bvi $(bindir) @$(INSTALL_PROGRAM) -s bvi $(bindir)
@$(INSTALL_PROGRAM) -s bmore $(bindir) @$(INSTALL_PROGRAM) -s bmore $(bindir)
@$(INSTALL_DATA) bmore.help $(datadir) @$(INSTALL_DATA) bmore.help $(libdir)
@if [ -f $(bindir)/bview ]; then rm $(bindir)/bview; fi @if [ -f $(bindir)/bview ]; then rm $(bindir)/bview; fi
@if [ -f $(bindir)/bvedit ]; then rm $(bindir)/bvedit; fi @if [ -f $(bindir)/bvedit ]; then rm $(bindir)/bvedit; fi
@ln $(bindir)/bvi $(bindir)/bview @ln $(bindir)/bvi $(bindir)/bview
@ln $(bindir)/bvi $(bindir)/bvedit @ln $(bindir)/bvi $(bindir)/bvedit
installdirs: installdirs:
$(SHELL) ${srcdir}/mkinstalldirs $(bindir) $(datadir) $(man1dir) $(SHELL) ${srcdir}/mkinstalldirs $(bindir) $(libdir) $(man1dir)
uninstall: uninstall:
@echo "Uninstalling bvi" @echo "Uninstalling bvi"
@ -80,12 +81,12 @@ uninstall:
@if [ -f $(bindir)/bvedit ]; then rm $(bindir)/bvedit; fi @if [ -f $(bindir)/bvedit ]; then rm $(bindir)/bvedit; fi
@if [ -f $(bindir)/bvi ]; then rm $(bindir)/bvi; fi @if [ -f $(bindir)/bvi ]; then rm $(bindir)/bvi; fi
@if [ -f $(bindir)/bmore ]; then rm $(bindir)/bmore; fi @if [ -f $(bindir)/bmore ]; then rm $(bindir)/bmore; fi
@if [ -f $(datadir)/bmore.help ]; then rm $(datadir)/bmore.help; fi @if [ -f $(libdir)/bmore.help ]; then rm $(libdir)/bmore.help; fi
@if [ -f $(man1dir)/bvi.1 ]; then rm $(man1dir)/bvi.1; fi @if [ -f $(man1dir)/bvi.1 ]; then rm $(man1dir)/bvi.1; fi
@if [ -f $(man1dir)/bmore.1 ]; then rm $(man1dir)/bmore.1; fi @if [ -f $(man1dir)/bmore.1 ]; then rm $(man1dir)/bmore.1; fi
clean: clean:
rm -f core *.o bvi bmore a.out rm -f core *.o bvi bvi.exe bmore bmore.exe a.out
distclean: clean distclean: clean
rm -f Makefile config.cache config.h config.log config.status rm -f Makefile config.cache config.h config.log config.status

6
README
View File

@ -9,8 +9,8 @@ and is distributed under the GPL (GNU Public License).
How to compile How to compile
============== ==============
gunzip -c bvi-1.3.1.tar.gz | tar xvf - gunzip -c bvi-1.3.2.tar.gz | tar xvf -
cd bvi-1.3.1 cd bvi-1.3.2
./configure ./configure
make make
make install make install
@ -39,6 +39,6 @@ comments, questions, etc. (even flames) to:
Gerhard Buergmann Gerhard Buergmann
Vienna, Austria Vienna, Austria
E-mail: Gerhard.Buergmann@utanet.at E-mail: gerhard@puon.at

View File

@ -5,3 +5,7 @@
#undef HAVE_CURSES_H #undef HAVE_CURSES_H
#undef NO_SYSERRL #undef NO_SYSERRL
#undef NEED_PUTC_CHAR
#undef HAVE_NCURSES_TERM_H

View File

@ -3,11 +3,12 @@
* 2000-05-10 V 1.3.0 alpha * 2000-05-10 V 1.3.0 alpha
* 2000-07-07 V 1.3.0 final * 2000-07-07 V 1.3.0 final
* 2001-12-07 V 1.3.1 * 2001-12-07 V 1.3.1
* 2003-07-03 V 1.3.2
* *
* NOTE: Edit this file with tabstop=4 ! * NOTE: Edit this file with tabstop=4 !
* *
* Copyright 1996-2000 by Gerhard Buergmann * Copyright 1996-2003 by Gerhard Buergmann
* Gerhard.Buergmann@altavista.net * gerhard@puon.at
* *
* This program is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the
@ -81,24 +82,47 @@ char *cmd;
{ {
system(cmd); system(cmd);
printf("\r"); printf("\r");
clrscr(); clearscreen();
fseek(curr_file, screen_home, SEEK_SET); fseek(curr_file, screen_home, SEEK_SET);
bytepos = screen_home; bytepos = screen_home;
} }
void
highlight()
{
highvideo();
}
void
normal()
{
normvideo();
}
void
clearscreen()
{
clrscr();
}
void void
home() home()
{ {
/*
tputs(Home, 1, putch);
screenlines = 0;
*/
gotoxy(1, 1); gotoxy(1, 1);
} }
/* force clear to end of line */
cleartoeol()
{
clreol();
}
int int
vgetc() vgetc()
{ {
@ -106,15 +130,3 @@ vgetc()
} }
/*
* force clear to end of line
*/
cleareol()
{
/*
tputs(erase_ln, 1, putch);
*/
clreol();
}

View File

@ -1,13 +1,14 @@
/* BM_UNIX.C - Unix specific subroutines for BMORE /* bm_unix.c - Unix specific subroutines for BMORE
* *
* 2000-05-31 V 1.3.0 beta * 2000-05-31 V 1.3.0 beta
* 2000-10-12 V 1.3.0 final * 2000-10-12 V 1.3.0 final
* 2002-02-10 V 1.3.1 * 2002-02-10 V 1.3.1
* 2003-07-04 V 1.3.2
* *
* NOTE: Edit this file with tabstop=4 ! * NOTE: Edit this file with tabstop=4 !
* *
* Copyright 1996-2002 by Gerhard Buergmann * Copyright 1996-2003 by Gerhard Buergmann
* Gerhard.Buergmann@altavista.net * gerhard@puon.at
* *
* This program is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the
@ -80,12 +81,21 @@ initterm()
no_tty = tcgetattr(fileno(stdout), &ostate); no_tty = tcgetattr(fileno(stdout), &ostate);
if (!no_tty) { if (!no_tty) {
nstate = ostate; nstate = ostate;
/*
* is this really necessary??
*
nstate.c_lflag &= ~(ICANON|ECHO|ECHOE|ECHONL);
*/
nstate.c_lflag &= ~(ICANON|ECHO|ECHOE|ECHONL); nstate.c_lflag &= ~(ICANON|ECHO|ECHOE|ECHONL);
nstate.c_cc[VMIN] = 1; nstate.c_cc[VMIN] = 1;
nstate.c_cc[VTIME] = 0; nstate.c_cc[VTIME] = 0;
tcsetattr(fileno(stdin), TCSADRAIN, &nstate); tcsetattr(fileno(stdin), TCSADRAIN, &nstate);
} }
#ifdef DJGPP
maxx = 80;
maxy = 25;
#else
if ((term = getenv("TERM")) == 0 || tgetent(buf, term) <= 0) { if ((term = getenv("TERM")) == 0 || tgetent(buf, term) <= 0) {
printf("Dumb terminal\n"); printf("Dumb terminal\n");
maxx = 80; maxx = 80;
@ -99,6 +109,7 @@ initterm()
clear_sc = tgetstr("cl", &clearptr); clear_sc = tgetstr("cl", &clearptr);
rev_start = tgetstr("so", &clearptr); rev_start = tgetstr("so", &clearptr);
rev_end = tgetstr("se", &clearptr); rev_end = tgetstr("se", &clearptr);
#endif
no_intty = tcgetattr(fileno(stdin), &ostate); no_intty = tcgetattr(fileno(stdin), &ostate);
tcgetattr(fileno(stderr), &ostate); tcgetattr(fileno(stderr), &ostate);
@ -129,12 +140,12 @@ reset_tty()
void void
sig() sig(sig)
int sig;
{ {
signal(SIGINT, sig); reset_tty();
signal(SIGQUIT, sig); printf("\r\n");
exit(0);
got_int = TRUE;
} }
@ -145,12 +156,15 @@ void
doshell(cmd) doshell(cmd)
char *cmd; char *cmd;
{ {
#ifndef DJGPP
char *getenv(); char *getenv();
char *shell; char *shell;
char cline[128]; char cline[128];
#endif
printf("\n"); printf("\n");
#ifndef DJGPP
if ((shell = getenv("SHELL")) == NULL) shell = "sh"; if ((shell = getenv("SHELL")) == NULL) shell = "sh";
else if(strrchr(shell,'/')) shell=(char *)(strrchr(shell,'/')+1); else if(strrchr(shell,'/')) shell=(char *)(strrchr(shell,'/')+1);
@ -161,6 +175,7 @@ doshell(cmd)
sprintf(cline, "%s -c \"%s\"", shell, cmd); sprintf(cline, "%s -c \"%s\"", shell, cmd);
cmd = cline; cmd = cline;
} }
#endif
reset_tty(); reset_tty();
system(cmd); system(cmd);
@ -173,40 +188,68 @@ doshell(cmd)
void void
highvideo() highlight()
{ {
#ifndef DJGPP
if (rev_start && rev_end) if (rev_start && rev_end)
tputs(rev_start, 1, putchr); tputs(rev_start, 1, putchr);
#endif
} }
void void
normvideo() normal()
{ {
#ifndef DJGPP
if (rev_start && rev_end) if (rev_start && rev_end)
tputs(rev_end, 1, putchr); tputs(rev_end, 1, putchr);
#endif
} }
void void
clrscr() clearscreen()
{ {
tputs(clear_sc, 1, putchr); #ifdef DJGPP
/* if (!no_tty)
{
int n;
for (n = 0; n < maxy; n++) {
cleartoeol();
printf("\n");
}
} */
#else
tputs(clear_sc, 1, putchr);
#endif
} }
void void
home() home()
{ {
tputs(Home, 1, putchr); #ifdef DJGPP
if (!no_tty) printf("\r");
#else
tputs(Home, 1, putchr);
#endif
} }
/* force clear to end of line */ /* force clear to end of line */
void void
clreol() cleartoeol()
{ {
#ifdef DJGPP
int n;
home();
if (!no_tty) for (n = 1; n < maxx; n++) printf(" ");
home();
#else
tputs(erase_ln, 1, putchr); tputs(erase_ln, 1, putchr);
#endif
} }

19
bmore.1
View File

@ -1,10 +1,14 @@
.TH BMORE 1 "3 Jan 2002" .TH BMORE 1 "3 Jan 2004"
.SH NAME .SH NAME
bmore \- browse through a binary file bmore \- browse through a binary file
.SH SYNOPSIS .SH SYNOPSIS
.B bmore .B bmore
[ [
.B \-adi .B \-acdi
] [
.B \-n \fIlines\fP
] [
.B \-w \fIcols\fP
] [ ] [
.B +\fIlinenumber\fP .B +\fIlinenumber\fP
] [ ] [
@ -76,6 +80,9 @@ except that a header is printed before each file in a series.
ASCII mode: no hex representation of the contents. Non printable ASCII mode: no hex representation of the contents. Non printable
characters are displayed as a dot (.) characters are displayed as a dot (.)
.TP .TP
.B \-c
Clear before displaying. Redrawing the screen instead of scrolling.
.TP
.B \-d .B \-d
Display error messages rather than ringing the terminal bell if Display error messages rather than ringing the terminal bell if
an unrecognized command is used. an unrecognized command is used.
@ -84,6 +91,14 @@ This is helpful for inexperienced users.
.B \-i .B \-i
Ignore case for searching. Ignore case for searching.
.TP .TP
.B \-n \fIlines\fP
Displays the indicated number of \fIlines\fP in each screenful,
rather than the default (the number of lines in the terminal screen
less two).
.TP
.B \-w \fIcols\fP
Display number of \fIcols\fP in each line.
.TP
.BI + linenumber\fP .BI + linenumber\fP
Start up at Start up at
.IR linenumber . .IR linenumber .

224
bmore.c
View File

@ -5,11 +5,12 @@
* 2000-05-31 V 1.3.0 beta * 2000-05-31 V 1.3.0 beta
* 2000-10-18 V 1.3.0 final * 2000-10-18 V 1.3.0 final
* 2002-01-16 V 1.3.1 * 2002-01-16 V 1.3.1
* 2004-01-09 V 1.3.2
* *
* NOTE: Edit this file with tabstop=4 ! * NOTE: Edit this file with tabstop=4 !
* *
* Copyright 1990-2002 by Gerhard Buergmann * Copyright 1990-2004 by Gerhard Buergmann
* Gerhard.Buergmann@altavista.net * gerhard@puon.at
* *
* This program is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the
@ -31,20 +32,25 @@
# include <locale.h> # include <locale.h>
#endif #endif
#ifdef __MSDOS__ #if defined(__MSDOS__) && !defined(DJGPP)
# define PRINTF cprintf # define PRINTF cprintf
#else #else
# define PRINTF printf # define PRINTF printf
#ifndef HELPFILE #ifndef HELPFILE
# define HELPFILE "/usr/local/share/bmore.help" # ifdef DJGPP
# define HELPFILE "/dev/env/DJDIR/lib/bmore.help"
# else
# define HELPFILE "/usr/local/lib/bmore.help"
# endif
#endif #endif
#endif #endif
#include "bmore.h" #include "bmore.h"
char *copyright = "Copyright (C) 1990-2002 by Gerhard Buergmann"; char *copyright = "Copyright (C) 1990-2004 by Gerhard Buergmann";
int maxx, maxy; int maxx, maxy;
int mymaxx = 0, mymaxy = 0;
char *name = NULL; char *name = NULL;
char sstring[MAXCMD] = ""; /* string for search */ char sstring[MAXCMD] = ""; /* string for search */
char estring[MAXCMD] = ""; /* string for shell escape */ char estring[MAXCMD] = ""; /* string for shell escape */
@ -62,11 +68,12 @@ char numarr[64]; /* string for collecting number */
char addr_form[15]; char addr_form[15];
int ascii_flag = 0; int ascii_flag = 0;
int d_flag = 0; int c_flag = 0, d_flag = 0;
int exval = 0;
int init_search = 0; int init_search = 0;
char buffer1[MAXCMD], buffer2[MAXCMD]; char buffer1[MAXCMD], buffer2[MAXCMD];
int out_len; int out_len;
int corr = 0, to_print; int corr = 0, do_header = 0, to_print;
off_t init_byte = 0; off_t init_byte = 0;
off_t last_search = 0; off_t last_search = 0;
off_t screen_home, filesize; off_t screen_home, filesize;
@ -74,7 +81,7 @@ off_t bytepos, oldpos;
int prompt = 1; int prompt = 1;
char helppath[MAXCMD]; char helppath[MAXCMD];
static char *progname; static char progname[10];
static char cmdbuf[MAXCMD]; static char cmdbuf[MAXCMD];
static int cnt = 0; static int cnt = 0;
static int icnt = 0; static int icnt = 0;
@ -86,12 +93,15 @@ char *emptyclass = "Empty byte class '[]' or '[^]'";
/* -a ASCII mode /* -a ASCII mode
* -d beginners mode * -d beginners mode
* -c clear before displaying
* -i ignore case * -i ignore case
* -n number of lines/screen
* -w width of screen
*/ */
void void
usage() usage()
{ {
fprintf(stderr, "Usage: %s [-adi] [+linenum | +/pattern] name1 name2 ...\n", progname); fprintf(stderr, "Usage: %s [-acdi] [-lines] [+linenum | +/pattern] name1 name2 ...\n", progname);
exit(1); exit(1);
} }
@ -108,15 +118,14 @@ main(argc, argv)
long count; long count;
int i, n = 1; int i, n = 1;
int d_line, r_line, z_line; int d_line, r_line, z_line;
#ifdef __MSDOS__
char *poi; char *poi;
#if defined(__MSDOS__) && !defined(DJGPP)
strcpy(helppath, argv[0]); strcpy(helppath, argv[0]);
poi = strrchr(helppath, '\\'); poi = strrchr(helppath, '\\');
*poi = '\0'; *poi = '\0';
strcat(helppath, "\\MORE.HLP"); strcat(helppath, "\\BMORE.HLP");
#else #else
strncpy(helppath, HELPFILE, MAXCMD - 1); strncpy(helppath, HELPFILE, MAXCMD - 1);
#endif #endif
@ -125,23 +134,46 @@ main(argc, argv)
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");
#endif #endif
progname = argv[0]; poi = strrchr(argv[0], DELIM);
if (poi) strncpy(progname, ++poi, 9);
else strncpy(progname, argv[0], 9);
strtok(progname, ".");
while (n < argc) { while (n < argc) {
switch (argv[n][0]) { switch (argv[n][0]) {
case '-': case '-':
i = 1; if (argv[n][1] >= '0' && argv[n][1] <= '9') {
while (argv[n][i] != '\0') { sscanf(&argv[n][1], "%dx%d", &mymaxy, &mymaxx);
switch (argv[n][i]) { } else if (argv[n][1] == 'n') {
case 'a': ascii_flag++; if (argv[n+1] == NULL || argv[n+1][0] == '-') {
break; usage();
case 'd': d_flag++; } else {
break; sscanf(&argv[++n][0], "%d", &mymaxy);
case 'i': ignore_case++; }
break; } else if (argv[n][1] == 'w') {
default: usage(); if (argv[n+1] == NULL || argv[n+1][0] == '-') {
usage();
} else {
sscanf(&argv[++n][0], "%d", &mymaxx);
}
} else {
i = 1;
while (argv[n][i] != '\0') {
switch (argv[n][i]) {
case 'a': ascii_flag++;
break;
case 'c': c_flag++;
break;
case 'd': d_flag++;
break;
case 'i': ignore_case++;
break;
default:
usage();
}
i++;
} }
i++;
} }
n++; n++;
break; break;
@ -166,24 +198,35 @@ main(argc, argv)
break; break;
} }
} }
if (numfiles == 0) {
curr_file = stdin;
if (isatty(fileno(stdin)) != 0) usage();
} else {
open_file(name);
file_nr = 1;
fseek(curr_file, init_byte, SEEK_SET);
bytepos += init_byte;
}
screen_home = bytepos;
initterm(); initterm();
set_tty(); set_tty();
maxy -= 2; maxy -= 2;
if (mymaxy) {
maxy = mymaxy;
}
z_line = maxy; z_line = maxy;
d_line = maxy / 2; d_line = maxy / 2;
r_line = 1; r_line = 1;
if (numfiles == 0) {
curr_file = stdin;
if (isatty(fileno(stdin)) != 0) {
reset_tty();
usage();
}
} else {
file_nr = 1;
while (open_file(name)) {
do_next(1);
}
if (exval) {
} else {
fseek(curr_file, init_byte, SEEK_SET);
bytepos += init_byte;
}
}
screen_home = bytepos;
AnzAdd = 10; AnzAdd = 10;
strcpy(addr_form, "%08lX "); strcpy(addr_form, "%08lX ");
@ -191,24 +234,42 @@ main(argc, argv)
out_len = ((maxx - AnzAdd - 1) / 4) * 4; out_len = ((maxx - AnzAdd - 1) / 4) * 4;
else else
out_len = ((maxx - AnzAdd - 1) / 16) * 4; out_len = ((maxx - AnzAdd - 1) / 16) * 4;
if (mymaxx) {
out_len = mymaxx;
}
if (init_search) if (init_search)
bmsearch(init_search); bmsearch(init_search);
if (no_tty) { if (no_tty) {
while(!printout(1)); int fileloop;
for (fileloop = 0; fileloop < numfiles; fileloop++) {
while(!printout(1));
do_next(1);
open_file(name);
}
fclose(curr_file); fclose(curr_file);
reset_tty(); reset_tty();
exit(0); exit(exval);
} }
if (printout(maxy)) { if (!exval) {
do_next(1); if (printout(maxy)) {
do_next(1);
}
} }
signal(SIGINT, sig);
signal(SIGQUIT, sig);
/* main loop */ /* main loop */
do { do {
to_print = 0; to_print = 0;
if (prompt) { if (prompt) {
highvideo(); if (prompt == 2) {
while (open_file(name)) {
do_next(1);
}
}
highlight();
PRINTF("--More--"); PRINTF("--More--");
if (prompt == 2) { if (prompt == 2) {
PRINTF("(Next file: %s)", name); PRINTF("(Next file: %s)", name);
@ -217,13 +278,15 @@ main(argc, argv)
} }
if (d_flag) PRINTF("[Press space to continue, 'q' to quit]"); if (d_flag) PRINTF("[Press space to continue, 'q' to quit]");
normvideo(); normal();
fflush(stdout); fflush(stdout);
} }
ch = vgetc(); ch = vgetc();
/*
if (prompt == 2) { if (prompt == 2) {
open_file(name); open_file(name);
} }
*/
prompt = 1; prompt = 1;
PRINTF("\r"); PRINTF("\r");
while (ch >= '0' && ch <= '9') { while (ch >= '0' && ch <= '9') {
@ -262,10 +325,10 @@ main(argc, argv)
break; break;
case 'q': case 'q':
case 'Q': case 'Q':
clreol(); cleartoeol();
fclose(curr_file); fclose(curr_file);
reset_tty(); reset_tty();
exit(0); exit(exval);
case ':' : case ':' :
switch (colon) { switch (colon) {
case 'f': case 'f':
@ -282,7 +345,7 @@ main(argc, argv)
if (precount < 1) precount = 1; if (precount < 1) precount = 1;
do_next(precount); do_next(precount);
PRINTF("\r"); PRINTF("\r");
clreol(); cleartoeol();
PRINTF("\n...Skipping to file %s\r\n\r\n", name); PRINTF("\n...Skipping to file %s\r\n\r\n", name);
prompt = 2; prompt = 2;
break; break;
@ -290,19 +353,19 @@ main(argc, argv)
if (precount < 1) precount = 1; if (precount < 1) precount = 1;
do_next(-precount); do_next(-precount);
PRINTF("\r"); PRINTF("\r");
clreol(); cleartoeol();
PRINTF("\n...Skipping back to file %s\r\n\r\n", name); PRINTF("\n...Skipping back to file %s\r\n\r\n", name);
prompt = 2; prompt = 2;
break; break;
case 'q': case 'q':
clreol(); cleartoeol();
fclose(curr_file); fclose(curr_file);
reset_tty(); reset_tty();
exit(0); exit(exval);
break; break;
case '!': case '!':
if (!no_intty) { if (!no_intty) {
clreol(); cleartoeol();
if (rdline(colon, estring)) break; if (rdline(colon, estring)) break;
doshell(estring); doshell(estring);
PRINTF("------------------------\r\n"); PRINTF("------------------------\r\n");
@ -314,7 +377,7 @@ main(argc, argv)
break; break;
case '!': case '!':
if (!no_intty) { if (!no_intty) {
clreol(); cleartoeol();
if (rdline(ch, estring)) break; if (rdline(ch, estring)) break;
doshell(estring); doshell(estring);
PRINTF("------------------------\r\n"); PRINTF("------------------------\r\n");
@ -329,7 +392,7 @@ main(argc, argv)
if (no_intty) { if (no_intty) {
bmbeep(); bmbeep();
} else { } else {
clrscr(); clearscreen();
to_print = maxy + 1; to_print = maxy + 1;
fseek(curr_file, screen_home, SEEK_SET); fseek(curr_file, screen_home, SEEK_SET);
bytepos = screen_home; bytepos = screen_home;
@ -363,7 +426,7 @@ main(argc, argv)
count = precount; count = precount;
} }
putchar('\r'); putchar('\r');
clreol(); cleartoeol();
PRINTF("\n...skipping %ld line", count); PRINTF("\n...skipping %ld line", count);
if (count > 1) { if (count > 1) {
PRINTF("s\r\n\r\n"); PRINTF("s\r\n\r\n");
@ -382,7 +445,7 @@ main(argc, argv)
} }
case '/': /**** Search String ****/ case '/': /**** Search String ****/
if (!repeat) { if (!repeat) {
clreol(); cleartoeol();
if (rdline(ch, sstring)) break; if (rdline(ch, sstring)) break;
} }
case 'n': /**** Search Next ****/ case 'n': /**** Search Next ****/
@ -401,13 +464,13 @@ main(argc, argv)
screen_home = bytepos; screen_home = bytepos;
to_print = maxy; to_print = maxy;
PRINTF("\r"); PRINTF("\r");
clreol(); cleartoeol();
PRINTF("\n\r\n***Back***\r\n\r\n"); PRINTF("\n\r\n***Back***\r\n\r\n");
} }
break; break;
case '=': case '=':
prompt = 0; prompt = 0;
clreol(); cleartoeol();
PRINTF("%lX hex %lu dec", (unsigned long)bytepos, PRINTF("%lX hex %lu dec", (unsigned long)bytepos,
(unsigned long)bytepos); (unsigned long)bytepos);
fflush(stdout); fflush(stdout);
@ -426,7 +489,7 @@ main(argc, argv)
case 'w': case 'w':
case 'v': case 'v':
if (!no_intty) { if (!no_intty) {
clreol(); cleartoeol();
if (ch == 'v') { if (ch == 'v') {
sprintf(string, "bvi +%lu %s", sprintf(string, "bvi +%lu %s",
(unsigned long)(screen_home + (unsigned long)(screen_home +
@ -482,7 +545,7 @@ rdline(ch, sstring)
if (i) { if (i) {
sstring[--i] = '\0'; sstring[--i] = '\0';
PRINTF("\r%c%s", ch, sstring); PRINTF("\r%c%s", ch, sstring);
clreol(); cleartoeol();
} else { } else {
ch1 = ESC; ch1 = ESC;
break; break;
@ -504,7 +567,7 @@ rdline(ch, sstring)
} }
if (ch1 == ESC) { if (ch1 == ESC) {
putchar('\r'); putchar('\r');
clreol(); cleartoeol();
return 1; return 1;
} }
if (i) sstring[i] = '\0'; if (i) sstring[i] = '\0';
@ -520,7 +583,7 @@ do_next(n)
if (n == 1 && file_nr == numfiles) { if (n == 1 && file_nr == numfiles) {
fclose(curr_file); fclose(curr_file);
reset_tty(); reset_tty();
exit(0); exit(exval);
} }
if ((file_nr + n) > numfiles) if ((file_nr + n) > numfiles)
file_nr = numfiles; file_nr = numfiles;
@ -534,12 +597,12 @@ do_next(n)
} else { } else {
fclose(curr_file); fclose(curr_file);
reset_tty(); reset_tty();
exit(0); exit(exval);
} }
} }
void int
open_file(name) open_file(name)
char *name; char *name;
{ {
@ -548,19 +611,15 @@ open_file(name)
if (stat(name, &buf) > -1) { if (stat(name, &buf) > -1) {
filesize = buf.st_size; filesize = buf.st_size;
} }
if (numfiles > 1) {
PRINTF("\r");
clreol();
PRINTF("\n::::::::::::::\r\n%s\r\n::::::::::::::\r\n", name);
corr = 2;
}
if (curr_file != NULL) fclose(curr_file); if (curr_file != NULL) fclose(curr_file);
if (numfiles > 1) do_header = 1;
if ((curr_file = fopen(name, "rb")) == NULL) { if ((curr_file = fopen(name, "rb")) == NULL) {
/* reset_tty(); */
perror(name); perror(name);
exit(1); exval = 1;
return 1;
} }
bytepos = screen_home = 0; bytepos = screen_home = 0;
return 0;
} }
@ -572,7 +631,7 @@ putline(buf, num)
int print_pos; int print_pos;
unsigned char ch; unsigned char ch;
PRINTF(addr_form, bytepos); PRINTF(addr_form, (unsigned long)bytepos);
for (print_pos = 0; print_pos < num; print_pos++) { for (print_pos = 0; print_pos < num; print_pos++) {
ch = buf[print_pos]; ch = buf[print_pos];
if (!ascii_flag) { if (!ascii_flag) {
@ -592,7 +651,8 @@ putline(buf, num)
*(string + print_pos) = ' '; *(string + print_pos) = ' ';
} }
*(string + num) = '\0'; *(string + num) = '\0';
PRINTF("%s\r\n", string); if (no_tty) PRINTF("%s\n", string);
else PRINTF("%s\r\n", string);
} }
@ -604,6 +664,20 @@ printout(lns)
int doub = 0; int doub = 0;
static int flag; static int flag;
if (c_flag) {
clearscreen();
}
if (do_header) {
if (no_tty) {
PRINTF("::::::::::::::\n%s\n::::::::::::::\n", name);
} else {
PRINTF("\r");
cleartoeol();
PRINTF("::::::::::::::\r\n%s\r\n::::::::::::::\r\n", name);
}
do_header = 0;
corr = 2;
}
if (corr && (lns > maxy - 2)) lns -= corr; if (corr && (lns > maxy - 2)) lns -= corr;
corr = 0; corr = 0;
do { do {
@ -619,7 +693,7 @@ printout(lns)
lns--; lns--;
} else { } else {
if (flag) { if (flag) {
clreol(); cleartoeol();
PRINTF("*\r\n"); PRINTF("*\r\n");
lns--; lns--;
} else { } else {
@ -855,10 +929,10 @@ emsg(s)
char *s; char *s;
{ {
putchar('\r'); putchar('\r');
clreol(); cleartoeol();
highvideo(); highlight();
PRINTF(s); PRINTF(s);
normvideo(); normal();
fflush(stdout); fflush(stdout);
prompt = 0; prompt = 0;
} }

871
bmore.c.old Normal file
View File

@ -0,0 +1,871 @@
/* BMORE - binary more
*
* 1990-01-31 V 1.0.0
* 1990-09-04 V 1.1.0
* 2000-05-31 V 1.3.0 beta
* 2000-10-18 V 1.3.0 final
* 2002-01-16 V 1.3.1
* 2002-02-22 V 1.3.2 line 576
*
* NOTE: Edit this file with tabstop=4 !
*
* Copyright 1990-2003 by Gerhard Buergmann
* gerhard@puon.at
*
* 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.
*
* See file COPYING for information on distribution conditions.
*/
#include <sys/types.h>
#ifdef HAVE_LOCALE_H
# include <locale.h>
#endif
#ifdef __MSDOS__
# define PRINTF cprintf
#else
# define PRINTF printf
#ifndef HELPFILE
# define HELPFILE "/usr/local/share/bmore.help"
#endif
#endif
#include "bmore.h"
char *copyright = "Copyright (C) 1990-2003 by Gerhard Buergmann";
int maxx, maxy;
char *name = NULL;
char sstring[MAXCMD] = ""; /* string for search */
char estring[MAXCMD] = ""; /* string for shell escape */
char string[MAXCMD];
FILE *curr_file = NULL, *help_file;
int AnzAdd;
long precount = -1; /* number preceding command */
char **files; /* list of input files */
int numfiles; /* number of input files */
int file_nr = 0; /* number of current input file */
int arrnum = 0;
char numarr[64]; /* string for collecting number */
char addr_form[15];
int ascii_flag = 0;
int d_flag = 0;
int init_search = 0;
char buffer1[MAXCMD], buffer2[MAXCMD];
int out_len;
int corr = 0, to_print;
off_t init_byte = 0;
off_t last_search = 0;
off_t screen_home, filesize;
off_t bytepos, oldpos;
int prompt = 1;
char helppath[MAXCMD];
static char *progname;
static char cmdbuf[MAXCMD];
static int cnt = 0;
static int icnt = 0;
static int smode;
char search_pat[BUFFER]; /* / or ? command */
char *emptyclass = "Empty byte class '[]' or '[^]'";
/* -a ASCII mode
* -d beginners mode
* -i ignore case
*/
void
usage()
{
fprintf(stderr, "Usage: %s [-adi] [+linenum | +/pattern] name1 name2 ...\n", progname);
exit(1);
}
int
main(argc, argv)
int argc;
char *argv[];
{
int ch, ch1;
int colon = 0, last_ch = 0;
long last_pre = 0;
int lflag, repeat;
long count;
int i, n = 1;
int d_line, r_line, z_line;
#ifdef __MSDOS__
char *poi;
strcpy(helppath, argv[0]);
poi = strrchr(helppath, '\\');
*poi = '\0';
strcat(helppath, "\\MORE.HLP");
#else
strncpy(helppath, HELPFILE, MAXCMD - 1);
#endif
#ifdef HAVE_LOCALE_H
setlocale(LC_ALL, "");
#endif
progname = argv[0];
while (n < argc) {
switch (argv[n][0]) {
case '-':
i = 1;
while (argv[n][i] != '\0') {
switch (argv[n][i]) {
case 'a': ascii_flag++;
break;
case 'd': d_flag++;
break;
case 'i': ignore_case++;
break;
default: usage();
}
i++;
}
n++;
break;
case '+': /* +cmd */
if (argv[n][1] == '/' || argv[n][1] == '\\') {
init_search = argv[n][1];
strcpy(sstring, &argv[n][2]);
} else {
if (argv[n][1] == '0') {
init_byte = (off_t)strtol(argv[n] + 1, NULL, 16);
} else {
init_byte = (off_t)strtol(argv[n] + 1, NULL, 10);
}
}
n++;
break;
default: /* must be a file name */
name = strdup(argv[n]);
files = &(argv[n]);
numfiles = argc - n;
n = argc;
break;
}
}
if (numfiles == 0) {
curr_file = stdin;
if (isatty(fileno(stdin)) != 0) usage();
} else {
open_file(name);
file_nr = 1;
fseek(curr_file, init_byte, SEEK_SET);
bytepos += init_byte;
}
screen_home = bytepos;
initterm();
set_tty();
maxy -= 2;
z_line = maxy;
d_line = maxy / 2;
r_line = 1;
AnzAdd = 10;
strcpy(addr_form, "%08lX ");
if (ascii_flag)
out_len = ((maxx - AnzAdd - 1) / 4) * 4;
else
out_len = ((maxx - AnzAdd - 1) / 16) * 4;
if (init_search)
bmsearch(init_search);
if (no_tty) {
while(!printout(1));
fclose(curr_file);
reset_tty();
exit(0);
}
if (printout(maxy)) {
do_next(1);
}
/* main loop */
do {
to_print = 0;
if (prompt) {
highvideo();
PRINTF("--More--");
if (prompt == 2) {
PRINTF("(Next file: %s)", name);
} else if (!no_intty && filesize) {
PRINTF("(%d%%)", (int)((bytepos * 100) / filesize));
}
if (d_flag) PRINTF("[Press space to continue, 'q' to quit]");
normvideo();
fflush(stdout);
}
ch = vgetc();
if (prompt == 2) {
open_file(name);
}
prompt = 1;
PRINTF("\r");
while (ch >= '0' && ch <= '9') {
numarr[arrnum++] = ch;
ch = vgetc();
}
numarr[arrnum] = '\0';
if (arrnum != 0) precount = strtol(numarr, (char **)NULL, 10);
else precount = -1;
lflag = arrnum = 0;
if (ch == '.') {
precount = last_pre;
ch = last_ch;
repeat = 1;
} else {
last_pre = precount;
last_ch = ch;
if (ch == ':') colon = vgetc();
repeat = 0;
}
switch (ch) {
case ' ': /* Display next k lines of text [current screen size] */
if (precount > 0) to_print = precount;
else to_print = maxy;
break;
case 'z': /* Display next k lines of bytes [current screen size]* */
if (precount > 0) z_line = precount;
to_print = z_line;
break;
case '\r':
case '\n': /* Display next k lines of text [current screen size]* */
if (precount > 0) r_line = precount;
to_print = r_line;
break;
case 'q':
case 'Q':
clreol();
fclose(curr_file);
reset_tty();
exit(0);
case ':' :
switch (colon) {
case 'f':
prompt = 0;
if (!no_intty)
PRINTF("\"%s\" line %lu", name,
(unsigned long)(bytepos - out_len));
else
PRINTF("[Not a file] line %lu",
(unsigned long)(bytepos - out_len));
fflush(stdout);
break;
case 'n':
if (precount < 1) precount = 1;
do_next(precount);
PRINTF("\r");
clreol();
PRINTF("\n...Skipping to file %s\r\n\r\n", name);
prompt = 2;
break;
case 'p':
if (precount < 1) precount = 1;
do_next(-precount);
PRINTF("\r");
clreol();
PRINTF("\n...Skipping back to file %s\r\n\r\n", name);
prompt = 2;
break;
case 'q':
clreol();
fclose(curr_file);
reset_tty();
exit(0);
break;
case '!':
if (!no_intty) {
clreol();
if (rdline(colon, estring)) break;
doshell(estring);
PRINTF("------------------------\r\n");
break;
}
default:
bmbeep();
}
break;
case '!':
if (!no_intty) {
clreol();
if (rdline(ch, estring)) break;
doshell(estring);
PRINTF("------------------------\r\n");
break;
}
case 'd': /* Scroll k lines [current scroll size, initially 11]* */
case BVICTRL('D'):
if (precount > 0) d_line = precount;
to_print = d_line;
break;
case BVICTRL('L'): /*** REDRAW SCREEN ***/
if (no_intty) {
bmbeep();
} else {
clrscr();
to_print = maxy + 1;
fseek(curr_file, screen_home, SEEK_SET);
bytepos = screen_home;
}
break;
case 'b': /* Skip backwards k screenfuls of text [1] */
case BVICTRL('B'):
if (no_intty) {
bmbeep();
} else {
if (precount < 1) precount = 1;
PRINTF("...back %ld page", precount);
if (precount > 1) {
PRINTF("s\r\n");
} else {
PRINTF("\r\n");
}
screen_home -= (maxy + 1) * out_len;
if (screen_home < 0) screen_home = 0;
fseek(curr_file, screen_home, SEEK_SET);
bytepos = screen_home;
to_print = maxy + 1;
}
break;
case 'f': /* Skip forward k screenfuls of bytes [1] */
case 's': /* Skip forward k lines of bytes [1] */
if (precount < 1) precount = 1;
if (ch == 'f') {
count = maxy * precount;
} else {
count = precount;
}
putchar('\r');
clreol();
PRINTF("\n...skipping %ld line", count);
if (count > 1) {
PRINTF("s\r\n\r\n");
} else {
PRINTF("\r\n\r\n");
}
screen_home += (count + maxy) * out_len;
fseek(curr_file, screen_home, SEEK_SET);
bytepos = screen_home;
to_print = maxy;
break;
case '\\':
if (ascii_flag) {
bmbeep();
break;
}
case '/': /**** Search String ****/
if (!repeat) {
clreol();
if (rdline(ch, sstring)) break;
}
case 'n': /**** Search Next ****/
case 'N':
bmsearch(ch);
/*
to_print--;
*/
break;
case '\'':
if (no_intty) {
bmbeep();
} else {
bytepos = last_search;
fseek(curr_file, bytepos, SEEK_SET);
screen_home = bytepos;
to_print = maxy;
PRINTF("\r");
clreol();
PRINTF("\n\r\n***Back***\r\n\r\n");
}
break;
case '=':
prompt = 0;
clreol();
PRINTF("%lX hex %lu dec", (unsigned long)bytepos,
(unsigned long)bytepos);
fflush(stdout);
break;
case '?':
case 'h':
if ((help_file = fopen(helppath, "r")) == NULL) {
emsg("Can't open help file");
break;
}
while ((ch1 = getc(help_file)) != EOF)
putchar(ch1);
fclose(help_file);
to_print = 0;
break;
case 'w':
case 'v':
if (!no_intty) {
clreol();
if (ch == 'v') {
sprintf(string, "bvi +%lu %s",
(unsigned long)(screen_home +
(maxy + 1) / 2 * out_len), name);
} else {
if (precount < 1) precount = bytepos - screen_home;
sprintf(string, "bvi -b %lu -s %lu %s",
(unsigned long)screen_home,
(unsigned long)precount, name);
}
doshell(string);
to_print = maxy + 1;
break;
}
default :
if (d_flag) {
emsg("[Press 'h' for instructions.]");
} else {
bmbeep();
}
break;
}
if (to_print) {
if (printout(to_print)) {
do_next(1);
}
}
} while (1);
}
int
rdline(ch, sstring)
int ch;
char *sstring;
{
int i = 0;
int ch1 = 0;
char bstring[MAXCMD];
if (ch == '!') {
strcpy(bstring, sstring);
sstring[0] = '\0';
}
putchar(ch);
fflush(stdout);
while (i < MAXCMD) {
ch1 = vgetc();
if (ch1 == '\n' || ch1 == '\r' || ch1 == ESC) {
break;
} else if (ch1 == 8) {
if (i) {
sstring[--i] = '\0';
PRINTF("\r%c%s", ch, sstring);
clreol();
} else {
ch1 = ESC;
break;
}
} else if (ch1 == '!' && i == 0) {
if (bstring[0] == '\0') {
emsg("No previous command");
return 1;
}
putchar(ch1);
PRINTF("\r%c%s", ch, bstring);
strcat(sstring, bstring);
i = strlen(sstring);
} else {
putchar(ch1);
sstring[i++] = ch1;
}
fflush(stdout);
}
if (ch1 == ESC) {
putchar('\r');
clreol();
return 1;
}
if (i) sstring[i] = '\0';
return 0;
}
void
do_next(n)
int n;
{
if (numfiles) {
if (n == 1 && file_nr == numfiles) {
fclose(curr_file);
reset_tty();
exit(0);
}
if ((file_nr + n) > numfiles)
file_nr = numfiles;
else if ((file_nr + n) < 1)
file_nr = 1;
else
file_nr += n;
prompt = 2;
free(name);
name = strdup(*(files + file_nr - 1));
} else {
fclose(curr_file);
reset_tty();
exit(0);
}
}
void
open_file(name)
char *name;
{
struct stat buf;
if (stat(name, &buf) > -1) {
filesize = buf.st_size;
}
if (numfiles > 1) {
PRINTF("\r");
clreol();
PRINTF("\n::::::::::::::\r\n%s\r\n::::::::::::::\r\n", name);
corr = 2;
}
if (curr_file != NULL) fclose(curr_file);
if ((curr_file = fopen(name, "rb")) == NULL) {
/* reset_tty(); */
perror(name);
exit(1);
}
bytepos = screen_home = 0;
}
void
putline(buf, num)
char *buf;
int num;
{
int print_pos;
unsigned char ch;
PRINTF(addr_form, (unsigned long)bytepos);
for (print_pos = 0; print_pos < num; print_pos++) {
ch = buf[print_pos];
if (!ascii_flag) {
PRINTF("%02X ", ch);
}
++bytepos;
if ((ch > 31) && (ch < 127))
*(string + print_pos) = ch;
else
*(string + print_pos) = '.';
}
for (; print_pos < out_len; print_pos++) {
if (!ascii_flag) {
PRINTF(" ");
}
++bytepos;
*(string + print_pos) = ' ';
}
*(string + num) = '\0';
PRINTF("%s\r\n", string);
}
int
printout(lns)
int lns;
{
int c, num;
int doub = 0;
static int flag;
if (corr && (lns > maxy - 2)) lns -= corr;
corr = 0;
do {
for (num = 0; num < out_len; num++) {
if ((c = nextchar()) == -1) break;
buffer1[num] = c;
}
if (!num) return 1;
if (memcmp(buffer1, buffer2, num) || !bytepos ) {
memcpy(buffer2, buffer1, num);
putline(buffer2, num);
if (!no_tty) flag = TRUE;
lns--;
} else {
if (flag) {
clreol();
PRINTF("*\r\n");
lns--;
} else {
doub++;
}
flag = FALSE;
bytepos += num;
}
if (lns == 0) {
screen_home = bytepos - ((maxy + 1 + doub) * out_len);
if (screen_home < 0) screen_home = 0;
return 0;
}
} while(num);
return 1;
}
int
nextchar()
{
if (cnt == 0) return fgetc(curr_file);
cnt--;
return cmdbuf[icnt++] & 0xff;
}
void
pushback(n, where)
int n;
char *where;
{
if (cnt) memmove(cmdbuf + n, cmdbuf, n);
memcpy(cmdbuf, where, n);
icnt = 0;
cnt += n;
}
/* Return:
* -1 EOF
* 0 not found at current position
* 1 found
*/
int
bmregexec(scan)
char *scan;
{
char *act;
int count, test;
int l;
char act_pat[MAXCMD]; /* found pattern */
act = act_pat;
l = 0;
while (*scan != 0) {
if ((test = nextchar()) == -1) return -1;
*act++ = test;
if (++l == MAXCMD) {
pushback(l, act_pat);
return 0;
}
if (ignore_case && smode == ASCII) test = toupper(test);
switch (*scan++) {
case ONE: /* exactly one character */
count = *scan++;
if (count == 1) {
if (test != *scan) {
bytepos++;
if (l > 1) pushback(--l, act_pat + 1);
return 0;
}
scan++;
} else if (count > 1) {
if (sbracket(test, scan, count)) {
bytepos++;
if (l > 1) pushback(--l, act_pat + 1);
return 0;
}
scan += count;
}
break;
case STAR: /* zero or more characters */
count = *scan++;
if (count == 1) { /* only one character, 0 - n times */
while (test == *scan) {
if ((test = nextchar()) == -1) return -2;
*act++ = test;
if (++l == MAXCMD) {
pushback(l, act_pat);
return 0;
}
if (ignore_case && smode == ASCII)
test = toupper(test);
}
pushback(1, --act);
l--;
scan++;
} else if (count > 1) { /* characters in bracket */
if (*scan == '^') {
do {
/* If we found something matching the next part of the expression, we
* abandon the search for not-matching characters. */
if (bmregexec(scan + count)) {
*act++ = test; /* May be wrong case !! */
l++;
scan += count;
bytepos--;
break;
}
if (sbracket(test, scan, count)) {
bytepos++;
if (l > 1) pushback(--l, act_pat + 1);
return 0;
} else {
if ((test = nextchar()) == -1) return -3;
*act++ = test;
if (++l == MAXCMD) {
pushback(l, act_pat);
return 0;
}
if (ignore_case && smode == ASCII)
test = toupper(test);
}
} while(1);
} else {
while(!sbracket(test, scan, count)) {
if ((test = nextchar()) == -1) return -4;
*act++ = test;
if (++l == MAXCMD) {
pushback(l, act_pat);
return 0;
}
if (ignore_case && smode == ASCII)
test = toupper(test);
}
scan += count;
pushback(1, --act);
l--;
}
} else { /* ".*" */
do {
if ((test = nextchar()) == -1) return -5;
*act++ = test;
if (++l == MAXCMD) {
pushback(l, act_pat);
return 0;
}
pushback(1, act - 1);
bytepos--;
} while (bmregexec(scan) == 0);
bytepos++;
act--;
l--;
}
break;
}
}
pushback(l, act_pat);
return 1; /* found */
}
int
sbracket(start, scan, count)
int start;
char *scan;
int count;
{
if (*scan++ == '^') {
if (!memchr(scan, start, --count)) return 0;
} else {
if (memchr(scan, start, --count)) return 0;
}
return 1;
}
void
bmsearch(ch)
int ch;
{
int i;
if (sstring[0] == '\0') {
emsg("No previous regular expression");
return;
}
if (ch == '/') {
if (ascii_comp(search_pat, sstring)) return;
}
if (ch == '\\') {
if (hex_comp(search_pat, sstring)) return;
}
oldpos = bytepos;
last_search = screen_home;
if (precount < 1) precount = 1;
while (precount--) {
while ((i = bmregexec(search_pat)) == 0);
if (i == 1) {
screen_home = bytepos;
to_print = maxy;
} else { /* i == -1 -> EOF */
if (no_intty) {
PRINTF("\r\nPattern not found\r\n");
do_next(1);
} else {
/*
sprintf(string, "Pattern not found %d - %ul", i, (unsigned long)bytepos);
emsg(string);
*/
emsg("Pattern not found");
bytepos = oldpos;
fseek(curr_file, bytepos, SEEK_SET);
break;
}
}
if (precount) {
nextchar();
bytepos++;
}
}
if (prompt) {
PRINTF("\r\n...skipping\r\n");
}
}
void
emsg(s)
char *s;
{
putchar('\r');
clreol();
highvideo();
PRINTF(s);
normvideo();
fflush(stdout);
prompt = 0;
}
void
bmbeep() {
putchar(7);
}

35
bmore.h
View File

@ -8,11 +8,12 @@
* 2000-05-31 V 1.3.0 beta * 2000-05-31 V 1.3.0 beta
* 2000-10-04 V 1.3.0 final * 2000-10-04 V 1.3.0 final
* 2002-01-16 V 1.3.1 * 2002-01-16 V 1.3.1
* 2003-02-20 V 1.3.2
* *
* NOTE: Edit this file with tabstop=4 ! * NOTE: Edit this file with tabstop=4 !
* *
* Copyright 1996-2002 by Gerhard Buergmann * Copyright 1996-2003 by Gerhard Buergmann
* Gerhard.Buergmann@altavista.net * gerhard@puon.at
* *
* This program is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the
@ -36,7 +37,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <setjmp.h> #include <setjmp.h>
#ifdef __MSDOS__ #if defined(__MSDOS__) && !defined(DJGPP)
# include "patchlev.h" # include "patchlev.h"
# include "dosconf.h" # include "dosconf.h"
# include <alloc.h> # include <alloc.h>
@ -46,15 +47,21 @@
# include "patchlevel.h" # include "patchlevel.h"
# include "config.h" # include "config.h"
# include <unistd.h> # include <unistd.h>
#if HAVE_NCURSES_H # if HAVE_NCURSES_H
# include <ncurses.h> # include <ncurses.h>
# include <ncurses/term.h> # else
#else
# include <curses.h> # include <curses.h>
# endif
# if HAVE_TERM_H
# include <term.h> # include <term.h>
#endif # else
# if HAVE_NCURSES_TERM_H
# include <ncurses/term.h>
# endif
# endif
#endif #endif
/* defines for filemode */ /* defines for filemode */
#define ERROR -1 #define ERROR -1
#define REGULAR 0 #define REGULAR 0
@ -89,7 +96,7 @@
# define FALSE 0 # define FALSE 0
#endif #endif
#ifdef __MSDOS__ #if defined(__MSDOS__) && !defined(DJGPP)
# define ANSI # define ANSI
# define PTR char huge * # define PTR char huge *
# define off_t long # define off_t long
@ -123,13 +130,13 @@ extern int no_tty, no_intty;
#ifdef ANSI #ifdef ANSI
void initterm(void), set_tty(void), reset_tty(void); void initterm(void), set_tty(void), reset_tty(void);
void clreol(void), clrscr(void), highvideo(void), normvideo(void); void cleartoeol(void), clearscreen(void), highlight(void);
void bmbeep(void), home(void), sig(void); void normal(void), bmbeep(void), home(void), sig(void);
void doshell(char *), emsg(char *); void doshell(char *), emsg(char *);
void do_next(int); void do_next(int);
void open_file(char *);
void bmsearch(int); void bmsearch(int);
void pushback(int, char *); void pushback(int, char *);
int open_file(void);
int printout(int), rdline(int, char *); int printout(int), rdline(int, char *);
int nextchar(void), vgetc(void); int nextchar(void), vgetc(void);
int sbracket(int, char *, int); int sbracket(int, char *, int);
@ -138,13 +145,13 @@ extern int no_tty, no_intty;
void putline(char *, int); void putline(char *, int);
#else #else
void initterm(), set_tty(), reset_tty(); void initterm(), set_tty(), reset_tty();
void clreol(), clrscr(), highvideo(), normvideo(); void cleartoeol(), clearscreen(), highlight();
void bmbeep(), home(), sig(); void normal(), bmbeep(), home(), sig();
void doshell(), emsg(); void doshell(), emsg();
void do_next(); void do_next();
void open_file();
void bmsearch(); void bmsearch();
void pushback(); void pushback();
int open_file();
int printout(), rdline(); int printout(), rdline();
int nextchar(), vgetc(); int nextchar(), vgetc();
int sbracket(); int sbracket();

224
bmore.man
View File

@ -1,29 +1,26 @@
BMORE(1) BMORE(1) BMORE(1) BMORE(1)
NNAAMMEE NAME
bmore - browse through a binary file bmore - browse through a binary file
SSYYNNOOPPSSIISS SYNOPSIS
bbmmoorree [ --aaddii ] [ ++_l_i_n_e_n_u_m_b_e_r ] [ ++//_A_S_C_I_I_-_p_a_t_t_e_r_n ] [ bmore [ -acdi ] [ -n lines ] [ -w cols ] [ +linenumber ] [
++\\_H_e_x_-_p_a_t_t_e_r_n ] [ _f_i_l_e_n_a_m_e ... ] +/ASCII-pattern ] [ +\Hex-pattern ] [ filename ... ]
DDEESSCCRRIIPPTTIIOONN DESCRIPTION
mmoorree is a filter that displays the contents of a binary more is a filter that displays the contents of a binary
file on the terminal, one screenful at a time. It nor­ file on the terminal, one screenful at a time. It nor-
mally pauses after each screenful, and prints ----MMoorree---- at mally pauses after each screenful, and prints --More-- at
the bottom of the screen. bbmmoorree provides a two-line over­ the bottom of the screen. bmore provides a two-line over-
lap between screens for continuity. If bbmmoorree is reading lap between screens for continuity. If bmore is reading
from a file rather than a pipe, the percentage of charac­ from a file rather than a pipe, the percentage of charac-
ters displayed so far is also shown. ters displayed so far is also shown.
bbmmoorree scrolls up to display one more screen line in bmore scrolls up to display one more screen line in
response to a RETURN character; it displays another response to a RETURN character; it displays another
screenful in response to a SPACE character. Other com­ screenful in response to a SPACE character. Other com-
mands are listed below. mands are listed below.
The screen is divided in three sections or panes: The byte The screen is divided in three sections or panes: The byte
@ -34,165 +31,148 @@ DDEESSCCRRIIPPTTIIOONN
screen line. Note that (as one would expect) the first screen line. Note that (as one would expect) the first
byte has the offset 0 (zero). byte has the offset 0 (zero).
bbmmoorree sets the terminal to _n_o_e_c_h_o mode, so that the output bmore sets the terminal to noecho mode, so that the output
can be continuous. Commands that you type do not normally can be continuous. Commands that you type do not normally
show up on your terminal, except for the // , \\ and !! com­ show up on your terminal, except for the / , \ and ! com-
mands. mands.
If the standard output is not a terminal, mmoorree acts just If the standard output is not a terminal, more acts just
like ccaatt(1V), except that a header is printed before each like cat(1V), except that a header is printed before each
file in a series. file in a series.
OOPPTTIIOONNSS OPTIONS
--aa ASCII mode: no hex representation of the contents. -a ASCII mode: no hex representation of the contents.
Non printable characters are displayed as a dot (.) Non printable characters are displayed as a dot (.)
--dd Display error messages rather than ringing the ter­ -c Clear before displaying. Redrawing the screen
minal bell if an unrecognized command is used. instead of scrolling.
-d Display error messages rather than ringing the ter-
minal bell if an unrecognized command is used.
This is helpful for inexperienced users. This is helpful for inexperienced users.
--ii Ignore case for searching. -i Ignore case for searching.
++_l_i_n_e_n_u_m_b_e_r -n lines
Start up at _l_i_n_e_n_u_m_b_e_r. Displays the indicated number of lines in each
screenful, rather than the default (the number of
lines in the terminal screen less two).
++//_A_S_C_I_I_-_p_a_t_t_e_r_n -w cols
Start up at the line containing the regular Display number of cols in each line.
+linenumber
Start up at linenumber.
+/ASCII-pattern
Start up at the line containing the regular expres-
sion pattern. Note: unlike editors, this construct
should not end with a `/'. If it does, then the
trailing slash is taken as a character in the
search pattern.
USAGE
13 June 2000 1 Commands
BMORE(1) BMORE(1)
expression _p_a_t_t_e_r_n. Note: unlike editors, this
construct should _n_o_t end with a `//'. If it does,
then the trailing slash is taken as a character in
the search pattern.
UUSSAAGGEE
CCoommmmaannddss
The commands take effect immediately; it is not necessary The commands take effect immediately; it is not necessary
to type a carriage return. Up to the time when the com­ to type a carriage return. Up to the time when the com-
mand character itself is given, the user may type the line mand character itself is given, the user may type the line
kill character to cancel the numerical argument being kill character to cancel the numerical argument being
formed. In addition, the user may type the erase charac­ formed. In addition, the user may type the erase charac-
ter to redisplay the `----MMoorree----((_x_x%%))' message. ter to redisplay the `--More--(xx%)' message.
In the following commands, _i is a numerical argument (11 by In the following commands, i is a numerical argument (1 by
default). default).
_iSPACE Display another screenful, or _i more lines if _i iSPACE Display another screenful, or i more lines if i
is specified. is specified.
_iRETURN Display another line, or _i more lines, if speci­ iRETURN Display another line, or i more lines, if speci-
fied. fied.
_i^^DD (CTRL-D) Display (scroll down) 11 more lines. _i i^D (CTRL-D) Display (scroll down) 11 more lines. i
is given, the scroll size is set to _i. is given, the scroll size is set to i.
_id Same as ^^DD. id Same as ^D.
_izz Same as SPACE, except that _i, if present, iz Same as SPACE, except that i, if present,
becomes the new default number of lines per becomes the new default number of lines per
screenful. screenful.
_iss Skip _i lines and then print a screenful. is Skip i lines and then print a screenful.
_iff Skip _i screenfuls and then print a screenful. if Skip i screenfuls and then print a screenful.
_i^^BB (CTRL-B) Skip back _i screenfuls and then print a i^B (CTRL-B) Skip back i screenfuls and then print a
screenful. screenful.
_b Same as ^^BB (CTRL-D). b Same as ^B (CTRL-D).
qq q
QQ Exit from mmoorree. Q Exit from more.
== Display the current line number. = Display the current line number.
vv Drop into the bbvvii(1) editor at the current off­ v Drop into the bvi(1) editor at the current off-
set of the current file. set of the current file.
w Drop into the bvi(1) editor at the current off-
ww Drop into the bbvvii(1) editor at the current off­
set of the current file. Only the portion of the set of the current file. Only the portion of the
file displayed on the screen will be loaded. file displayed on the screen will be loaded.
h Help. Give a description of all the more com-
13 June 2000 2
BMORE(1) BMORE(1)
hh Help. Give a description of all the mmoorree com­
mands. mands.
_i//_p_a_t_t_e_r_n Search for the _ith occurrence of the regular i/pattern Search for the ith occurrence of the regular
expression _p_a_t_t_e_r_n. Display the screenful expression pattern. Display the screenful
starting at the file position that contains the starting at the file position that contains the
_ith match for the regular expression _A_S_C_I_I_-_p_a_t_­ ith match for the regular expression ASCII-pat-
_t_e_r_n, or the end of a pipe, whichever comes tern, or the end of a pipe, whichever comes
first. If bbmmoorree is displaying a file and there first. If bmore is displaying a file and there
is no such match, its position in the file is no such match, its position in the file
remains unchanged. Regular expressions can be remains unchanged. Regular expressions can be
edited using erase and kill characters. Erasing edited using erase and kill characters. Erasing
back past the first column cancels the search back past the first column cancels the search
command. command.
´´ Single quote. Go to the point from which the ' Single quote. Go to the point from which the
last search started. If no search has been per­ last search started. If no search has been per-
formed in the current file, go to the beginning formed in the current file, go to the beginning
of the file. of the file.
!!_c_o_m_m_a_n_d Invoke a shell to execute _c_o_m_m_a_n_d. The charac­ !command Invoke a shell to execute command. The charac-
ters %% and !!, when used within _c_o_m_m_a_n_d are ters % and !, when used within command are
replaced with the current filename and the pre­ replaced with the current filename and the pre-
vious shell command, respectively. If there is vious shell command, respectively. If there is
no current filename, %% is not expanded. Prepend no current filename, % is not expanded. Prepend
a backslash to these characters to escape expan­ a backslash to these characters to escape expan-
sion. sion.
_i::nn Skip to the _ith next filename given in the com­ i:n Skip to the ith next filename given in the com-
mand line, or to the last filename in the list mand line, or to the last filename in the list
if _i is out of range. if i is out of range.
_i::pp Skip to the _ith previous filename given in the i:p Skip to the ith previous filename given in the
command line, or to the first filename if _i is command line, or to the first filename if i is
out of range. If given while mmoorree is positioned out of range. If given while more is positioned
within a file, go to the beginning of the file. within a file, go to the beginning of the file.
If mmoorree is reading from a pipe, mmoorree simply If more is reading from a pipe, more simply
rings the terminal bell. rings the terminal bell.
::ff Display the current filename and offset number. :f Display the current filename and offset number.
::qq :q
::QQ Exit from bbmmoorree (same as qq or QQ )).. :Q Exit from bmore (same as q or Q ).
.. Dot. Repeat the previous command. . Dot. Repeat the previous command.
FFIILLEESS FILES
//eettcc//tteerrmmccaapp terminal data base /etc/termcap terminal data base
//uussrr//llooccaall//sshhaarree//bbmmoorree..hheellpp /usr/local/share/bmore.help
help file help file
SSEEEE AALLSSOO SEE ALSO
bbvvii(1), tteerrmmccaapp(5) bvi(1), termcap(5)
3 Jan 2004
3 Jan 2002 3

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

8
bvi.1
View File

@ -93,7 +93,7 @@
.nr % 0 .nr % 0
.rr F .rr F
.\} .\}
.TH BVI 1 "BVI Version 1.3.1" "3/Jan/2002" "User Commands" .TH BVI 1 "BVI Version 1.3.2" "3/Jan/2004" "User Commands"
.IX Title "BVI 1" .IX Title "BVI 1"
.UC .UC
.IX Name "bvi, bview - visual display editor for binary files" .IX Name "bvi, bview - visual display editor for binary files"
@ -194,7 +194,7 @@
bvi, bview \- visual editor for binary files bvi, bview \- visual editor for binary files
.SH "VERSION" .SH "VERSION"
.IX Header "VERSION" .IX Header "VERSION"
bvi-1.3.1 bvi-1.3.2
.SH "SYNOPSIS" .SH "SYNOPSIS"
.IX Header "SYNOPSIS" .IX Header "SYNOPSIS"
\fBbvi\fR\ \ \ [\fB\-R\fR]\ [\fB\-c\fR\ \fIcmd\fR]\ [\fB\-f\fR\ \fIscript\fR]\ [\fB\-b\fR\ \fIbegin\fR]\ [\fB\-e\fR\ \fIend\fR]\ [\fB\-s\fR\ \fIsize\fR]\ \fIfile\fR... \fBbvi\fR\ \ \ [\fB\-R\fR]\ [\fB\-c\fR\ \fIcmd\fR]\ [\fB\-f\fR\ \fIscript\fR]\ [\fB\-b\fR\ \fIbegin\fR]\ [\fB\-e\fR\ \fIend\fR]\ [\fB\-s\fR\ \fIsize\fR]\ \fIfile\fR...
@ -594,11 +594,11 @@ the file. If you use ASCII mode you can use the special characters
.SH "AUTHOR" .SH "AUTHOR"
.IX Header "AUTHOR" .IX Header "AUTHOR"
bvi was developed by Gerhard Buergmann, Vienna, Austria bvi was developed by Gerhard Buergmann, Vienna, Austria
\fIGerhard.Buergmann@altavista.net\fR \fIGerhard.Buergmann@puon.at\fR
.SH "WWW" .SH "WWW"
.IX Header "WWW" .IX Header "WWW"
Bvi\ Homepage:\ \ http://bvi.sourceforge.net/ Bvi\ Homepage:\ \ http://bvi.sourceforge.net/
Vi\ Pages:\ \ \ \ \ \ http://www.math.fu-berlin.de/~guckes/vi/ Vi\ Pages:\ \ \ \ \ \ http://www.guckes.net/vi/clones.php3
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (all\ about\ Vi\ and\ its\ clones) \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (all\ about\ Vi\ and\ its\ clones)
.SH "FILES" .SH "FILES"
.IX Header "FILES" .IX Header "FILES"

7
bvi.c
View File

@ -8,11 +8,12 @@
* 2000-05-10 V 1.3.0 alpha * 2000-05-10 V 1.3.0 alpha
* 2000-10-24 V 1.3.0 final * 2000-10-24 V 1.3.0 final
* 2002-01-03 V 1.3.1 * 2002-01-03 V 1.3.1
* 2004-01-04 V 1.3.2
* *
* NOTE: Edit this file with tabstop=4 ! * NOTE: Edit this file with tabstop=4 !
* *
* Copyright 1996-2002 by Gerhard Buergmann * Copyright 1996-2004 by Gerhard Buergmann
* Gerhard.Buergmann@altavista.net * gerhard@puon.at
* *
* This program is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the
@ -37,7 +38,7 @@
#endif #endif
char *copyright = "Copyright (C) 1996-2002 by Gerhard Buergmann"; char *copyright = "Copyright (C) 1996-2004 by Gerhard Buergmann";
jmp_buf env; /* context for `longjmp' function */ jmp_buf env; /* context for `longjmp' function */

11
bvi.h
View File

@ -8,11 +8,12 @@
* 2000-05-10 V 1.3.0 alpha * 2000-05-10 V 1.3.0 alpha
* 2000-10-24 V 1.3.0 final * 2000-10-24 V 1.3.0 final
* 2001-10-29 V 1.3.1 * 2001-10-29 V 1.3.1
* 2003-07-04 V 1.3.2
* *
* NOTE: Edit this file with tabstop=4 ! * NOTE: Edit this file with tabstop=4 !
* *
* Copyright 1996-2001 by Gerhard Buergmann * Copyright 1996-2003 by Gerhard Buergmann
* Gerhard.Buergmann@altavista.net * gerhard@puon.at
* *
* This program is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the
@ -36,7 +37,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <setjmp.h> #include <setjmp.h>
#ifdef __MSDOS__ #if defined(__MSDOS__) && !defined(DJGPP)
# include "patchlev.h" # include "patchlev.h"
# include "dosconf.h" # include "dosconf.h"
# include "doscur.h" # include "doscur.h"
@ -109,7 +110,7 @@
# define FALSE 0 # define FALSE 0
#endif #endif
#ifdef __MSDOS__ #if defined(__MSDOS__) && !defined(DJGPP)
# define ANSI # define ANSI
# define PTR char huge * # define PTR char huge *
# define off_t long # define off_t long
@ -185,7 +186,7 @@ extern off_t block_begin, block_end, block_size;
#define S_ISFIFO(m) ((m & 0170000) == 0010000) /* fifo */ #define S_ISFIFO(m) ((m & 0170000) == 0010000) /* fifo */
#endif #endif
#ifdef __MSDOS__ #if defined(__MSDOS__) && !defined(DJGPP)
void d_memcpy(PTR, PTR, off_t); void d_memcpy(PTR, PTR, off_t);
void d_memmove(PTR, PTR, off_t); void d_memmove(PTR, PTR, off_t);
#endif #endif

196
bvi.man
View File

@ -2,28 +2,48 @@ BVI(1) User Commands BVI(1)
NAME NAME
bvi, bview - visual display editor for binary files bvi, bview - visual editor for binary files
VERSION VERSION
bvi-1.3.1 bvi-1.3.2
SYNOPSIS SYNOPSIS
bvi [-R] [-c cmd] [-f script] file... bvi [-R] [-c cmd] [-f script] [-b begin] [-e end] [-s size] file...
bview [-R] [-c cmd] [-f script] file... bview [-R] [-c cmd] [-f script] [-b begin] [-e end] [-s size] file...
OPTIONS OPTIONS
file... file...
One or more files. The file argument indicates one or A list of filenames. The first one will be the
more files to be edited. current file and will be read into the buffer. The
cursor will be positioned on the first line of the
buffer. You can get to the other files with the
":next" command.
-R "Readonly": The readonly flag is set for all the -R "Readonly": The readonly flag is set for all the
files, preventing accidental overwriting with a write files, preventing accidental overwriting with a write
command. command.
-b begin
causes bvi to load a file not from the start but from
offset begin.
-e end
causes bvi to load a file not till end but till
address end.
-s size
causes bvi not to load the complete file but only size
bytes.
-c cmd -c cmd
Execute command cmd. Begin editing by executing the cmd will be executed after the first file has
specified editor command (usually a search or been read. If the cmd contains spaces it must be
positioning command). enclosed in double quotes (this depends on the shell
that is used).
-f script -f script
This command provides a means for collecting a series This command provides a means for collecting a series
@ -33,39 +53,38 @@ OPTIONS
to make several global changes in a binary file. to make several global changes in a binary file.
DESCRIPTION DESCRIPTION
Bvi stands for "Binary VIsual editor". Bvi is a display Bvi stands for "Binary VIsual editor". Bvi is a screen
oriented editor for binary files; its command set is based oriented editor for binary files; its command set is based
on those of the vi(1) texteditor. As a binary editor on that of the vi(1) text editor. As a binary editor does
cannot have the concept of "lines" there are several not have the concept of "lines" there are differences from
differences to Vi commands (see COMPARISON). Vi commands wherever the latter are line orientate.
COMPARISON COMPARISON
The main differences between Vi and Bvi are: The main differences between Vi and Bvi are:
The screen is divided in three sections/windows: The byte The screen is divided in three sections or panes: The byte
offset (at the left side), the hex window (in the middle), offset (extreme left), the hex pane (middle), and an ascii
and the ascii window (to the right) which shows the ascii pane (right) which shows as printable characters those
values of those bytes in the hex window. On an 80 column bytes in the hex pane. On an 80 column terminal there
terminal you will therefore see sixteen hex values and will be sixteen hex values and their ASCII values on each
their ASCII values on each screen line. Note that the screen line. Note that (as one would expect) the first
first byte has the offset '0' (zero). byte has the offset '0' (zero).
You can toggle between the hex and ascii windows with the You can toggle between the hex and ascii windows with the
tabulator key (TAB). Toggling between these two windows tab key (TAB). Toggling between these two windows does
does not change the current position within the file. not change the current position (offset) within the file.
No "lines" concept: Files are treated as one long series No "lines" concept: Files are treated as one long stream
of bytes only. These characters "newline" and "carriage of bytes. The characters "newline" and "carriage return"
return" thus are not special, ie they do not mark the end are not special, id est they never mark the end of lines.
of lines. Therefore the lines on the screen do not Therefore the lines on the screen do not represent lines
represent lines in the usual way. Data is broken across in the usual way. Data is broken across screen lines
screen lines as they happen to fit in. As a consequence arbitarily. As a consequence there are no commands in bvi
there are no commands in bvi from ex or vi that are based from ex or vi that are based on line numbers, eg "dd",
on line numbers, eg "dd", "yy", 'C', 'S', 'o', 'O'. This "yy", 'C', 'S', 'o', 'O'. This also changes the meaning
also changes the meaning of "range" before the ":write" of "range" before the ":write" command to a byte offset,
command to a byte offset, ie the command ":100,200w foo" ie the command ":100,200w foo" writes all *bytes* (not
writes all *bytes* (not lines) from offset 100 to offset lines) from offset 100 to offset 200 to the file "foo".
200 to the file "foo".
No "text objects": There are also no text-specific No "text objects": There are also no text-specific
arrangements like words, paragraphs, sentences, sections arrangements like words, paragraphs, sentences, sections
@ -102,38 +121,41 @@ COMPARISON
between hex value are optional, so searching for between hex value are optional, so searching for
"6775636B6573" will find "guckes". "6775636B6573" will find "guckes".
Changing data (insertion, deletion) moves the data to Changing the length of data (insertion, deletion) moves
other addresses; this is bad for many cases (eg. the data to other addresses; this is bad for many cases
databases, program files) and is thus disabled by default. (eg. databases, program files) and is thus disabled by
You can enable this commands by typing default. You can enable this commands by typing
:set memmove :set memmove
BVI Modes: BVI Modes:
Command Mode aka Normal Mode: Command Mode (Normal Mode):
Input is treated as commands. Note that command mode is Input is treated as command. Note that command mode is
the default mode after startup and when you escape/quit the default mode after startup and after escaping from
from either command line mode or input mode. Use ESC input mode. Use ESC (escape) to cancel a partial
(escape) to cancel a partial (uncompleted) command. (uncompleted) command.
Input Mode: Input Mode:
Input is treated as replacement of current character or is Input is treated as replacement of current characters or
appended to the current file. This mode is entered from (after the end of the file) is appended to the current
command mode by typing either of 'i', 'I', 'A', 'r', or file. This mode is entered from command mode by typing
'R'. You can enter the character itself (in the ASCII one of 'i', 'I', 'A', 'r', or 'R'. You can enter the
window) or its hexadecimal value (in the HEX window). characters from the keyboard (in the ASCII window) or
Type TAB to switch between these two windows. Type ESC to hexadecimal values (in the HEX window). Type TAB to
cancel current command and return to command mode. Type switch between these two windows. Type ESC to finish the
CTRL-C to cancel current command abnormally. current input and return to command mode. Type CTRL-C to
cancel current command abnormally.
Command line mode (aka Last Line Mode): Command line mode (Last Line Mode or : mode):
Reading input for : / ? \ # or !; terminate by typing a Similar to vi, this mode is entered by typing one of the
carriage return; an interrupt cancels termination. Type characters : / ? \ # ! The command is terminated and
ESC to cancel current command and return to command mode. executed by typing a carriage return; to cancel a
partially typed command, type ESC to cancel the current
command and return to command mode.
ENVIRONMENT ENVIRONMENT
The editor recognizes the environment variable BVIINIT as The editor recognizes the environment variable BVIINIT as
@ -166,11 +188,11 @@ COMMAND SUMMARY
abbreviations used within the following description of abbreviations used within the following description of
commands. commands.
Abstract: Abstract:
Arrow keys move the cursor on the screen within the Arrow keys move the cursor on the screen within the
current window. current window.
Sample commands: Sample commands:
:version show version info :version show version info
<- v ^ -> arrow keys move the cursor <- v ^ -> arrow keys move the cursor
h j k l same as arrow keys h j k l same as arrow keys
@ -180,7 +202,7 @@ COMMAND SUMMARY
/text search for text /text search for text
^U ^D scroll up or down ^U ^D scroll up or down
Counts before bvi commands: Counts before bvi commands:
Numbers may be typed as a prefix to some commands. Numbers may be typed as a prefix to some commands.
They are interpreted in one of these ways. They are interpreted in one of these ways.
@ -189,11 +211,11 @@ COMMAND SUMMARY
scroll amount ^D ^U scroll amount ^D ^U
repeat effect most of the rest repeat effect most of the rest
Interrupting, canceling Interrupting, canceling
ESC end insert or incomplete command ESC end insert or incomplete command
DEL (delete or rubout) interrupts DEL (delete or rubout) interrupts
File manipulation: File manipulation:
ZZ if file modified, write and exit; ZZ if file modified, write and exit;
otherwise, exit otherwise, exit
:w write changed buffer to file :w write changed buffer to file
@ -202,7 +224,7 @@ COMMAND SUMMARY
:q quit when no changes have been made :q quit when no changes have been made
:q! quit and discard all changes :q! quit and discard all changes
:e file edit file :e file edit file
:e! reedit current file, discard all changes :e! re-read current file, discard all changes
:e # edit the alternate file :e # edit the alternate file
:e! # edit the alternate file, discard changes :e! # edit the alternate file, discard changes
:w file write current buffer to file :w file write current buffer to file
@ -218,13 +240,13 @@ COMMAND SUMMARY
current position within buffer current position within buffer
^G same as :f ^G same as :f
Additional edit commands Additional edit commands
You can insert/append/change bytes in You can insert/append/change bytes in
ASCII/binary/decimal/ hexadecimal or octal representation. ASCII/binary/decimal/ hexadecimal or octal representation.
You can enter several (screen) lines of input. A line with You can enter several (screen) lines of input. A line with
only a period (.) in it will terminate the command. You only a period (.) in it will terminate the command. You
must not type in values greater than a byte value. This must not type in values greater than a byte value. This
causes an abandom of the command. Pressing the CR key causes an abandonment of the command. Pressing the CR key
does not insert a newline - character into the file. If does not insert a newline - character into the file. If
you use ASCII mode you can use the special characters \n, you use ASCII mode you can use the special characters \n,
\r, \t and \0. \r, \t and \0.
@ -233,7 +255,7 @@ COMMAND SUMMARY
:a bCR append bytes (Binary) at end of file :a bCR append bytes (Binary) at end of file
:c hCR change bytes (hexadecimal) at cursor position :c hCR change bytes (hexadecimal) at cursor position
Bit-level operations Bit-level operations
:and n bitwise 'and' operation with value n :and n bitwise 'and' operation with value n
:or n bitwise 'or' operation with value n :or n bitwise 'or' operation with value n
:xor n bitwise 'xor' operation with value n :xor n bitwise 'xor' operation with value n
@ -244,7 +266,7 @@ COMMAND SUMMARY
:rl i rotate each byte i bits to the left :rl i rotate each byte i bits to the left
:rr i rotate each byte i bits to the right :rr i rotate each byte i bits to the right
Command mode addresses Command mode addresses
:w foo write current buffer to a file :w foo write current buffer to a file
named "foo" named "foo"
:5,10w foo copy byte 5 through 100 into as :5,10w foo copy byte 5 through 100 into as
@ -256,7 +278,7 @@ COMMAND SUMMARY
:/pat/,$ foo search pattern pat and and copy :/pat/,$ foo search pattern pat and and copy
through end of file through end of file
Positioning within file: Positioning within file:
^B backward screen ^B backward screen
^F forward screen ^F forward screen
^D scroll down half screen ^D scroll down half screen
@ -271,7 +293,7 @@ COMMAND SUMMARY
N repeat last search command, but in opposite N repeat last search command, but in opposite
direction direction
Adjusting the screen: Adjusting the screen:
^L clear and redraw screen ^L clear and redraw screen
zCR redraw screen with current line at top of screen zCR redraw screen with current line at top of screen
z- redraw screen with current line at bottom of z- redraw screen with current line at bottom of
@ -283,16 +305,15 @@ COMMAND SUMMARY
^E scroll screen down 1 line ^E scroll screen down 1 line
^Y scroll screen up 1 line ^Y scroll screen up 1 line
Marking and returning: Marking and returning:
mx mark current position with lower-case letter x mx mark current position with lower-case letter x
Note: this command works for all lower-case Note: this command works for all lower-case
letters letters
'x move cursor to mark x in ASCII section 'x move cursor to mark x in ASCII section
`x move cursor to mark x in HEX section `x move cursor to mark x in HEX section
'' move cursor to previous context in ASCII section '' move cursor to previous context in ASCII section
`` move cursor to previous context in HEX section `` move cursor to previous context in HEX section
Line positioning:
Line positioning:
H jump to first line on screen ("top") H jump to first line on screen ("top")
L jump to last line on screen ("low") L jump to last line on screen ("low")
M jump to middle line on screen ("middle") M jump to middle line on screen ("middle")
@ -302,7 +323,7 @@ COMMAND SUMMARY
DOWN or j next line, same column DOWN or j next line, same column
UP or k previous line, same column UP or k previous line, same column
Character positioning: Character positioning:
^ first byte in HEX window ^ first byte in HEX window
$ end of screen line $ end of screen line
l or RIGHT jump onto next byte (within current l or RIGHT jump onto next byte (within current
@ -316,7 +337,7 @@ COMMAND SUMMARY
n| jump onto nth byte/character within current n| jump onto nth byte/character within current
line line
Strings: Strings:
(works similar to the strings(1) command) (works similar to the strings(1) command)
Note: "Words" are defined as strings of "nonprinting Note: "Words" are defined as strings of "nonprinting
characters". characters".
@ -327,35 +348,34 @@ COMMAND SUMMARY
\0 or \n \0 or \n
B back to previous string delimited with a B back to previous string delimited with a
nonprinting char nonprinting char
Corrections during insert:
Corrections during insert:
^H erase last character (backspace) ^H erase last character (backspace)
erase your erase character, same as ^H (backspace) erase your erase character, same as ^H (backspace)
ESC ends insertion, back to command mode ESC ends insertion, back to command mode
Append and replace: Append and replace:
A append at end of file A append at end of file
rx replace current bte with char 'x' rx replace current bte with char 'x'
R enter replace mode; for all subsequent input, R enter replace mode; for all subsequent input,
the current byte is overwritten with the next the current byte is overwritten with the next
input character; leave replace mode with ESC. input character; leave replace mode with ESC.
Miscellaneous Operations: Miscellaneous Operations:
TAB toggle between ASCII and HEX section TAB toggle between ASCII and HEX section
Yank and Put: Yank and Put:
3ySPACE yank 3 characters 3ySPACE yank 3 characters
p insert contents of yank buffer p insert contents of yank buffer
o replace text with content of yank buffer o replace text with content of yank buffer
P put back at end of file P put back at end of file
Undo, Redo: Undo, Redo:
u undo last change u undo last change
Note: Only the last change can be undone. Note: Only the last change can be undone.
Therefore this commands toggles between the Therefore this commands toggles between the
last and second-t-last state of the buffer. last and second-t-last state of the buffer.
Setting Options: Setting Options:
With the :set command you can set options in bvi With the :set command you can set options in bvi
Option Default Description Option Default Description
@ -380,13 +400,14 @@ COMMAND SUMMARY
32 is displayed in the statusline as shown 32 is displayed in the statusline as shown
in ascii(7) if unset rather in DOS-style (^A) in ascii(7) if unset rather in DOS-style (^A)
AUTHOR AUTHOR
bvi was developed by Gerhard Buergmann, Vienna, Austria bvi was developed by Gerhard Buergmann, Vienna, Austria
Gerhard.Buergmann@altavista.net Gerhard.Buergmann@puon.at
WWW WWW
Bvi Homepage: http://bvi.sourceforge.net/ Bvi Homepage: http://bvi.sourceforge.net/
Vi Pages: http://www.math.fu-berlin.de/~guckes/vi/ Vi Pages: http://www.guckes.net/vi/clones.php3
(all about Vi and its clones) (all about Vi and its clones)
FILES FILES
@ -400,5 +421,4 @@ BUGS
SEE ALSO SEE ALSO
vi(1), strings(1), ascii(5) vi(1), strings(1), ascii(5)
3/Jan/2004 BVI Version 1.3.2
3/Jan/2002 BVI Version 1.3.1 8

7
comm.c
View File

@ -9,11 +9,12 @@
* 2000-03-03 V 1.3.0 beta * 2000-03-03 V 1.3.0 beta
* 2000-07-15 V 1.3.0 final * 2000-07-15 V 1.3.0 final
* 2001-10-10 V 1.3.1 * 2001-10-10 V 1.3.1
* 2003-07-04 V 1.3.2
* *
* NOTE: Edit this file with tabstop=4 ! * NOTE: Edit this file with tabstop=4 !
* *
* Copyright 1996-2001 by Gerhard Buergmann * Copyright 1996-2003 by Gerhard Buergmann
* Gerhard.Buergmann@altavista.net * gerhard@puon.at
* *
* This program is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the
@ -39,7 +40,7 @@
# include <fcntl.h> # include <fcntl.h>
#endif #endif
#ifdef __MSDOS__ #if defined(__MSDOS__) && !defined(DJGPP)
# include <io.h> # include <io.h>
# include <dir.h> # include <dir.h>
# define WRITE (O_WRONLY|O_CREAT|O_TRUNC|O_BINARY) # define WRITE (O_WRONLY|O_CREAT|O_TRUNC|O_BINARY)

444
config.guess vendored Normal file → Executable file
View File

@ -1,9 +1,9 @@
#! /bin/sh #! /bin/sh
# Attempt to guess a canonical system name. # Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# Free Software Foundation, Inc. # 2000, 2001, 2002 Free Software Foundation, Inc.
timestamp='2001-07-12' timestamp='2002-11-30'
# This file is free software; you can redistribute it and/or modify it # This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by # under the terms of the GNU General Public License as published by
@ -24,8 +24,9 @@ timestamp='2001-07-12'
# configuration script generated by Autoconf, you may include it under # configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program. # the same distribution terms that you use for the rest of that program.
# Written by Per Bothner <bothner@cygnus.com>. # Originally written by Per Bothner <per@bothner.com>.
# Please send patches to <config-patches@gnu.org>. # Please send patches to <config-patches@gnu.org>. Submit a context
# diff and a properly formatted ChangeLog entry.
# #
# This script attempts to guess a canonical system name similar to # This script attempts to guess a canonical system name similar to
# config.sub. If it succeeds, it prints the system name on stdout, and # config.sub. If it succeeds, it prints the system name on stdout, and
@ -87,30 +88,40 @@ if test $# != 0; then
exit 1 exit 1
fi fi
trap 'exit 1' 1 2 15
dummy=dummy-$$ # CC_FOR_BUILD -- compiler used by this script. Note that the use of a
trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 # compiler to aid in system detection is discouraged as it requires
# temporary files to be created and, as you can see below, it is a
# headache to deal with in a portable fashion.
# CC_FOR_BUILD -- compiler used by this script.
# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
# use `HOST_CC' if defined, but it is deprecated. # use `HOST_CC' if defined, but it is deprecated.
set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in # This shell variable is my proudest work .. or something. --bje
,,) echo "int dummy(){}" > $dummy.c ;
for c in cc gcc c89 ; do set_cc_for_build='tmpdir=${TMPDIR-/tmp}/config-guess-$$ ;
($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; (old=`umask` && umask 077 && mkdir $tmpdir && umask $old && unset old)
if test $? = 0 ; then || (echo "$me: cannot create $tmpdir" >&2 && exit 1) ;
dummy=$tmpdir/dummy ;
files="$dummy.c $dummy.o $dummy.rel $dummy" ;
trap '"'"'rm -f $files; rmdir $tmpdir; exit 1'"'"' 1 2 15 ;
case $CC_FOR_BUILD,$HOST_CC,$CC in
,,) echo "int x;" > $dummy.c ;
for c in cc gcc c89 c99 ; do
if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
CC_FOR_BUILD="$c"; break ; CC_FOR_BUILD="$c"; break ;
fi ; fi ;
done ; done ;
rm -f $dummy.c $dummy.o $dummy.rel ; rm -f $files ;
if test x"$CC_FOR_BUILD" = x ; then if test x"$CC_FOR_BUILD" = x ; then
CC_FOR_BUILD=no_compiler_found ; CC_FOR_BUILD=no_compiler_found ;
fi fi
;; ;;
,,*) CC_FOR_BUILD=$CC ;; ,,*) CC_FOR_BUILD=$CC ;;
,*,*) CC_FOR_BUILD=$HOST_CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;;
esac' esac ;
unset files'
# This is needed to find uname on a Pyramid OSx when run in the BSD universe. # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 1994-08-24) # (ghazi@noc.rutgers.edu 1994-08-24)
@ -127,29 +138,30 @@ UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:NetBSD:*:*) *:NetBSD:*:*)
# Netbsd (nbsd) targets should (where applicable) match one or # NetBSD (nbsd) targets should (where applicable) match one or
# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
# *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
# switched to ELF, *-*-netbsd* would select the old # switched to ELF, *-*-netbsd* would select the old
# object file format. This provides both forward # object file format. This provides both forward
# compatibility and a consistent mechanism for selecting the # compatibility and a consistent mechanism for selecting the
# object file format. # object file format.
# Determine the machine/vendor (is the vendor relevant). #
case "${UNAME_MACHINE}" in # Note: NetBSD doesn't particularly care about the vendor
amiga) machine=m68k-unknown ;; # portion of the name. We always set it to "unknown".
arm32) machine=arm-unknown ;; sysctl="sysctl -n hw.machine_arch"
atari*) machine=m68k-atari ;; UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
sun3*) machine=m68k-sun ;; /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
mac68k) machine=m68k-apple ;; case "${UNAME_MACHINE_ARCH}" in
macppc) machine=powerpc-apple ;; armeb) machine=armeb-unknown ;;
hp3[0-9][05]) machine=m68k-hp ;; arm*) machine=arm-unknown ;;
ibmrt|romp-ibm) machine=romp-ibm ;; sh3el) machine=shl-unknown ;;
*) machine=${UNAME_MACHINE}-unknown ;; sh3eb) machine=sh-unknown ;;
*) machine=${UNAME_MACHINE_ARCH}-unknown ;;
esac esac
# The Operating System including object format, if it has switched # The Operating System including object format, if it has switched
# to ELF recently, or will in the future. # to ELF recently, or will in the future.
case "${UNAME_MACHINE}" in case "${UNAME_MACHINE_ARCH}" in
i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k) arm*|i386|m68k|ns32k|sh3*|sparc|vax)
eval $set_cc_for_build eval $set_cc_for_build
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep __ELF__ >/dev/null | grep __ELF__ >/dev/null
@ -166,12 +178,62 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
;; ;;
esac esac
# The OS release # The OS release
release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` # Debian GNU/NetBSD machines have a different userland, and
# thus, need a distinct triplet. However, they do not need
# kernel version information, so it can be replaced with a
# suitable tag, in the style of linux-gnu.
case "${UNAME_VERSION}" in
Debian*)
release='-gnu'
;;
*)
release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
;;
esac
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
# contains redundant information, the shorter form: # contains redundant information, the shorter form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}" echo "${machine}-${os}${release}"
exit 0 ;; exit 0 ;;
amiga:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
arc:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
hp300:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
mac68k:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
macppc:OpenBSD:*:*)
echo powerpc-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
mvme68k:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
mvme88k:OpenBSD:*:*)
echo m88k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
mvmeppc:OpenBSD:*:*)
echo powerpc-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
pmax:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
sgi:OpenBSD:*:*)
echo mipseb-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
sun3:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
wgrisc:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
*:OpenBSD:*:*)
echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
alpha:OSF1:*:*) alpha:OSF1:*:*)
if test $UNAME_RELEASE = "V4.0"; then if test $UNAME_RELEASE = "V4.0"; then
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
@ -180,6 +242,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# A Tn.n version is a released field test version. # A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel. # A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r. # 1.2 uses "1.2" for uname -r.
eval $set_cc_for_build
cat <<EOF >$dummy.s cat <<EOF >$dummy.s
.data .data
\$Lformat: \$Lformat:
@ -205,10 +268,9 @@ main:
jsr \$26,exit jsr \$26,exit
.end main .end main
EOF EOF
eval $set_cc_for_build $CC_FOR_BUILD -o $dummy $dummy.s 2>/dev/null
$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
if test "$?" = 0 ; then if test "$?" = 0 ; then
case `./$dummy` in case `$dummy` in
0-0) 0-0)
UNAME_MACHINE="alpha" UNAME_MACHINE="alpha"
;; ;;
@ -227,9 +289,15 @@ EOF
2-307) 2-307)
UNAME_MACHINE="alphaev67" UNAME_MACHINE="alphaev67"
;; ;;
2-1307)
UNAME_MACHINE="alphaev68"
;;
3-1307)
UNAME_MACHINE="alphaev7"
;;
esac esac
fi fi
rm -f $dummy.s $dummy rm -f $dummy.s $dummy && rmdir $tmpdir
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
exit 0 ;; exit 0 ;;
Alpha\ *:Windows_NT*:*) Alpha\ *:Windows_NT*:*)
@ -244,29 +312,11 @@ EOF
Amiga*:UNIX_System_V:4.0:*) Amiga*:UNIX_System_V:4.0:*)
echo m68k-unknown-sysv4 echo m68k-unknown-sysv4
exit 0;; exit 0;;
amiga:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
*:[Aa]miga[Oo][Ss]:*:*) *:[Aa]miga[Oo][Ss]:*:*)
echo ${UNAME_MACHINE}-unknown-amigaos echo ${UNAME_MACHINE}-unknown-amigaos
exit 0 ;; exit 0 ;;
arc64:OpenBSD:*:*) *:[Mm]orph[Oo][Ss]:*:*)
echo mips64el-unknown-openbsd${UNAME_RELEASE} echo ${UNAME_MACHINE}-unknown-morphos
exit 0 ;;
arc:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
hkmips:OpenBSD:*:*)
echo mips-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
pmax:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
sgi:OpenBSD:*:*)
echo mips-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
wgrisc:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
*:OS/390:*:*) *:OS/390:*:*)
echo i370-ibm-openedition echo i370-ibm-openedition
@ -288,6 +338,10 @@ EOF
NILE*:*:*:dcosx) NILE*:*:*:dcosx)
echo pyramid-pyramid-svr4 echo pyramid-pyramid-svr4
exit 0 ;; exit 0 ;;
DRS?6000:UNIX_SV:4.2*:7*)
case `/usr/bin/uname -p` in
sparc) echo sparc-icl-nx7 && exit 0 ;;
esac ;;
sun4H:SunOS:5.*:*) sun4H:SunOS:5.*:*)
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;; exit 0 ;;
@ -316,7 +370,7 @@ EOF
echo m68k-sun-sunos${UNAME_RELEASE} echo m68k-sun-sunos${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
sun*:*:4.2BSD:*) sun*:*:4.2BSD:*)
UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
case "`/bin/arch`" in case "`/bin/arch`" in
sun3) sun3)
@ -330,9 +384,6 @@ EOF
aushp:SunOS:*:*) aushp:SunOS:*:*)
echo sparc-auspex-sunos${UNAME_RELEASE} echo sparc-auspex-sunos${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
atari*:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
# The situation for MiNT is a little confusing. The machine name # The situation for MiNT is a little confusing. The machine name
# can be virtually everything (everything which is not # can be virtually everything (everything which is not
# "atarist" or "atariste" at least should have a processor # "atarist" or "atariste" at least should have a processor
@ -359,18 +410,6 @@ EOF
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
echo m68k-unknown-mint${UNAME_RELEASE} echo m68k-unknown-mint${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
sun3*:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
mac68k:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
mvme68k:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
mvme88k:OpenBSD:*:*)
echo m88k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
powerpc:machten:*:*) powerpc:machten:*:*)
echo powerpc-apple-machten${UNAME_RELEASE} echo powerpc-apple-machten${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
@ -387,6 +426,7 @@ EOF
echo clipper-intergraph-clix${UNAME_RELEASE} echo clipper-intergraph-clix${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
mips:*:*:UMIPS | mips:*:*:RISCos) mips:*:*:UMIPS | mips:*:*:RISCos)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c sed 's/^ //' << EOF >$dummy.c
#ifdef __cplusplus #ifdef __cplusplus
#include <stdio.h> /* for printf() prototype */ #include <stdio.h> /* for printf() prototype */
@ -408,16 +448,21 @@ EOF
exit (-1); exit (-1);
} }
EOF EOF
eval $set_cc_for_build $CC_FOR_BUILD -o $dummy $dummy.c \
$CC_FOR_BUILD $dummy.c -o $dummy \ && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
&& ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
&& rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy && rmdir $tmpdir
rm -f $dummy.c $dummy
echo mips-mips-riscos${UNAME_RELEASE} echo mips-mips-riscos${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
Motorola:PowerMAX_OS:*:*) Motorola:PowerMAX_OS:*:*)
echo powerpc-motorola-powermax echo powerpc-motorola-powermax
exit 0 ;; exit 0 ;;
Motorola:*:4.3:PL8-*)
echo powerpc-harris-powermax
exit 0 ;;
Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
echo powerpc-harris-powermax
exit 0 ;;
Night_Hawk:Power_UNIX:*:*) Night_Hawk:Power_UNIX:*:*)
echo powerpc-harris-powerunix echo powerpc-harris-powerunix
exit 0 ;; exit 0 ;;
@ -478,6 +523,7 @@ EOF
exit 0 ;; exit 0 ;;
*:AIX:2:3) *:AIX:2:3)
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c sed 's/^ //' << EOF >$dummy.c
#include <sys/systemcfg.h> #include <sys/systemcfg.h>
@ -489,9 +535,8 @@ EOF
exit(0); exit(0);
} }
EOF EOF
eval $set_cc_for_build $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy && rmdir $tmpdir
rm -f $dummy.c $dummy
echo rs6000-ibm-aix3.2.5 echo rs6000-ibm-aix3.2.5
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
echo rs6000-ibm-aix3.2.4 echo rs6000-ibm-aix3.2.4
@ -500,7 +545,7 @@ EOF
fi fi
exit 0 ;; exit 0 ;;
*:AIX:*:[45]) *:AIX:*:[45])
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
IBM_ARCH=rs6000 IBM_ARCH=rs6000
else else
@ -540,10 +585,8 @@ EOF
9000/31? ) HP_ARCH=m68000 ;; 9000/31? ) HP_ARCH=m68000 ;;
9000/[34]?? ) HP_ARCH=m68k ;; 9000/[34]?? ) HP_ARCH=m68k ;;
9000/[678][0-9][0-9]) 9000/[678][0-9][0-9])
case "${HPUX_REV}" in if [ -x /usr/bin/getconf ]; then
11.[0-9][0-9]) sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
if [ -x /usr/bin/getconf ]; then
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
case "${sc_cpu_version}" in case "${sc_cpu_version}" in
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
@ -552,12 +595,13 @@ EOF
case "${sc_kernel_bits}" in case "${sc_kernel_bits}" in
32) HP_ARCH="hppa2.0n" ;; 32) HP_ARCH="hppa2.0n" ;;
64) HP_ARCH="hppa2.0w" ;; 64) HP_ARCH="hppa2.0w" ;;
'') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
esac ;; esac ;;
esac esac
fi ;; fi
esac if [ "${HP_ARCH}" = "" ]; then
if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c sed 's/^ //' << EOF >$dummy.c
#define _HPUX_SOURCE #define _HPUX_SOURCE
#include <stdlib.h> #include <stdlib.h>
@ -590,11 +634,10 @@ EOF
exit (0); exit (0);
} }
EOF EOF
eval $set_cc_for_build (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
(CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi rm -f $dummy.c $dummy && rmdir $tmpdir
rm -f $dummy.c $dummy fi ;;
fi ;;
esac esac
echo ${HP_ARCH}-hp-hpux${HPUX_REV} echo ${HP_ARCH}-hp-hpux${HPUX_REV}
exit 0 ;; exit 0 ;;
@ -603,6 +646,7 @@ EOF
echo ia64-hp-hpux${HPUX_REV} echo ia64-hp-hpux${HPUX_REV}
exit 0 ;; exit 0 ;;
3050*:HI-UX:*:*) 3050*:HI-UX:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c sed 's/^ //' << EOF >$dummy.c
#include <unistd.h> #include <unistd.h>
int int
@ -628,9 +672,8 @@ EOF
exit (0); exit (0);
} }
EOF EOF
eval $set_cc_for_build $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy && rmdir $tmpdir
rm -f $dummy.c $dummy
echo unknown-hitachi-hiuxwe2 echo unknown-hitachi-hiuxwe2
exit 0 ;; exit 0 ;;
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
@ -658,9 +701,6 @@ EOF
parisc*:Lites*:*:*) parisc*:Lites*:*:*)
echo hppa1.1-hp-lites echo hppa1.1-hp-lites
exit 0 ;; exit 0 ;;
hppa*:OpenBSD:*:*)
echo hppa-unknown-openbsd
exit 0 ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
echo c1-convex-bsd echo c1-convex-bsd
exit 0 ;; exit 0 ;;
@ -679,9 +719,6 @@ EOF
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
echo c4-convex-bsd echo c4-convex-bsd
exit 0 ;; exit 0 ;;
CRAY*X-MP:*:*:*)
echo xmp-cray-unicos
exit 0 ;;
CRAY*Y-MP:*:*:*) CRAY*Y-MP:*:*:*)
echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;; exit 0 ;;
@ -703,18 +740,12 @@ EOF
CRAY*SV1:*:*:*) CRAY*SV1:*:*:*)
echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;; exit 0 ;;
CRAY-2:*:*:*)
echo cray2-cray-unicos
exit 0 ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit 0 ;; exit 0 ;;
hp300:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
@ -725,10 +756,19 @@ EOF
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
*:FreeBSD:*:*) *:FreeBSD:*:*)
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` # Determine whether the default compiler uses glibc.
exit 0 ;; eval $set_cc_for_build
*:OpenBSD:*:*) sed 's/^ //' << EOF >$dummy.c
echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` #include <features.h>
#if __GLIBC__ >= 2
LIBC=gnu
#else
LIBC=
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
rm -f $dummy.c && rmdir $tmpdir
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
exit 0 ;; exit 0 ;;
i*:CYGWIN*:*) i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin echo ${UNAME_MACHINE}-pc-cygwin
@ -739,11 +779,17 @@ EOF
i*:PW*:*) i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32 echo ${UNAME_MACHINE}-pc-pw32
exit 0 ;; exit 0 ;;
x86:Interix*:3*)
echo i586-pc-interix3
exit 0 ;;
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks
exit 0 ;;
i*:Windows_NT*:* | Pentium*:Windows_NT*:*) i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem? # How do we know it's Interix rather than the generic POSIX subsystem?
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
# UNAME_MACHINE based on the output of uname instead of i386? # UNAME_MACHINE based on the output of uname instead of i386?
echo i386-pc-interix echo i586-pc-interix
exit 0 ;; exit 0 ;;
i*:UWIN*:*) i*:UWIN*:*)
echo ${UNAME_MACHINE}-pc-uwin echo ${UNAME_MACHINE}-pc-uwin
@ -764,20 +810,57 @@ EOF
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;; exit 0 ;;
ia64:Linux:*:*) ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;; exit 0 ;;
m68*:Linux:*:*) m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;; exit 0 ;;
mips:Linux:*:*) mips:Linux:*:*)
case `sed -n '/^byte/s/^.*: \(.*\) endian/\1/p' < /proc/cpuinfo` in eval $set_cc_for_build
big) echo mips-unknown-linux-gnu && exit 0 ;; sed 's/^ //' << EOF >$dummy.c
little) echo mipsel-unknown-linux-gnu && exit 0 ;; #undef CPU
esac #undef mips
#undef mipsel
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
CPU=mipsel
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
CPU=mips
#else
CPU=
#endif
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
rm -f $dummy.c && rmdir $tmpdir
test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
;;
mips64:Linux:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#undef CPU
#undef mips64
#undef mips64el
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
CPU=mips64el
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
CPU=mips64
#else
CPU=
#endif
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
rm -f $dummy.c && rmdir $tmpdir
test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
;; ;;
ppc:Linux:*:*) ppc:Linux:*:*)
echo powerpc-unknown-linux-gnu echo powerpc-unknown-linux-gnu
exit 0 ;; exit 0 ;;
ppc64:Linux:*:*)
echo powerpc64-unknown-linux-gnu
exit 0 ;;
alpha:Linux:*:*) alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
EV5) UNAME_MACHINE=alphaev5 ;; EV5) UNAME_MACHINE=alphaev5 ;;
@ -786,7 +869,7 @@ EOF
PCA57) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;;
EV6) UNAME_MACHINE=alphaev6 ;; EV6) UNAME_MACHINE=alphaev6 ;;
EV67) UNAME_MACHINE=alphaev67 ;; EV67) UNAME_MACHINE=alphaev67 ;;
EV68*) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;;
esac esac
objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
@ -819,7 +902,8 @@ EOF
# The BFD linker knows what the default object file format is, so # The BFD linker knows what the default object file format is, so
# first see if it will tell us. cd to the root directory to prevent # first see if it will tell us. cd to the root directory to prevent
# problems with other programs or directories called `ld' in the path. # problems with other programs or directories called `ld' in the path.
ld_supported_targets=`cd /; ld --help 2>&1 \ # Set LC_ALL=C to ensure ld outputs messages in English.
ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
| sed -ne '/supported targets:/!d | sed -ne '/supported targets:/!d
s/[ ][ ]*/ /g s/[ ][ ]*/ /g
s/.*supported targets: *// s/.*supported targets: *//
@ -831,7 +915,7 @@ EOF
;; ;;
a.out-i386-linux) a.out-i386-linux)
echo "${UNAME_MACHINE}-pc-linux-gnuaout" echo "${UNAME_MACHINE}-pc-linux-gnuaout"
exit 0 ;; exit 0 ;;
coff-i386) coff-i386)
echo "${UNAME_MACHINE}-pc-linux-gnucoff" echo "${UNAME_MACHINE}-pc-linux-gnucoff"
exit 0 ;; exit 0 ;;
@ -842,33 +926,30 @@ EOF
exit 0 ;; exit 0 ;;
esac esac
# Determine whether the default compiler is a.out or elf # Determine whether the default compiler is a.out or elf
cat >$dummy.c <<EOF
#include <features.h>
#ifdef __cplusplus
#include <stdio.h> /* for printf() prototype */
int main (int argc, char *argv[]) {
#else
int main (argc, argv) int argc; char *argv[]; {
#endif
#ifdef __ELF__
# ifdef __GLIBC__
# if __GLIBC__ >= 2
printf ("%s-pc-linux-gnu\n", argv[1]);
# else
printf ("%s-pc-linux-gnulibc1\n", argv[1]);
# endif
# else
printf ("%s-pc-linux-gnulibc1\n", argv[1]);
# endif
#else
printf ("%s-pc-linux-gnuaout\n", argv[1]);
#endif
return 0;
}
EOF
eval $set_cc_for_build eval $set_cc_for_build
$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 sed 's/^ //' << EOF >$dummy.c
rm -f $dummy.c $dummy #include <features.h>
#ifdef __ELF__
# ifdef __GLIBC__
# if __GLIBC__ >= 2
LIBC=gnu
# else
LIBC=gnulibc1
# endif
# else
LIBC=gnulibc1
# endif
#else
#ifdef __INTEL_COMPILER
LIBC=gnu
#else
LIBC=gnuaout
#endif
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
rm -f $dummy.c && rmdir $tmpdir
test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
;; ;;
i*86:DYNIX/ptx:4*:*) i*86:DYNIX/ptx:4*:*)
@ -885,6 +966,23 @@ EOF
# Use sysv4.2uw... so that sysv4* matches it. # Use sysv4.2uw... so that sysv4* matches it.
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
exit 0 ;; exit 0 ;;
i*86:OS/2:*:*)
# If we were able to find `uname', then EMX Unix compatibility
# is probably installed.
echo ${UNAME_MACHINE}-pc-os2-emx
exit 0 ;;
i*86:XTS-300:*:STOP)
echo ${UNAME_MACHINE}-unknown-stop
exit 0 ;;
i*86:atheos:*:*)
echo ${UNAME_MACHINE}-unknown-atheos
exit 0 ;;
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
i*86:*DOS:*:*)
echo ${UNAME_MACHINE}-pc-msdosdjgpp
exit 0 ;;
i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
@ -906,22 +1004,19 @@ EOF
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
echo ${UNAME_MACHINE}-pc-isc$UNAME_REL echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
elif /bin/uname -X 2>/dev/null >/dev/null ; then elif /bin/uname -X 2>/dev/null >/dev/null ; then
UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
&& UNAME_MACHINE=i586 && UNAME_MACHINE=i586
(/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
&& UNAME_MACHINE=i686 && UNAME_MACHINE=i686
(/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
&& UNAME_MACHINE=i686 && UNAME_MACHINE=i686
echo ${UNAME_MACHINE}-pc-sco$UNAME_REL echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
else else
echo ${UNAME_MACHINE}-pc-sysv32 echo ${UNAME_MACHINE}-pc-sysv32
fi fi
exit 0 ;; exit 0 ;;
i*86:*DOS:*:*)
echo ${UNAME_MACHINE}-pc-msdosdjgpp
exit 0 ;;
pc:*:*:*) pc:*:*:*)
# Left here for compatibility: # Left here for compatibility:
# uname -m prints for DJGPP always 'pc', but it prints nothing about # uname -m prints for DJGPP always 'pc', but it prints nothing about
@ -945,9 +1040,15 @@ EOF
# "miniframe" # "miniframe"
echo m68010-convergent-sysv echo m68010-convergent-sysv
exit 0 ;; exit 0 ;;
mc68k:UNIX:SYSTEM5:3.51m)
echo m68k-convergent-sysv
exit 0 ;;
M680?0:D-NIX:5.3:*)
echo m68k-diab-dnix
exit 0 ;;
M68*:*:R3V[567]*:*) M68*:*:R3V[567]*:*)
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0)
OS_REL='' OS_REL=''
test -r /etc/.relid \ test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
@ -964,9 +1065,6 @@ EOF
mc68030:UNIX_System_V:4.*:*) mc68030:UNIX_System_V:4.*:*)
echo m68k-atari-sysv4 echo m68k-atari-sysv4
exit 0 ;; exit 0 ;;
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
TSUNAMI:LynxOS:2.*:*) TSUNAMI:LynxOS:2.*:*)
echo sparc-unknown-lynxos${UNAME_RELEASE} echo sparc-unknown-lynxos${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
@ -993,8 +1091,8 @@ EOF
echo ns32k-sni-sysv echo ns32k-sni-sysv
fi fi
exit 0 ;; exit 0 ;;
PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
# says <Richard.M.Bartel@ccMail.Census.GOV> # says <Richard.M.Bartel@ccMail.Census.GOV>
echo i586-unisys-sysv4 echo i586-unisys-sysv4
exit 0 ;; exit 0 ;;
*:UNIX_System_V:4*:FTX*) *:UNIX_System_V:4*:FTX*)
@ -1006,6 +1104,10 @@ EOF
# From seanf@swdc.stratus.com. # From seanf@swdc.stratus.com.
echo i860-stratus-sysv4 echo i860-stratus-sysv4
exit 0 ;; exit 0 ;;
*:VOS:*:*)
# From Paul.Green@stratus.com.
echo hppa1.1-stratus-vos
exit 0 ;;
mc68*:A/UX:*:*) mc68*:A/UX:*:*)
echo m68k-apple-aux${UNAME_RELEASE} echo m68k-apple-aux${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
@ -1034,6 +1136,9 @@ EOF
SX-5:SUPER-UX:*:*) SX-5:SUPER-UX:*:*)
echo sx5-nec-superux${UNAME_RELEASE} echo sx5-nec-superux${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
SX-6:SUPER-UX:*:*)
echo sx6-nec-superux${UNAME_RELEASE}
exit 0 ;;
Power*:Rhapsody:*:*) Power*:Rhapsody:*:*)
echo powerpc-apple-rhapsody${UNAME_RELEASE} echo powerpc-apple-rhapsody${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
@ -1044,15 +1149,17 @@ EOF
echo `uname -p`-apple-darwin${UNAME_RELEASE} echo `uname -p`-apple-darwin${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*) *:procnto*:*:* | *:QNX:[0123456789]*:*)
if test "${UNAME_MACHINE}" = "x86pc"; then UNAME_PROCESSOR=`uname -p`
if test "$UNAME_PROCESSOR" = "x86"; then
UNAME_PROCESSOR=i386
UNAME_MACHINE=pc UNAME_MACHINE=pc
fi fi
echo `uname -p`-${UNAME_MACHINE}-nto-qnx echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
*:QNX:*:4*) *:QNX:*:4*)
echo i386-pc-qnx echo i386-pc-qnx
exit 0 ;; exit 0 ;;
NSR-[KW]:NONSTOP_KERNEL:*:*) NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*)
echo nsr-tandem-nsk${UNAME_RELEASE} echo nsr-tandem-nsk${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
*:NonStop-UX:*:*) *:NonStop-UX:*:*)
@ -1075,11 +1182,6 @@ EOF
fi fi
echo ${UNAME_MACHINE}-unknown-plan9 echo ${UNAME_MACHINE}-unknown-plan9
exit 0 ;; exit 0 ;;
i*86:OS/2:*:*)
# If we were able to find `uname', then EMX Unix compatibility
# is probably installed.
echo ${UNAME_MACHINE}-pc-os2-emx
exit 0 ;;
*:TOPS-10:*:*) *:TOPS-10:*:*)
echo pdp10-unknown-tops10 echo pdp10-unknown-tops10
exit 0 ;; exit 0 ;;
@ -1103,6 +1205,7 @@ esac
#echo '(No uname command or uname output not recognized.)' 1>&2 #echo '(No uname command or uname output not recognized.)' 1>&2
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
eval $set_cc_for_build
cat >$dummy.c <<EOF cat >$dummy.c <<EOF
#ifdef _SEQUENT_ #ifdef _SEQUENT_
# include <sys/types.h> # include <sys/types.h>
@ -1217,9 +1320,8 @@ main ()
} }
EOF EOF
eval $set_cc_for_build $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy && rmdir $tmpdir
rm -f $dummy.c $dummy
# Apollos put the system type in the environment. # Apollos put the system type in the environment.

View File

@ -1,47 +1,87 @@
/* config.h.in. Generated automatically from configure.in by autoheader. */ /* config.h.in. Generated automatically from configure.in by autoheader. */
/***** begin user configuration section *****/
/* Define to `int' if <sys/types.h> doesn't define. */
/* #undef mode_t */
/* Define to `long' if <sys/types.h> doesn't define. */
/* #undef off_t */
/* Define to `int' if <sys/types.h> doesn't define. */
/* #undef pid_t */
/* Define to `unsigned' if <sys/types.h> doesn't define. */
/* #undef size_t */
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define if you have the memmove function. */
#undef HAVE_MEMMOVE
/* Define if you have the strdup function. */
#undef HAVE_STRDUP
/* Define if you have the strtol function. */
#undef HAVE_STRTOL
/* Define if you have the strerror function. */
#undef HAVE_STRERROR
/* Define if you have the <curses.h> header file. */
#undef HAVE_CURSES_H
/* Define if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define if you have the <ncurses.h> header file. */
#undef HAVE_NCURSES_H #undef HAVE_NCURSES_H
/* Define if you have the <unistd.h> header file. */ #undef HAVE_CURSES_H
#undef HAVE_UNISTD_H
/* Define if you have the ncurses library (-lncurses). */ #undef NO_SYSERRL
#undef HAVE_LIBNCURSES
/* Define if your tputs need putc(char) */
#undef NEED_PUTC_CHAR #undef NEED_PUTC_CHAR
#undef HAVE_NCURSES_TERM_H
/* Define if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define if you have the `memmove' function. */
#undef HAVE_MEMMOVE
/* Define if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define if you have the <ncurses/term.h> header file. */
#undef HAVE_NCURSES_TERM_H
/* Define if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define if you have the `strdup' function. */
#undef HAVE_STRDUP
/* Define if you have the `strerror' function. */
#undef HAVE_STRERROR
/* Define if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define if you have the `strtol' function. */
#undef HAVE_STRTOL
/* Define if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define if you have the <termcap.h> header file. */
#undef HAVE_TERMCAP_H
/* Define if you have the <termios.h> header file. */
#undef HAVE_TERMIOS_H
/* Define if you have the <termio.h> header file. */
#undef HAVE_TERMIO_H
/* Define if you have the <term.h> header file. */
#undef HAVE_TERM_H
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* The size of a `int', as computed by sizeof. */
#undef SIZEOF_INT
/* The size of a `long', as computed by sizeof. */
#undef SIZEOF_LONG
/* The size of a `void *', as computed by sizeof. */
#undef SIZEOF_VOID_P
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define to `int' if <sys/types.h> does not define. */
#undef off_t
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t

320
config.sub vendored Normal file → Executable file
View File

@ -1,9 +1,9 @@
#! /bin/sh #! /bin/sh
# Configuration validation subroutine script. # Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# Free Software Foundation, Inc. # 2000, 2001, 2002 Free Software Foundation, Inc.
timestamp='2001-06-08' timestamp='2002-11-30'
# This file is (in principle) common to ALL GNU software. # This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software # The presence of a machine in this file suggests that SOME GNU software
@ -29,7 +29,8 @@ timestamp='2001-06-08'
# configuration script generated by Autoconf, you may include it under # configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program. # the same distribution terms that you use for the rest of that program.
# Please send patches to <config-patches@gnu.org>. # Please send patches to <config-patches@gnu.org>. Submit a context
# diff and a properly formatted ChangeLog entry.
# #
# Configuration subroutine to validate and canonicalize a configuration type. # Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument. # Supply the specified configuration type as an argument.
@ -117,7 +118,7 @@ esac
# Here we must recognize all the valid KERNEL-OS combinations. # Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in case $maybe_os in
nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-*) nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;; ;;
@ -223,26 +224,46 @@ esac
case $basic_machine in case $basic_machine in
# Recognize the basic CPU types without company name. # Recognize the basic CPU types without company name.
# Some are omitted here because they have special meanings below. # Some are omitted here because they have special meanings below.
tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc \ 1750a | 580 \
| arm | arme[lb] | arm[bl]e | armv[2345] | armv[345][lb] | strongarm | xscale \ | a29k \
| pyramid | mn10200 | mn10300 | tron | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| 580 | i960 | h8300 \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| x86 | ppcbe | mipsbe | mipsle | shbe | shle \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
| hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \ | clipper \
| hppa64 \ | d10v | d30v | dlx | dsp16xx \
| alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \ | fr30 | frv \
| alphaev6[78] \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| we32k | ns16k | clipper | i370 | sh | sh[34] \ | i370 | i860 | i960 | ia64 \
| powerpc | powerpcle \ | ip2k \
| 1750a | dsp16xx | pdp10 | pdp11 \ | m32r | m68000 | m68k | m88k | mcore \
| mips16 | mips64 | mipsel | mips64el \ | mips | mipsbe | mipseb | mipsel | mipsle \
| mips64orion | mips64orionel | mipstx39 | mipstx39el \ | mips16 \
| mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \ | mips64 | mips64el \
| mips64vr5000 | mips64vr5000el | mcore | s390 | s390x \ | mips64vr | mips64vrel \
| sparc | sparclet | sparclite | sparc64 | sparcv9 | sparcv9b \ | mips64orion | mips64orionel \
| v850 | c4x \ | mips64vr4100 | mips64vr4100el \
| thumb | d10v | d30v | fr30 | avr | openrisc | tic80 \ | mips64vr4300 | mips64vr4300el \
| pj | pjl | h8500 | z8k) | mips64vr5000 | mips64vr5000el \
| mipsisa32 | mipsisa32el \
| mipsisa64 | mipsisa64el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
| ns16k | ns32k \
| openrisc | or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| pyramid \
| sh | sh[1234] | sh3e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
| strongarm \
| tahoe | thumb | tic80 | tron \
| v850 | v850e \
| we32k \
| x86 | xscale | xstormy16 | xtensa \
| z8k)
basic_machine=$basic_machine-unknown basic_machine=$basic_machine-unknown
;; ;;
m6811 | m68hc11 | m6812 | m68hc12) m6811 | m68hc11 | m6812 | m68hc12)
@ -265,31 +286,56 @@ case $basic_machine in
exit 1 exit 1
;; ;;
# Recognize the basic CPU types with company name. # Recognize the basic CPU types with company name.
# FIXME: clean up the formatting here. 580-* \
vax-* | tahoe-* | i*86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \ | a29k-* \
| m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | c[123]* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| arm-* | armbe-* | armle-* | armv*-* | strongarm-* | xscale-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
| mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
| power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| xmp-* | ymp-* \ | avr-* \
| x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* \ | bs2000-* \
| hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* \
| hppa2.0n-* | hppa64-* \ | clipper-* | cydra-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \ | d10v-* | d30v-* | dlx-* \
| alphaev6[78]-* \ | elxsi-* \
| we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
| clipper-* | orion-* \ | h8300-* | h8500-* \
| sparclite-* | pdp10-* | pdp11-* | sh-* | sh[34]-* | sh[34]eb-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| powerpc-* | powerpcle-* | sparc64-* | sparcv9-* | sparcv9b-* | sparc86x-* \ | i*86-* | i860-* | i960-* | ia64-* \
| mips16-* | mips64-* | mipsel-* \ | ip2k-* \
| mips64el-* | mips64orion-* | mips64orionel-* \ | m32r-* \
| mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| mipstx39-* | mipstx39el-* | mcore-* \ | m88110-* | m88k-* | mcore-* \
| f30[01]-* | f700-* | s390-* | s390x-* | sv1-* | t3e-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| [cjt]90-* \ | mips16-* \
| m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \ | mips64-* | mips64el-* \
| thumb-* | v850-* | d30v-* | tic30-* | tic80-* | c30-* | fr30-* \ | mips64vr-* | mips64vrel-* \
| bs2000-* | tic54x-* | c54x-* | x86_64-* | pj-* | pjl-*) | mips64orion-* | mips64orionel-* \
| mips64vr4100-* | mips64vr4100el-* \
| mips64vr4300-* | mips64vr4300el-* \
| mips64vr5000-* | mips64vr5000el-* \
| mipsisa32-* | mipsisa32el-* \
| mipsisa64-* | mipsisa64el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipstx39 | mipstx39el \
| none-* | np1-* | ns16k-* | ns32k-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
| pyramid-* \
| romp-* | rs6000-* \
| sh-* | sh[1234]-* | sh3e-* | sh[34]eb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
| tahoe-* | thumb-* | tic30-* | tic4x-* | tic54x-* | tic80-* | tron-* \
| v850-* | v850e-* | vax-* \
| we32k-* \
| x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
| xtensa-* \
| ymp-* \
| z8k-*)
;; ;;
# Recognize the various machine names and aliases which stand # Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS. # for a CPU type and a company and sometimes even an OS.
@ -352,6 +398,10 @@ case $basic_machine in
basic_machine=ns32k-sequent basic_machine=ns32k-sequent
os=-dynix os=-dynix
;; ;;
c90)
basic_machine=c90-cray
os=-unicos
;;
convex-c1) convex-c1)
basic_machine=c1-convex basic_machine=c1-convex
os=-bsd os=-bsd
@ -372,16 +422,8 @@ case $basic_machine in
basic_machine=c38-convex basic_machine=c38-convex
os=-bsd os=-bsd
;; ;;
cray | ymp) cray | j90)
basic_machine=ymp-cray basic_machine=j90-cray
os=-unicos
;;
cray2)
basic_machine=cray2-cray
os=-unicos
;;
[cjt]90)
basic_machine=${basic_machine}-cray
os=-unicos os=-unicos
;; ;;
crds | unos) crds | unos)
@ -396,6 +438,14 @@ case $basic_machine in
decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
basic_machine=mips-dec basic_machine=mips-dec
;; ;;
decsystem10* | dec10*)
basic_machine=pdp10-dec
os=-tops10
;;
decsystem20* | dec20*)
basic_machine=pdp10-dec
os=-tops20
;;
delta | 3300 | motorola-3300 | motorola-delta \ delta | 3300 | motorola-3300 | motorola-delta \
| 3300-motorola | delta-motorola) | 3300-motorola | delta-motorola)
basic_machine=m68k-motorola basic_machine=m68k-motorola
@ -576,14 +626,6 @@ case $basic_machine in
basic_machine=m68k-atari basic_machine=m68k-atari
os=-mint os=-mint
;; ;;
mipsel*-linux*)
basic_machine=mipsel-unknown
os=-linux-gnu
;;
mips*-linux*)
basic_machine=mips-unknown
os=-linux-gnu
;;
mips3*-*) mips3*-*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
;; ;;
@ -598,6 +640,10 @@ case $basic_machine in
basic_machine=m68k-rom68k basic_machine=m68k-rom68k
os=-coff os=-coff
;; ;;
morphos)
basic_machine=powerpc-unknown
os=-morphos
;;
msdos) msdos)
basic_machine=i386-pc basic_machine=i386-pc
os=-msdos os=-msdos
@ -677,6 +723,10 @@ case $basic_machine in
basic_machine=hppa1.1-oki basic_machine=hppa1.1-oki
os=-proelf os=-proelf
;; ;;
or32 | or32-*)
basic_machine=or32-unknown
os=-coff
;;
OSE68000 | ose68000) OSE68000 | ose68000)
basic_machine=m68000-ericsson basic_machine=m68000-ericsson
os=-ose os=-ose
@ -699,19 +749,19 @@ case $basic_machine in
pbb) pbb)
basic_machine=m68k-tti basic_machine=m68k-tti
;; ;;
pc532 | pc532-*) pc532 | pc532-*)
basic_machine=ns32k-pc532 basic_machine=ns32k-pc532
;; ;;
pentium | p5 | k5 | k6 | nexgen) pentium | p5 | k5 | k6 | nexgen | viac3)
basic_machine=i586-pc basic_machine=i586-pc
;; ;;
pentiumpro | p6 | 6x86 | athlon) pentiumpro | p6 | 6x86 | athlon | athlon_*)
basic_machine=i686-pc basic_machine=i686-pc
;; ;;
pentiumii | pentium2) pentiumii | pentium2)
basic_machine=i686-pc basic_machine=i686-pc
;; ;;
pentium-* | p5-* | k5-* | k6-* | nexgen-*) pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
;; ;;
pentiumpro-* | p6-* | 6x86-* | athlon-*) pentiumpro-* | p6-* | 6x86-* | athlon-*)
@ -726,15 +776,25 @@ case $basic_machine in
power) basic_machine=power-ibm power) basic_machine=power-ibm
;; ;;
ppc) basic_machine=powerpc-unknown ppc) basic_machine=powerpc-unknown
;; ;;
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
;; ;;
ppcle | powerpclittle | ppc-le | powerpc-little) ppcle | powerpclittle | ppc-le | powerpc-little)
basic_machine=powerpcle-unknown basic_machine=powerpcle-unknown
;; ;;
ppcle-* | powerpclittle-*) ppcle-* | powerpclittle-*)
basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
;; ;;
ppc64) basic_machine=powerpc64-unknown
;;
ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppc64le | powerpc64little | ppc64-le | powerpc64-little)
basic_machine=powerpc64le-unknown
;;
ppc64le-* | powerpc64little-*)
basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ps2) ps2)
basic_machine=i386-ibm basic_machine=i386-ibm
;; ;;
@ -752,10 +812,22 @@ case $basic_machine in
rtpc | rtpc-*) rtpc | rtpc-*)
basic_machine=romp-ibm basic_machine=romp-ibm
;; ;;
s390 | s390-*)
basic_machine=s390-ibm
;;
s390x | s390x-*)
basic_machine=s390x-ibm
;;
sa29200) sa29200)
basic_machine=a29k-amd basic_machine=a29k-amd
os=-udi os=-udi
;; ;;
sb1)
basic_machine=mipsisa64sb1-unknown
;;
sb1el)
basic_machine=mipsisa64sb1el-unknown
;;
sequent) sequent)
basic_machine=i386-sequent basic_machine=i386-sequent
;; ;;
@ -763,7 +835,7 @@ case $basic_machine in
basic_machine=sh-hitachi basic_machine=sh-hitachi
os=-hms os=-hms
;; ;;
sparclite-wrs) sparclite-wrs | simso-wrs)
basic_machine=sparclite-wrs basic_machine=sparclite-wrs
os=-vxworks os=-vxworks
;; ;;
@ -829,10 +901,22 @@ case $basic_machine in
basic_machine=i386-sequent basic_machine=i386-sequent
os=-dynix os=-dynix
;; ;;
t3e) t3d)
basic_machine=t3e-cray basic_machine=alpha-cray
os=-unicos os=-unicos
;; ;;
t3e)
basic_machine=alphaev5-cray
os=-unicos
;;
t90)
basic_machine=t90-cray
os=-unicos
;;
tic4x | c4x*)
basic_machine=tic4x-unknown
os=-coff
;;
tic54x | c54x*) tic54x | c54x*)
basic_machine=tic54x-unknown basic_machine=tic54x-unknown
os=-coff os=-coff
@ -843,6 +927,10 @@ case $basic_machine in
tx39el) tx39el)
basic_machine=mipstx39el-unknown basic_machine=mipstx39el-unknown
;; ;;
toad1)
basic_machine=pdp10-xkl
os=-tops20
;;
tower | tower-32) tower | tower-32)
basic_machine=m68k-ncr basic_machine=m68k-ncr
;; ;;
@ -867,8 +955,8 @@ case $basic_machine in
os=-vms os=-vms
;; ;;
vpp*|vx|vx-*) vpp*|vx|vx-*)
basic_machine=f301-fujitsu basic_machine=f301-fujitsu
;; ;;
vxworks960) vxworks960)
basic_machine=i960-wrs basic_machine=i960-wrs
os=-vxworks os=-vxworks
@ -889,17 +977,13 @@ case $basic_machine in
basic_machine=hppa1.1-winbond basic_machine=hppa1.1-winbond
os=-proelf os=-proelf
;; ;;
windows32) xps | xps100)
basic_machine=i386-pc
os=-windows32-msvcrt
;;
xmp)
basic_machine=xmp-cray
os=-unicos
;;
xps | xps100)
basic_machine=xps100-honeywell basic_machine=xps100-honeywell
;; ;;
ymp)
basic_machine=ymp-cray
os=-unicos
;;
z8k-*-coff) z8k-*-coff)
basic_machine=z8k-unknown basic_machine=z8k-unknown
os=-sim os=-sim
@ -920,13 +1004,6 @@ case $basic_machine in
op60c) op60c)
basic_machine=hppa1.1-oki basic_machine=hppa1.1-oki
;; ;;
mips)
if [ x$os = x-linux-gnu ]; then
basic_machine=mips-unknown
else
basic_machine=mips-mips
fi
;;
romp) romp)
basic_machine=romp-ibm basic_machine=romp-ibm
;; ;;
@ -946,13 +1023,16 @@ case $basic_machine in
we32k) we32k)
basic_machine=we32k-att basic_machine=we32k-att
;; ;;
sh3 | sh4) sh3 | sh4 | sh3eb | sh4eb | sh[1234]le | sh3ele)
basic_machine=sh-unknown basic_machine=sh-unknown
;; ;;
sh64)
basic_machine=sh64-unknown
;;
sparc | sparcv9 | sparcv9b) sparc | sparcv9 | sparcv9b)
basic_machine=sparc-sun basic_machine=sparc-sun
;; ;;
cydra) cydra)
basic_machine=cydra-cydrome basic_machine=cydra-cydrome
;; ;;
orion) orion)
@ -967,10 +1047,6 @@ case $basic_machine in
pmac | pmac-mpw) pmac | pmac-mpw)
basic_machine=powerpc-apple basic_machine=powerpc-apple
;; ;;
c4x*)
basic_machine=c4x-none
os=-coff
;;
*-unknown) *-unknown)
# Make sure to match an already-canonicalized machine name. # Make sure to match an already-canonicalized machine name.
;; ;;
@ -1033,9 +1109,12 @@ case $os in
| -chorusos* | -chorusrdb* \ | -chorusos* | -chorusrdb* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* | -os2*) | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix*)
# Remember, each alternative MUST END IN *, to match a version number. # Remember, each alternative MUST END IN *, to match a version number.
;; ;;
-qnx*) -qnx*)
@ -1047,8 +1126,10 @@ case $os in
;; ;;
esac esac
;; ;;
-nto-qnx*)
;;
-nto*) -nto*)
os=-nto-qnx os=`echo $os | sed -e 's|nto|nto-qnx|'`
;; ;;
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
| -windows* | -osx | -abug | -netware* | -os9* | -beos* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
@ -1087,14 +1168,20 @@ case $os in
-acis*) -acis*)
os=-aos os=-aos
;; ;;
-atheos*)
os=-atheos
;;
-386bsd) -386bsd)
os=-bsd os=-bsd
;; ;;
-ctix* | -uts*) -ctix* | -uts*)
os=-sysv os=-sysv
;; ;;
-nova*)
os=-rtmk-nova
;;
-ns2 ) -ns2 )
os=-nextstep2 os=-nextstep2
;; ;;
-nsk*) -nsk*)
os=-nsk os=-nsk
@ -1133,8 +1220,8 @@ case $os in
-xenix) -xenix)
os=-xenix os=-xenix
;; ;;
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
os=-mint os=-mint
;; ;;
-none) -none)
;; ;;
@ -1167,10 +1254,11 @@ case $basic_machine in
arm*-semi) arm*-semi)
os=-aout os=-aout
;; ;;
# This must come before the *-dec entry.
pdp10-*) pdp10-*)
os=-tops20 os=-tops20
;; ;;
pdp11-*) pdp11-*)
os=-none os=-none
;; ;;
*-dec | vax-*) *-dec | vax-*)
@ -1197,6 +1285,9 @@ case $basic_machine in
mips*-*) mips*-*)
os=-elf os=-elf
;; ;;
or32-*)
os=-coff
;;
*-tti) # must be before sparc entry or we get the wrong os. *-tti) # must be before sparc entry or we get the wrong os.
os=-sysv3 os=-sysv3
;; ;;
@ -1260,19 +1351,19 @@ case $basic_machine in
*-next) *-next)
os=-nextstep3 os=-nextstep3
;; ;;
*-gould) *-gould)
os=-sysv os=-sysv
;; ;;
*-highlevel) *-highlevel)
os=-bsd os=-bsd
;; ;;
*-encore) *-encore)
os=-bsd os=-bsd
;; ;;
*-sgi) *-sgi)
os=-irix os=-irix
;; ;;
*-siemens) *-siemens)
os=-sysv4 os=-sysv4
;; ;;
*-masscomp) *-masscomp)
@ -1344,7 +1435,7 @@ case $basic_machine in
-ptx*) -ptx*)
vendor=sequent vendor=sequent
;; ;;
-vxsim* | -vxworks*) -vxsim* | -vxworks* | -windiss*)
vendor=wrs vendor=wrs
;; ;;
-aux*) -aux*)
@ -1359,6 +1450,9 @@ case $basic_machine in
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
vendor=atari vendor=atari
;; ;;
-vos*)
vendor=stratus
;;
esac esac
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
;; ;;

2
configure vendored
View File

@ -3171,7 +3171,7 @@ EOF
fi fi
for ac_header in fcntl.h termcap.h termio.h termios.h unistd.h for ac_header in fcntl.h termcap.h termio.h termios.h unistd.h term.h ncurses/term.h
do do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
echo "$as_me:3177: checking for $ac_header" >&5 echo "$as_me:3177: checking for $ac_header" >&5

View File

@ -44,7 +44,7 @@ AC_CHECK_TYPE(off_t, int)
dnl Checks for header files. dnl Checks for header files.
AC_HEADER_STDC AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h termcap.h termio.h termios.h unistd.h) AC_CHECK_HEADERS(fcntl.h termcap.h termio.h termios.h unistd.h term.h ncurses/term.h)
dnl Check if ncurses requested dnl Check if ncurses requested
_cppflags="${CPPFLAGS}" _cppflags="${CPPFLAGS}"

View File

@ -8,8 +8,8 @@
* *
* NOTE: Edit this file with tabstop=4 ! * NOTE: Edit this file with tabstop=4 !
* *
* Copyright 1996-1969 by Gerhard Buergmann * Copyright 1996-2002 by Gerhard Buergmann
* Gerhard.Buergmann@altavista.net * Gerhard.Buergmann@puon.at
* *
* This program is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the

View File

@ -1,7 +1,7 @@
/* DOSCUR.H - CURSES.H for TURBO C /* DOSCUR.H - CURSES.H for TURBO C
* *
* Copyright 1996 by Gerhard Buergmann * Copyright 1996-2002 by Gerhard Buergmann
* Gerhard.Buergmann@altavista.net * Gerhard.Buergmann@puon.at
* *
* 1996-02-28 V 1.0.0 * 1996-02-28 V 1.0.0
* 1998-04-12 V 1.0.1 * 1998-04-12 V 1.0.1
@ -146,4 +146,3 @@ void attrset(int);
#define ERR (-1) #define ERR (-1)


View File

@ -10,8 +10,8 @@
* *
* NOTE: Edit this file with tabstop=4 ! * NOTE: Edit this file with tabstop=4 !
* *
* Copyright 1996-2000 by Gerhard Buergmann * Copyright 1996-2002 by Gerhard Buergmann
* Gerhard.Buergmann@altavista.net * Gerhard.Buergmann@puon.at
* *
* This program is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the

7
edit.c
View File

@ -8,9 +8,10 @@
* 2000-05-14 V 1.3.0 alpha * 2000-05-14 V 1.3.0 alpha
* 2000-07-15 V 1.3.0 final * 2000-07-15 V 1.3.0 final
* 2001-12-07 V 1.3.1 * 2001-12-07 V 1.3.1
* 2003-07-04 V 1.3.2
* *
* Copyright 1996-2001 by Gerhard Buergmann * Copyright 1996-2003 by Gerhard Buergmann
* Gerhard.Buergmann@altavista.net * gerhard@puon.at
* *
* This program is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the
@ -861,7 +862,7 @@ do_ins_chg(start, arg, mode)
break; break;
} }
mfree: mfree:
#ifdef __MSDOS__ #if defined(__MSDOS__) && !defined(DJGPP)
farfree(tempbuf); farfree(tempbuf);
#else #else
free(tempbuf); free(tempbuf);

View File

@ -62,15 +62,17 @@ continuity. If bmore is reading from a file rather than a pipe,
the percentage of characters displayed so far is also shown. the percentage of characters displayed so far is also shown.
<p> <p>
<strong>bmore</strong> scrolls up to display one more screen line in <strong>bmore</strong> scrolls up to display one more screen line in
response to a RETURN character; it displays another response to a <font color="#aaaaaa"><b>RETURN</b></font> character; it displays another
screenful in response to a SPACE character. Other commands are listed below. screenful in response to a <font color="#aaaaaa"><b>SPACE</b></font> character. Other commands are listed below.
<P> <P>
The screen is divided in three sections or panes: The byte The screen is divided in three sections or panes: The byte
offset (extreme left), the hex pane (middle), and an ascii offset (extreme left), the hex pane (middle), and an ascii
pane (right) which shows as printable characters those pane (right) which shows as printable characters those
bytes in the hex pane. On an 80 column terminal there bytes in the hex pane. On an 80 column terminal there
will be sixteen hex values and their ASCII values on each will be sixteen hex values and their ASCII values on each
screen line. Note that (as one would expect) the first screen line (can be changed with the <b>-n</b> option).
<p>
Note that (as one would expect) the first
byte has the offset 0 (zero). byte has the offset 0 (zero).
<P> <P>
<center> <center>
@ -145,12 +147,13 @@ byte has the offset 0 (zero).
Equal lines will only displayed once, a star (*) is the placeholder Equal lines will only displayed once, a star (*) is the placeholder
for one or more lines equal to the line above. for one or more lines equal to the line above.
</p> </p>
<p><font size="-1"> <p><small>
<a class="btop" href="#top"> <a class="btop" href="#top">
<img border="0" width="16" height="7" src="gif/up.gif" <img border="0" width="16" height="7" src="gif/up.gif"
alt="Back to the top">Back to the top</a> alt="Back to the top">Back to the top</a>
</font> </small>
<hr noshade> <hr noshade>
<i>Last update: Fri Oct 13 22:30:06 CEST 2000 by Gerhard B&uuml;rgmann</i> <i>Last update: October 13<sup>th</sup> 2000 by Gerhard B&uuml;rgmann,
<a class="btop" href="http://www.purkersdorf-online.at/">Purkersdorf</a>/Austria</i>
</td></tr></table> </td></tr></table>
</body></html> </body></html>

View File

@ -57,11 +57,19 @@ height="62" border="0"></a>
<p> <p>
<table> <table>
<tr><th valign="top">-a</th><td>ASCII mode</td></tr> <tr><th valign="top">-a</th><td>ASCII mode</td></tr>
<tr><th valign="top">-c</th><td>Clear before displaying. Redrawing the screen
instead of scrolling. Can be useful, if you change the number of
displayed lines.</td></tr>
<tr><th valign="top">-d</th><td>Display error messages rather than ringing the <tr><th valign="top">-d</th><td>Display error messages rather than ringing the
terminal bell if an unrecognized command is used. terminal bell if an unrecognized command is used.
This is helpful for inexperienced users. This is helpful for inexperienced users.
</td></tr> </td></tr>
<tr><th valign="top">-i</th><td>Ignore case for searching.</td></tr> <tr><th valign="top">-i</th><td>Ignore case for searching.</td></tr>
<tr><th valign="top"><nobreak>-n <i>lines</i></nobreak></th>
<td>Displays the indicated number of <i>lines</i> in each screenful,
rather than the default (the number of lines in the terminal screen less two).</td></tr>
<tr><th valign="top">-w <i>cols</i></th><td>
Display number of <i>cols</i> (bytes of data) in each line.</td></tr>
<tr><th valign="top">+<I>linenumber</i></th> <tr><th valign="top">+<I>linenumber</i></th>
<td>Start up at <I>linenumber</i></td></tr> <td>Start up at <I>linenumber</i></td></tr>
<tr><th valign="top">+/<font color="#FF0000">ASCII-pattern</font></th> <tr><th valign="top">+/<font color="#FF0000">ASCII-pattern</font></th>
@ -122,12 +130,13 @@ With the <tt><b>-a</b></tt> option the display looks like this:
</td></tr></table> </td></tr></table>
</center> </center>
<p> &nbsp;</p> <p> &nbsp;</p>
<p><font size="-1"> <p><small>
<a class="btop" href="#top"> <a class="btop" href="#top">
<img border="0" width="16" height="7" src="gif/up.gif" <img border="0" width="16" height="7" src="gif/up.gif"
alt="Back to the top">Back to the top</a> alt="Back to the top">Back to the top</a>
</font> </small>
<hr noshade> <hr noshade>
<i>Last update: Fri Oct 13 21:38:17 CEST 2000 by Gerhard B&uuml;rgmann</i> <i>Last update: January 4<sup>th</sup> 2004 by Gerhard B&uuml;rgmann,
<a class="btop" href="http://www.purkersdorf-online.at/">Purkersdorf</a>/Austria</i>
</td></tr></table> </td></tr></table>
</body></html> </body></html>

View File

@ -202,7 +202,8 @@ Usually not available in vi but in ex (without the <I>m</I> - modifier).
ALT="Back to the top">Back to the top</A> ALT="Back to the top">Back to the top</A>
</FONT> </FONT>
<HR NOSHADE> <HR NOSHADE>
<I>Last update: October 30<SUP>th</SUP> 1999 by Gerhard B&uuml;rgmann</I> <I>Last update: October 30<SUP>th</SUP> 1999 by Gerhard B&uuml;rgmann,
<a class="btop" href="http://www.purkersdorf-online.at/">Purkersdorf</a>/Austria</I>
</BODY></HTML> </BODY></HTML>

View File

@ -110,7 +110,8 @@
ALT="Back to the top">Back to the top</A> ALT="Back to the top">Back to the top</A>
</FONT> </FONT>
<HR NOSHADE> <HR NOSHADE>
<I>Last update: October 30<SUP>th</SUP> 1999 by Gerhard B&uuml;rgmann</I> <I>Last update: October 30<SUP>th</SUP> 1999 by Gerhard B&uuml;rgmann,
<a class="btop" href="http://www.purkersdorf-online.at/">Purkersdorf</a>/Austria</I>
</BODY></HTML> </BODY></HTML>

View File

@ -18,6 +18,7 @@
</p> </p>
<p> <p>
<font color="#ffffff" class="thl">Download<br></font> <font color="#ffffff" class="thl">Download<br></font>
<a class="ths" href="new132.html">New in 1.3.2</a><br>
<a class="ths" href="new131.html">New in 1.3.1</a><br> <a class="ths" href="new131.html">New in 1.3.1</a><br>
<a class="ths" href="new130.html">New in 1.3.0</a><br> <a class="ths" href="new130.html">New in 1.3.0</a><br>
<a class="ths" href="new120.html">New in 1.2.0</a><br> <a class="ths" href="new120.html">New in 1.2.0</a><br>
@ -57,31 +58,41 @@ height="62" border="0"></a>
NOTE: All packages are compressed with the GNU gzip program. You NOTE: All packages are compressed with the GNU gzip program. You
can download it from <a href="ftp://ftp.gnu.org/gnu/gzip/">ftp://ftp.gnu.org/gnu/gzip/</a>. can download it from <a href="ftp://ftp.gnu.org/gnu/gzip/">ftp://ftp.gnu.org/gnu/gzip/</a>.
<p> <p>
Current stable release of bvi is <b>1.3.1</b> Current stable release of bvi is <b>1.3.2</b>
(Check out what's <a href="new131.html">new</a>): (Check out what's <a href="new132.html">new</a>):
<p> <p>
<h3>Sources</h3> <h3>Sources</h3>
<ul> <ul>
<li><a href="http://download.sourceforge.net/bvi/bvi-1.3.1.src.tar.gz">bvi-1.3.1.src.tar.gz</a> <li><a href="http://prdownloads.sourceforge.net/bvi/bvi-1.3.2.src.tar.gz">bvi-1.3.2.src.tar.gz</a>
&nbsp; (168k)</li> &nbsp; (168k)</li>
<li><a href="http://download.sourceforge.net/bvi/bvi-1.3.0.src.tar.gz">bvi-1.3.0.src.tar.gz</a> <li><a href="http://prdownloads.sourceforge.net/bvi/bvi-1.3.1.src.tar.gz">bvi-1.3.1.src.tar.gz</a>
&nbsp; (165k)</li>
<li><a href="http://prdownloads.sourceforge.net/bvi/bvi-1.3.0.src.tar.gz">bvi-1.3.0.src.tar.gz</a>
&nbsp; (144k)</li> &nbsp; (144k)</li>
</ul> </ul>
<h3>Packages</h3>
<ul>
<li><a href="http://packages.debian.org/stable/editors/bvi.html">Debian</a>
<h3>Executables</h3> <h3>Executables</h3>
<ul> <ul>
<li>Linux: &nbsp; <a href="http://download.sourceforge.net/bvi/bvi-1.3.1-linux_static_elf.tar.gz">bvi-1.3.1-linux_static_elf.tar.gz</a> <li>Linux: &nbsp; <a href="http://prdownloads.sourceforge.net/bvi/bvi-1.3.1-linux_static_elf.tar.gz">bvi-1.3.1-linux_static_elf.tar.gz</a>
&nbsp; (338k)</li> &nbsp; (354k)</li>
<li>Linux: &nbsp; <a href="http://download.sourceforge.net/bvi/bvi-1.3.0-linux_static_elf.tar.gz">bvi-1.3.0-linux_static_elf.tar.gz</a> <li>Solaris: &nbsp; <a href="http://prdownloads.sourceforge.net/bvi/bvi-1.3.1-solaris.tar.gz">bvi-1.3.1-solaris.tar.gz</a>
&nbsp; (107k)</li>
<li>SunOS 4.1.3: &nbsp; <a href="http://prdownloads.sourceforge.net/bvi/bvi-1.3.1-sun4.tar.gz">bvi-1.3.1-sun4.tar.gz</a>
&nbsp; (110k)</li>
<li>Linux: &nbsp; <a href="http://prdownloads.sourceforge.net/bvi/bvi-1.3.0-linux_static_elf.tar.gz">bvi-1.3.0-linux_static_elf.tar.gz</a>
&nbsp; (338k)</li> &nbsp; (338k)</li>
</ul> </ul>
<p><font size="-1"> <p><small>
<a class="btop" href="#top"> <a class="btop" href="#top">
<img border="0" width="16" height="7" src="gif/up.gif" <img border="0" width="16" height="7" src="gif/up.gif"
alt="Back to the top">Back to the top</a> alt="Back to the top">Back to the top</a>
</font> </small>
<hr noshade> <hr noshade>
<i>Last update: February 12<sup>th</sup> 2002 by Gerhard B&uuml;rgmann</i> <i>Last update: January 18<sup>th</sup> 2004 by Gerhard B&uuml;rgmann,
<a class="btop" href="http://www.purkersdorf-online.at/">Purkersdorf</a>/Austria</i>
</td></tr></table> </td></tr></table>
</body></html> </body></html>

View File

@ -188,7 +188,8 @@ of the command!
ALT="Back to the top">Back to the top</A> ALT="Back to the top">Back to the top</A>
</FONT> </FONT>
<HR NOSHADE> <HR NOSHADE>
<I>Last update: September 30<SUP>th</SUP> 1999 by Gerhard B&uuml;rgmann</I> <I>Last update: September 30<SUP>th</SUP> 1999 by Gerhard B&uuml;rgmann,
<a class="btop" href="http://www.purkersdorf-online.at/">Purkersdorf</a>/Austria</I>
</BODY></HTML> </BODY></HTML>

View File

@ -198,10 +198,10 @@ Schreibweise angegeben werden. Auch bei Eingabe von genau acht 0 und 1
Werten wird der Byte - Wert bin&auml;r interpretiert.<BR> Werten wird der Byte - Wert bin&auml;r interpretiert.<BR>
Beispiel:<BR> Beispiel:<BR>
<BLOCKQUOTE CLASS="examp"> <BLOCKQUOTE CLASS="examp">
<B><TT>:100,500and 01A </TT><FONT COLOR=#AAAAAA>RETURN</FONT></B><BR> <B><TT>:100,500and 01A </TT><FONT COLOR="#AAAAAA">RETURN</FONT></B><BR>
<B><TT>:03FA,01000or 00001000 </TT><FONT COLOR=#AAAAAA>RETURN</FONT></B><BR> <B><TT>:03FA,01000or 00001000 </TT><FONT COLOR="#AAAAAA">RETURN</FONT></B><BR>
<B><TT>:.rr 3 </TT><FONT COLOR=#AAAAAA>RETURN</FONT></B><BR> <B><TT>:.rr 3 </TT><FONT COLOR="#AAAAAA">RETURN</FONT></B><BR>
<B><TT>:'a,$sl 1 </TT><FONT COLOR=#AAAAAA>RETURN</FONT></B><BR> <B><TT>:'a,$sl 1 </TT><FONT COLOR="#AAAAAA">RETURN</FONT></B><BR>
</BLOCKQUOTE> </BLOCKQUOTE>
<p><font size="-1"> <p><font size="-1">
<a class="btop" href="#top"> <a class="btop" href="#top">
@ -209,6 +209,7 @@ Beispiel:<BR>
alt="Back to the top">Back to the top</a> alt="Back to the top">Back to the top</a>
</font> </font>
<hr noshade> <hr noshade>
<i>Last update: Thu Jun 01 12:00:00 CEST 2000 by Gerhard B&uuml;rgmann</i> <i>Last update: June 1<sup>st</sup> 2000 by Gerhard B&uuml;rgmann,
<a class="btop" href="http://www.purkersdorf-online.at/">Purkersdorf</a>/Austria</i>
</td></tr></table> </td></tr></table>
</body></html> </body></html>

View File

@ -1,10 +1,6 @@
<!DOCTYPE html PUBLIC "-//W3C/DTD HTML 3.2 Final//EN"> <!DOCTYPE html PUBLIC "-//W3C/DTD HTML 3.2 Final//EN">
<html><head> <html><head>
<title>BVI - Binary VIsual editor</title> <title>BVI - Binary VIsual editor</title>
<script language="JavaScript">
<!--
if(top.frames.length!=0){top.location=location;}// -->
</script>
<link rel=stylesheet type="text/css" href="bvi.css"> <link rel=stylesheet type="text/css" href="bvi.css">
<meta name="description" content="Bvi stands for Binary VIsual editor. <meta name="description" content="Bvi stands for Binary VIsual editor.
Bvi is a display oriented editor for binary files. Bvi is a display oriented editor for binary files.
@ -14,7 +10,11 @@ hexadecimal, linux, octal, patch, more, unix, solaris, sunos, visual, vi">
<meta name="robots" content="INDEX,FOLLOW"> <meta name="robots" content="INDEX,FOLLOW">
<meta name="author" content="Gerhard Buergmann"> <meta name="author" content="Gerhard Buergmann">
<meta name="publisher" content="Gerhard Buergmann"> <meta name="publisher" content="Gerhard Buergmann">
</head><body bgcolor="#ffffff" background="gif/bg2.gif"> <script language="JavaScript">
<!--
if(top.frames.length!=0){top.location=location;}// -->
</script>
</head><body background="gif/bg2.gif">
<a name="top"></a> <a name="top"></a>
<table width="100%" border="0" cellspacing="0" cellpadding="0"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><th width="1%" valign="top"><img src="gif/dot.gif" width="130" height="1" alt=""> <tr><th width="1%" valign="top"><img src="gif/dot.gif" width="130" height="1" alt="">
@ -49,13 +49,17 @@ Deutsche<br>Beschreibung
Sitemap Sitemap
</a></p> </a></p>
<p><a class="thl" href="http://sourceforge.net/projects/bvi/">
Project Page
</a></p>
<hr noshade width="60%"> <hr noshade width="60%">
<p><a class="thl" href="http://www.math.fu-berlin.de/~guckes/vi/"> <p><a class="thl" href="http://www.guckes.net/vi/clones.php3">
VI and Clones VI and Clones
</a></p> </a></p>
<p><a class="thl" href="http://spin.ch/~tpo/linux/hexeds.html"> <p><a class="thl" href="http://sourcepole.com/sources/reviews/hexeds.xml">
Hex-Editors Hex-Editors
</a></p> </a></p>
@ -66,7 +70,7 @@ Hex-Editors
<img src="http://sourceforge.net/sflogo.php?group_id=16427&type=1" width="88" height="31" border="0" alt="SourceForge Logo"></a> <img src="http://sourceforge.net/sflogo.php?group_id=16427&type=1" width="88" height="31" border="0" alt="SourceForge Logo"></a>
</p> </p>
</TH> </th>
<td width=1%><img src="gif/dot.gif" width="40" height="1" alt=""></td> <td width=1%><img src="gif/dot.gif" width="40" height="1" alt=""></td>
<td width=99%> <td width=99%>
<center> <center>
@ -84,16 +88,17 @@ If you never heard about <strong>vi</strong>, maybe <strong>bvi</strong> is not
choice for you. choice for you.
<p> <p>
<h3>Original site: <a href="http://bvi.sourceforge.net/">http://bvi.sourceforge.net</a></h3> <h1 align="center">Current: Version 1.3.2</h1>
You can download source and compiled versions from the You can download source and compiled versions from the
<a href="download.html">download page</a>.<br> <a href="download.html">download page</a>.<br>
Check out whats <a href="new131.html">new in 1.3.1</a>! Check out whats <a href="new132.html">new in 1.3.2</a>!
<p> <p>
<b>Newsgroup:</b> <a href="news:comp.editors">comp.editors</a> <b>Newsgroup:</b> <a href="news:comp.editors">comp.editors</a>
<p> <p>
<b>Mailing List:</b> <b>Mailing List</b> (very low traffic):
<blockquote> <blockquote>
To join this list, simply send a blank email to To join this list, simply send a blank email to
<a href="mailto:bvi-subscribe@yahoogroups.com">bvi-subscribe@yahoogroups.com</a>. <a href="mailto:bvi-subscribe@yahoogroups.com">bvi-subscribe@yahoogroups.com</a>.
@ -102,23 +107,23 @@ Simply reply this message and your subscription will be complete.
</blockquote> </blockquote>
<strong>Bvi</strong> was developed by Gerhard B&uuml;rgmann and is published <strong>Bvi</strong> was developed by Gerhard B&uuml;rgmann and is published
under the GNU Public License. Current stable version is 1.3.1. under the GNU Public License. Current stable version is 1.3.2.
<strong>Bvi</strong> is running on most UNIX - like operating systems and <strong>Bvi</strong> is running on most UNIX - like operating systems and
on MSDOS. on MSDOS.
<p> <p>
If you want to contact me:<br> If you want to contact me:<br>
Gerhard B&uuml;rgmann, Vienna ( <a href="http://www.purkersdorf-online.at/">Purkersdorf</a> ) / Austria / Europe<br> Gerhard B&uuml;rgmann, Vienna ( <a href="http://www.purkersdorf-online.at/">Purkersdorf</a> ) / Austria / Europe<br>
E-mail: <a href="mailto:gerhard.buergmann@altavista.net"> E-mail: <a href="mailto:gerhard@puon.at"> gerhard@puon.at</a><br>
Gerhard.Buergmann@altavista.net</a> Have a look at <a href="http://www.meta-chrom.com/">Meta Chrom Kennzeichenhalter</a>
<p> <p>
<font size="-1"> <small>
<a class="btop" href="#top"> <a class="btop" href="#top">
<img border="0" width="16" height="7" src="gif/up.gif" <img border="0" width="16" height="7" src="gif/up.gif"
alt="Back to the top">Back to the top</a> alt="Back to the top">Back to the top</a>
</font> </small>
<hr noshade> <hr noshade>
<i>Last update: February 12<sup>th</sup> 2002 by Gerhard B&uuml;rgmann</i> <i>Last update: January 8<sup>th</sup> 2004 by Gerhard B&uuml;rgmann</i>
</p> </p>
</td></tr></table> </td></tr></table>

View File

@ -59,9 +59,9 @@ for cursor movement.
<li>Download the source package from the Download Page</li> <li>Download the source package from the Download Page</li>
<li>Unzip the package with the command:</li> <li>Unzip the package with the command:</li>
<pre class="examp"> <pre class="examp">
# gunzip -c bvi-1.3.1.src.tar.gz | tar xvf # gunzip -c bvi-1.3.2.src.tar.gz | tar xvf
</pre> </pre>
<li>Change to the directory <tt class="examp">bvi-1.3.1</tt> and type <li>Change to the directory <tt class="examp">bvi-1.3.2</tt> and type
<pre class="examp"> <pre class="examp">
# ./configure # ./configure
# make # make
@ -91,12 +91,19 @@ You will find now four new commands:
files from your file system.<br> files from your file system.<br>
You can remove the program binaries and object files from the You can remove the program binaries and object files from the
source code directory by typing `<tt class="examp">make clean</tt>'. source code directory by typing `<tt class="examp">make clean</tt>'.
To also remove the files that `<TT CLASS="examp">configure</tt>' created To also remove the files that `<tt class="examp">configure</tt>' created
(so you can compile the package for (so you can compile the package for
a different kind of computer), type `<tt class="examp">make distclean</tt>'. </li> a different kind of computer), type `<tt class="examp">make distclean</tt>'. </li>
</ol> </ol>
<h2>MSDOS</h2> <h2>MSDOS</h2>
Beginning with <b>version 1.3.2</b> you may use the DJGPP environment to
compile <b>bvi</b> for working under both Win32 and DOS.
<p>
The MSDOS version (Borland C) exists for historical reasons and is not
supported anymore:
<blockquote>
<p>
You have to convert the sourcefiles from the UNIX textformat to You have to convert the sourcefiles from the UNIX textformat to
the MSDOS textformat first. This can be done e.g. by loading and the MSDOS textformat first. This can be done e.g. by loading and
saving them with the MSDOS standard editor `edit'. saving them with the MSDOS standard editor `edit'.
@ -112,21 +119,21 @@ be able to convert it to a .COM file.
<li>Download the source package from the Download Page</li> <li>Download the source package from the Download Page</li>
<li>Unzip the package with the command: <li>Unzip the package with the command:
<pre class="examp"> <pre class="examp">
gunzip -c bvi-1.3.1.src.tar.gz | tar xvf gunzip -c bvi-1.3.2.src.tar.gz | tar xvf
</pre></li> </pre></li>
<li> Load the tcconfig file (located in the <TT>bc</TT> subdirectory <li> Load the tcconfig file (located in the <TT>bc</TT> subdirectory
for Borland - C).</li> for Borland - C).</li>
<li> Press F9-Make</li> <li> Press F9-Make</li>
</ol> </ol>
The MSDOS version exists for historical reasons and is not really </blockquote>
supported anymore. <p><small>
<p><font size="-1">
<a class="btop" href="#top"> <a class="btop" href="#top">
<img border="0" width="16" height="7" src="gif/up.gif" <img border="0" width="16" height="7" src="gif/up.gif"
alt="Back to the top">Back to the top</a> alt="Back to the top">Back to the top</a>
</font> </small>
<hr noshade> <hr noshade>
<i>Last update: February 12<sup>th</sup> 2002 by Gerhard B&uuml;rgmann</i> <i>Last update: February 12<sup>th</sup> 2004 by Gerhard B&uuml;rgmann,
<a class="btop" href="http://www.purkersdorf-online.at/">Purkersdorf</a>/Austria</i>
</td></tr></table> </td></tr></table>
</body></html> </body></html>

View File

@ -1,14 +1,16 @@
<xmp> <xmp>
BMORE(1) BMORE(1) BMORE(1) BMORE(1)
NAME NAME
bmore - browse through a binary file bmore - browse through a binary file
SYNOPSIS SYNOPSIS
bmore [ -adi ] [ +linenumber ] [ +/ASCII-pattern ] [ bmore [ -acdi ] [ -n lines ] [ -w cols ] [ +linenumber ] [
+\Hex-pattern ] [ filename ... ] +/ASCII-pattern ] [ +\Hex-pattern ] [ filename ... ]
DESCRIPTION DESCRIPTION
more is a filter that displays the contents of a binary more is a filter that displays the contents of a binary
file on the terminal, one screenful at a time. It nor- file on the terminal, one screenful at a time. It nor-
@ -17,12 +19,12 @@ DESCRIPTION
lap between screens for continuity. If bmore is reading lap between screens for continuity. If bmore is reading
from a file rather than a pipe, the percentage of charac- from a file rather than a pipe, the percentage of charac-
ters displayed so far is also shown. ters displayed so far is also shown.
bmore scrolls up to display one more screen line in bmore scrolls up to display one more screen line in
response to a RETURN character; it displays another response to a RETURN character; it displays another
screenful in response to a SPACE character. Other com- screenful in response to a SPACE character. Other com-
mands are listed below. mands are listed below.
The screen is divided in three sections or panes: The byte The screen is divided in three sections or panes: The byte
offset (extreme left), the hex pane (middle), and an ascii offset (extreme left), the hex pane (middle), and an ascii
pane (right) which shows as printable characters those pane (right) which shows as printable characters those
@ -30,142 +32,150 @@ DESCRIPTION
will be sixteen hex values and their ASCII values on each will be sixteen hex values and their ASCII values on each
screen line. Note that (as one would expect) the first screen line. Note that (as one would expect) the first
byte has the offset 0 (zero). byte has the offset 0 (zero).
bmore sets the terminal to noecho mode, so that the output bmore sets the terminal to noecho mode, so that the output
can be continuous. Commands that you type do not normally can be continuous. Commands that you type do not normally
show up on your terminal, except for the / , \ and ! com- show up on your terminal, except for the / , \ and ! com-
mands. mands.
If the standard output is not a terminal, more acts just If the standard output is not a terminal, more acts just
like cat(1V), except that a header is printed before each like cat(1V), except that a header is printed before each
file in a series. file in a series.
OPTIONS OPTIONS
-a ASCII mode: no hex representation of the contents. -a ASCII mode: no hex representation of the contents.
Non printable characters are displayed as a dot (.) Non printable characters are displayed as a dot (.)
-c Clear before displaying. Redrawing the screen
instead of scrolling.
-d Display error messages rather than ringing the ter- -d Display error messages rather than ringing the ter-
minal bell if an unrecognized command is used. minal bell if an unrecognized command is used.
This is helpful for inexperienced users. This is helpful for inexperienced users.
-i Ignore case for searching. -i Ignore case for searching.
-n lines
Displays the indicated number of lines in each
screenful, rather than the default (the number of
lines in the terminal screen less two).
-w cols
Display number of cols in each line.
+linenumber +linenumber
Start up at linenumber. Start up at linenumber.
+/ASCII-pattern +/ASCII-pattern
Start up at the line containing the regular Start up at the line containing the regular expres-
expression pattern. Note: unlike editors, this sion pattern. Note: unlike editors, this construct
construct should not end with a `/'. If it does, should not end with a `/'. If it does, then the
then the trailing slash is taken as a character in trailing slash is taken as a character in the
the search pattern. search pattern.
USAGE USAGE
Commands Commands
The commands take effect immediately; it is not necessary The commands take effect immediately; it is not necessary
to type a carriage return. Up to the time when the com- to type a carriage return. Up to the time when the com-
mand character itself is given, the user may type the line mand character itself is given, the user may type the line
kill character to cancel the numerical argument being kill character to cancel the numerical argument being
formed. In addition, the user may type the erase charac- formed. In addition, the user may type the erase charac-
ter to redisplay the `--More--(xx%)' message. ter to redisplay the `--More--(xx%)' message.
In the following commands, i is a numerical argument (1 by In the following commands, i is a numerical argument (1 by
default). default).
iSPACE Display another screenful, or i more lines if i iSPACE Display another screenful, or i more lines if i
is specified. is specified.
iRETURN Display another line, or i more lines, if speci- iRETURN Display another line, or i more lines, if speci-
fied. fied.
i^D (CTRL-D) Display (scroll down) 11 more lines. i i^D (CTRL-D) Display (scroll down) 11 more lines. i
is given, the scroll size is set to i. is given, the scroll size is set to i.
id Same as ^D. id Same as ^D.
iz Same as SPACE, except that i, if present, iz Same as SPACE, except that i, if present,
becomes the new default number of lines per becomes the new default number of lines per
screenful. screenful.
is Skip i lines and then print a screenful. is Skip i lines and then print a screenful.
if Skip i screenfuls and then print a screenful. if Skip i screenfuls and then print a screenful.
i^B (CTRL-B) Skip back i screenfuls and then print a i^B (CTRL-B) Skip back i screenfuls and then print a
screenful. screenful.
b Same as ^B (CTRL-D). b Same as ^B (CTRL-D).
q q
Q Exit from more. Q Exit from more.
= Display the current line number.
v Drop into the bvi(1) editor at the current off-
set of the current file.
w Drop into the bvi(1) editor at the current off-
set of the current file. Only the portion of the
file displayed on the screen will be loaded.
h Help. Give a description of all the more com- = Display the current line number.
v Drop into the bvi(1) editor at the current off-
set of the current file.
w Drop into the bvi(1) editor at the current off-
set of the current file. Only the portion of the
file displayed on the screen will be loaded.
h Help. Give a description of all the more com-
mands. mands.
i/pattern Search for the ith occurrence of the regular i/pattern Search for the ith occurrence of the regular
expression pattern. Display the screenful expression pattern. Display the screenful
starting at the file position that contains the starting at the file position that contains the
ith match for the regular expression ASCII-pat- ith match for the regular expression ASCII-pat-
tern, or the end of a pipe, whichever comes tern, or the end of a pipe, whichever comes
first. If bmore is displaying a file and there first. If bmore is displaying a file and there
is no such match, its position in the file is no such match, its position in the file
remains unchanged. Regular expressions can be remains unchanged. Regular expressions can be
edited using erase and kill characters. Erasing edited using erase and kill characters. Erasing
back past the first column cancels the search back past the first column cancels the search
command. command.
' Single quote. Go to the point from which the ' Single quote. Go to the point from which the
last search started. If no search has been per- last search started. If no search has been per-
formed in the current file, go to the beginning formed in the current file, go to the beginning
of the file. of the file.
!command Invoke a shell to execute command. The charac-
ters % and !, when used within command are !command Invoke a shell to execute command. The charac-
replaced with the current filename and the pre- ters % and !, when used within command are
vious shell command, respectively. If there is replaced with the current filename and the pre-
no current filename, % is not expanded. Prepend vious shell command, respectively. If there is
no current filename, % is not expanded. Prepend
a backslash to these characters to escape expan- a backslash to these characters to escape expan-
sion. sion.
i:n Skip to the ith next filename given in the com- i:n Skip to the ith next filename given in the com-
mand line, or to the last filename in the list mand line, or to the last filename in the list
if i is out of range. if i is out of range.
i:p Skip to the ith previous filename given in the i:p Skip to the ith previous filename given in the
command line, or to the first filename if i is command line, or to the first filename if i is
out of range. If given while more is positioned out of range. If given while more is positioned
within a file, go to the beginning of the file. within a file, go to the beginning of the file.
If more is reading from a pipe, more simply If more is reading from a pipe, more simply
rings the terminal bell. rings the terminal bell.
:f Display the current filename and offset number.
:f Display the current filename and offset number.
:q :q
:Q Exit from bmore (same as q or Q ). :Q Exit from bmore (same as q or Q ).
. Dot. Repeat the previous command. . Dot. Repeat the previous command.
AUTHOR FILES
bmore was developed by Gerhard Buergmann, Vienna, Austria /etc/termcap terminal data base
Gerhard.Buergmann@altavista.net /usr/local/share/bmore.help
help file
FILES
/etc/termcap terminal data base
/usr/local/share/bmore.help help file
SEE ALSO SEE ALSO
bvi(1), termcap(5) bvi(1), termcap(5)
3 Jan 2004
13/Oct/2000 BMORE Version 1.3.0 </xmp>
</xmp>

View File

@ -3,14 +3,14 @@ BVI(1) User Commands BVI(1)
NAME NAME
bvi, bview - visual display editor for binary files bvi, bview - visual editor for binary files
VERSION VERSION
bvi-1.3.0 bvi-1.3.2
SYNOPSIS SYNOPSIS
bvi [-R] [-c cmd] [-b begin] [-e end] [-s size] [-f script] file... bvi [-R] [-c cmd] [-f script] [-b begin] [-e end] [-s size] file...
bview [-R] [-c cmd] [-b begin] [-e end] [-s size] [-f script] file... bview [-R] [-c cmd] [-f script] [-b begin] [-e end] [-s size] file...
OPTIONS OPTIONS
file... file...
@ -24,23 +24,27 @@ OPTIONS
files, preventing accidental overwriting with a write files, preventing accidental overwriting with a write
command. command.
-b begin -b begin
causes bvi to load a file not from the start but from causes bvi to load a file not from the start but from
offset {begin}. offset begin.
-e end -e end
causes bvi to load a file not till end but till address causes bvi to load a file not till end but till
{end}. address end.
-s size -s size
causes bvi not to load the complete file but only causes bvi not to load the complete file but only size
{size} bytes. bytes.
-c cmd -c cmd
{cmd} will be executed after the first file has cmd will be executed after the first file has
been read. If the {cmd} contains spaces it must been read. If the cmd contains spaces it must be
be enclosed in double quotes (this depends on the enclosed in double quotes (this depends on the shell
shell that is used). that is used).
-f script -f script
This command provides a means for collecting a series This command provides a means for collecting a series
@ -55,7 +59,7 @@ DESCRIPTION
on that of the vi(1) text editor. As a binary editor does on that of the vi(1) text editor. As a binary editor does
not have the concept of "lines" there are differences from not have the concept of "lines" there are differences from
Vi commands wherever the latter are line orientate. Vi commands wherever the latter are line orientate.
COMPARISON COMPARISON
The main differences between Vi and Bvi are: The main differences between Vi and Bvi are:
@ -65,11 +69,11 @@ COMPARISON
bytes in the hex pane. On an 80 column terminal there bytes in the hex pane. On an 80 column terminal there
will be sixteen hex values and their ASCII values on each will be sixteen hex values and their ASCII values on each
screen line. Note that (as one would expect) the first screen line. Note that (as one would expect) the first
byte has the offset '0' (zero). byte has the offset '0' (zero).
You can toggle between the hex and ascii windows with the You can toggle between the hex and ascii windows with the
tabulator key (TAB). Toggling between these two windows tab key (TAB). Toggling between these two windows does
does not change the current position within the file. not change the current position (offset) within the file.
No "lines" concept: Files are treated as one long stream No "lines" concept: Files are treated as one long stream
of bytes. The characters "newline" and "carriage return" of bytes. The characters "newline" and "carriage return"
@ -82,7 +86,7 @@ COMPARISON
of "range" before the ":write" command to a byte offset, of "range" before the ":write" command to a byte offset,
ie the command ":100,200w foo" writes all *bytes* (not ie the command ":100,200w foo" writes all *bytes* (not
lines) from offset 100 to offset 200 to the file "foo". lines) from offset 100 to offset 200 to the file "foo".
No "text objects": There are also no text-specific No "text objects": There are also no text-specific
arrangements like words, paragraphs, sentences, sections arrangements like words, paragraphs, sentences, sections
and so on. and so on.
@ -118,23 +122,23 @@ COMPARISON
between hex value are optional, so searching for between hex value are optional, so searching for
"6775636B6573" will find "guckes". "6775636B6573" will find "guckes".
Changing data (insertion, deletion) moves the data to Changing the length of data (insertion, deletion) moves
other addresses; this is bad for many cases (eg. the data to other addresses; this is bad for many cases
databases, program files) and is thus disabled by default. (eg. databases, program files) and is thus disabled by
You can enable this commands by typing default. You can enable this commands by typing
:set memmove :set memmove
BVI Modes: BVI Modes:
Command Mode (Normal Mode): Command Mode (Normal Mode):
Input is treated as command. Note that command mode is Input is treated as command. Note that command mode is
the default mode after startup and after escaping from the default mode after startup and after escaping from
input mode. Use ESC (escape) to cancel a partial input mode. Use ESC (escape) to cancel a partial
(uncompleted) command. (uncompleted) command.
Input Mode: Input Mode:
Input is treated as replacement of current characters or Input is treated as replacement of current characters or
(after the end of the file) is appended to the current (after the end of the file) is appended to the current
@ -145,15 +149,15 @@ COMPARISON
switch between these two windows. Type ESC to finish the switch between these two windows. Type ESC to finish the
current input and return to command mode. Type CTRL-C to current input and return to command mode. Type CTRL-C to
cancel current command abnormally. cancel current command abnormally.
Command line mode (Last Line Mode or : mode): Command line mode (Last Line Mode or : mode):
Similar to vi, this mode is entered by typing one of the Similar to vi, this mode is entered by typing one of the
characters : / ? \ # ! The command is terminated and characters : / ? \ # ! The command is terminated and
executed by typing a carriage return; to cancel a executed by typing a carriage return; to cancel a
partially typed command, type ESC to cancel the current partially typed command, type ESC to cancel the current
command and return to command mode. command and return to command mode.
ENVIRONMENT ENVIRONMENT
The editor recognizes the environment variable BVIINIT as The editor recognizes the environment variable BVIINIT as
a command (or list of commands) to run when it starts a command (or list of commands) to run when it starts
@ -185,11 +189,11 @@ COMMAND SUMMARY
abbreviations used within the following description of abbreviations used within the following description of
commands. commands.
Abstract: Abstract:
Arrow keys move the cursor on the screen within the Arrow keys move the cursor on the screen within the
current window. current window.
Sample commands: Sample commands:
:version show version info :version show version info
<- v ^ -> arrow keys move the cursor <- v ^ -> arrow keys move the cursor
h j k l same as arrow keys h j k l same as arrow keys
@ -199,7 +203,7 @@ COMMAND SUMMARY
/text search for text /text search for text
^U ^D scroll up or down ^U ^D scroll up or down
Counts before bvi commands: Counts before bvi commands:
Numbers may be typed as a prefix to some commands. Numbers may be typed as a prefix to some commands.
They are interpreted in one of these ways. They are interpreted in one of these ways.
@ -208,11 +212,11 @@ COMMAND SUMMARY
scroll amount ^D ^U scroll amount ^D ^U
repeat effect most of the rest repeat effect most of the rest
Interrupting, canceling Interrupting, canceling
ESC end insert or incomplete command ESC end insert or incomplete command
DEL (delete or rubout) interrupts DEL (delete or rubout) interrupts
File manipulation: File manipulation:
ZZ if file modified, write and exit; ZZ if file modified, write and exit;
otherwise, exit otherwise, exit
:w write changed buffer to file :w write changed buffer to file
@ -221,7 +225,7 @@ COMMAND SUMMARY
:q quit when no changes have been made :q quit when no changes have been made
:q! quit and discard all changes :q! quit and discard all changes
:e file edit file :e file edit file
:e! reedit current file, discard all changes :e! re-read current file, discard all changes
:e # edit the alternate file :e # edit the alternate file
:e! # edit the alternate file, discard changes :e! # edit the alternate file, discard changes
:w file write current buffer to file :w file write current buffer to file
@ -237,13 +241,13 @@ COMMAND SUMMARY
current position within buffer current position within buffer
^G same as :f ^G same as :f
Additional edit commands Additional edit commands
You can insert/append/change bytes in You can insert/append/change bytes in
ASCII/binary/decimal/ hexadecimal or octal representation. ASCII/binary/decimal/ hexadecimal or octal representation.
You can enter several (screen) lines of input. A line with You can enter several (screen) lines of input. A line with
only a period (.) in it will terminate the command. You only a period (.) in it will terminate the command. You
must not type in values greater than a byte value. This must not type in values greater than a byte value. This
causes an abandom of the command. Pressing the CR key causes an abandonment of the command. Pressing the CR key
does not insert a newline - character into the file. If does not insert a newline - character into the file. If
you use ASCII mode you can use the special characters \n, you use ASCII mode you can use the special characters \n,
\r, \t and \0. \r, \t and \0.
@ -252,7 +256,7 @@ COMMAND SUMMARY
:a bCR append bytes (Binary) at end of file :a bCR append bytes (Binary) at end of file
:c hCR change bytes (hexadecimal) at cursor position :c hCR change bytes (hexadecimal) at cursor position
Bit-level operations Bit-level operations
:and n bitwise 'and' operation with value n :and n bitwise 'and' operation with value n
:or n bitwise 'or' operation with value n :or n bitwise 'or' operation with value n
:xor n bitwise 'xor' operation with value n :xor n bitwise 'xor' operation with value n
@ -263,7 +267,7 @@ COMMAND SUMMARY
:rl i rotate each byte i bits to the left :rl i rotate each byte i bits to the left
:rr i rotate each byte i bits to the right :rr i rotate each byte i bits to the right
Command mode addresses Command mode addresses
:w foo write current buffer to a file :w foo write current buffer to a file
named "foo" named "foo"
:5,10w foo copy byte 5 through 100 into as :5,10w foo copy byte 5 through 100 into as
@ -275,7 +279,7 @@ COMMAND SUMMARY
:/pat/,$ foo search pattern pat and and copy :/pat/,$ foo search pattern pat and and copy
through end of file through end of file
Positioning within file: Positioning within file:
^B backward screen ^B backward screen
^F forward screen ^F forward screen
^D scroll down half screen ^D scroll down half screen
@ -290,7 +294,7 @@ COMMAND SUMMARY
N repeat last search command, but in opposite N repeat last search command, but in opposite
direction direction
Adjusting the screen: Adjusting the screen:
^L clear and redraw screen ^L clear and redraw screen
zCR redraw screen with current line at top of screen zCR redraw screen with current line at top of screen
z- redraw screen with current line at bottom of z- redraw screen with current line at bottom of
@ -302,16 +306,15 @@ COMMAND SUMMARY
^E scroll screen down 1 line ^E scroll screen down 1 line
^Y scroll screen up 1 line ^Y scroll screen up 1 line
Marking and returning: Marking and returning:
mx mark current position with lower-case letter x mx mark current position with lower-case letter x
Note: this command works for all lower-case Note: this command works for all lower-case
letters letters
'x move cursor to mark x in ASCII section 'x move cursor to mark x in ASCII section
`x move cursor to mark x in HEX section `x move cursor to mark x in HEX section
'' move cursor to previous context in ASCII section '' move cursor to previous context in ASCII section
`` move cursor to previous context in HEX section `` move cursor to previous context in HEX section
Line positioning:
Line positioning:
H jump to first line on screen ("top") H jump to first line on screen ("top")
L jump to last line on screen ("low") L jump to last line on screen ("low")
M jump to middle line on screen ("middle") M jump to middle line on screen ("middle")
@ -321,7 +324,7 @@ COMMAND SUMMARY
DOWN or j next line, same column DOWN or j next line, same column
UP or k previous line, same column UP or k previous line, same column
Character positioning: Character positioning:
^ first byte in HEX window ^ first byte in HEX window
$ end of screen line $ end of screen line
l or RIGHT jump onto next byte (within current l or RIGHT jump onto next byte (within current
@ -335,7 +338,7 @@ COMMAND SUMMARY
n| jump onto nth byte/character within current n| jump onto nth byte/character within current
line line
Strings: Strings:
(works similar to the strings(1) command) (works similar to the strings(1) command)
Note: "Words" are defined as strings of "nonprinting Note: "Words" are defined as strings of "nonprinting
characters". characters".
@ -346,35 +349,34 @@ COMMAND SUMMARY
\0 or \n \0 or \n
B back to previous string delimited with a B back to previous string delimited with a
nonprinting char nonprinting char
Corrections during insert:
Corrections during insert:
^H erase last character (backspace) ^H erase last character (backspace)
erase your erase character, same as ^H (backspace) erase your erase character, same as ^H (backspace)
ESC ends insertion, back to command mode ESC ends insertion, back to command mode
Append and replace: Append and replace:
A append at end of file A append at end of file
rx replace current bte with char 'x' rx replace current bte with char 'x'
R enter replace mode; for all subsequent input, R enter replace mode; for all subsequent input,
the current byte is overwritten with the next the current byte is overwritten with the next
input character; leave replace mode with ESC. input character; leave replace mode with ESC.
Miscellaneous Operations: Miscellaneous Operations:
TAB toggle between ASCII and HEX section TAB toggle between ASCII and HEX section
Yank and Put: Yank and Put:
3ySPACE yank 3 characters 3ySPACE yank 3 characters
p insert contents of yank buffer p insert contents of yank buffer
o replace text with content of yank buffer o replace text with content of yank buffer
P put back at end of file P put back at end of file
Undo, Redo: Undo, Redo:
u undo last change u undo last change
Note: Only the last change can be undone. Note: Only the last change can be undone.
Therefore this commands toggles between the Therefore this commands toggles between the
last and second-t-last state of the buffer. last and second-t-last state of the buffer.
Setting Options: Setting Options:
With the :set command you can set options in bvi With the :set command you can set options in bvi
Option Default Description Option Default Description
@ -399,13 +401,14 @@ COMMAND SUMMARY
32 is displayed in the statusline as shown 32 is displayed in the statusline as shown
in ascii(7) if unset rather in DOS-style (^A) in ascii(7) if unset rather in DOS-style (^A)
AUTHOR AUTHOR
bvi was developed by Gerhard Buergmann, Vienna, Austria bvi was developed by Gerhard Buergmann, Vienna, Austria
Gerhard.Buergmann@altavista.net Gerhard.Buergmann@puon.at
WWW WWW
Bvi Homepage: http://bvi.linuxave.net/ Bvi Homepage: http://bvi.sourceforge.net/
Vi Pages: http://www.math.fu-berlin.de/~guckes/vi/ Vi Pages: http://www.guckes.net/vi/clones.php3
(all about Vi and its clones) (all about Vi and its clones)
FILES FILES
@ -419,6 +422,5 @@ BUGS
SEE ALSO SEE ALSO
vi(1), strings(1), ascii(5) vi(1), strings(1), ascii(5)
3/Jan/2004 BVI Version 1.3.2
13/Oct/2000 BVI Version 1.3.0 8
</xmp> </xmp>

View File

@ -18,6 +18,7 @@
</p> </p>
<p> <p>
<a class="thl" href="download.html">Download</a><br> <a class="thl" href="download.html">Download</a><br>
<a class="ths" href="new132.html">New in 1.3.2</a><br>
<a class="ths" href="new131.html">New in 1.3.1</a><br> <a class="ths" href="new131.html">New in 1.3.1</a><br>
<a class="ths" href="new130.html">New in 1.3.0</a><br> <a class="ths" href="new130.html">New in 1.3.0</a><br>
<font color="#ffffff" class="ths">New in 1.2.0<br></font> <font color="#ffffff" class="ths">New in 1.2.0<br></font>
@ -144,12 +145,13 @@ height="62" border="0"></a>
<LI>Local settings according to the environment variable LANG <LI>Local settings according to the environment variable LANG
will be evaluated (see setlocal(3)). will be evaluated (see setlocal(3)).
</UL> </UL>
<p><font size="-1"> <p><small>
<a class="btop" href="#top"> <a class="btop" href="#top">
<img border="0" width="16" height="7" src="gif/up.gif" <img border="0" width="16" height="7" src="gif/up.gif"
alt="Back to the top">Back to the top</a> alt="Back to the top">Back to the top</a>
</font> </small>
<hr noshade> <hr noshade>
<i>Last update: Thu Jun 01 12:00:00 CEST 2000 by Gerhard B&uuml;rgmann</i> <i>Last update: June, 1<sup>st</sup> 2000 by Gerhard B&uuml;rgmann,
<a class="btop" href="http://www.purkersdorf-online.at/">Purkersdorf</a>/Austria</i>
</td></tr></table> </td></tr></table>
</body></html> </body></html>

View File

@ -18,6 +18,7 @@
</p> </p>
<p> <p>
<a class="thl" href="download.html">Download</a><br> <a class="thl" href="download.html">Download</a><br>
<a class="ths" href="new132.html">New in 1.3.2</a><br>
<a class="ths" href="new131.html">New in 1.3.1</a><br> <a class="ths" href="new131.html">New in 1.3.1</a><br>
<font color="#ffffff" class="ths">New in 1.3.0<br></font> <font color="#ffffff" class="ths">New in 1.3.0<br></font>
<a class="ths" href="new120.html">New in 1.2.0</a><br> <a class="ths" href="new120.html">New in 1.2.0</a><br>
@ -91,12 +92,13 @@ which is displayed on the screen.
<li>Debian bug #68436 (Buffer overflow in io.c) fixed <li>Debian bug #68436 (Buffer overflow in io.c) fixed
</UL> </UL>
</UL> </UL>
<p><font size="-1"> <p><small>
<a class="btop" href="#top"> <a class="btop" href="#top">
<img border="0" width="16" height="7" src="gif/up.gif" <img border="0" width="16" height="7" src="gif/up.gif"
alt="Back to the top">Back to the top</a> alt="Back to the top">Back to the top</a>
</font> </small>
<hr noshade> <hr noshade>
<i>Last update: Thu Oct 12 20:51:06 CEST 2000 by Gerhard B&uuml;rgmann</i> <i>Last update: October 12<sup>th</sup> 2000 by Gerhard B&uuml;rgmann,
<a class="btop" href="http://www.purkersdorf-online.at/">Purkersdorf</a>/Austria</i>
</td></tr></table> </td></tr></table>
</body></html> </body></html>

View File

@ -18,6 +18,7 @@
</p> </p>
<p> <p>
<a class="thl" href="download.html">Download</a><br> <a class="thl" href="download.html">Download</a><br>
<a class="ths" href="new132.html">New in 1.3.2</a><br>
<font color="#ffffff" class="ths">New in 1.3.1<br></font> <font color="#ffffff" class="ths">New in 1.3.1<br></font>
<a class="ths" href="new130.html">New in 1.3.0</a><br> <a class="ths" href="new130.html">New in 1.3.0</a><br>
<a class="ths" href="new120.html">New in 1.2.0</a><br> <a class="ths" href="new120.html">New in 1.2.0</a><br>
@ -85,12 +86,13 @@ This is a bugfix release.
<li>subshell support fixes</li> <li>subshell support fixes</li>
</ul> </ul>
<p><font size="-1"> <p><small>
<a class="btop" href="#top"> <a class="btop" href="#top">
<img border="0" width="16" height="7" src="gif/up.gif" <img border="0" width="16" height="7" src="gif/up.gif"
alt="Back to the top">Back to the top</a> alt="Back to the top">Back to the top</a>
</font> </small>
<hr noshade> <hr noshade>
<i>Last update: February 12<sup>th</sup> 2002 by Gerhard B&uuml;rgmann</i> <i>Last update: February 12<sup>th</sup> 2002 by Gerhard B&uuml;rgmann,
<a class="btop" href="http://www.purkersdorf-online.at/">Purkersdorf</a>/Austria</i>
</td></tr></table> </td></tr></table>
</body></html> </body></html>

93
html/new132.html Normal file
View File

@ -0,0 +1,93 @@
<!DOCTYPE html PUBLIC "-//W3C/DTD HTML 3.2 Final//EN">
<html><head>
<title>BVI: CHANGES in bvi 1.3.2</title>
<link rel=stylesheet type="text/css" href="bvi.css">
</head><body bgcolor="#ffffff" background="gif/bg2.gif">
<a name="top"></a>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td width="1%" valign="top" align="center">
<img src="gif/dot.gif" width="130" height="1" alt="">
<hr noshade width="60%">
<p>
<a class="thl" href="index.html">Home</a><br>
</p>
<p>
<a class="thl" href="quick.html">Quick Tutorial</a><br>
</p>
<p>
<a class="thl" href="download.html">Download</a><br>
<font color="#ffffff" class="ths">New in 1.3.2<br></font>
<a class="ths" href="new131.html">New in 1.3.1</a><br>
<a class="ths" href="new130.html">New in 1.3.0</a><br>
<a class="ths" href="new120.html">New in 1.2.0</a><br>
</p>
<p>
<a class="thl" href="install.html">Installation</a><br>
</p>
<p>
<a class="thl" href="overview.html">Command Overview</a><br>
</p>
<p>
<a class="thl" href="bmore.html">bmore</a><br>
</p>
<p>
<a class="thl" href="german.html">Deutsche Beschreibung</a><br>
</p>
<hr noshade width="60%">
</td>
<td width="1%"><img src="gif/dot.gif" width="40" height="1" alt=""></td>
<td width="99%">
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr><td width="99%">
<font class="head">CHANGES in bvi 1.3.2</font>
</td>
<td align="right" valign="bottom" width="116" rowspan="2">
<a href="index.html">
<img src="gif/bvi_s.gif" alt="BVI" width="116"
height="62" border="0"></a>
</td></tr>
<tr><td valign="bottom">
<hr noshade>
</td></tr></table>
<p>
This is a bugfix release.
<p>
<b><font color="red">BVI:</font></b>
<ul>
<li> ported to compile under DJGPP v2.0 w/ PDCURSES (by simoN)</li>
<p>
<li>some minor fixes</li>
<p>
</ul>
<p><br></p>
<b><font color="red">BMORE:</font></b></li>
<ul>
<li>configure: checking term.h and ncurses/term.h</li>
<p>
<li>cast in bmore.c in putline();</li>
<p>
<li>fixed multiple file handling for "bmore" (by simoN)</li>
<p>
<li>renamed several local screen processing routines to avoid compiler conflicts</li>
<p>
<li>several minor fixes to "bmore" code (by simoN)</li>
<p>
<li>reset tty after CTRL-C in bmore</li>
</ul>
<p><br></p>
<p><small>
<a class="btop" href="#top">
<img border="0" width="16" height="7" src="gif/up.gif"
alt="Back to the top">Back to the top</a>
</small>
<hr noshade>
<i>Last update: January 8<sup>th</sup> 2004 by Gerhard B&uuml;rgmann,
<a class="btop" href="http://www.purkersdorf-online.at/">Purkersdorf</a>/Austria</i>
</td></tr></table>
</body></html>

View File

@ -62,19 +62,19 @@ the standard ascii vi.
<P> <P>
<CENTER> <CENTER>
<TABLE WIDTH=70%> <TABLE WIDTH=70%>
<TR BGCOLOR=#CCCCFF><TD>Commands shown in blue frames are commands which <TR BGCOLOR="#CCCCFF"><TD>Commands shown in blue frames are commands which
are available in both bvi and vi, but with a slightly different are available in both bvi and vi, but with a slightly different
behavior.</TD></TR> behavior.</TD></TR>
<TR BGCOLOR=#CCFFCC><TD>Green frames are used for commands which are <TR BGCOLOR="#CCFFCC"><TD>Green frames are used for commands which are
equal in both bvi and vi.</TD></TR> equal in both bvi and vi.</TD></TR>
<TR BGCOLOR=#FFCCCC><TD>Red frames are used for missing commands</TD></TR> <TR BGCOLOR="#FFCCCC"><TD>Red frames are used for missing commands</TD></TR>
</TABLE> </TABLE>
</CENTER> </CENTER>
<P> <P>
Special keys are displayed in a gray font, e.g. Special keys are displayed in a gray font, e.g.
<FONT COLOR=#AAAAAA><B>RETURN</B></FONT>, <font color="#aaaaaa"><b>RETURN</b></font>,
<FONT COLOR=#AAAAAA><B>ARROW_UP</B></FONT> or <font color="#aaaaaa"><b>ARROW_UP</b></font> or
<FONT COLOR=#AAAAAA><B>CTRL</B></FONT>. <font color="#aaaaaa"><b>CTRL</b></font>.
<H3>Topics:</H3> <H3>Topics:</H3>
<P> <P>
@ -91,6 +91,7 @@ Special keys are displayed in a gray font, e.g.
alt="Back to the top">Back to the top</a> alt="Back to the top">Back to the top</a>
</font> </font>
<hr noshade> <hr noshade>
<i>Last update: Thu Jun 01 12:00:00 CEST 2000 by Gerhard B&uuml;rgmann</i> <i>Last update: June 1<sup>st</sup> 2000 by Gerhard B&uuml;rgmann,
<a class="btop" href="http://www.purkersdorf-online.at/">Purkersdorf</a>/Austria</i>
</td></tr></table> </td></tr></table>
</body></html> </body></html>

View File

@ -96,6 +96,7 @@ Examples:
alt="Back to the top">Back to the top</a> alt="Back to the top">Back to the top</a>
</font> </font>
<hr noshade> <hr noshade>
<i>Last update: Thu Jun 01 12:00:00 CEST 2000 by Gerhard B&uuml;rgmann</i> <i>Last update: Thu Jun 01 12:00:00 CEST 2000 by Gerhard B&uuml;rgmann,
<a class="btop" href="http://www.purkersdorf-online.at/">Purkersdorf</a>/Austria</i>
</td></tr></table> </td></tr></table>
</body></html> </body></html>

View File

@ -125,6 +125,7 @@ the whole remaining file has to be moved one position backwards.
alt="Back to the top">Back to the top</a> alt="Back to the top">Back to the top</a>
</font> </font>
<hr noshade> <hr noshade>
<i>Last update: Thu Jun 01 12:00:00 CEST 2000 by Gerhard B&uuml;rgmann</i> <i>Last update: June 1<sup>st</sup> 2000 by Gerhard B&uuml;rgmann,
<a class="btop" href="http://www.purkersdorf-online.at/">Purkersdorf</a>/Austria</i>
</td></tr></table> </td></tr></table>
</body></html> </body></html>

View File

@ -1,113 +0,0 @@
<HTML><HEAD>
<TITLE>BVI Editing Files</TITLE>
<LINK REL=STYLESHEET TYPE="text/css" HREF="bvi.css">
</HEAD><BODY BGCOLOR=#ffffff BACKGROUND="gif/bg2.gif">
<A NAME="top"></A>
<TABLE WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=0>
<TR><TD WIDTH=1% VALIGN=TOP ALIGN=CENTER><IMG SRC="gif/dot.gif" WIDTH=130 HEIGHT=1>
<HR NOSHADE WIDTH=60%>
<P>
<A CLASS="thl" HREF="index.html">Home</A>
</P>
<P>
<A CLASS="thl" HREF="quick.html">Quick Tutorial</A>
<FONT COLOR=#FFFFFF CLASS="ths">Editing Files<BR></FONT>
<A CLASS="ths" HREF="qt_search.html">Search Commands</A>
<A CLASS="ths" HREF="qt_bit.html">Bit-wise Operations</A>
<A CLASS="ths" HREF="qt_find.html">Find and Replace</A>
<A CLASS="ths" HREF="qt_yank.html">Yank and Put</A>
<A CLASS="ths" HREF="qt_set.html">Settings</A>
</P>
<P>
<A CLASS="thl" HREF="download.html">Download</A>
</P>
<HR NOSHADE WIDTH=60%>
</TD>
<TD WIDTH=1%><IMG SRC="gif/dot.gif" WIDTH=40 HEIGHT=1></TD>
<TD WIDTH=99%>
<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=0 BORDER=0>
<TR><TD WIDTH=99%>
<FONT CLASS=head>Quick Tutorial</FONT><BR>
<FONT CLASS=sub>Editing Files</FONT>
</TD><TD ALIGN=RIGHT VALIGN=BOTTOM WIDTH=116 ROWSPAN=2>
<IMG SRC="gif/bvi_s.gif" ALT="BVI" WIDTH="116" HEIGHT="62">
</TD></TR>
<TR><TD VALIGN=BOTTOM>
<HR NOSHADE>
</TD></TR></TABLE>
<P>
Inserting or deleting bytes can be dangerous on some kind of files,
because binary files are mostly executables, database files or maybe
graphic files. So you must not shift the remaining bytes to another
address.
Therefor commands for inserting or deleting bytes are disabled by
default.
You can use the <B>r</B> command to change a single byte, or
the <B>R</B> command to replace multiple characters. You can use a
numeric prefix for both commands.
<P>
You can add characters at the end of the file using the <B>A</B> command.
If you start with an empty file, you can create a binary file from
scratch. If the cursor is in the ASCII section of the screen and you
type <B><TT>100Ax</TT><FONT COLOR=#AAAAAA>ESC</FONT></B>, you create a file
which contents 100 x'es.
<P>
The <B>D</B> command can be used to truncate a file at a certain position.
Since there are no lines in a binary file, the <B>D</B> command deletes
to end of file.
<P>
If you have to edit a binary file where it does not matter to move bytes
to a different address, you can enable the insert and delete commands by
typing <B>:set memmove</B>.
Now you are able to use the <B>i</B> command for inserting bytes, the
<B>x</B> or <B>X</B> command to delete the byte over or before the cursor
and those types of <B>d</B> commands, which does not rely on text lines
(e.g. <B>d<FONT COLOR=#AAAAAA>SPACE</FONT></B>, <B>df<TT>C</TT>, d/<TT>xyz</TT>,
d$, d'a, d<TT>n</TT>G</B>).
<P>
All edits can be undone by pressing the <B>u</B> key.
<H4>Using ex (colon) commands</H4>
The edit commands of the <B>ex</B> editor are usually not available in
standard <B>vi</B> implementations (<TT>:i[nsert], :a[ppend]</TT>
and <TT>:c[hange]</TT>). In <B><FONT COLOR=#FF0000>bvi</B></FONT>
they <I>are</I> available with extended options. There are five
modifiers <TT>a[scii], b[inary], d[ecimal], h[exadecimal]</TT> and
<TT>o[ctal]</TT> (ascii is default). Therefor you can insert, append
or change data in all five representations.
<P>
<B>Example:</B><BR>
you would like to append a file with data available in decimal
representation:
<BLOCKQUOTE><PRE>
:a d
0 12 3 128 255 17 0 0 255 255
23 24 25 128 6 6 6
.
</PRE></BLOCKQUOTE>
A line with only a period (.) in it will terminate the command.
<BR>
You must not type values greater than a byte value (255 decimal, FF hex).
This causes an abandon of the command.<BR>
Pressing the <FONT COLOR=#888888>RETURN</FONT> key does <I>not</I> insert
a newline - character into the file. If you use <B>:i a</B> (insert
ascii) you can use the special characters \n, \r, \t and \0.
<P>
An additional advantage is, that all typed bytes are inserted into the
file at once. If you insert characters in vi - mode, for every byte typed,
the whole remaining file has to be moved one position backwards.
<P>
<FONT SIZE=-1>
<A CLASS="btop" HREF="#top"><IMG BORDER=0 WIDTH=16 HEIGHT=7 SRC="gif/up.gif"
ALT="Back to the top">Back to the top</A>
</FONT>
<HR NOSHADE>
<I>Last update: 17 - 06 - 2000 by Gerhard B&uuml;rgmann</I>
</TD></TR></TABLE>
</BODY>
</HTML>

View File

@ -93,6 +93,7 @@ is currently not implemented.
alt="Back to the top">Back to the top</a> alt="Back to the top">Back to the top</a>
</font> </font>
<hr noshade> <hr noshade>
<i>Last update: Fri Jun 30 22:33:20 CEST 2000 by Gerhard B&uuml;rgmann</i> <i>Last update: Fri Jun 30 22:33:20 CEST 2000 by Gerhard B&uuml;rgmann,
<a class="btop" href="http://www.purkersdorf-online.at/">Purkersdorf</a>/Austria</i>
</td></tr></table> </td></tr></table>
</body></html> </body></html>

View File

@ -139,6 +139,7 @@ written back into the original file.
alt="Back to the top">Back to the top</a> alt="Back to the top">Back to the top</a>
</font> </font>
<hr noshade> <hr noshade>
<i>Last update: Sun Jul 09 21:57:38 CEST 2000 by Gerhard B&uuml;rgmann</i> <i>Last update: Sun Jul 09 21:57:38 CEST 2000 by Gerhard B&uuml;rgmann,
<a class="btop" href="http://www.purkersdorf-online.at/">Purkersdorf</a>/Austria</i>
</td></tr></table> </td></tr></table>
</body></html> </body></html>

View File

@ -110,6 +110,7 @@ are line oriented, therefor <B>not</B> useful for binary files and
alt="Back to the top">Back to the top</a> alt="Back to the top">Back to the top</a>
</font> </font>
<hr noshade> <hr noshade>
<i>Last update: Thu Jun 01 12:00:00 CEST 2000 by Gerhard B&uuml;rgmann</i> <i>Last update: Thu Jun 01 12:00:00 CEST 2000 by Gerhard B&uuml;rgmann,
<a class="btop" href="http://www.purkersdorf-online.at/">Purkersdorf</a>/Austria</i>
</td></tr></table> </td></tr></table>
</body></html> </body></html>

View File

@ -121,6 +121,7 @@ Abbreviation: <B><TT>:set wl=4<FONT COLOR=#AAAAAA>RETURN</FONT></TT></B>
alt="Back to the top">Back to the top</a> alt="Back to the top">Back to the top</a>
</font> </font>
<hr noshade> <hr noshade>
<i>Last update: Thu Jun 01 12:00:00 CEST 2000 by Gerhard B&uuml;rgmann</i> <i>Last update: Thu Jun 01 12:00:00 CEST 2000 by Gerhard B&uuml;rgmann,
<a class="btop" href="http://www.purkersdorf-online.at/">Purkersdorf</a>/Austria</i>
</td></tr></table> </td></tr></table>
</body></html> </body></html>

View File

@ -127,6 +127,7 @@ NOTE: There are currently no namend buffers available.
alt="Back to the top">Back to the top</a> alt="Back to the top">Back to the top</a>
</font> </font>
<hr noshade> <hr noshade>
<i>Last update: Thu Jun 01 12:00:00 CEST 2000 by Gerhard B&uuml;rgmann</i> <i>Last update: June 1<sup>st</sup> 2000 by Gerhard B&uuml;rgmann,
<a class="btop" href="http://www.purkersdorf-online.at/">Purkersdorf</a>/Austria</i>
</td></tr></table> </td></tr></table>
</body></html> </body></html>

View File

@ -194,6 +194,7 @@ You should use at most two of the three address options to avoid ambiguity!
alt="Back to the top">Back to the top</a> alt="Back to the top">Back to the top</a>
</font> </font>
<hr noshade> <hr noshade>
<i>Last update: Thu Oct 19 20:58:31 CEST 2000 by Gerhard B&uuml;rgmann</i> <i>Last update: October 19<sup>th</sup> 2000 by Gerhard B&uuml;rgmann,
<a class="btop" href="http://www.purkersdorf-online.at/">Purkersdorf</a>/Austria</i>
</td></tr></table> </td></tr></table>
</body></html> </body></html>

View File

@ -110,7 +110,8 @@
ALT="Back to the top">Back to the top</A> ALT="Back to the top">Back to the top</A>
</FONT> </FONT>
<HR NOSHADE> <HR NOSHADE>
<I>Last update: October 30<SUP>th</SUP> 1999 by Gerhard B&uuml;rgmann</I> <I>Last update: October 30<SUP>th</SUP> 1999 by Gerhard B&uuml;rgmann,
<a class="btop" href="http://www.purkersdorf-online.at/">Purkersdorf</a>/Austria</I>
</BODY></HTML> </BODY></HTML>

View File

@ -88,6 +88,9 @@ height="62" border="0"></a>
</li> </li>
<ul> <ul>
<li> <li>
<a class="thl" href="new132.html">New in 1.3.2</a><br>
</li>
<li>
<a class="thl" href="new131.html">New in 1.3.1</a><br> <a class="thl" href="new131.html">New in 1.3.1</a><br>
</li> </li>
<li> <li>
@ -145,12 +148,13 @@ height="62" border="0"></a>
<ul> <ul>
</ul> </ul>
</ul><p> </ul><p>
<p><font size="-1"> <p><small>
<a class="btop" href="#top"> <a class="btop" href="#top">
<img border="0" width="16" height="7" src="gif/up.gif" <img border="0" width="16" height="7" src="gif/up.gif"
alt="Back to the top">Back to the top</a> alt="Back to the top">Back to the top</a>
</font> </small>
<hr noshade> <hr noshade>
<i>Last update: February 12<sup>th</sup> 2002 by Gerhard B&uuml;rgmann</i> <i>Last update: January 8<sup>th</sup> 2004 by Gerhard B&uuml;rgmann,
<a class="btop" href="http://www.purkersdorf-online.at/">Purkersdorf</a>/Austria</i>
</td></tr></table> </td></tr></table>
</body></html> </body></html>

View File

@ -135,7 +135,8 @@ of the command!
ALT="Back to the top">Back to the top</A> ALT="Back to the top">Back to the top</A>
</FONT> </FONT>
<HR NOSHADE> <HR NOSHADE>
<I>Last update: October 30<SUP>th</SUP> 1999 by Gerhard B&uuml;rgmann</I> <I>Last update: October 30<SUP>th</SUP> 1999 by Gerhard B&uuml;rgmann,
<a class="btop" href="http://www.purkersdorf-online.at/">Purkersdorf</a>/Austria</I>
</BODY></HTML> </BODY></HTML>

View File

@ -56,7 +56,7 @@ dir_arg=""
while [ x"$1" != x ]; do while [ x"$1" != x ]; do
case $1 in case $1 in
-c) instcmd="$cpprog" -c) instcmd=$cpprog
shift shift
continue;; continue;;
@ -79,7 +79,7 @@ while [ x"$1" != x ]; do
shift shift
continue;; continue;;
-s) stripcmd="$stripprog" -s) stripcmd=$stripprog
shift shift
continue;; continue;;
@ -106,7 +106,7 @@ done
if [ x"$src" = x ] if [ x"$src" = x ]
then then
echo "install: no input file specified" echo "$0: no input file specified" >&2
exit 1 exit 1
else else
: :
@ -115,8 +115,8 @@ fi
if [ x"$dir_arg" != x ]; then if [ x"$dir_arg" != x ]; then
dst=$src dst=$src
src="" src=""
if [ -d $dst ]; then if [ -d "$dst" ]; then
instcmd=: instcmd=:
chmodcmd="" chmodcmd=""
else else
@ -125,20 +125,20 @@ if [ x"$dir_arg" != x ]; then
else else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command # Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad # might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'. # if $src (and thus $dsttmp) contains '*'.
if [ -f $src -o -d $src ] if [ -f "$src" ] || [ -d "$src" ]
then then
: :
else else
echo "install: $src does not exist" echo "$0: $src does not exist" >&2
exit 1 exit 1
fi fi
if [ x"$dst" = x ] if [ x"$dst" = x ]
then then
echo "install: no destination specified" echo "$0: no destination specified" >&2
exit 1 exit 1
else else
: :
@ -147,16 +147,16 @@ else
# If destination is a directory, append the input filename; if your system # If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic # does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ] if [ -d "$dst" ]
then then
dst="$dst"/`basename $src` dst=$dst/`basename "$src"`
else else
: :
fi fi
fi fi
## this sed command emulates the dirname command ## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists. # Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script # this part is taken from Noah Friedman's mkinstalldirs script
@ -165,69 +165,73 @@ dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
if [ ! -d "$dstdir" ]; then if [ ! -d "$dstdir" ]; then
defaultIFS=' defaultIFS='
' '
IFS="${IFS-${defaultIFS}}" IFS="${IFS-$defaultIFS}"
oIFS="${IFS}" oIFS=$IFS
# Some sh's can't handle IFS=/ for some reason. # Some sh's can't handle IFS=/ for some reason.
IFS='%' IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}" IFS=$oIFS
pathcomp='' pathcomp=''
while [ $# -ne 0 ] ; do while [ $# -ne 0 ] ; do
pathcomp="${pathcomp}${1}" pathcomp=$pathcomp$1
shift shift
if [ ! -d "${pathcomp}" ] ; if [ ! -d "$pathcomp" ] ;
then then
$mkdirprog "${pathcomp}" $mkdirprog "$pathcomp"
else else
: :
fi fi
pathcomp="${pathcomp}/" pathcomp=$pathcomp/
done done
fi fi
if [ x"$dir_arg" != x ] if [ x"$dir_arg" != x ]
then then
$doit $instcmd $dst && $doit $instcmd "$dst" &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi && if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi
else else
# If we're going to rename the final executable, determine the name now. # If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ] if [ x"$transformarg" = x ]
then then
dstfile=`basename $dst` dstfile=`basename "$dst"`
else else
dstfile=`basename $dst $transformbasename | dstfile=`basename "$dst" $transformbasename |
sed $transformarg`$transformbasename sed $transformarg`$transformbasename
fi fi
# don't allow the sed command to completely eliminate the filename # don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ] if [ x"$dstfile" = x ]
then then
dstfile=`basename $dst` dstfile=`basename "$dst"`
else else
: :
fi fi
# Make a temp file name in the proper directory. # Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/#inst.$$# dsttmp=$dstdir/#inst.$$#
rmtmp=$dstdir/#rm.$$#
# Trap to clean up temp files at exit.
trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
# Move or copy the file name to the temp name # Move or copy the file name to the temp name
$doit $instcmd $src $dsttmp && $doit $instcmd "$src" "$dsttmp" &&
trap "rm -f ${dsttmp}" 0 &&
# and set any options; do chmod last to preserve setuid bits # and set any options; do chmod last to preserve setuid bits
@ -235,17 +239,38 @@ else
# ignore errors from any of these, just make sure not to ignore # ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command. # errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi && if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi &&
# Now remove or move aside any old file at destination location. We try this
# two ways since rm can't unlink itself on some systems and the destination
# file might be busy for other reasons. In this case, the final cleanup
# might fail but the new file should still install successfully.
{
if [ -f "$dstdir/$dstfile" ]
then
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null ||
$doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null ||
{
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
(exit 1); exit
}
else
:
fi
} &&
# Now rename the file to the real destination. # Now rename the file to the real destination.
$doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
$doit $mvcmd $dsttmp $dstdir/$dstfile
fi && fi &&
# The final little trick to "correctly" pass the exit status to the exit trap.
exit 0 {
(exit 0); exit
}

21
io.c
View File

@ -1,4 +1,4 @@
/* IO.C - file in/out and alloc subroutines for BVI /* io.c - file in/out and alloc subroutines for BVI
* *
* 1996-02-28 V 1.0.0 * 1996-02-28 V 1.0.0
* 1999-01-20 V 1.1.0 * 1999-01-20 V 1.1.0
@ -7,11 +7,12 @@
* 1999-10-15 V 1.2.0 final * 1999-10-15 V 1.2.0 final
* 2000-03-23 V 1.3.0 beta * 2000-03-23 V 1.3.0 beta
* 2000-08-17 V 1.3.0 final * 2000-08-17 V 1.3.0 final
* 2004-01-04 V 1.3.2
* *
* NOTE: Edit this file with tabstop=4 ! * NOTE: Edit this file with tabstop=4 !
* *
* Copyright 1996-2000 by Gerhard Buergmann * Copyright 1996-2004 by Gerhard Buergmann
* Gerhard.Buergmann@altavista.net * gerhard@puon.at
* *
* This program is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the
@ -275,6 +276,15 @@ bvi_init(dir)
return; return;
} }
#ifdef DJGPP
strcpy(rcpath, "c:");
strcpy(rcpath, dir);
poi = strrchr(rcpath, '\\');
*poi = '\0';
strcat(rcpath, "\\BVI.RC");
read_rc(rcpath);
read_rc("BVI.RC");
#else
strncpy(rcpath, getenv("HOME"), MAXCMD - 8); strncpy(rcpath, getenv("HOME"), MAXCMD - 8);
rcpath[MAXCMD - 8] = '\0'; rcpath[MAXCMD - 8] = '\0';
strcat(rcpath, "/.bvirc"); strcat(rcpath, "/.bvirc");
@ -286,6 +296,7 @@ bvi_init(dir)
if (stat(rcpath, &buf) == 0) { if (stat(rcpath, &buf) == 0) {
if (buf.st_uid == getuid()) read_rc(rcpath); if (buf.st_uid == getuid()) read_rc(rcpath);
} }
#endif
} }
@ -327,7 +338,11 @@ do_shell()
{ {
addch('\n'); addch('\n');
savetty(); savetty();
#ifdef DJGPP
system("");
#else
system(shell); system(shell);
#endif
resetty(); resetty();
} }

View File

@ -4,8 +4,6 @@
# Created: 1993-05-16 # Created: 1993-05-16
# Public domain # Public domain
# $Id: mkinstalldirs,v 1.1 2001/05/22 14:43:50 akim Exp $
errstatus=0 errstatus=0
dirmode="" dirmode=""
@ -14,61 +12,100 @@ Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
# process command line arguments # process command line arguments
while test $# -gt 0 ; do while test $# -gt 0 ; do
case "${1}" in case $1 in
-h | --help | --h* ) # -h for help -h | --help | --h*) # -h for help
echo "${usage}" 1>&2; exit 0 ;; echo "$usage" 1>&2
-m ) # -m PERM arg exit 0
shift ;;
test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } -m) # -m PERM arg
dirmode="${1}" shift
shift ;; test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
-- ) shift; break ;; # stop option processing dirmode=$1
-* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option shift
* ) break ;; # first non-opt arg ;;
esac --) # stop option processing
shift
break
;;
-*) # unknown option
echo "$usage" 1>&2
exit 1
;;
*) # first non-opt arg
break
;;
esac
done done
for file for file
do do
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` if test -d "$file"; then
shift shift
else
break
fi
done
pathcomp= case $# in
for d 0) exit 0 ;;
do esac
pathcomp="$pathcomp$d"
case "$pathcomp" in
-* ) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then case $dirmode in
echo "mkdir $pathcomp" '')
if mkdir -p -- . 2>/dev/null; then
echo "mkdir -p -- $*"
exec mkdir -p -- "$@"
fi
;;
*)
if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
echo "mkdir -m $dirmode -p -- $*"
exec mkdir -m "$dirmode" -p -- "$@"
fi
;;
esac
mkdir "$pathcomp" || lasterr=$? for file
do
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
shift
if test ! -d "$pathcomp"; then pathcomp=
errstatus=$lasterr for d
else do
if test ! -z "$dirmode"; then pathcomp="$pathcomp$d"
echo "chmod $dirmode $pathcomp" case $pathcomp in
-*) pathcomp=./$pathcomp ;;
esac
lasterr="" if test ! -d "$pathcomp"; then
chmod $dirmode "$pathcomp" || lasterr=$? echo "mkdir $pathcomp"
if test ! -z "$lasterr"; then mkdir "$pathcomp" || lasterr=$?
errstatus=$lasterr
fi
fi
fi
fi
pathcomp="$pathcomp/" if test ! -d "$pathcomp"; then
done errstatus=$lasterr
else
if test ! -z "$dirmode"; then
echo "chmod $dirmode $pathcomp"
lasterr=""
chmod "$dirmode" "$pathcomp" || lasterr=$?
if test ! -z "$lasterr"; then
errstatus=$lasterr
fi
fi
fi
fi
pathcomp="$pathcomp/"
done
done done
exit $errstatus exit $errstatus
# Local Variables: # Local Variables:
# mode:shell-script # mode: shell-script
# sh-indentation:3 # sh-indentation: 2
# End: # End:
# mkinstalldirs ends here

View File

@ -1 +1 @@
#define VERSION "1.3.1" #define VERSION "1.3.2"

27
re.c
View File

@ -9,8 +9,8 @@
* 2000-04-25 V 1.3.0 beta * 2000-04-25 V 1.3.0 beta
* 2000-09-29 V 1.3.0 final * 2000-09-29 V 1.3.0 final
* *
* Copyright 1996-2000 by Gerhard Buergmann * Copyright 1996-2003 by Gerhard Buergmann
* Gerhard.Buergmann@altavista.net * gerhard@puon.at
* *
* This program is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the
@ -268,7 +268,8 @@ do_substitution(delim, line, startpos, endpos)
} else { } else {
if ((n = hexchar()) < 0) { if ((n = hexchar()) < 0) {
emsg("Badly formed replacement pattern"); emsg("Badly formed replacement pattern");
return 0; } return 0;
}
repl_pat[pat_len] = n; repl_pat[pat_len] = n;
pat_len++; pat_len++;
} }
@ -291,9 +292,9 @@ do_substitution(delim, line, startpos, endpos)
if (strchr(cmd, 'c')) conf = 1; if (strchr(cmd, 'c')) conf = 1;
} }
if ((strchr("\\#", ch) && loc == ASCII) if ((strchr("\\#", ch) && loc == ASCII)
|| (strchr("/?", ch) && loc == HEX)) || (strchr("/?", ch) && loc == HEX)) {
toggle(); toggle();
}
startpos--; startpos--;
move(maxy, 0); move(maxy, 0);
refresh(); refresh();
@ -377,15 +378,16 @@ searching(ch, line, startpos, endpos, flag)
if (line[0] == '\0' && again == 0) { if (line[0] == '\0' && again == 0) {
emsg(noprev); emsg(noprev);
return 0L; } return 0L;
}
ignore_case = (P(P_IC)); ignore_case = (P(P_IC));
magic = P(P_MA); magic = P(P_MA);
start_addr--; start_addr--;
if ((strchr("\\#", ch) && loc == ASCII) if ((strchr("\\#", ch) && loc == ASCII)
|| (strchr("/?", ch) && loc == HEX)) || (strchr("/?", ch) && loc == HEX)) {
toggle(); toggle();
}
if (!strchr("Nn", ch)) { if (!strchr("Nn", ch)) {
m[0] = ch; m[0] = ch;
m[1] = '\0'; m[1] = '\0';
@ -425,7 +427,7 @@ searching(ch, line, startpos, endpos, flag)
if (flag & 1) { if (flag & 1) {
msg("Search wrapped BOTTOM|Search wrapped around BOTTOM of buffer"); msg("Search wrapped BOTTOM|Search wrapped around BOTTOM of buffer");
found = fsearch(mem, startpos, search_pat); found = fsearch(mem, startpos, search_pat);
} }
} else { } else {
found = rsearch(startpos - 1, mem, search_pat); found = rsearch(startpos - 1, mem, search_pat);
if (flag & S_GLOBAL) return(found); if (flag & S_GLOBAL) return(found);
@ -433,17 +435,18 @@ searching(ch, line, startpos, endpos, flag)
if (flag & 1) { if (flag & 1) {
msg("Search wrapped TOP|Search wrapped around TOP of buffer"); msg("Search wrapped TOP|Search wrapped around TOP of buffer");
found = rsearch(endpos, startpos, search_pat); found = rsearch(endpos, startpos, search_pat);
} }
} }
if (!found) { if (!found) {
if (flag & 1) { if (flag & 1) {
emsg(notfound); emsg(notfound);
} else { } else {
if (P(P_TE)) if (P(P_TE)) {
sprintf(string, "No match to %s", sdir == FORWARD ? "BOTTOM" : "TOP"); sprintf(string, "No match to %s", sdir == FORWARD ? "BOTTOM" : "TOP");
else } else {
sprintf(string, "Address search hit %s without matching pattern", sprintf(string, "Address search hit %s without matching pattern",
sdir == FORWARD ? "BOTTOM" : "TOP"); sdir == FORWARD ? "BOTTOM" : "TOP");
}
emsg(string); emsg(string);
} }
} else { } else {

View File

@ -6,8 +6,8 @@
* 2000-04-25 V 1.3.0 beta * 2000-04-25 V 1.3.0 beta
* 2000-07-12 V 1.3.0 final * 2000-07-12 V 1.3.0 final
* *
* Copyright 1996-2000 by Gerhard Buergmann * Copyright 1996-2002 by Gerhard Buergmann
* Gerhard.Buergmann@altavista.net * Gerhard.Buergmann@puon.at
* *
* This program is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the

4
script Normal file
View File

@ -0,0 +1,4 @@
set mm
0,20d
w! %.new
q

11
set.c
View File

@ -9,10 +9,11 @@
* 1999-07-02 V 1.2.0 beta * 1999-07-02 V 1.2.0 beta
* 1999-08-14 V 1.2.0 final * 1999-08-14 V 1.2.0 final
* 2000-07-15 V 1.3.0 final * 2000-07-15 V 1.3.0 final
* 2001-10-10 V 1.3.1 cast for alloc_buf * 2001-10-10 V 1.3.1
* 2003-07-03 V 1.3.2
* *
* Copyright 1996-2001 by Gerhard Buergmann * Copyright 1996-2003 by Gerhard Buergmann
* Gerhard.Buergmann@altavista.net * gerhard@puon.at
* *
* This program is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the
@ -52,7 +53,7 @@ struct param params[] = {
{ "window", "window", 25, "", P_NUM }, { "window", "window", 25, "", P_NUM },
{ "wordlength", "wl", 4, "", P_NUM }, { "wordlength", "wl", 4, "", P_NUM },
{ "wrapscan", "ws", TRUE, "", P_BOOL }, { "wrapscan", "ws", TRUE, "", P_BOOL },
#ifdef __MSDOS__ #if defined(__MSDOS__) && !defined(DJGPP)
{ "color", "co", 7, "", P_NUM }, { "color", "co", 7, "", P_NUM },
#endif #endif
{ "", "", 0, "", 0, } /* end marker */ { "", "", 0, "", 0, } /* end marker */
@ -122,7 +123,7 @@ doset(arg)
params[i].nvalue = strtol(s, &s, 10); params[i].nvalue = strtol(s, &s, 10);
} }
params[i].flags |= P_CHANGED; params[i].flags |= P_CHANGED;
#ifdef __MSDOS__ #if defined(__MSDOS__) && !defined(DJGPP)
if (i == P_CO) { if (i == P_CO) {
textcolor(P(P_CO) & 0x07); textcolor(P(P_CO) & 0x07);
textbackground((P(P_CO) & 0xf0) >> 4); textbackground((P(P_CO) & 0xf0) >> 4);

4
set.h
View File

@ -2,8 +2,8 @@
* *
* NOTE: Edit this file with tabstop=4 ! * NOTE: Edit this file with tabstop=4 !
* *
* Copyright 1996-2000 by Gerhard Buergmann * Copyright 1996-2002 by Gerhard Buergmann
* Gerhard.Buergmann@altavista.net * Gerhard.Buergmann@puon.at
* *
* 1998-03-14 V 1.0.0 * 1998-03-14 V 1.0.0
* 1999-01-14 V 1.1.0 * 1999-01-14 V 1.1.0