summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimo Savinen <tjsa@iki.fi>2005-10-09 14:36:39 +0000
committerHadrien Dorio <hadrien.dorio@gmail.com>2017-12-16 00:24:05 +0100
commitb8e1dc4200c8e57024b9a37edc67f9a24c02f0e5 (patch)
tree49e33aa104913d84863a2228ca0edaf912345492
parent11460c1f56ed4939c8f0df0482059f5fecd289fa (diff)
downloadbinary-block-editor-b8e1dc4200c8e57024b9a37edc67f9a24c02f0e5.tar.gz
binary-block-editor-b8e1dc4200c8e57024b9a37edc67f9a24c02f0e5.zip
0.1.3
-rw-r--r--ChangeLog10
-rwxr-xr-xconfigure20
-rw-r--r--configure.ac2
-rw-r--r--doc/bbe.18
-rw-r--r--doc/bbe.info9
-rw-r--r--doc/bbe.texi5
-rw-r--r--src/bbe.c8
-rw-r--r--src/execute.c31
8 files changed, 65 insertions, 28 deletions
diff --git a/ChangeLog b/ChangeLog
index 6e09b63..efe0e21 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,11 +1,21 @@
+2005-10-09 Timo Savinen <tjsa.iki.fi>
+
+ * Version 0.1.3
+ * bug in c BCD ASC
+ * p b added
+ * Typo in usage fixed
+
2005-10-02 Timo Savinen <tjsa.iki.fi>
+
* Version 0.1.2
* escape codes for \n \t \r \a \b \v \f
* "p d" fixed
* Meaning of A and I flipped (to what sed has)
* check for gnu functions, compiles ok in hp-ux with gcc.
* Bitwise operators &,|,^ and ~
+
2005-09-25 Timo Savinen <tjsa.iki.fi>
+
* Version 0.1.1
* Bug fixes (\\ escape in strings)
* -s option added
diff --git a/configure b/configure
index 354103f..e0b906e 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for bbe 0.1.2.
+# Generated by GNU Autoconf 2.59 for bbe 0.1.3.
#
# Report bugs to <tjsa@iki.fi>.
#
@@ -269,8 +269,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='bbe'
PACKAGE_TARNAME='bbe'
-PACKAGE_VERSION='0.1.2'
-PACKAGE_STRING='bbe 0.1.2'
+PACKAGE_VERSION='0.1.3'
+PACKAGE_STRING='bbe 0.1.3'
PACKAGE_BUGREPORT='tjsa@iki.fi'
ac_unique_file="src/bbe.c"
@@ -780,7 +780,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures bbe 0.1.2 to adapt to many kinds of systems.
+\`configure' configures bbe 0.1.3 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -846,7 +846,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of bbe 0.1.2:";;
+ short | recursive ) echo "Configuration of bbe 0.1.3:";;
esac
cat <<\_ACEOF
@@ -965,7 +965,7 @@ fi
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
-bbe configure 0.1.2
+bbe configure 0.1.3
generated by GNU Autoconf 2.59
Copyright (C) 2003 Free Software Foundation, Inc.
@@ -979,7 +979,7 @@ cat >&5 <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by bbe $as_me 0.1.2, which was
+It was created by bbe $as_me 0.1.3, which was
generated by GNU Autoconf 2.59. Invocation command line was
$ $0 $@
@@ -1623,7 +1623,7 @@ fi
# Define the identity of the package.
PACKAGE='bbe'
- VERSION='0.1.2'
+ VERSION='0.1.3'
cat >>confdefs.h <<_ACEOF
@@ -4660,7 +4660,7 @@ _ASBOX
} >&5
cat >&5 <<_CSEOF
-This file was extended by bbe $as_me 0.1.2, which was
+This file was extended by bbe $as_me 0.1.3, which was
generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -4723,7 +4723,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-bbe config.status 0.1.2
+bbe config.status 0.1.3
configured by $0, generated by GNU Autoconf 2.59,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
diff --git a/configure.ac b/configure.ac
index 781cbe3..c15f653 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script.
-AC_INIT(bbe, 0.1.2, tjsa@iki.fi)
+AC_INIT(bbe, 0.1.3, tjsa@iki.fi)
AC_CONFIG_SRCDIR(src/bbe.c)
AC_CONFIG_AUX_DIR(config)
AM_INIT_AUTOMAKE
diff --git a/doc/bbe.1 b/doc/bbe.1
index 599ec5b..46735af 100644
--- a/doc/bbe.1
+++ b/doc/bbe.1
@@ -25,12 +25,12 @@
.\" .br insert line break
.\" .sp <n> insert n+1 empty lines
.\" for manpage-specific macros, see man(7)
-.TH "BBE" "1" "August 24, 2005" "" ""
+.TH "BBE" "1" "2005-10-05" "" ""
.SH "NAME"
-bbe \- Binary block editor
+bbe \- binary block editor
.SH "SYNOPSIS"
.B bbe
-.RI [ options ]... [input\-file]...
+.RI [ options ]...
.SH "DESCRIPTION"
\fBbbe\fP is a sed\-like editor for binary files. It performs binary transformations on the blocks of input stream.
@@ -140,7 +140,7 @@ Insert \fIstring\fR starting at position \fIn\fR.
.TP
p \fIformat\fR
The contents of block is printed in format defined by \fIformat\fR. \fIformat\fR
-can have any of the formats H, D, O and A for Hexadecimal, Decimal, Octal or Ascii.
+can have any of the formats H, D, O, A and B for Hexadecimal, Decimal, Octal, Asciii and Binary.
.TP
s/\fIsearch\fR/\fIreplace\fR/
Replace all occurrences of \fIsearch\fR with \fIreplace\fR.
diff --git a/doc/bbe.info b/doc/bbe.info
index e4f884d..22bdb7b 100644
--- a/doc/bbe.info
+++ b/doc/bbe.info
@@ -351,6 +351,9 @@ block, first byte is number zero.
A
Ascii, nonprintable characters are printed as space.
+ B
+ Binary.
+
FORMAT can contain several codes, values are then separated by
hyphen.
@@ -524,8 +527,8 @@ Node: Invoking bbe3696
Node: Invocation4230
Node: Block5253
Node: Commands7297
-Node: Limits11229
-Node: bbe programs11782
-Node: Problems15563
+Node: Limits11254
+Node: bbe programs11807
+Node: Problems15588

End Tag Table
diff --git a/doc/bbe.texi b/doc/bbe.texi
index 5753e40..6d2577f 100644
--- a/doc/bbe.texi
+++ b/doc/bbe.texi
@@ -6,7 +6,7 @@
@finalout
@c %**end of header
-@set VERSION 0.1.2
+@set VERSION 0.1.3
@copying
This file documents the @command{bbe} - binary block editor
@@ -355,6 +355,9 @@ Octal.
@item A
Ascii, nonprintable characters are printed as space.
+
+@item B
+Binary.
@end table
@var{format} can contain several codes, values are then separated by hyphen.
diff --git a/src/bbe.c b/src/bbe.c
index 6a57fab..ae456cc 100644
--- a/src/bbe.c
+++ b/src/bbe.c
@@ -20,7 +20,7 @@
*
*/
-/* $Id: bbe.c,v 1.33 2005/09/30 10:58:15 timo Exp $ */
+/* $Id: bbe.c,v 1.35 2005/10/06 16:48:06 timo Exp $ */
#include "bbe.h"
#ifdef HAVE_GETOPT_H
@@ -43,7 +43,7 @@ static char *program = "bbe";
#ifdef VERSION
static char *version = VERSION;
#else
-static char *version = "0.1.2";
+static char *version = "0.1.3";
#endif
#ifdef PACKAGE_BUGREPORT
@@ -73,7 +73,7 @@ char *convert_strings[] = {
};
/* format types for p command */
-char *p_formats="DOHA";
+char *p_formats="DOHAB";
/* formats for F and B commands */
char *FB_formats="DOH";
@@ -662,7 +662,7 @@ help(FILE *stream)
fprintf(stream,"\t\tSuppress normal output, print only block contents.\n");
fprintf(stream,"-?, --help\n");
fprintf(stream,"\t\tDisplay this help and exit.\n");
- fprintf(stream,"-V, --Version\n");
+ fprintf(stream,"-V, --version\n");
#else
fprintf(stream,"-b BLOCK\n");
fprintf(stream,"\t\tBlock definition.\n");
diff --git a/src/execute.c b/src/execute.c
index a69932b..ffadc3c 100644
--- a/src/execute.c
+++ b/src/execute.c
@@ -20,7 +20,7 @@
*
*/
-/* $Id: execute.c,v 1.23 2005/09/30 10:58:15 timo Exp $ */
+/* $Id: execute.c,v 1.25 2005/10/05 16:06:11 timo Exp $ */
#include "bbe.h"
#include <stdlib.h>
@@ -51,6 +51,9 @@ static struct command *current_commands;
/* commands to be executed at end of buffer */
#define BLOCK_END_COMMANDS "AJL"
+/* most significant bit of byte */
+#define BYTE_MASK (1 << (sizeof(unsigned char) * 8 - 1))
+
/* byte_to_string, convert byte value to visible string,
either hex (H), decimal (D), octal (O) or ascii (A)
@@ -58,7 +61,9 @@ static struct command *current_commands;
char *
byte_to_string(unsigned char byte,char format)
{
- static char string[10];
+ static char string[128];
+ int i;
+ int j;
switch(format)
{
@@ -74,6 +79,15 @@ byte_to_string(unsigned char byte,char format)
case 'A':
sprintf(string,"%c",isprint(byte) ? byte : ' ');
break;
+ case 'B':
+ i = 0;
+ do
+ {
+ string[i] = ((BYTE_MASK >> i) & byte) ? '1' : '0';
+ i++;
+ } while (BYTE_MASK >> i);
+ string[i] = 0;
+ break;
default:
string[0] = 0;
break;
@@ -233,7 +247,7 @@ execute_commands(struct command *c,char *command_letters)
c->rpos = 0;
if(last_byte()) // unless last byte of block
{
- if(*out_buffer.write_pos >= '0' && *out_buffer.write_pos <= '9')
+ if(*out_buffer.write_pos >= '0' && *out_buffer.write_pos <= '9')
{
a = *out_buffer.write_pos - '0';
a = (a << 4) & 0xf0;
@@ -257,6 +271,7 @@ execute_commands(struct command *c,char *command_letters)
} else
{
b = 0x0f;
+ if(*out_buffer.write_pos == 'F' || *out_buffer.write_pos == 'f') delete_this_byte=1;
}
out_buffer.write_pos[-1] = a | b;
}
@@ -273,10 +288,16 @@ execute_commands(struct command *c,char *command_letters)
a = (*out_buffer.write_pos >> 4) & 0x0f;
b = *out_buffer.write_pos & 0x0f;
*out_buffer.write_pos = '0' + a;
- if(!delete_this_byte && b != 0x0f)
+ if(!delete_this_byte)
{
write_next_byte();
- *out_buffer.write_pos = '0' + b;
+ if(b == 0x0f)
+ {
+ *out_buffer.write_pos = 'F';
+ } else
+ {
+ *out_buffer.write_pos = '0' + b;
+ }
}
}
break;
OpenPOWER on IntegriCloud