Skip to content

Instantly share code, notes, and snippets.

@MicahElliott
Created November 28, 2010 07:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MicahElliott/718675 to your computer and use it in GitHub Desktop.
Save MicahElliott/718675 to your computer and use it in GitHub Desktop.
A personal indentation config for C files, using ‘indent’.
#! /bin/bash
# A personal indentation config for C files, using ‘indent’.
#
# Every project should agree on and share one of these!
#
# Install ‘indent’: apt-get install indent
# See ‘indent(1)’ for the other 100 options to consider.
#
# Backups are funny. Using an explicit file here, since most careful
# use involves running on one file at a time, which affects backup
# scheme.
origfile="${1?Provide a C input file}"
backup="$1.NOINDENT"
cp "$origfile" "$backup"
#--braces-on-if-line
cmd="
indent
--dont-break-procedure-type
--tab-size2
--no-tabs
--indent-level3
--no-space-after-parentheses
--no-space-after-function-call-names
$origfile
"
eval $cmd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment