Arch manual pages

addinclude(1) addinclude(1)

NAME

addinclude - adds an include to a C or C++ header- or source file

SYNOPSIS

addinclude filename include

DESCRIPTION

Addinclude provides a simple way to add includes to source or header files for C or C++.
 
Sometimes, a patch is overkill and search and replace does not cut it, due to include gards.
 
Addinclude adds the includes after the first #ifdef and preferrably together with the other #include lines.
 
If the header is empty, or there are no #ifdefs or #includes, the include is inserted at the top of the file.

EXAMPLES

addinclude - by itself returns errorcode 1 at exit
 
addinclude file.h '#include <string.h>' - adds #include <string.h> to file.h
 
addinclude file.h stdlib - adds #include <stdlib.h> to file.h
 
addinclude file.h ´"some.h"´ - adds #include "some.h" to file.h
 
addinclude --nofix file.h ´"#include <some>"´ - don't change the include text
 
addinclude --top file.h ´"#include <firstpost.h>"´ - place the include at the top
 
addinclude --c++ file.cpp memory - adds #include <memory> to file.cpp

OPTIONS

--version or -v
displays the current version number
--help or -h
displays brief informative text about usage
--nofix or -n
don't change the given include text
--top or -t
add the include at the very top
--c++ or -+
don't add .h to the include name
--verbose or -V
slightly more verbose output

WHY

Aims to solve a tiny problem properly instead of a thousand problems halfway, in true UNIX-spirit
 
Makes a common case easy to solve
 
Has clear syntax
 
Is only one small executable, not a big package

SEE ALSO

sed(1)

VERSION

1.0

BUGS

Only unknown bugs so far.

AUTHOR

addinclude was written by Alexander F Rødseth <xyproto@archlinux.org>.
16 Nov 2017