'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.

  1. 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
  2. tab.c replaces leading spaces with TABs.
  3. 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
  4. 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 #includes.
  5. 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

  1. adjust awk version of the old Unix command to align text