Addinclude



What is it?

Addinclude is a small utility to add an include to a C header- or sourcefile, written in Go

Description

Addinclude provides a simple way to add includes to C header- or sourcefiles.
Sometimes, a patch is overkill and search and replace does not cut it.
Addinclude adds the includes after the first #ifdef and preferably 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
Why?
It aims to solve a tiny problem properly instead of a thousand problems halfway, in true UNIX-spirit.
It creates a line that is very easy to read, as opposed to using sed for the same task.
It should be very clear from the syntax what is being done.
It's only one small executable, not a big package.

Which parameters are supported?

--version or -v for the current version
--help or -h for quick help
--nofix or -n to don't touch the include statement given on the commandline
--top or -t to put the include at the top
Addinclude ordinarily only takes a filename and an include

Installation

Install the Arch Linux package with pacman -S addinclude or download the source.
There is also a source zip for Windows and the binary itself.
Here's the project page at github.
Alexander Rødseth 2013