mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-10-21 06:23:52 +00:00
Clean up
This commit is contained in:
@@ -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
|
||||
Executable
+27
@@ -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"
|
||||
Reference in New Issue
Block a user