'C' Utilities
The links from this page contain the source code for little 'C' utilities which I have written,
and which I use on multiple sites. This page acts a a repository for the code for me, and you are
welcome to use anything on this page which you find of value.
- detab.c replaces all the TABs in a file with spaces. Usually I use this from within vi, and have two binaries called detab4 and detab8 which are compiled with the TABSTOP definition as 4 and 8 respectively
- tab.c replaces leading spaces with TABs.
- day_of_century.c produces a number of days since 01/01/2001 for a given date,
or visa versa. Two invocations are useful for determining the difference (in days) between two dates,
for example
echo $(day_of_century 25/12/2014) $(day_of_century 2010-01-01) - p |dc
- hexdmp.c Produces a character and hexidecimal version of a binary input
(as per the 6502 machine code monitor of a few years back). Note that for large file support (>2GB file sizes)
you may need something like
#define _FILE_OFFSET_BITS 64
(OS dependant) inserted before the #include
s.
- rm_quoted_crlf.c Removes quoted CRLF from a file, useful sometimes when processing CSVs
Not strictly 'C', but awk, the following is also useful
- adjust awk version of the old Unix command to align text