diff options
| author | Timo Savinen <tjsa@iki.fi> | 2006-03-16 12:53:53 +0000 |
|---|---|---|
| committer | Hadrien Dorio <hadrien.dorio@gmail.com> | 2017-12-16 00:24:06 +0100 |
| commit | 8cd3947e7a7cc09de6299bbe82262bc123476218 (patch) | |
| tree | 0ffc2ba3f5a03768c46f45c4cc87b8eb101208be /doc | |
| parent | dcefa7a144fb35b23d1ca339d58f3b9e58e7faa3 (diff) | |
| download | binary-block-editor-8cd3947e7a7cc09de6299bbe82262bc123476218.tar.gz binary-block-editor-8cd3947e7a7cc09de6299bbe82262bc123476218.zip | |
0.1.9
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/Makefile.in | 11 | ||||
| -rw-r--r-- | doc/bbe.1 | 73 | ||||
| -rw-r--r-- | doc/bbe.html | 182 | ||||
| -rw-r--r-- | doc/bbe.info | 23 | ||||
| -rw-r--r-- | doc/bbe.texi | 9 |
5 files changed, 155 insertions, 143 deletions
diff --git a/doc/Makefile.in b/doc/Makefile.in index 77e741a..20ec50e 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -277,10 +277,13 @@ dist-info: $(INFO_DEPS) $(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \ esac; \ if test -f $$base; then d=.; else d=$(srcdir); fi; \ - for file in $$d/$$base*; do \ - relfile=`expr "$$file" : "$$d/\(.*\)"`; \ - test -f $(distdir)/$$relfile || \ - cp -p $$file $(distdir)/$$relfile; \ + base_i=`echo "$$base" | sed 's|\.info$$||;s|$$|.i|'`; \ + for file in $$d/$$base $$d/$$base-[0-9] $$d/$$base-[0-9][0-9] $$d/$$base_i[0-9] $$d/$$base_i[0-9][0-9]; do \ + if test -f $$file; then \ + relfile=`expr "$$file" : "$$d/\(.*\)"`; \ + test -f $(distdir)/$$relfile || \ + cp -p $$file $(distdir)/$$relfile; \ + else :; fi; \ done; \ done @@ -25,7 +25,7 @@ .\" .br insert line break .\" .sp <n> insert n+1 empty lines .\" for manpage-specific macros, see man(7) -.TH "BBE" "1" "2005-11-13" "" "" +.TH "BBE" "1" "2006-03-14" "" "" .SH "NAME" bbe \- binary block editor .SH "SYNOPSIS" @@ -58,17 +58,17 @@ List all available options and their meanings. .BR \-V ", " \-\-version Show version of program. .BR -.LP -BLOCK can be defined as: +.PP +\fIBLOCK\fP can be defined as: .TP N:M -Where N'th byte starts a M bytes long block (first byte is 0). +Where \fIN\fR'th byte starts a \fIM\fR bytes long block (first byte is 0). .TP :M -Block length in input stream is M. +Block length in input stream is \fIM\fR. .TP /start/:M -String \fIstart\fP starts M bytes long block. +String \fIstart\fP starts \fIM\fR bytes long block. .TP /start/:/stop/ String \fIstart\fP starts the block and block ends to string \fIstop\fR. @@ -78,29 +78,28 @@ String \fIstart\fR starts the block and block will end at next occurence of \fIs .TP :/stop/ Block starts at the beginning of input stream (or at the end of previous block) and ends at the next occurrence of \fIstop\fR. String \fIstop\fR will be included to the block. -.P -Special value '$' of M means the end of stream. -.P +.PP +Special value '$' of \fIM\fR means the end of stream. +.PP Default value for block is 0:$, meaning the whole input stream. -.P +.PP Both \fIstart\fR and \fIstop\fR strings are included to block. Nonprintable characters can be escaped as -.IP -\\nnn +.TP +\ennn decimal -.IP -\\xnn +.TP +\exnn hexadecimal -.IP -\\0nnn +.TP +\e0nnn octal -.LP -Character '\\' can be escaped as '\\\\'. Escape codes '\\a','\\b','\\t','\\n','\\v','\\f','\\r' and '\\;' can also be used. -.LP -Length (N and M) can be defined as decimal (n), hexadecimal (xn) or octal (0n) value. +.PP +Character '\e' can be escaped as '\e\e'. Escape codes '\ea','\eb','\et','\en','\ev','\ef','\er' and '\e;' can also be used. +.PP +Length (\fIN\fR and \fIM\fR) can be defined as decimal (n), hexadecimal (xn) or octal (0n) value. .SH "COMMAND SYNOPSIS" -bbe has two type of commands: block and byte commands, both are allways related to current block. That means that the input stream outside of block remains untouched. -.LP -\fBBlock commands\fR +\fBbbe\fR has two type of commands: block and byte commands, both are allways related to current block. That means that the input stream outside of block remains untouched. +.SS Block commands .TP D [\fIn\fR] Delete the \fIn\fR'th block. Without \fIn\fR, all found blocks are deleted from the output stream. @@ -133,9 +132,7 @@ Before printing a block, the contents of file \fIfile\fR is printed. .TP < \fIfile\fR After printing a block, the contents of file \fIfile\fR is printed. -.LP -\fBByte commands\fR -.TP +.SS Byte commands \fIn\fR in byte commands is offset from the beginning of current block (starts from zero). .TP r \fIn\fR \fIstring\fR @@ -154,8 +151,8 @@ Replace all occurrences of \fIsearch\fR with \fIreplace\fR. y/\fIsource\fR/\fIdest\fR/ Translate bytes in \fIsource\fR to the corresponding bytes in \fIdest\fR. \fISource\fR and \fIdest\fR must have equal length. .TP -d \fIn\fR \fIm\fR -Delete \fIm\fR bytes starting from the offset \fIn\fR. +d \fIn\fR \fIm\fR|* +Delete \fIm\fR bytes starting from the offset \fIn\fR. If * is defined instead of \fIm\fR, then all bytes starting from \fIn\fR are deleted. .TP c \fIfrom\fR \fIto\fR Convert bytes from format \fIfrom\fR to \fIto\fR. Currently supported formats are: @@ -193,26 +190,24 @@ All bytes from start of the block to offset \fIn\fR are replaced by \fIc\fR. .TP f \fIn\fR \fIc\fR All bytes starting from offset \fIn\fR to end of the block are replaced by \fIc\fR. -.LP +.PP Nonvisible characters in strings can be escaped same way as in block definition strings. Character '/' in s and y commands can be any visible character. -.LP +.PP Note that the D, A, I, F, B, c, s, i, y, p, <, > and d commands cause the length of input and output streams to be different. .SH "EXAMPLES" .TP -bbe \-e "s/c:\\\\temp\\\\data1.txt/c:\\\\temp\\\\data2.txt/" file1 -all occurences of "c:\\temp\\data1.txt" in file file1 are changed to "c:\\temp\\data2.txt" +bbe \-e "s/c:\e\etemp\e\edata1.txt/c:\e\etemp\e\edata2.txt/" file1 +all occurences of "c:\etemp\edata1.txt" in file file1 are changed to "c:\etemp\edata2.txt" .TP -bbe \-b 0420:16 \-e "r 4 \\x12\\x4a" file1 +bbe \-b 0420:16 \-e "r 4 \ex12\ex4a" file1 Two bytes starting at fifth byte of a 16 byte long block starting at offset 0420 (octal) in file1 are changed to hexadecimal values 12 and 4a. .TP -bbe \-b :16 \-e "I \\x0a" file1 -New line character is added after every block, block length is 16. -.TP -bbe \-b "/\\x2f\\x34\\x6a/:/\\xff\\xff/" \-e "y/\\x2f\\x34\\x6a\\xff/____/" \-e "w /tmp/data" -Blocks between strings "\\x2f\\x34\\x6a" and "\\xff\\xff" are written to file /tmp/data. Before writing the block start and end strings are converted to ___ and __. +bbe \-b :16 \-e "A \ex0a" file1 +Newline is added after every block, block length is 16. + .SH "SEE ALSO" .BR sed (1). .SH "AUTHOR" -Timo Savinen <tjsa@iki.fi > +Timo Savinen <tjsa@iki.fi> diff --git a/doc/bbe.html b/doc/bbe.html index 1c3505f..19e1c67 100644 --- a/doc/bbe.html +++ b/doc/bbe.html @@ -3,11 +3,11 @@ <title>bbe - binary block editor</title> <meta http-equiv="Content-Type" content="text/html"> <meta name="description" content="bbe - binary block editor"> -<meta name="generator" content="makeinfo 4.7"> +<meta name="generator" content="makeinfo 4.8"> <link title="Top" rel="top" href="#Top"> <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> <!-- -This file documents version 0.1.8 of `bbe', a binary block editor. +This file documents version 0.1.9 of `bbe', a binary block editor. Copyright (C) 2005 Timo Savinen @@ -32,23 +32,25 @@ Copyright (C) 2005 Timo Savinen pre.smallformat { font-family:inherit; font-size:smaller } pre.smallexample { font-size:smaller } pre.smalllisp { font-size:smaller } - span.sc { font-variant:small-caps } - span.roman { font-family: serif; font-weight: normal; } + span.sc { font-variant:small-caps } + span.roman { font-family:serif; font-weight:normal; } + span.sansserif { font-family:sans-serif; font-weight:normal; } --></style> </head> <body> <h1 class="settitle">bbe - binary block editor</h1> <div class="node"> <p><hr> -<a name="Top"></a>Next: <a rel="next" accesskey="n" href="#Overview">Overview</a>, +<a name="Top"></a> +Next: <a rel="next" accesskey="n" href="#Overview">Overview</a>, Previous: <a rel="previous" accesskey="p" href="#dir">(dir)</a>, Up: <a rel="up" accesskey="u" href="#dir">(dir)</a> -<br> + </div> <h2 class="unnumbered">bbe</h2> -<p>This file documents version 0.1.8 of <span class="command">bbe</span>, a binary block editor. +<p>This file documents version 0.1.9 of <samp><span class="command">bbe</span></samp>, a binary block editor. <p>Copyright © 2005 Timo Savinen @@ -70,74 +72,77 @@ into another language, under the above conditions for modified versions. <!-- texinfo-all-menus-update, which is normally bound to C-c C-u C-a. --> <ul class="menu"> <li><a accesskey="1" href="#Overview">Overview</a>: Preliminary information. -<li><a accesskey="2" href="#Samples">Samples</a>: Samples using <span class="command">bbe</span>. -<li><a accesskey="3" href="#Invoking-bbe">Invoking bbe</a>: How to run <span class="command">bbe</span>. -<li><a accesskey="4" href="#bbe-programs">bbe programs</a>: How <span class="command">bbe</span> works. +<li><a accesskey="2" href="#Samples">Samples</a>: Samples using <samp><span class="command">bbe</span></samp>. +<li><a accesskey="3" href="#Invoking-bbe">Invoking bbe</a>: How to run <samp><span class="command">bbe</span></samp>. +<li><a accesskey="4" href="#bbe-programs">bbe programs</a>: How <samp><span class="command">bbe</span></samp> works. <li><a accesskey="5" href="#Problems">Problems</a>: Reporting bugs. </ul> <div class="node"> <p><hr> -<a name="Overview"></a>Next: <a rel="next" accesskey="n" href="#Samples">Samples</a>, +<a name="Overview"></a> +Next: <a rel="next" accesskey="n" href="#Samples">Samples</a>, Previous: <a rel="previous" accesskey="p" href="#Top">Top</a>, Up: <a rel="up" accesskey="u" href="#Top">Top</a> -<br> + </div> <h2 class="chapter">1 Preliminary information</h2> <p><a name="index-greetings-1"></a><a name="index-overview-2"></a> -The <span class="command">bbe</span> program is a sed-like editor for binary files. <span class="command">bbe</span> -performs basic byte related transformations on blocks of input stream. <span class="command">bbe</span> is non-interactive command line tool and -can be used as a part of a pipeline. <span class="command">bbe</span> makes only one pass over input stream. +The <samp><span class="command">bbe</span></samp> program is a sed-like editor for binary files. <samp><span class="command">bbe</span></samp> +performs basic byte related transformations on blocks of input stream. <samp><span class="command">bbe</span></samp> is non-interactive command line tool and +can be used as a part of a pipeline. <samp><span class="command">bbe</span></samp> makes only one pass over input stream. - <p><span class="command">bbe</span> contains also grep-like features, like printing the filename, offset and block number. + <p><samp><span class="command">bbe</span></samp> contains also grep-like features, like printing the filename, offset and block number. <div class="node"> <p><hr> -<a name="Samples"></a>Next: <a rel="next" accesskey="n" href="#Invoking-bbe">Invoking bbe</a>, +<a name="Samples"></a> +Next: <a rel="next" accesskey="n" href="#Invoking-bbe">Invoking bbe</a>, Previous: <a rel="previous" accesskey="p" href="#Overview">Overview</a>, Up: <a rel="up" accesskey="u" href="#Top">Top</a> -<br> + </div> -<h2 class="chapter">2 Samples using <span class="command">bbe</span></h2> +<h2 class="chapter">2 Samples using <samp><span class="command">bbe</span></samp></h2> <p><a name="index-sample-3"></a> -Few examples of running <span class="command">bbe</span>: +Few examples of running <samp><span class="command">bbe</span></samp>: <dl> -<dt><span class="samp">bbe -b "/\x80\x50\x0e/:12" -e "d 0 3" -e "c BCD ASC" -e "A \x0a" -e "w /tmp/numbers" -o /dev/null /tmp/bdata</span><dd>Task here is to extract BCD coded numbers from the file <span class="file">/tmp/bdata</span> and write them -in ascii format with newline to file <span class="file">/tmp/numbers</span>. +<dt>`<samp><span class="samp">bbe -b "/\x80\x50\x0e/:12" -e "d 0 3" -e "c BCD ASC" -e "A \x0a" -e "w /tmp/numbers" -o /dev/null /tmp/bdata</span></samp>'<dd>Task here is to extract BCD coded numbers from the file <samp><span class="file">/tmp/bdata</span></samp> and write them +in ascii format with newline to file <samp><span class="file">/tmp/numbers</span></samp>. 12 bytes long blocks containing the BCD-numbers start with three byte sequence of -values <span class="samp">0x80</span>, <span class="samp">0x50</span> and <span class="samp">0x0e</span>. First three bytes (the block start sequence) -are removed (<span class="samp">d 0 3</span>) rest of the block is transformed from BCD to Ascii (<span class="samp">c BCD ASC</span>) and a newline character is -appended at the end of the block (<span class="samp">A \x0a</span>). -All transformed blocks are written to <span class="file">/tmp/numbers</span> (<span class="samp">w /tmp/numbers</span>). Nothing is written to -the output (<span class="samp">-o /dev/null</span>). +values `<samp><span class="samp">0x80</span></samp>', `<samp><span class="samp">0x50</span></samp>' and `<samp><span class="samp">0x0e</span></samp>'. First three bytes (the block start sequence) +are removed (`<samp><span class="samp">d 0 3</span></samp>') rest of the block is transformed from BCD to Ascii (`<samp><span class="samp">c BCD ASC</span></samp>') and a newline character is +appended at the end of the block (`<samp><span class="samp">A \x0a</span></samp>'). +All transformed blocks are written to <samp><span class="file">/tmp/numbers</span></samp> (`<samp><span class="samp">w /tmp/numbers</span></samp>'). Nothing is written to +the output (`<samp><span class="samp">-o /dev/null</span></samp>'). <br> - <br><dt><span class="samp">bbe -b ":525" -e "i 524 \x0a" -o /tmp/data_with_nl /tmp/data</span><dd>A newline is added after every 525'th byte of the file <span class="file">/tmp/data</span>. Data with newlines is written to <span class="file">/tmp/data_with_nl</span>. + <br><dt>`<samp><span class="samp">bbe -b ":525" -e "i 524 \x0a" -o /tmp/data_with_nl /tmp/data</span></samp>'<dd>A newline is added after every 525'th byte of the file <samp><span class="file">/tmp/data</span></samp>. Data with newlines is written to <samp><span class="file">/tmp/data_with_nl</span></samp>. <br> - <br><dt><span class="samp">bbe -b ":526" -e "d 525 1" -o /tmp/data /tmp/data_with_nl</span><dd>Every 526'th byte (inserted newline in previous example) is removed from the file <span class="file">/tmp/data_with_nl</span>. Data without newlines is written to <span class="file">/tmp/data</span>. + <br><dt>`<samp><span class="samp">bbe -b ":526" -e "d 525 1" -o /tmp/data /tmp/data_with_nl</span></samp>'<dd>Every 526'th byte (inserted newline in previous example) is removed from the file <samp><span class="file">/tmp/data_with_nl</span></samp>. Data without newlines is written to <samp><span class="file">/tmp/data</span></samp>. <br> - <br><dt><span class="samp">bbe -e "s/\x0d\x0a/\x0a/"</span><dd>Same effect as has command <span class="command">dos2unix</span>. + <br><dt>`<samp><span class="samp">bbe -e "s/\x0d\x0a/\x0a/"</span></samp>'<dd>Same effect as has command <samp><span class="command">dos2unix</span></samp>. </dl> <div class="node"> <p><hr> -<a name="Invoking-bbe"></a>Next: <a rel="next" accesskey="n" href="#bbe-programs">bbe programs</a>, +<a name="Invoking-bbe"></a> +Next: <a rel="next" accesskey="n" href="#bbe-programs">bbe programs</a>, Previous: <a rel="previous" accesskey="p" href="#Samples">Samples</a>, Up: <a rel="up" accesskey="u" href="#Top">Top</a> -<br> + </div> -<h2 class="chapter">3 How to run <span class="command">bbe</span></h2> +<h2 class="chapter">3 How to run <samp><span class="command">bbe</span></samp></h2> <p><a name="index-running-bbe-4"></a><a name="index-using-5"></a> -<span class="command">bbe</span> accepts several commands to operate on blocks. Commands are +<samp><span class="command">bbe</span></samp> accepts several commands to operate on blocks. Commands are executed in the same order as they appear in command line or in a script file. Order is significant, because the changes made to current byte by previous commands are seen by next commands. @@ -151,15 +156,16 @@ seen by next commands. <div class="node"> <p><hr> -<a name="Invocation"></a>Next: <a rel="next" accesskey="n" href="#Block">Block</a>, +<a name="Invocation"></a> +Next: <a rel="next" accesskey="n" href="#Block">Block</a>, Up: <a rel="up" accesskey="u" href="#Invoking-bbe">Invoking bbe</a> -<br> + </div> <h3 class="section">3.1 Program invocation</h3> <p><a name="index-options-6"></a> -The format for running the <span class="command">bbe</span> program is: +The format for running the <samp><span class="command">bbe</span></samp> program is: <pre class="example"> bbe <var>option</var> ... </pre> @@ -169,7 +175,7 @@ The format for running the <span class="command">bbe</span> program is: <dl> <dt><code>-b </code><var>BLOCK</var><dt><code>--block=</code><var>BLOCK</var><dd>Block definition. - <br><dt><code>-e </code><var>COMMAND</var><dt><code>--expression=</code><var>COMMAND</var><dd>Add command(s) to the commands to be executed. Commands must separated by semicolon. + <br><dt><code>-e </code><var>COMMAND</var><dt><code>--expression=</code><var>COMMAND</var><dd>Add command(s) to the commands to be executed. Commands must be separated by semicolon. <br><dt><code>-f </code><var>script-file</var><dt><code>--file=</code><var>script-file</var><dd>Add commands from <var>script-file</var> to the commands to be executed. @@ -180,26 +186,27 @@ The format for running the <span class="command">bbe</span> program is: <br><dt><code>-?</code><dt><code>--help</code><dd>Print an informative help message describing the options and then exit successfully. - <br><dt><code>-V</code><dt><code>--version</code><dd>Print the version number of <span class="command">bbe</span> and then exit successfully. + <br><dt><code>-V</code><dt><code>--version</code><dd>Print the version number of <samp><span class="command">bbe</span></samp> and then exit successfully. </dl> <p>All remaining options are names of input files, if no input files are specified or <code>-</code> is given, then the standard input is read. <div class="node"> <p><hr> -<a name="Block"></a>Next: <a rel="next" accesskey="n" href="#Commands">Commands</a>, +<a name="Block"></a> +Next: <a rel="next" accesskey="n" href="#Commands">Commands</a>, Previous: <a rel="previous" accesskey="p" href="#Invocation">Invocation</a>, Up: <a rel="up" accesskey="u" href="#Invoking-bbe">Invoking bbe</a> -<br> + </div> <h3 class="section">3.2 Block definition</h3> <p><a name="index-block-7"></a> -<span class="command">bbe</span> devides the input stream to blocks defined by the <code>-b</code> option. If block is +<samp><span class="command">bbe</span></samp> devides the input stream to blocks defined by the <code>-b</code> option. If block is not defined, the whole input stream is considered as one block. Commands have effect only inside a block, rest of the input stream -remains untouched. Currently <span class="command">bbe</span> supports only one block definition per invocation. If input stream consists of different blocks, -several <span class="command">bbe</span>s can be combined in a pipeline. +remains untouched. Currently <samp><span class="command">bbe</span></samp> supports only one block definition per invocation. If input stream consists of different blocks, +several <samp><span class="command">bbe</span></samp>s can be combined in a pipeline. <p>A block can be defined several ways: @@ -262,16 +269,17 @@ Values in <var>start</var> and <var>stop</var> must be escaped with <code>\</cod <div class="node"> <p><hr> -<a name="Commands"></a>Next: <a rel="next" accesskey="n" href="#Limits">Limits</a>, +<a name="Commands"></a> +Next: <a rel="next" accesskey="n" href="#Limits">Limits</a>, Previous: <a rel="previous" accesskey="p" href="#Block">Block</a>, Up: <a rel="up" accesskey="u" href="#Invoking-bbe">Invoking bbe</a> -<br> + </div> -<h3 class="section">3.3 <span class="command">bbe</span> commands</h3> +<h3 class="section">3.3 <samp><span class="command">bbe</span></samp> commands</h3> <p><a name="index-commands-8"></a> -Commands in <span class="command">bbe</span> can be divided in two groups: Block related commands +Commands in <samp><span class="command">bbe</span></samp> can be divided in two groups: Block related commands and byte related commands. Block related commands operate at block level e.g. remove a block. Byte related commands work allways inside a block and they don't have effect beyond the block boundaries. @@ -308,9 +316,9 @@ Stream offset starts at zero. <var>f</var> can have one of following values: <br><dt><code>B </code><var>f</var><dd>Before block contents the current block number and colon is printed in format specified by <var>f</var>. Block numbering starts at one. <var>f</var> can have one of the sames codes as <code>F</code>-command. - <br><dt><code>> </code><span class="file">file</span><dd>Before printing a block, the contents of file <span class="file">file</span> is printed. + <br><dt><code>> <samp></code><span class="file">file</span><code></samp></code><dd>Before printing a block, the contents of file <samp><span class="file">file</span></samp> is printed. - <br><dt><code>< </code><span class="file">file</span><dd>After printing a block, the contents of file <span class="file">file</span> is printed. + <br><dt><code>< <samp></code><span class="file">file</span><code></samp></code><dd>After printing a block, the contents of file <samp><span class="file">file</span></samp> is printed. </dl> <h4 class="subheading">Byte commands are:</h4> @@ -327,7 +335,8 @@ Block numbering starts at one. <var>f</var> can have one of the sames codes as < <strong>Note</strong>: Bytes, that cannot be converted are passed through as they are. e.g. in ASC -> BCD conversion, ASCII characters not in range <code>'0'</code> – <code>'9'</code> are not converted. - <br><dt><code>d </code><var>n</var> <var>m</var><dd>Delete <var>m</var> bytes starting from the offset <var>n</var>. + <br><dt><code>d </code><var>n</var> <var>m</var><code>|*</code><dd>Delete <var>m</var> bytes starting from the offset <var>n</var>. If * is defined instead of <var>m</var>, then +all bytes of the block starting from <var>n</var> are deleted. <br><dt><code>i </code><var>n</var> <var>string</var><dd>Insert <var>string</var> after byte number <var>n</var>. @@ -359,9 +368,9 @@ in range <code>'0'</code> – <code>'9'</code> are not converted. <br><dt><code>s/</code><var>search</var><code>/</code><var>replace</var><code>/</code><dd>All occurences of <var>search</var> are replaced by <var>replace</var>. <var>replace</var> can be empty. Separator <code>/</code> can be replaced by any character not present in <var>search</var> or <var>replace</var>. - <br><dt><code>w </code><span class="file">file</span><dd>Contents of blocks are written to file <span class="file">file</span>. <strong>Note</strong>: Data inserted by commands <code>A</code>, <code>I</code>, + <br><dt><code>w <samp></code><span class="file">file</span><code></samp></code><dd>Contents of blocks are written to file <samp><span class="file">file</span></samp>. <strong>Note</strong>: Data inserted by commands <code>A</code>, <code>I</code>, <code>></code> and <code><</code> -are written to file <span class="file">file</span> and <code>j</code> and <code>l</code> commands have no effect on <code>w</code>-commands. Zero size files are not preserved.<br> +are written to file <samp><span class="file">file</span></samp> and <code>j</code> and <code>l</code> commands have no effect on <code>w</code>-commands. Zero size files are not preserved.<br> Filename can contain format string <code>%B</code> or <code>%nB</code>, these format strings are replace by current block number (starting from one), causing every block to have it's own file. In <code>%nB</code>, the <code>n</code> is field width in range 0-99. If <code>n</code> has a leading zero, then the block numbers will be left padded with zeroes. @@ -379,15 +388,16 @@ Separator <code>/</code> can be replaced by any character not present in <var>so <div class="node"> <p><hr> -<a name="Limits"></a>Previous: <a rel="previous" accesskey="p" href="#Commands">Commands</a>, +<a name="Limits"></a> +Previous: <a rel="previous" accesskey="p" href="#Commands">Commands</a>, Up: <a rel="up" accesskey="u" href="#Invoking-bbe">Invoking bbe</a> -<br> + </div> <h3 class="section">3.4 Limitations</h3> <p><a name="index-big-files-9"></a><a name="index-limits-10"></a> -At least in GNU/Linux <span class="command">bbe</span> should be able to handle big files (> 4 GB), other +At least in GNU/Linux <samp><span class="command">bbe</span></samp> should be able to handle big files (> 4 GB), other systems are not tested. <p>There are however, some limitations in block and command definitions: @@ -398,22 +408,23 @@ systems are not tested. <div class="node"> <p><hr> -<a name="bbe-programs"></a>Next: <a rel="next" accesskey="n" href="#Problems">Problems</a>, +<a name="bbe-programs"></a> +Next: <a rel="next" accesskey="n" href="#Problems">Problems</a>, Previous: <a rel="previous" accesskey="p" href="#Invoking-bbe">Invoking bbe</a>, Up: <a rel="up" accesskey="u" href="#Top">Top</a> -<br> + </div> -<h2 class="chapter">4 How <span class="command">bbe</span> works</h2> +<h2 class="chapter">4 How <samp><span class="command">bbe</span></samp> works</h2> -<p><span class="command">bbe</span> scans the input stream just once, so the last block may differ from the block definition, because <span class="command">bbe</span> doesn't -'peek' the end of the input stream. Last block may be shorter than defined, e.g. if block is defined as <span class="samp">/string/:128</span> +<p><samp><span class="command">bbe</span></samp> scans the input stream just once, so the last block may differ from the block definition, because <samp><span class="command">bbe</span></samp> doesn't +'peek' the end of the input stream. Last block may be shorter than defined, e.g. if block is defined as `<samp><span class="samp">/string/:128</span></samp>' and if the end of input stream is found before 128'th byte of the last block is reached, the last block remains shorter. <h4 class="subheading">Basic execution cycle:</h4> <ol type=1 start=1> -<li>Start of the block is searched. If found, data before block is written to output stream (unless <span class="option">-s</span> is defined) and +<li>Start of the block is searched. If found, data before block is written to output stream (unless <samp><span class="option">-s</span></samp> is defined) and step 2 is executed. <li>Block commands affecting the start of the block (<code>I</code>, <code>D</code>, <code>J</code>, <code>N</code>, <code>F</code>, <code>></code> and <code>B</code>) are executed. @@ -424,13 +435,13 @@ the following commands don't 'see' the removed byte. <li>When end of the block is reached the end of the block commands (<code>A</code> and <code><</code>) are executed. - <li>Next block is searched, data between the blocks, if not suppressed with <span class="option">-s</span>, is written to output stream. + <li>Next block is searched, data between the blocks, if not suppressed with <samp><span class="option">-s</span></samp>, is written to output stream. </ol> <h4 class="subheading">Few examples:</h4> <dl> -<dt><span class="samp">echo "The quick brown fox jumps over a lazy dog" | bbe -b "/The/:21" -e "j 4" -e "s/ /X/"</span><dd>Output is +<dt>`<samp><span class="samp">echo "The quick brown fox jumps over a lazy dog" | bbe -b "/The/:21" -e "j 4" -e "s/ /X/"</span></samp>'<dd>Output is <pre class="example"> The quickXbrownXfoxXjumps over a lazy dog </pre> <p>The only block in this is @@ -438,7 +449,7 @@ the following commands don't 'see' the removed byte. </pre> <p>All spaces in the block are converted to X's, before conversion first 4 bytes are skipped.<br> - <br><dt><span class="samp">echo "The quick brown fox jumps over a lazy dog" | bbe -b ":/ /" -e "J 1" -e "A \x0a"</span><dd>Output is: + <br><dt>`<samp><span class="samp">echo "The quick brown fox jumps over a lazy dog" | bbe -b ":/ /" -e "J 1" -e "A \x0a"</span></samp>'<dd>Output is: <pre class="example"> The quick brown fox @@ -451,22 +462,22 @@ the following commands don't 'see' the removed byte. </pre> <p>All blocks end at space, a newline character is inserted after every block except the first block.<br> - <br><dt><span class="samp">echo "The quick brown fox jumps over a lazy dog" | bbe -e "r 4 fast\x20" -e "s/f/c/"</span><dd>Output is: + <br><dt>`<samp><span class="samp">echo "The quick brown fox jumps over a lazy dog" | bbe -e "r 4 fast\x20" -e "s/f/c/"</span></samp>'<dd>Output is: <pre class="example"> The cast brown cox jumps over a lazy dog </pre> <p>Also the <code>f</code> in <code>fast</code> is converted to <code>c</code>.<br> - <br><dt><span class="samp">echo "1234567890" | bbe -b ":1" -e "L 9" -e "A -"</span><dd>Output is + <br><dt>`<samp><span class="samp">echo "1234567890" | bbe -b ":1" -e "L 9" -e "A -"</span></samp>'<dd>Output is <pre class="example"> 1-2-3-4-5-6-7-8-9-0 </pre> <p>Hyphen is inserted after every 1 byte long block,but not after 9'th block.<br> - <br><dt><span class="samp">bbe -s -b "/First line/:/Last line/" /tmp/text</span><dd>Print lines between sentences <span class="samp">First line</span> and <span class="samp">Last line</span>.<br> + <br><dt>`<samp><span class="samp">bbe -s -b "/First line/:/Last line/" /tmp/text</span></samp>'<dd>Print lines between sentences `<samp><span class="samp">First line</span></samp>' and `<samp><span class="samp">Last line</span></samp>'.<br> - <br><dt><span class="samp">bbe -s -b "%<a %:%</a>%" -e "s/\x0a/ /" -e "A \n" ./index.html</span><dd>Extract all links from <span class="file">./index.html</span>. To get one link per line, + <br><dt>`<samp><span class="samp">bbe -s -b "%<a %:%</a>%" -e "s/\x0a/ /" -e "A \n" ./index.html</span></samp>'<dd>Extract all links from <samp><span class="file">./index.html</span></samp>. To get one link per line, all newlines are converted to spaces and newline is added after every link.<br> - <br><dt><span class="samp">bbe -b "/\x5f\x28\x02/:10" -s -e "F d" -e "p h" -e "A \n" ./bindata</span><dd>10 bytes long sequences starting with values <code>x5f</code> <code>x28</code> and <code>x02</code> are printed as hex values. + <br><dt>`<samp><span class="samp">bbe -b "/\x5f\x28\x02/:10" -s -e "F d" -e "p h" -e "A \n" ./bindata</span></samp>'<dd>10 bytes long sequences starting with values <code>x5f</code> <code>x28</code> and <code>x02</code> are printed as hex values. Also the file offset is printed before each sequence and new line is added after every sequence. Example output: <pre class="example"> 52688:x5f x28 x02 x32 x36 x5f x81 x64 x01 x93 @@ -475,7 +486,7 @@ Example output: </pre> <p><br> - <br><dt><span class="samp">bbe -b "/Linux/:5" -s -e "N;D;A \x0a" /bin/* | uniq</span><dd>Print the files names of those programs in /bin directory which contains word <span class="samp">Linux</span>. + <br><dt>`<samp><span class="samp">bbe -b "/Linux/:5" -s -e "N;D;A \x0a" /bin/* | uniq</span></samp>'<dd>Print the files names of those programs in /bin directory which contains word `<samp><span class="samp">Linux</span></samp>'. Example output: <pre class="example"> /bin/loadkeys: /bin/mkbimage: @@ -484,35 +495,36 @@ Example output: </pre> <p><br> - <br><dt><span class="samp">bbe -b "/\x5f\x81\x18\x06/:10" -s -e "B d;d 0 4;c BCD ASC;A \n" ./bindata</span><dd>Print BCD numbers and their block numbers in ascii format. Numbers start with sequence <code>x5f</code> <code>x81</code> <code>x18</code> <code>x06</code>. + <br><dt>`<samp><span class="samp">bbe -b "/\x5f\x81\x18\x06/:10" -s -e "B d;d 0 4;c BCD ASC;A \n" ./bindata</span></samp>'<dd>Print BCD numbers and their block numbers in ascii format. Numbers start with sequence <code>x5f</code> <code>x81</code> <code>x18</code> <code>x06</code>. The start sequence is not printed.<br> - <br><dt><span class="samp">bbe -b "/\x5f/:2" -e "j 1;& \xf0" -o newdata bindata</span><dd>The least significant nybble of bytes after <code>x5f</code> is cleared.<br> + <br><dt>`<samp><span class="samp">bbe -b "/\x5f/:2" -e "j 1;& \xf0" -o newdata bindata</span></samp>'<dd>The least significant nybble of bytes after <code>x5f</code> is cleared.<br> - <br><dt><span class="samp">bbe -b "/\xff\xd8\xff/:/\xff\xd9/" -s -e "w pic%02B.jpg" -o /dev/null manual.pdf</span><dd>Extract jpg-images from pdf-file to separate jpg-files (assuming that the jpg start/stop sequences + <br><dt>`<samp><span class="samp">bbe -b "/\xff\xd8\xff/:/\xff\xd9/" -s -e "w pic%02B.jpg" -o /dev/null manual.pdf</span></samp>'<dd>Extract jpg-images from pdf-file to separate jpg-files (assuming that the jpg start/stop sequences does not appear in other context than jpg-images). -Files will be named as <span class="file">pic01.jpg</span>, <span class="file">pic02.jpg</span>, <span class="file">pic03.jpg</span>,<small class="dots">...</small> <br> +Files will be named as <samp><span class="file">pic01.jpg</span></samp>, <samp><span class="file">pic02.jpg</span></samp>, <samp><span class="file">pic03.jpg</span></samp>,<small class="dots">...</small> <br> - <br><dt><span class="samp">bbe -b "_<body>_:_</body>_" -s -o temp nicebody.html</span><dt><span class="samp">bbe -b "_<body>_:_</body>_" -e "D;< temp" -o tmpindex.html index.html</span><dt><span class="samp">mv tmpindex.html index.html</span><dd>The body part of the html-document <span class="file">index.html</span> is replaced by the body of the document <span class="file">nicebody.html</span>. + <br><dt>`<samp><span class="samp">bbe -b "_<body>_:_</body>_" -s -o temp nicebody.html</span></samp>'<dt>`<samp><span class="samp">bbe -b "_<body>_:_</body>_" -e "D;< temp" -o tmpindex.html index.html</span></samp>'<dt>`<samp><span class="samp">mv tmpindex.html index.html</span></samp>'<dd>The body part of the html-document <samp><span class="file">index.html</span></samp> is replaced by the body of the document <samp><span class="file">nicebody.html</span></samp>. </dl> <div class="node"> <p><hr> -<a name="Problems"></a>Previous: <a rel="previous" accesskey="p" href="#bbe-programs">bbe programs</a>, +<a name="Problems"></a> +Previous: <a rel="previous" accesskey="p" href="#bbe-programs">bbe programs</a>, Up: <a rel="up" accesskey="u" href="#Top">Top</a> -<br> + </div> <h2 class="chapter">5 Reporting Bugs</h2> <p><a name="index-bugs-11"></a><a name="index-problems-12"></a> -If you find a bug in <span class="command">bbe</span>, please send electronic mail to +If you find a bug in <samp><span class="command">bbe</span></samp>, please send electronic mail to <a href="mailto:tjsa@iki.fi">tjsa@iki.fi</a>. Include the version number, which you can find by -running <span class="samp">bbe --version</span><!-- /@w -->. Also include in your message the +running `<samp><span class="samp">bbe --version</span></samp>'<!-- /@w -->. Also include in your message the output that the program produced and the output you expected. <p>If you have other questions, comments or suggestions about -<span class="command">bbe</span>, contact the author via electronic mail to +<samp><span class="command">bbe</span></samp>, contact the author via electronic mail to <a href="mailto:tjsa@iki.fi">tjsa@iki.fi</a>. The author will try to help you out, although he may not have time to fix your problems. @@ -521,15 +533,15 @@ may not have time to fix your problems. <ul> <li><a name="toc_Top" href="#Top">bbe</a> <li><a name="toc_Overview" href="#Overview">1 Preliminary information</a> -<li><a name="toc_Samples" href="#Samples">2 Samples using <span class="command">bbe</span></a> -<li><a name="toc_Invoking-bbe" href="#Invoking-bbe">3 How to run <span class="command">bbe</span></a> +<li><a name="toc_Samples" href="#Samples">2 Samples using <samp><span class="command">bbe</span></samp></a> +<li><a name="toc_Invoking-bbe" href="#Invoking-bbe">3 How to run <samp><span class="command">bbe</span></samp></a> <ul> <li><a href="#Invocation">3.1 Program invocation</a> <li><a href="#Block">3.2 Block definition</a> -<li><a href="#Commands">3.3 <span class="command">bbe</span> commands</a> +<li><a href="#Commands">3.3 <samp><span class="command">bbe</span></samp> commands</a> <li><a href="#Limits">3.4 Limitations</a> </li></ul> -<li><a name="toc_bbe-programs" href="#bbe-programs">4 How <span class="command">bbe</span> works</a> +<li><a name="toc_bbe-programs" href="#bbe-programs">4 How <samp><span class="command">bbe</span></samp> works</a> <li><a name="toc_Problems" href="#Problems">5 Reporting Bugs</a> </li></ul> </div> diff --git a/doc/bbe.info b/doc/bbe.info index 63cb3ba..ee6ee16 100644 --- a/doc/bbe.info +++ b/doc/bbe.info @@ -1,6 +1,6 @@ -This is bbe.info, produced by makeinfo version 4.7 from bbe.texi. +This is bbe.info, produced by makeinfo version 4.8 from bbe.texi. - This file documents version 0.1.8 of `bbe', a binary block editor. + This file documents version 0.1.9 of `bbe', a binary block editor. Copyright (C) 2005 Timo Savinen @@ -23,7 +23,7 @@ File: bbe.info, Node: Top, Next: Overview, Prev: (dir), Up: (dir) bbe *** -This file documents version 0.1.8 of `bbe', a binary block editor. +This file documents version 0.1.9 of `bbe', a binary block editor. Copyright (C) 2005 Timo Savinen @@ -127,7 +127,7 @@ The format for running the `bbe' program is: `-e COMMAND' `--expression=COMMAND' - Add command(s) to the commands to be executed. Commands must + Add command(s) to the commands to be executed. Commands must be separated by semicolon. `-f SCRIPT-FILE' @@ -327,8 +327,9 @@ block, first byte is number zero. are. e.g. in ASC -> BCD conversion, ASCII characters not in range `'0'' - `'9'' are not converted. -`d N M' - Delete M bytes starting from the offset N. +`d N M|*' + Delete M bytes starting from the offset N. If * is defined instead + of M, then all bytes of the block starting from N are deleted. `i N STRING' Insert STRING after byte number N. @@ -550,10 +551,10 @@ Node: Overview1841 Node: Samples2328 Node: Invoking bbe3726 Node: Invocation4260 -Node: Block5272 -Node: Commands7318 -Node: Limits11994 -Node: bbe programs12372 -Node: Problems16758 +Node: Block5275 +Node: Commands7321 +Node: Limits12090 +Node: bbe programs12468 +Node: Problems16854 End Tag Table diff --git a/doc/bbe.texi b/doc/bbe.texi index 5e8ade6..6f96cc6 100644 --- a/doc/bbe.texi +++ b/doc/bbe.texi @@ -6,7 +6,7 @@ @finalout @c %**end of header -@set VERSION 0.1.8 +@set VERSION 0.1.9 @copying This file documents version @value{VERSION} of @command{bbe}, a binary block editor. @@ -139,7 +139,7 @@ Block definition. @item -e @var{COMMAND} @itemx --expression=@var{COMMAND} -Add command(s) to the commands to be executed. Commands must separated by semicolon. +Add command(s) to the commands to be executed. Commands must be separated by semicolon. @item -f @var{script-file} @@ -334,8 +334,9 @@ Binary Coded Decimal @strong{Note}: Bytes, that cannot be converted are passed through as they are. e.g. in ASC -> BCD conversion, ASCII characters not in range @code{'0'} -- @code{'9'} are not converted. -@item d @var{n} @var{m} -Delete @var{m} bytes starting from the offset @var{n}. +@item d @var{n} @var{m}|* +Delete @var{m} bytes starting from the offset @var{n}. If * is defined instead of @var{m}, then +all bytes of the block starting from @var{n} are deleted. @item i @var{n} @var{string} Insert @var{string} after byte number @var{n}. |

