-lite | Frog DNA, basically
Table of Contents
NOTE: Incompatible changes in v2.0 compared to v1.x!
Introduction
Libite is a lightweight library of frog DNA that can be used to fill the gaps in any dinosaur project. It holds useful functions and macros developed by both Finit and the OpenBSD project. Most notably the string functions: strlcpy(3), strlcat(3) and the highly useful *BSD sys/queue.h and sys/tree.h API's.
Libite holds many of the missing pieces in GNU libc, although -lite does
not aim to become another GLIB. One noticeable gap in GLIBC is the
_SAFE macros available in the BSD sys/queue.h API — highly
recommended when traversing lists to delete/free nodes.
The code is open sourced under a mix of permissive Open Source licenses: MIT/X11 license, ISC license, and BSD licenses.
Tip: have a look at my blog post about other useful UNIX API's! https://troglobit.com/post/2020-02-22-useful-unix-apis/
Using -lite
Libite is by default installed as a library and a set of include files.
To prevent clashing with include files of the same name -lite employs
an include file namespace libite/, which is strongly recommended to
use in your applications:
#include <libite/lite.h>
#include <libite/conio.h>
#include <libite/queue.h>
#include <libite/tree.h>
Note: prior to v2.5.0, the
lite/namespace was used for headers, which is still available in the default install. This clashed with the headers of the LiTE library from the DirectFB project.
The output from the pkg-config tool holds no surprises:
$ pkg-config --libs --static --cflags libite
-I/usr/local/include -D_LIBITE_LITE -L/usr/local/lib -lite
Note:
_LIBITE_LITEis defined since v2.5.0, useful for software that want to be able to build against headers from an older libite:#ifdef _LIBITE_LITE # include <libite/lite.h> #else # include <lite/lite.h> #endif
The prefix path /usr/local/ shown here is only the default. Use the
configure script to select a different prefix when installing libite.
For GNU autotools based projects, use the following in configure.ac:
# Check for required libraries
PKG_CHECK_MODULES([lite], [libite >= 1.5.0])
and in your Makefile.am:
proggy_CFLAGS = $(lite_CFLAGS)
proggy_LDADD = $(lite_LIBS)
API Documentaion: https://codedocs.xyz/troglobit/libite/
Build & Install
This library was initially built for and developed on GNU/Linux systems as a light weight utility library, these days NetBSD should also work.
$ ./configure
$ make -j5
$ sudo make install-strip
$ sudo ldconfig
Use ./configure --without-symlink to prevent the install step
from creating the lite -> libite/ compatibility symlink for the header
files, required for systems with DirectFB LiTE. The default, however,
is to install the symlink to ensure compatibility with existing software
that depends on the -lite library headers in their previous namespace.
Note: When checking out code from GIT, use ./autogen.sh
to generate a configure script. It is a generated file and otherwise
only included in released tarballs.
Origin & References
Much of the code in libite (-lite) is written by Claudio Matsuoka for the original Finit and released under the MIT/X11 license. Joachim Wiberg later improved on the Finit code base and included pieces of software released under the ISC and BSD licenses. See each respective file for license details.
Copyright (c) 2008-2010 Claudio Matsuoka <cmatsuoka@gmail.com> Copyright (c) 2008-2023 Joachim Wiberg <troglobit@gmail.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Contributing to the Project
Thank you for considering contributing back to Free Software!
There are a few things we would like you to consider when filing an issue or pull request with this project:
-
If you are filing a bug report or feature request
Please take the time to check if an issue already has been filed matching your problem
-
What version are you running, have you tried the latest release?
UNIX distributions often package and test software for their particular brand. If you are using a pre-packaged version, then please file a bug with that distribution instead.
-
Coding Style
Lines are allowed to be longer than 72 characters these days, there is no enforced max. length.
Tip: Always submit code that follows the style of surrounding code!
The coding style itself is strictly Linux KNF, like GIT it is becoming a de facto standard for C programming
https://www.kernel.org/doc/Documentation/CodingStyle
-
Logical Change Sets
Changes should be broken down into logical units that add a feature or fix a bug. Keep changes separate from each other and do not mix a bug fix with a whitespace cleanup or a new feature addition.
This is important not only for readability, or for the possibility of maintainers to revert changes, but does also increase your chances of having a change accepted.
-
Commit messages
Commit messages exist to track why a change was made. Try to be as clear and concise as possible in your commit messages, and always, be proud of your work and set up a proper GIT identity for your commits:
git config --global user.name "J. Random Hacker" git config --global user.email random.j.hacker@example.comSee this helpful guide for how to write simple, readable commit messages, or have at least a look at the below example.
http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
Example
Example commit message from the Pro Git online book, notice
how git commit -s is used to automatically add a Signed-off-by:
Capitalized, short (50 chars or less) summary
More detailed explanatory text, if necessary. Wrap it to about 72
characters or so. In some contexts, the first line is treated as the
subject of an email and the rest of the text as the body. The blank
line separating the summary from the body is critical (unless you omit
the body entirely); tools like rebase can get confused if you run the
two together.
Write your commit message in the imperative: "Fix bug" and not "Fixed bug"
or "Fixes bug." This convention matches up with commit messages generated
by commands like git merge and git revert.
Further paragraphs come after blank lines.
- Bullet points are okay, too
- Typically a hyphen or asterisk is used for the bullet, followed by a
single space, with blank lines in between, but conventions vary here
- Use a hanging indent
Signed-off-by: J. Random Hacker <random.j.hacker@example.com>
Security Policy
Supported Versions
libite (-lite) is a small project, as such we have no possibility to support older versions. The only supported version is the latest released on GitHub:
https://github.com/troglobit/libite/releases
Reporting a Vulnerability
Contact the project's main author and owner to report and discuss vulnerabilities.