Preparing repo for semi-automatic code formatting in accordance with project coding style, using the astyle open source tool. Creating README.astyle and 2 astyle config files containing rules for format of .c and .h files

This commit is contained in:
Alexander
2018-06-18 13:49:39 +03:00
parent 4ac1c29ca9
commit 6038064e71
3 changed files with 20 additions and 0 deletions

18
README.astyle Normal file
View File

@@ -0,0 +1,18 @@
Use the _astylerc config file and the 'astyle' util to format the
project source files in accordance with the project coding style.
At project top level run these commands:
1. To format the .c files:
$ find . -type f -name "*.c" | xargs astyle --options=_astylerc-c
-OR- (to skip creation of backup files)
$ find . -type f -name "*.c" | xargs astyle --options=_astylerc-c -n
2. To format the .h files:
$ find . -type f -name "*.h" | xargs astyle --options=_astylerc-h
-OR- (to skip creation of backup files)
$ find . -type f -name "*.h" | xargs astyle --options=_astylerc-h -n
3. To remove the backup file created by astyle:
$ find . -type f -name "*.bak" -delete # this are *.c backup files
$ find . -type f -name "*.orig" -delete # this are *.h backup files

1
_astylerc-c Normal file
View File

@@ -0,0 +1 @@
--style=kr --convert-tabs --indent=spaces=4 --indent-switches --pad-oper --unpad-paren --align-pointer=middle --suffix=.bak --lineend=linux --min-conditional-indent=

1
_astylerc-h Normal file
View File

@@ -0,0 +1 @@
--convert-tabs --indent=spaces=4