Skip to content
This repository
Octocat-spinner-32 documentation Support newline addition/removal before opening brace for C++11 lambda. June 04, 2013
Octocat-spinner-32 etc Correcting issues in default objc.cfg October 13, 2013
Octocat-spinner-32 man Allow "-" to mean read filenames from stdin with -F/--files. March 16, 2013
Octocat-spinner-32 osx Add missing osx directory. October 25, 2009
Octocat-spinner-32 scripts Added a script that generates uncrustify_version.h on windows. February 25, 2012
Octocat-spinner-32 src Fix indent error if an open paren is the first thing on a line April 03, 2014
Octocat-spinner-32 tests Fix wrong test result. April 03, 2014
Octocat-spinner-32 uncrustify.xcodeproj Allow removal or addition of newlines after blocks. December 09, 2013
Octocat-spinner-32 win32 Add VS2011 project files (Oleg Smolsky) March 29, 2012
Octocat-spinner-32 .gitignore Updating “.gitignore” for Xcode 4. April 26, 2012
Octocat-spinner-32 AUTHORS Import r1644 from subversion October 17, 2009
Octocat-spinner-32 BUGS Import r1644 from subversion October 17, 2009
Octocat-spinner-32 COPYING Import r1644 from subversion October 17, 2009
Octocat-spinner-32 ChangeLog Fix the version in the ChangeLog January 14, 2013
Octocat-spinner-32 HELP Import r1644 from subversion October 17, 2009
Octocat-spinner-32 INSTALL Import r1644 from subversion October 17, 2009
Octocat-spinner-32 Makefile.am Use silent rules instead of nostdinc May 28, 2010
Octocat-spinner-32 Makefile.in Run autogen.sh on Ubuntu 12.10. January 01, 2013
Octocat-spinner-32 NEWS Import r1644 from subversion October 17, 2009
Octocat-spinner-32 README Update the README file to indicate that bugs should go on the sf.net … September 05, 2013
Octocat-spinner-32 TESTING Tweaks to the TESTING how-to August 26, 2011
Octocat-spinner-32 aclocal.m4 Run autogen.sh on Ubuntu 12.10. January 01, 2013
Octocat-spinner-32 autogen.sh Import r1644 from subversion October 17, 2009
Octocat-spinner-32 commit.log Update commit.log January 01, 2013
Octocat-spinner-32 config.guess Import r1644 from subversion October 17, 2009
Octocat-spinner-32 config.sub Import r1644 from subversion October 17, 2009
Octocat-spinner-32 configure Run autogen.sh on Ubuntu 12.10. January 01, 2013
Octocat-spinner-32 configure.in Update version number to 0.60 January 01, 2013
Octocat-spinner-32 extras.vpj Add a few files to the workspace January 01, 2013
Octocat-spinner-32 install-sh Run autogen.sh on Ubuntu 12.10. January 01, 2013
Octocat-spinner-32 make_token_names.sh Remove the date from token_names.h/make_token_names.sh December 28, 2012
Octocat-spinner-32 make_win32.sh Add a script to build a win32 release zip on linux March 08, 2010
Octocat-spinner-32 missing Run autogen.sh on Ubuntu 12.10. January 01, 2013
Octocat-spinner-32 release-steps.txt Save off changes for version 0.59 October 04, 2011
Octocat-spinner-32 run_tests.sh Import r1644 from subversion October 17, 2009
Octocat-spinner-32 uncrustify.vpj Add ability to get config from UNCRUSTIFY_CONFIG env var to win32 December 29, 2011
Octocat-spinner-32 uncrustify.vpw Update SlickEdit project files October 08, 2011
Octocat-spinner-32 update-default-cfg.sh Import r1644 from subversion October 17, 2009
Octocat-spinner-32 working.txt save off work in the freebsd branch December 05, 2009
README
README for Uncrustify
=====================

Post any bugs to the issue tracker found on the project's Sourceforge page:
  http://sourceforge.net/projects/uncrustify

Please include the following with your issue:
 - a description of what is not working right
 - input code sufficient to demonstrate the issue
 - expected output code
 - configuration options used to generate the output

If the issue cannot be easily reproduced, then it isn't likely to be fixed.


Building the program
--------------------

Quick start:
 $ ./configure
 $ make

The executable is src/uncrustify.
Copy that to your ~/bin/ folder or wherever you want.


Building the program using Xcode on Mac OS X
---------------------------------------------

You can of course just open the Xcode project and build uncrustify using the
default 'Debug' configuration but if you want to install it the 'Install'
configuration will not work from within Xcode.

For that you will have to use the Xcode command line tool 'xcodebuild'.

To do that, cd into the uncrustify project folder where uncrustify.xcodeproj
resides and enter the following command:

sudo xcodebuild -configuration 'Install'

You will be prompted for the root level password. By doing this you will install
uncrustify into /usr/local/bin. The install location can be changed by editing
the Build Settings for the uncrustify target. The setting you need to change is
called, surprisingly enough, 'Installation Directory'.


Configuring the program
-----------------------

Examine the example config files in etc and/or read
documentation/htdocs/configuration.txt.
Copy the existing config file that closely matches your style and put in
~/.uncrustify/.  Modify to your liking.


Running the program (and refining your style)
---------------------------------------------

As of the current release, I don't particularly trust this program to not make
mistakes and screw up my whitespace formatting.

Here's how to run it:
$ uncrustify -c ~/.uncrustify/mystyle.cfg -f somefile.c > somefile.c.unc

The -c option selects the configuration file.
The -f option specifies the input file.
The output is sent to stdout.  Error messages are sent to stderr.

Use a quality side-by-side diff tool to determine if the program did what you
wanted.
Repeat until your style is refined.


Running the program (once you've found your style)
--------------------------------------------------

Write a script to automate the above.
Check out etc/dofiles.sh for an example.
That script is used as follows:
1. navigate one level above your project
2. make a list of file to process
  $ find myproj -name "*.[ch]" > files.txt
3. sh etc/dofiles.sh files.txt
4. Use your favorite diff/merge program to merge in the changes
  $ xxdiff out/myproj myproj
Something went wrong with that request. Please try again.