.\" .\" libexplain - Explain errno values returned by libc functions .\" Copyright (C) 2008-2011 Peter Miller .\" Written by Peter Miller .\" .\" This program is free software; you can redistribute it and/or modify .\" it under the terms of the GNU General Public License as published by .\" the Free Software Foundation; either version 3 of the License, or (at .\" your option) any later version. .\" .\" This program is distributed in the hope that it will be useful, .\" but WITHOUT ANY WARRANTY; without even the implied warranty of .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU .\" General Public License for more details. .\" .\" You should have received a copy of the GNU General Public License .\" along with this program. If not, see . .\" .ad l .hy 0 .nf .so etc/version.so

# libexplain \*(v)

The libexplain project provides a library which may be used to explain Unix and Linux system call errors. This will make your application's error messages much more informative to your users.

The library is not quite a drop-in replacement for strerror, but it comes close. Each system call has a dedicated libexplain function, for example

>     fd = open(path, flags, mode);
>     if (fd < 0)
>     {
>         fprintf(stderr, "%s\en", explain_open(path, flags, mode));
>         exit(EXIT_FAILURE);
>     }

| ‘I think it's totally awesome, in the category of “why hasn't this existed for n years” awesome.’ — Parker san

If, for example, you were to try to open `no-such-dir/some-file`, you would see a message like

> `open(pathname = "no-such-dir/some-file", flags = O_RDONLY) failed, No such file or directory (2, ENOENT) because there is no "no-such-dir" directory in the current directory`

The good news is that for each of these functions there is a wrapper function, in this case explain_open_or_die(3), that includes the above code fragment. Adding good error reporting is as simple as using a different, but similarly named, function. The library also provides thread safe variants of each explanation function.

The coverage for system calls is being improved all the time, as you can see from this documentation page generated from the source code. .so etc/coverage.so

## Documentation

- The LCA 2010 talk, “No medium found: when it's time to stop trying to read strerror's mind” is a available as PDF, and the slides are available as HTML.
- There is full documentation of all API functions. This is the interface users of the library may use.
- There is full documentation of all internal functions. This includes all of the functions internal to the library, for libexplain developers to use.
- The above documentation is generated from the source files, via Doxygen.
- Want to help? Here is a list of places in the source code marked “FIXME”.

## Download

There are several ways you can obtain the software, as either source code or pre-compiled binaries.

| Master Sources The following files are available for download from this web site:
File | Description
--- | ---
libexplain-\*(V).README | The README file form the tarball.
libexplain-\*(V).tar.gz | The complete source.
libexplain-\*(V).pdf | The reference manual, in PDF format.
| Sourceforge Downloads The best possible download speed for the source tarball will be from the SourceForge download pages here is the most recent tarball from there.
> | Ubuntu Packages If you use Ubuntu Linux, there are pre-built packages available for installation using the normal `sudo apt-get install` method, from this package archive (PPA). Instructions are available there for how to manually add the PPA to your `/etc/apt/sources.list` file, but the following commands are sufficient on recent versions of Ubuntu:
>     sudo add-apt-repository ppa:pmiller-opensource/ppa
>     sudo apt-get update
>     sudo apt-get install libexplain-dev
| Debian Packages The libexplain project is available as part of Debian Linux. The libexplain project is available as part of Ubuntu Linux. The most recent version is usually available from the PPA. This web site also provides pre-built Debian packages for .so etc/lsb-release.so
| Aegis Libexplain is developed using Aegis DVCS The Aegis repository for this project is available. The complete source is available in aedist(1) format.

.\" ------------------------------------------------------------------------

## Services provided by SourceForge

- Mailing list is libexplain-users@lists.sourceforge.net, and you can subscribe here.
- SourceForge project page.
- SourceForge download page, and most recent tarball link.
- SourceForge trackers page: the bug tracker, the patch tracker, and feature requests.

## Services provided by Debian

- Debian main build farm
- Debian ports build farm.

.\" ------------------------------------------------------------------------

| Libexplain is written and owned by Peter Miller <pmiller@opensource.org.au> and is freely distributable under the terms and conditions of the GNU LGPL, so you may use libexplain with proprietary programs. |  | There is more Software by Peter Miller at his home page. |

.\" ------------------------------------------------------------------------

This page is hosted by SourceForge.
This page has been accessed approximately times since .ds MO1 Jan .ds MO2 Feb .ds MO3 Mar .ds MO4 Apr .ds MO5 May .ds MO6 Jun .ds MO7 Jul .ds MO8 Aug .ds MO9 Sep .ds MO10 Oct .ds MO11 Nov .ds MO12 Dec .nr y4 \n[yr]+1900 \n[dy]-\*[MO\n[mo]]-\n[y4].