view bcc.1 @ 32:d41fa28014a4 default tip @

misc: update copyright years
author David Demelier <markand@malikania.fr>
date Thu, 04 Jan 2024 10:17:16 +0100
parents fa16422c777a
children
line wrap: on
line source

.\"
.\" Copyright (c) 2020-2024 David Demelier <markand@malikania.fr>
.\"
.\" Permission to use, copy, modify, and/or distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd April 13, 2021
.Dt BCC 1
.Os
.\" NAME
.Sh NAME
.Nm bcc
.Nd binary to C/C++ arrays converter
.\" SYNOPSIS
.Sh SYNOPSIS
.Nm bcc
.Op Fl 0cs
.Op Fl I Ar tab-num
.Op Fl i Ar space-num
.Op Fl t Ar type
.Ar filename
.Ar variable
.\" DESCRIPTION
.Sh DESCRIPTION
The
.Nm
utility converts the
.Ar input
file into a C or C++ array named
.Ar variable
that can be embedded as-is in the source code. A special
.Ar -
value can be passed as input which will read standard input instead.
.Pp
The
.Ar variable
can contain any character but only ones that are allowed in the C standard will
be kept, other will be replaced with a
.Dq _ .
Also, the extension (by finding the first .) is removed as well. This can be
handy when generating a lots of file based on their names during a build
process.
.Pp
Note: you must still not start a variable name with digits.
.Pp
The following options are available:
.Bl -tag -width space-num-xxx
.It Fl 0
Terminate the generated array with a trailing NUL.
.It Fl c
Generates a
.Em const
array.
.It Fl I Ar tab-num
Use
.Ar tab-num
count as leading tab indents.
.It Fl i Ar space-num
Use
.Ar space-num
count as leading space indents.
.It Fl s
Generates a
.Em static
array.
.It Fl t Ar type
Changes the array char type to store the data content which defaults to
.Ar unsigned char .
.El
.\" EXAMPLES
.Sh EXAMPLES
Create a static const array from an image.
.Bd -literal -offset indent
bcc -sc image.png image > image.h
.Ed
.Pp
Create a modifiable char NUL-terminated array from a text file
.Bd -literal -offset indent
bcc -0 -t char text.txt text > text.h
.Ed
.\" HISTORY
.Sh HISTORY
The
.Nm
tool is inspired by
.Nm xxd
utility but offers more flexibility over the the generated code.
.\" SEE ALSO
.Sh SEE ALSO
.Xr xxd 1
.Sh AUTHORS
The
.Nm
utility was written by
.An David Demelier Aq Mt markand@malikania.fr .