File: hexer.1

package info (click to toggle)
hexer 0.1.5-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 724 kB
  • ctags: 967
  • sloc: ansic: 12,189; makefile: 99
file content (1086 lines) | stat: -rw-r--r-- 24,944 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
.\" hexer.1	01/12/1996
.\"
.\" Copyright (c) 1995,1996 Sascha Demetrio
.\" Copyright (c) 2009 Peter Pentchev
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\"    If you modify any part of HEXER and redistribute it, you must add
.\"    a notice to the `README' file and the modified source files containing
.\"    information about the  changes you made.  I do not want to take
.\"    credit or be blamed for your modifications.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"    If you modify any part of HEXER and redistribute it in binary form,
.\"    you must supply a `README' file containing information about the
.\"    changes you made.
.\" 3. The name of the developer may not be used to endorse or promote
.\"    products derived from this software without specific prior written
.\"    permission.
.\"
.\" HEXER WAS DEVELOPED BY SASCHA DEMETRIO.
.\" THIS SOFTWARE SHOULD NOT BE CONSIDERED TO BE A COMMERCIAL PRODUCT.
.\" THE DEVELOPER URGES THAT USERS WHO REQUIRE A COMMERCIAL PRODUCT
.\" NOT MAKE USE OF THIS WORK.
.\"
.\" DISCLAIMER:
.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE DEVELOPER BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\" 
.TH HEXER 1 "April 15, 2009" "Hexer 0.1.5"
.\"
.\" --- Section -- NAME -------------------------------------------------------
.\"
.SH NAME
hexer \- binary file editor
.\"
.\" --- Section -- SYNOPSIS ---------------------------------------------------
.\"
.SH SYNOPSIS
.B hexer
[options] [file [...]]
.\"
.\" --- Section -- DESCRIPTION ------------------------------------------------
.\"
.SH DESCRIPTION
.B hexer
is a multi-buffer editor for viewing and manipulating binary files.  It can't
(shouldn't) be used for editing block devices, because it tries to load the
whole file into a buffer (it should work for diskettes).  The most important
features of
.B hexer
are:  multi buffers, multi level undo, command line editing with completion,
binary regular expressions (see below).
The user interface is kept similar to
.BR vi ,
so if you know how to use
.BR vi ,
you'll get started easily.
.\"
.\" --- Section -- OPTIONS ----------------------------------------------------
.\"
.SH OPTIONS
.TP 4
.BI \-R,\ \-\-readonly
.TP
.BI \-v,\ \-\-view
Edit files in read only mode.
.TP
.BI \-r,\ \-\-recover " filename"
Recover the file
.I filename
after a crash. (not implemented)
.TP
.BI \-c,\ \-\-command " command"
Start the editing session by executing the editor command
.IR command .
If
.I command
contains spaces, it must be surrounded by double quotes.  It is possible to
specify multiple commands on the command line:
.br
.BI "hexer \-c " command1 " \-c " command2 " ..."
.TP
.B \-t,\ \-\-tite
Turn off the usage of the termcap/terminfo ti/te sequence.
.TP
.B \-h,\ \-\-help
Print out a short help message and exit.
.TP
.BI + command
This is equivalent to the
.B \-c
option.
.LP
.B Note:
The long options are not available on all systems.
.\"
.\" --- Section -- CUSTOMIZING ------------------------------------------------
.\"
.SH CUSTOMIZING
The editor reads its startup commands from the file
.B ~/.hexerrc
(another startup file may be specified by setting the environment variable
.BR HEXERRC ).
Empty lines and lines starting with a `"'\(hycharacter (double quote) are ignored.
It is not possible to have a command and a comment in the same line.
.\"
.\" --- Section -- EDITOR COMMANDS --------------------------------------------
.\"
.SH EDITOR COMMANDS
As in
.BR vi ,
there are several editing modes:
.\"
.\" --- Subsection -- Command Mode --------------------------------------------
.\"
.TP 4
.B Command Mode
Some commands in
.B Command Mode
can take a numeric argument.  To enter a numeric argument just type the
(decimal) number.  The number will be echoed at the bottom line of the screen
as you type.  To enter an octal number, type a `0' as the first digit.
To enter a hexadecimal number, type `0x' (this is not a problem, because the
.BR x -command
with a zero counter wouldn't make sense anyway).
Some of the commands can take a visually selected area as an argument
(see subsection
.BR "Visual Mode" ).
.RS
.TP
.B b
Move backwards to the beginning of a word.
.TP
.B e
Move to the end of a word.
.TP
.B G
If a numeric argument
.B n
is given, move the cursor to position
.BR n .
If no argument is specified, set the position to the end of the buffer.
The first byte in the buffer is at position `0', so the command to move
to the beginning of the buffer is `0G'.
.TP
.B Control-G
Display the buffer name, size, status and the current position at the
bottom line.
.TP
.B h j k l
Move the cursor.  The arrow keys work as well.  The numeric argument (if
specified) determines the number rows or columns the cursor will move.
Different from
.BR vi :
the cursor can be positioned
.B behind
the last byte in the buffer.
.TP
.B i
Enter
.B Insert Mode
(see below) at the current position of the point.  If a numeric argument
.B n
is given, the typed text will be inserted
.B n
times.
.B Note:
Moving the cursor (using the arrow keys) will discard the numeric argument.
.TP
.B n
Move to the next match using the current RE.  This is equivalent to typing
`/', <Return>.
.TP
.B N
Move to the previous match using the current RE.  This is equivalent to
typing `?', <Return>.
.TP
.B Control-O
Paste over.  Copy the kill buffer to the current position overwriting the
contents of the current buffer.  If a numeric argument
.B n
is given, the kill buffer is pasted
.B n
times.
.TP
.B p
Paste.  Insert the kill buffer at the current position.  If a numeric argument
.B n
is given, the kill buffer is pasted
.B n
times.
.TP
.B r
Replace a single byte using the
.BR "Replace Mode" .
If an area is selected, all bytes in the selected area are replaced.
If a numeric argument is given, the specified number of bytes is replaced.
.TP
.B R
Enter
.B Replace Mode
(see below).  If a numeric argument
.B n
is given, the replace command is repeated
.B n
times.
.B Note:
Moving the cursor (using the arrow keys) will discard the numeric argument.
.TP
.B Control-R
Redo the last undo.
.TP
.B u
Undo the last change to the current buffer.
.LP
Whenever possible
.B hexer
creates a file
.IB name .hexer
in the current directory (the
.BR swapfile )
for each buffer visited (where
.I name
is the name of the buffer).  All changes made to the buffer
.I name
are stored in that file, so it is possible to undo (and redo) all
changes made to the buffer.  If the
.B swapfile
can't be created, the undo list is stored in the memory.
.TP
.B v
Enter
.B Visual Mode
(see below).  Visual selection of areas.
.TP
.B w
Move forward to the beginning of a word.
.TP
.B x
Delete the byte under the cursor.  If a numeric argument
.B n
is given,
.B n
bytes are deleted.
In
.BR "Visual Mode" ,
the selected area is deleted.
.B Note:
The bytes deleted using the
.BR x -command
are not copied to the kill buffer.
.TP
.B Control-X
The same as the
.BR x -command,
but the bytes deleted are copied to the kill buffer.
.TP
.B y
Yank.  Yank the byte under the cursor into the kill buffer.  If a numeric
argument
.B n
is given,
.B n
bytes are yanked into the kill buffer.
In
.BR "Visual Mode" ,
the selected area is copied to the kill buffer.
.TP
.B zb
Place the cursor in the bottom line of the screen.
.TP
.B zt
Place the cursor in the top line of the screen.
.TP
.B zz
Place the cursor in the middle line of the screen.
.br
Note that the commands
.BR zb , " zt"
and
.B zz
don't change the position in the file - only the screen is scrolled
(if necessary).
.TP
.B :
Enter
.B Exh Mode
(see below).  The
.B Exh Mode
is similar to the
.BR ex -mode
in
.BR vi ,
but not compatible.  If an area is selected, the bounds of the
selection are copied to the command line.
.TP
.B /
Search forward through the buffer using a
.BR RE ( "regular expression" ).
If no
.B RE
is specified, the
.B RE
given in the previous
.BR / -
or
.BR ? -command
is reused.
.br
.B Note:
The
.BR RE s
in
.B hexer
are a little bit different from regular expressions in 
.B vi
(see section
.BR "REGULAR EXPRESSIONS" ).
.TP
.B ?
Search reverse using a regular expression.
.TP
.B .
Repeat the last change to the buffer
.BR "at the current position" .
This means that if the previous command deleted
.B n
bytes and replaced them by
.B m
other bytes
.RB ( n
or
.B m
may be zero), the
.BR . -command
will do
.B exactly
the same at the current position in the file.
.TP
.B <
Shift the hex column left
.B n
bytes, where
.B n
is the (optional) numeric argument.  Note that the
.BR < -command
only changes the way the buffer is displayed in the hex column, the buffer
itself is kept unchanged.
.TP
.B >
Shift the hex column right
.B n
bytes.
.TP
.B Control-^
Switch to the alternate buffer (see below).
.TP
.B %
Enter a calculator command (see section
.BR CALCULATOR ).
.LP
.RE
.\"
.\" --- Subsection -- Visual Mode ---------------------------------------------
.\"
.TP
.B Visual Mode
Select an area on the buffer.  You can enter the
.B Visual Mode
by using the
.BR v -command
or by specifying an area in
.BR "Exh Mode" .
The selection starts at the cursor position when entering the
.B Visual Mode
and ends at the current cursor position.  You can leave the
.B Visual Mode
without performing a command on the selected area by pressing
.B v
or
.BR Escape .
To perform a command on the selected area simply enter the command as if
you where in
.BR "Command Mode" .
Commands that can't use the selection will ignore it.
As in
.BR "Command Mode" ,
it is possible to specify a numeric argument.  Commands that can take the
selection as an argument will ignore the numeric argument.
.\"
.\" --- Subsection -- Insert Mode ---------------------------------------------
.\"
.TP
.B Insert Mode
In
.B Insert Mode
the bytes you type are inserted at the current position of the cursor.
At any time, you can toggle the active column (hex column or text column)
by pressing the
.BR TAB -key.
If the hex column is active the bytes are entered as two digit hex numbers,
if the text column is active, the bytes are entered as ASCII text.
The
.BR Delete -
or
.BR BackSpace -key
deletes the previously inserted byte.  If the hex column is active, the
previously inserted nibble (hex digit) is deleted.  It is not possible
to delete more bytes than have been inserted in the current insert command.
While in
.BR "Insert Mode" ,
you can move the cursor using the arrow keys.  Note that moving the cursor
discards the numeric argument given to the insert command.
To leave the
.BR "Insert Mode" ,
type
.BR Escape .
If a numeric argument
.B n
was given to the insert command and is hasn't been discarded by a cursor
movement, the typed bytes are inserted
.B n
times.
.\"
.\" --- Subsection -- Replace Mode --------------------------------------------
.\"
.TP
.B Replace Mode
In
.B Replace Mode
you replace the bytes under the cursor as you type.  Hitting
.B BackSpace
restores the original contents of the buffer.  The effect of a numeric
argument is similar to the
.BR "Insert Mode" :
the typed bytes are replaced
.B n
times.  As in
.BR "Insert Mode" ,
moving the cursor using the arrow keys discards the numeric argument.
.\"
.\" --- Subsection -- Exh Mode ------------------------------------------------
.TP
.B Exh Mode
The
.B Exh Mode
in
.B hexer
is kept similar to the
.BR ex -mode
in
.BR vi .
Typically, an
.B exh
command looks like:
.RS
.TP
.BI : "area command arguments"
Perform the command
.I command
on the area
.IR area .
.TP
.TP
.BI : "command arguments"
Perform the command
.B command
at the current position.
.TP
.BI : area
Select the area
.IR area .
.TP
.BI : position
Move the cursor to position
.IR position .
.LP
An area may be defined as:
.TP
.I position1,position2
The area starts at
.I position1
and ends at
.I position2
(inclusive).
.TP
.I position
The area selects one byte at
.I position
.TP
.I %
The area selects the entire buffer.
.LP
A position may be defined as:
.TP
.I offset
A decimal, octal (prefixed with `0') or hex (prefixed with `0x') number.
.TP
.I .
The beginning of the buffer.
.TP
.I $
The end of the buffer.
.TP
.RI / regexp /
A regular expression
(see section
.BR "REGULAR EXPRESSIONS" ).
The buffer is searched forward starting at the current
position.  If a match was found, the current position is set to the position
of the match.
.TP
.RI ? regexp ?
The buffer is searched reverse.
.LP
Commands may be abbreviated with a unique prefix of the command, some commands
may be abbreviated with a single character, even if that character isn't a
unique prefix of the command name.
Currently the following commands are supported:
.TP
.B s, substitute
.B Synopsis:
.I area
.B s
.RI / regexp / replace / flags
.br
Search for the regular expression
.I regexp
and replace it with
.I replace
(see section
.BR "REGULAR EXPRESSIONS" ).
.I replace
may contain `\\' references to subexpressions of 
.RI regexp .
.IR flags :
.RS
.TP
.BR g :
global, this flag is ignored (it doesn't make sense in a binary editor).
.TP
.BR c :
confirm, ask the user to confirm each substitution.
.LP
(Note that the `/' character used as separator could be any character,
it's just common practice to use `/'.) Trailing separators may be omitted.
If
.I area
is omitted, the whole buffer is searched.
.RE
.TP
.B w, write
.B Synopsis:
.I area
.B w
.I filename
.br
Write
.I area
to the file
.IR filename .
If
.I area
is omitted. the whole buffer is written to the file, if
.I filename
is omitted, the filename associated with the buffer is used.
.TP
.B r, read
.B Synopsis:
.I position
.B r
.I filename
.br
Insert the contents of the file
.I filename
at
.IR position .
If
.I position
is omitted, the current position is used.
.TP
.B e, edit
.B Synopsis: e
.I name
.B or: e #
.br
Change to buffer
.IR name .
If there is no such buffer,
.B hexer
tries to open a file named
.I name
and load it into a new buffer.  If
.I name
is a hash sign
.RB ( # ),
the alternate buffer is selected.  On success the current
buffer becomes the alternate buffer.
.TP
.B b, buffer
.B Synopsis: b
.I name
.br
.B or: b
.br
Change to buffer
.IR name .
On success the current buffer becomes the alternate buffer.  If
.I name
is omitted, a list of all buffers is displayed.
.TP
.B n, next
Select the next buffer in the buffer list.
.TP
.B N, previous
Select the previous buffer in th buffer list.
.TP
.B S, skip
Select the next unvisited buffer in the buffer list.
.TP
.B rewind
Select the first buffer in the buffer list.
.TP
.B wall
Write all unsaved buffers.
.TP
.B c, close
.B Synopsis: c
.I name
.br
.B or: c!
.I name
.br
.B or: c
.br
.B or: c!
.br
Close the buffer
.IR name .
If
.I name
is omitted, the current buffer is closed.  If the buffer has been modified,
but not saved, it can't be closed using a
.BR :c -command;
use
.B :c!
to override.
.TP
.B h, help
View an online help text.
.TP
.B q, quit
.B Synopsis: q
.I name
.br
.B or: q!
.I name
.br
.B or: q
.br
.B or: q!
.br
Close all buffers and exit the editor.  If an opened buffer has bee modified,
but not saved, the
.BR :q -command
can't be performed; use
.B :q!
to override.
.TP
.B map
.TP
.B imap
.TP
.B vmap
.B Synopsis: map
.I from
.I to
.br
.B or: imap
.I from
.I to
.br
.B or: vmap
.I from
.I to
.br
The key sequence
.I from
is mapped to
.IR to .
To enter special keys (e.g. function keys), mask them using
.BR "Control-V" .
.B :map
affects the
.B Command Mode
only,
.B :imap
affects the
.B Insert Mode
only and
.B :vmap
affects the
.B Visual Mode
only.  It is not possible to re-map key sequences on the command line editor.
.TP
.B unmap
.TP
.B iunmap
.TP
.B vunmap
.B Synopsis: unmap
.I from
.br
.B or: iunmap
.I from
.br
.B or: vunmap
.I from
.br
Delete a key mapping created with
.BR :map , " :imap"
or
.BR :vmap .
.TP
.B set
.B Synopsis: set
.I variable
[...]
.br
.B or: set
.IR variable = value
[...]
.br
.BI "or: set no" variable
[...]
.br
.B or: set
.br
There are not too many variables that could be modified, this might change
though.  The following variables can be used:
.B iso
(bool):  display the whole ISO-8859/1 character set;
.B ascii
(bool):  display ASCII characters only;
.B TERM
(string):  the name of the terminal;
.B maxmatch
(number),
.B specialnl
(bool): see section
.BR "REGULAR EXPRESSIONS" .
.B :set
called without an argument lists all variables and values.
.TP
.B d, delete
.B Synopsis:
.I area
.B d
.br
Delete all bytes in
.IR area .
The deleted bytes are copied to the kill buffer.
.TP
.B y, yank
.B Synopsis:
.I area
.B y
.br
Copy the bytes in
.I area
to the kill buffer.
.TP
.B version
Display the version number of
.BR hexer .
.TP
.B zz
Place the cursor in the middle line of the screen.  Note that the
screen is scrolled (if necessary); the cursor position is kept unchanged.
.TP
.B zt
Place the cursor in the top line of the screen.
.TP
.B zb
Place the cursor in the bottom line of the screen.
.TP
.B wq
The same as
.BR :x .
.TP
.B x, exit
Save all buffers and exit the editor.
.LP
If a command is called and can't use the given positions, areas or arguments,
the additional positions, areas, arguments are ignored.
.br
.B Conditional commands:
It is possible to specify a list of terminal names for which the given
command should be executed. The syntax is:
.RS
.BI : terminals : command
.RE
where
.I terminals
is a colon-separated list of terminal names.  The command is executed if and
only if the value of
.B TERM
is in the list.  I.e. you could have a command like
.RS
.B :xterm:set iso
.RE
in your
.BR .hexerrc -file
(use the ISO character set only if working on an xterm).
.RE
.\"
.\" --- Subsection -- Cursor Motion -------------------------------------------
.\"
.TP
.B Cursor Motion
In
.BR "Command Mode" , " Insert Mode" , " Replace Mode"
.RB and " Visual Mode" ,
you can use the following cursor motion commands:
.RS
.TP
.B Arrow Keys
Move the cursor.
.TP
.B Control-F
Move forward one page.
.TP
.B Control-B
Move back one page.
.TP
.B Control-D
Move forward half a page.
.TP
.B Control-U
Move back half a page.
.LP
.RE
.\"
.\" --- Section -- COMMAND LINE EDITING ---------------------------------------
.\"
.SH COMMAND LINE EDITING
On the command line you can use the following commands:
.TP
.B UpArrow DownArrow
Move up and down through the history of the current context.
.TP
.B LeftArrow RightArrow
Move the cursor.
.TP
.B Control-A
Move the cursor to the beginning of the line.
.TP
.B Control-E
Move the cursor to the end of the line.
.TP
.B Control-K
Delete all characters from the current cursor position up to the end of the
line.
.TP
.B Control-U
Delete all characters from the beginning of the line up to the current
cursor position.
.TP
.B Delete
.TP
.B BackSpace
Delete the character left of the cursor.
.TP
.B Control-D
Delete the character under the cursor.
.TP
.B Enter Return
Accept the line.
.TP
.B Escape
Discard the line.
.B Note:
This is different from
.BR vi .
.TP
.B TAB
Try to complete currently typed word.  If the completion is not unique,
the word is completed as far as unique.  If the
.BR TAB -key
is hit twice on the same position,  a list of all possible completions is
displayed.
.\"
.\" --- Section -- REGULAR EXPRESSIONS ----------------------------------------
.\"
.SH REGULAR EXPRESSIONS
In this section it is assumed that you are familiar with REs (regular
expressions).
In most applications
.RB ( egrep ", " vi ", ...)"
REs work on lines, that means it is not possible to use a RE containing
a line break (newline character).
In
.BR hexer ,
the buffer is not split up into distinct lines and a newline character
is considered to be a `normal' character, now here's the problem:
imagine searching for "a.*b" in a 5 MB file, this would take very long
(might be up to several minutes on a slow machine).  That's why there's
a
.B maxmatch
limit (a repeat operator matches at most
.B maxmatch
occurrences of its operand).  The default value of
.B maxmatch
is 1024, but it may be customized using the
.BR :set -command.
For simple expressions (expressions for which the length of the match can
be determined from the expression) it is possible to override the
.B maxmatch
limit by doubling the `*' or `+' operator, e.g. "a.**b" or
"foo\\(bar\\)\\+\\+".
.br
Note that the context specifiers `^'/`$' (beginning/end of a line) and
`\\<'/`\\>' (beginning/end of a word) are available and actually do
what you expect.  If you don't want the atoms `.' and `[^...]' to match
the newline character you can set the
.B specialnl
option using the
.BR :set -command.
.br
To enter a special character, you can use the standard C `\\'\(hyescape
sequences.  To enter a character using its octal code, use a `\\o'\(hyprefix
followed by up to three octal digits.
(C-style octal escapes are not supported, because `\\0', ... `\\9' are
interpreted as back-references to subexpressions of the RE.)
To enter a character using it's hex code, type a `\\x'-prefix followed
by up to two hex digits; decimal codes can be entered using a `\\d'\(hyprefix
followed by up to three decimal digits.  It is possible to enter strings
of codes by doubling the base specifier, e.g. "\\xxfe ff 5a 7e" or
"\\oo276 277 132 176".  Note that such a string is treated as an atom, i.e.
the RE "\\xxff fe*" matches any number (<
.BR maxmatch )
of repetitions of
.BR "ff fe" .
.br
It is possible to use all kinds of character `\\'\(hyescapes (escapes
representing a single character) within `[]'\(hyranges.  Within a range,
the `o' selecting an octal base for the escape may be omitted, since
back-references within a range don't make sense.  When specifying a
minimum and/or maximum number of repetitions using the `\\{,}'\(hyoperator,
the numbers may be given in decimal (no prefix), octal (`0'-prefix) or
hex (`0x'-prefix).  If no maximum number is specified and the operand is
not a simple expression, at most
.B maxmatch
matches will be found.
.\"
.\" --- Section -- CALCULATOR -------------------------------------------------
.\"
.SH CALCULATOR
.B Hexer
provides a simple calculator
.RB ( myc )
capable of all operations available in C.
To enter a
.B myc
command just enter a
.B %
(percent) sign and an expression in infix notation.
It is possible to use parentheses.
.B myc
understands the following binary infix operators (from highest priority to
lowest):
.B **
(power),
.B *
(multiply),
.B /
(divide),
.B %
(modulo),
.B +
(add),
.B -
(subtract),
.B <<
(shift left),
.B >>
(shift right),
.B <
(less),
.B <=
(less or equal),
.B >
(greater),
.B >=
(greater or equal),
.B ==
(equal),
.B !=
(not equal),
.B &
(arithmetical and),
.B |
(arithmetical or),
.B ^
(arithmetical exclusive or),
.B &&
(logical and),
.B ||
(logical or),
.B =
(assign);  and the following unary prefix operators:
.B -
(negate, unary minus),
.B !
(logical not),
.B ~
(bitwise complement).
.B myc
knows three data types:
.BR boolean ,
.B integer
(32 bit),
.B float
(64 bit, equivalent to C double).
On some esoteric platforms the precision of integer and float may be
different.
As in C the result of a division depends on the data types of the operands.
An integer divided by an integer yields an integer.
If you want the result to be a float, make sure one of the operands is a
float, e.g. type
.I 4/7.
instead of
.I 4/7
or
.I a/(b+0.)
instead of
.IR a/b .
The power operation returns a float if the result is too large to fit in an
integer.
The result of a calculation is stored in the special variables
.B $$
and
.BI $ n
where
.I n
is the number of the command.
.\"
.\" --- Section -- BUGS -------------------------------------------------------
.\"
.SH BUGS
Probably.  Please report bugs to
.IR demetrio@cs.uni-sb.de .
.\"
.\" --- Section -- COPYRIGHT --------------------------------------------------
.\"
.SH COPYRIGHT
.B hexer
is
.BR "not in the public domain" ,
but freely distributable.  It may be used for any non-commercial purpose.
See file
.B COPYRIGHT
for details.
.\"
.\" --- Section -- AUTHOR -----------------------------------------------------
.\"
.SH AUTHOR
Sascha Demetrio
.br
.I demetrio@cs.uni-sb.de