aboutsummaryrefslogtreecommitdiff
path: root/a8eol.rst
blob: ff81d824a604b1ea7737007e6059970c77d75ba3 (plain)
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
.. RST source for a8eol(1) man page. Convert with:
..   rst2man.py a8eol.rst > a8eol.1
.. rst2man.py comes from the SBo development/docutils package.

=====
a8eol
=====

-------------------------------------------------------
convert Atari 8-bit text files to/from UNIX/Windows/Mac
-------------------------------------------------------

.. include:: manhdr.rst

SYNOPSIS
========

**a8eol** [*-admu8tcpsxih*] [*infile*] [*outfile*]

DESCRIPTION
===========

**a8eol** converts between ATASCII and UNIX, MS-DOS/Windows, and
Mac text file formats. It can auto-detect the input file format
and set the output format accordingly, or the user can explicitly
set the input and output formats. Various options are available for
translating non-printing characters, including a mode similar to what
old computer magazines used for program listings.

OPTIONS
=======

File type options:
------------------

-a
  Input is UNIX, MS-DOS/Windows, or MacOS < 10 text; convert to Atari (EOL=$9B)

-d
  Input is Atari text; convert to MS-DOS/Windows (EOL=$0A,$0D)

-m
  Input is Atari text; convert to MacOS < 10 (EOL=$0D)

-u
  Input is Atari text; convert to UNIX (EOL=$0A)

With none of the above: input type is  auto-detected;  output  type  is
UNIX if input is Atari, or Atari if input is UNIX/DOS/Mac.

Only  one  file  type option can be used per run of **a8eol**. If more than
one is given, the last one occurring on the command line will be used.

Translation options:
--------------------

-n
  Translate EOL characters only; pass anything else as-is (including
  tabs and backspaces).

-c
  Replace  non-printing  characters  with  ^x (ASCII input) or {x}
  (ATASCII input). This option also enables the  **-8**  option.  When
  the  input file is ATASCII, the output resembles a program list‐
  ing from an old computer magazine (see **ATASCII CODES**, below).

-p
  Replace non-printing characters with *.* (period, dot).

-s
  Remove (strip) non-printing characters.

-x
  Replace non-printing characters with *\\x[hex]*.

With none of the above: EOL, tab, and backspace characters  are
translated; everything else is passed through as-is.

Only  one translation option can be used per run of **a8eol**. If more than
one is given, the last one occurring on the command line will be used.

Other options:
--------------

-8
  8-bit ASCII/ATASCII mode: Do not strip bit  7  (inverse  video).
  This option may be used alone or combined with any of the
  translation options, above.  Characters with bit 7 set are
  considered non-printing.  This option is always enabled when **-c**
  is used.

-i
  In-place  conversion. Original file renamed to *infile~*. This option
  can't be used when reading from standard input.

-q
  Quiet operation. Error messages will still be printed.

-v
  Verbose operation. Prints extra info about what **a8eol** is doing.

-h
  Print built-in help message and exit.

Leave *infile* blank or use **-** to read from  standard  input  (in  which
case, don't use the **-i** option).

Leave *outfile* blank or use **-** to write to standard output.

NOTES
=====

Without  the **-8** option, bit 7 is stripped (cleared) for all input
characters, *except* for the ATASCII EOL ($9B) character (when the
input  is an  Atari file). Bit 7 stripping occurs for each input
character *before* any of the translation options are applied.

The input type auto-detection isn't perfect. It scans from  the
beginning  of  the input, looking for either an ATASCII EOL or
an ASCII carriage return or linefeed. An Atari file with ATASCII
graphics  may  be mis-detected  as an ASCII file, if it contains
any $0A or $0D bytes before the first EOL ($0A and $0D are graphics
characters,  in  ATASCII).  If this happens, force Atari input with
**-d**, **-m**, or **-u**.

The auto-detection also fails with an "Illegal seek" error when
reading from a pipe (e.g. **cat file | a8eol**). To avoid this, either
set the  input  type  explicitly  with one of **-[admu]**, or read from a
regular file (possibly a temporary one created just for this purpose).
This  is  a bug  (not  a feature), but probably not worth the time
it'd take to fix it.

The **-a** option is "magical" in that it can handle input with UNIX
(*\\n*), DOS (*\\r\\n*), or Mac Classic (*\\r* only) line endings. In fact, it
can handle an input file containing any combination of the three  line
ending types in the same file.

ATASCII CODES
=============

When  the *-c* option is used on ATASCII input, the special Atari
character codes are translated into human-readable descriptive
strings.  This is similar  to the way old magazines (Compute!, Antic,
Analog) printed ATASCII codes in typeset program listings.

List of code translations:

.. csv-table::
  :header: "Dec", "Hex", "Keystroke(s)", "Description"

  "--","--","{inv}","Inverse Video (800: Atari Logo)","Start a sequence of inverse video characters"
  "--","--","{norm}","Inverse Video (800: Atari Logo)","End a sequence of inverse video characters (back to normal)"
  "0","00","{ctrl-,}","Ctrl ,","Heart; replaces ASCII NUL"
  "27","1B","{esc}","Esc Esc","Literal Escape character"
  "28","1C","{up}","Esc Ctrl -","Cursor Up"
  "29","1D","{down}","Esc Ctrl =","Cursor Down"
  "30","1E","{left}","Esc Ctrl +","Cursor Left"
  "31","1F","{right}","Esc Ctrl \*","Cursor Right"
  "96","60","{ctrl-.}","Ctrl .","Diamond; replaces ASCII grave accent: \`"
  "123","7B","{ctrl-;}","Ctrl ;","Club; replaces ASCII left brace: {"
  "125","7D","{clear}","Esc Ctrl < or Esc Shift <","Clear screen (CLR/HOME on 800); Replaces ASCII right brace: }"
  "126","7E","{bksp}","Esc Backspace","Backspace (BACK S on 800); Replaces ASCII tilde: ~"
  "127","7F","{tab}","Esc Tab","Tab to next tab stop; Replaces ASCII DEL: ~"
  "155","9B","--","Enter","Atari EOL (translated to \\n, \\r\\n, or \\r)"
  "156","9C","{del-line}","Esc Shift BackSp","Delete logical line @ cursor"
  "157","9D","{ins-line}","Esc Shift >","Insert blank line @ cursor"
  "158","9E","{clr-tab}","Esc Ctrl Tab","Clear current tab stop"
  "159","9F","{set-tab}","Esc Shift Tab","Set tab stop @ cursor position"
  "253","FD","{bell}","Esc Ctrl 2","Ring bell (800: internal spkr)"
  "254","FE","{del-char}","Esc Ctrl BackSp","Delete character @ cursor"
  "255","FF","{ins-char}","Esc Ctrl >","Insert one space @ cursor"

Other control characters are listed as *{ctrl-X}*, where *X*  is  the
keystroke to use for entering the character.

.. other sections we might want, uncomment as needed.

.. FILES
.. =====

.. ENVIRONMENT
.. ===========

EXIT STATUS
===========

0 for success, non-zero for any error. Error messages are printed to **stderr**.

.. BUGS
.. ====

.. EXAMPLES
.. ========

.. include:: manftr.rst