forked from shadowsocks/shadowsocks-libev
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
format with .uncrustify.cfg (shadowsocks#1759)
* format with .uncrustify.cfg format with .uncrustify.cfg * format with .uncrustify.cfg * format with .uncrustify.cfg exclude json.* base64.* uthash.h * format with .uncrustify.cfg exclude json.* base64.* uthash.h
- Loading branch information
1 parent
26ae365
commit cc1bb4c
Showing
22 changed files
with
500 additions
and
418 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
@echo off | ||
|
||
set root=%~dp0 | ||
set source=%root%src | ||
|
||
goto start | ||
|
||
:format | ||
set filelist=%1 | ||
for /r "%filelist%" %%f in (*) do ( | ||
if "%%~xf" equ ".h" ( | ||
call :format_file %%f | ||
) else if "%%~xf" equ ".c" ( | ||
call :format_file %%f | ||
) | ||
) | ||
goto end | ||
|
||
:format_file | ||
set f=%1 | ||
if "%~n1" neq "base64" ( | ||
if "%~n1" neq "json" ( | ||
if "%~n1" neq "uthash" ( | ||
echo 'format file "%f%"' | ||
uncrustify -c %root%\.uncrustify.cfg -l C --replace --no-backup %f% | ||
DEL %~dp1*.uncrustify >nul 2>nul | ||
) | ||
) | ||
) | ||
goto end | ||
|
||
:start | ||
call :format %source% | ||
|
||
:end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env bash | ||
|
||
root=$(pwd) | ||
source="$root"/src | ||
|
||
function format() { | ||
filelist=$(ls "$1") | ||
pushd "$1" | ||
for file in $filelist; do | ||
if test -d "$file"; then | ||
echo "format directory $file" | ||
format "$file" | ||
else | ||
if ([ "${file%%.*}" != "base64" ] && | ||
[ "${file%%.*}" != "json" ] && | ||
[ "${file%%.*}" != "uthash" ]) && | ||
([ "${file##*.}" = "h" ] || [ "${file##*.}" = "c" ]); then | ||
echo "format file $file" | ||
uncrustify -c "$root"/.uncrustify.cfg -l C --replace --no-backup "$file" | ||
rm ./*.uncrustify >/dev/null 2>&1 | ||
fi | ||
fi | ||
done | ||
popd | ||
} | ||
|
||
format "$source" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.