Skip to content

Commit aa56903

Browse files
committed
Pretty up README.md and usage
1 parent 62b8493 commit aa56903

File tree

4 files changed

+90
-51
lines changed

4 files changed

+90
-51
lines changed

LICENSE

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2021, Nat!
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
1. Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
2. Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
3. Neither the name of the copyright holder nor the names of its
17+
contributors may be used to endorse or promote products derived from
18+
this software without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,33 @@
44

55
Non-ASCII characters will be escaped to hex or octal. C-escapes are used for
66
known C escapes like '\b'. The output is separated into lines of approximately
7-
even length and does not exceed the chosen line length. An example output
8-
is [usage.inc](src/usage.inc)
7+
even length and does not exceed the chosen line length. An example of a
8+
conversion is [usage.txt](src/usage.txt) being turned into [usage.inc](src/usage.inc).
99
You can feed it binary or text files.
1010

11-
You can then easily `#include` the output as string contents, or copy/paste it
12-
into your C program like so:
11+
You can `#include` the output as string contents, or copy/paste it into your C
12+
program like so:
1313

1414
```
15-
static char text[] =
15+
static char data[] =
1616
#include "data.inc"
1717
;
1818
```
1919

2020
> #### Note
2121
>
22-
> C will append a "\0" to strings!
22+
> C will append a '\0' character to strings! So the actual data length
23+
> is `sizeof( data) - 1`.
24+
25+
## Options
2326

2427
See the [usage.txt](src/usage.txt) for options.
2528

2629
## Example
2730

2831
Use mulle-c-string-escape to create a string representation of itself. We use
29-
`cmake` here instead of `mulle-sde craft --release` here too ease the fear
30-
of the unkown:
32+
`cmake` here, instead of `mulle-sde craft --release`, too ease the developers
33+
fear of the unknown:
3134

3235
```
3336
mkdir -p kitchen/Release
@@ -77,4 +80,11 @@ mulle-sde craft
7780

7881
## Dedication
7982

80-
This little tool is dedicated to the memory of Oliver Mondry (mondry@me.com)
83+
To the memory of Oliver "General" Mondry (mondry@me.com)
84+
85+
86+
## Author
87+
88+
[Nat!](//www.mulle-kybernetik.com/weblog) for
89+
[Mulle kybernetiK](//www.mulle-kybernetik.com).
90+

src/usage.inc

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
"Usage:\n"
2-
"\tmulle-c-string-escape [options] [infile] [outfile]\n"
2+
" mulle-c-string-escape [options] [infile] [outfile]\n"
33
"\n"
4-
"\xe2\x9e\xbf mulle-c-string-escape turns data into C-strings\n"
4+
" \xe2\x9e\xbf mulle-c-string-escape turns data into C-strings\n"
55
"\n"
6-
"Non-ASCII characters will be escaped to hex or octal. C-escapes are used for\n"
7-
"known C escapes like '\\b'. The output is separated into lines of approximately\n"
8-
"even length and does not exceed the chosen line length.\n"
9-
"You can feed it binary or text files.\n"
6+
" Non-ASCII characters will be escaped to hex or octal. C-escapes are used for\n"
7+
" known C escapes like '\\b'. The output is separated into lines of approximately\n"
8+
" even length and does not exceed the chosen line length.\n"
9+
" You can feed it binary or text files.\n"
1010
"\n"
11-
"You can then easily `#include` the output, or copy/paste it into your\n"
12-
"C program like so:\n"
11+
" You can then easily `#include` the output, or copy/paste it into your\n"
12+
" C program like so:\n"
1313
"\n"
14-
" static char data[] =\n"
15-
" #include \"data.inc\"\n"
16-
" ;\n"
17-
" #define s_data (sizeof( data) - 1)\n"
14+
" static char data[] =\n"
15+
" #include \"data.inc\"\n"
16+
" ;\n"
17+
" #define s_data (sizeof( data) - 1)\n"
1818
"\n"
1919
"Example:\n"
20-
"\tmulle-c-string-escape -0 -l 120 < mytext.txt\n"
20+
" mulle-c-string-escape -0 -l 120 < mytext.txt\n"
2121
"\n"
2222
"Options:\n"
23-
"\t-[01234] : zero to four space prefix (TAB)\n"
24-
"\t-h : this help\n"
25-
"\t-e : escape TAB characters\n"
26-
"\t-l <n> : targetted line length (80)\n"
27-
"\t-n : don't create a new line for linefeeds in text\n"
28-
"\t-p <s> : use a custom prefix instead of spaces or TAB\n"
29-
"\t-t <s> : visual size of TAB in text (8)\n"
23+
" -[01234] : zero to four space prefix (TAB)\n"
24+
" -h : this help\n"
25+
" -e : escape TAB characters\n"
26+
" -l <n> : targetted line length (80)\n"
27+
" -n : don't create a new line for linefeeds in text\n"
28+
" -p <s> : use a custom prefix instead of spaces or TAB\n"
29+
" -t <s> : visual size of TAB in text (8)\n"
3030
" -v : print version information and exit\n"
3131
"\n"
3232
"Dedication:\n"
33-
" This little tool is dedicated to the memory of Oliver Mondry (mondry@me.com)\n"
33+
" To the memory of Oliver \"General\" Mondry (mondry@me.com)\n"
3434
"\n"

src/usage.txt

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
Usage:
2-
mulle-c-string-escape [options] [infile] [outfile]
2+
mulle-c-string-escape [options] [infile] [outfile]
33

4-
➿ mulle-c-string-escape turns data into C-strings
4+
➿ mulle-c-string-escape turns data into C-strings
55

6-
Non-ASCII characters will be escaped to hex or octal. C-escapes are used for
7-
known C escapes like '\b'. The output is separated into lines of approximately
8-
even length and does not exceed the chosen line length.
9-
You can feed it binary or text files.
6+
Non-ASCII characters will be escaped to hex or octal. C-escapes are used for
7+
known C escapes like '\b'. The output is separated into lines of approximately
8+
even length and does not exceed the chosen line length.
9+
You can feed it binary or text files.
1010

11-
You can then easily `#include` the output, or copy/paste it into your
12-
C program like so:
11+
You can then easily `#include` the output, or copy/paste it into your
12+
C program like so:
1313

14-
static char data[] =
15-
#include "data.inc"
16-
;
17-
#define s_data (sizeof( data) - 1)
14+
static char data[] =
15+
#include "data.inc"
16+
;
17+
#define s_data (sizeof( data) - 1)
1818

1919
Example:
20-
mulle-c-string-escape -0 -l 120 < mytext.txt
20+
mulle-c-string-escape -0 -l 120 < mytext.txt
2121

2222
Options:
23-
-[01234] : zero to four space prefix (TAB)
24-
-h : this help
25-
-e : escape TAB characters
26-
-l <n> : targetted line length (80)
27-
-n : don't create a new line for linefeeds in text
28-
-p <s> : use a custom prefix instead of spaces or TAB
29-
-t <s> : visual size of TAB in text (8)
23+
-[01234] : zero to four space prefix (TAB)
24+
-h : this help
25+
-e : escape TAB characters
26+
-l <n> : targetted line length (80)
27+
-n : don't create a new line for linefeeds in text
28+
-p <s> : use a custom prefix instead of spaces or TAB
29+
-t <s> : visual size of TAB in text (8)
3030
-v : print version information and exit
3131

3232
Dedication:
33-
This little tool is dedicated to the memory of Oliver Mondry (mondry@me.com)
33+
To the memory of Oliver "General" Mondry (mondry@me.com)
3434

0 commit comments

Comments
 (0)