||4 weeks ago|
|lib||4 weeks ago|
|m4||1 month ago|
|.gitignore||12 years ago|
|COPYING||12 years ago|
|README.md||4 weeks ago|
Incenp.org “Notch” Library
This is Incenp.org’s Notch Library. It’s a small, general-purpose C library aimed at providing various helper functions, including replacement implementations for non-standard functions available in some C libraries (mostly the GNU C library) but not in others.
Libnotch is distributed under the terms of the GNU General Public License (see COPYING).
The name “Notch” comes from the Notch gene, a component of a major signal transduction pathway in metazoans.
- vasprintf, asprintf. These functions are GNU extensions also available in BSD. They are analogs of vsprintf(3) and sprintf(3) but they take care of allocating a buffer large enough to hold the formatted string.
- err, errx, verr, verrx, warn, warnx, vwarn, vwarnx. These are BSD extension functions also available in the GNU C library. They print error messages on stderr and, for the err functions, terminate the program with the given exit status.
- getdelim, getline. These functions are GNU extensions that were later standardized in POSIX.1-2008. They read data from the given input stream into an automatically reallocated buffer until an end-of-line (getline) or any other specified delimiter (getdelim) is read.
- getsubopt. This function is part of the POSIX.1-2001 standard. It parses a string into comma-separated tokens.
- setprogname, getprogname. These functions are BSD extensions. They store and retrieve the name of the running program. They are used in the err functions above to print the name of the program in front of error messages.
- strchrnul. This function is a GNU extension. It searches for a character in a string, like strchr, but returns a pointer to the terminating null character, rather than NULL, if the character is not found.
- dlopen,dlsym. These functions are standardized in POSIX.1-2001, They open a dynamic library and search for a given symbol in it, respectively. This library provides a LoadLibrary-based implementation for Windows platforms.
Other helper functions
- commands module. This module implements a small command interpreter. It defines functions to parse a string, a string array or a file and call user-defined functions.
- baseenc and encoding modules. These modules provide function to encode and decode streams and buffers to and from various encodings (Base64, Base32, ZBase32, Quoted-Printable…).
- hexio module. This module defines functions to read and write data either in raw hexadecimal format or in hexdump’s “raw + ASCII” format.
- linebuf module. This module allows to read a line from a buffered input stream.
- readpwd. This function reads input from the terminal without echoing the characters on the terminal. It uses termios.h on Unix systems and the Windows API on Windows systems.
- splitstr. This function splits an input string on a specified delimiter and returns an newly allocated array of tokens.
- xmem module. This module provides “die-on-error” versions of several functions that allocate memory (e.g. malloc, strdup, etc.).
- xdg module. This module implements the XDG Base Directory Specification. It fills a structure containing the paths to the XDG directories, either read from the environment or assigned from default values.
- sbuffer module. This module provides an automatically allocated and growing string buffer to ease manipulation on strings.
- notch module. This module provide various other functions that do not belong to any other module.