Skip to content

Instantly share code, notes, and snippets.

@zchee
Forked from paulfryzel/gist:3947535
Created November 12, 2015 22:36
Show Gist options
  • Save zchee/37f718b2232511d8e3f2 to your computer and use it in GitHub Desktop.
Save zchee/37f718b2232511d8e3f2 to your computer and use it in GitHub Desktop.
like gofmt but for c... and using astyle
#!/usr/bin/env bash
# mostly from http://word.bitly.com/post/31921713978/static-analysis
function cfmt {
if [[ $# -ne 1 ]]; then
echo "Usage: cfmt <file>"
else
astyle \
--style=1tbs \
--lineend=linux \
--convert-tabs \
--preserve-date \
--pad-header \
--indent-switches \
--align-pointer=name \
--align-reference=name \
--pad-oper \
--suffix=none \
$1
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment