view tools/call_Uncrustify.bat @ 801:71b89219671c default tip

Fix Debian package rules for Qt5 build.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 13 Apr 2018 02:02:51 +0300
parents 67a46ff9cac2
children
line wrap: on
line source

@echo off

IF (%1)==() GOTO error
dir /b /ad %1 >nul 2>nul && GOTO indentDir
IF NOT EXIST %1 GOTO error
goto indentFile

:indentDir
set searchdir=%1

IF (%2)==() GOTO assignDefaultSuffix
set filesuffix=%2

GOTO run

:assignDefaultSuffix
::echo !!!!DEFAULT SUFFIX!!!
set filesuffix=*

:run
FOR /F "tokens=*" %%G IN ('DIR /B /S %searchdir%\*.%filesuffix%') DO (
echo Indenting file "%%G"
"../indenters/uncrustify.exe" -f "%%G" -c "./uncrustify.cfg" -o indentoutput.tmp
move /Y indentoutput.tmp "%%G"

)
GOTO ende

:indentFile
echo Indenting one file %1
"../indenters/uncrustify.exe" -f "%1" -c "./uncrustify.cfg" -o indentoutput.tmp
move /Y indentoutput.tmp "%1"


GOTO ende

:error
echo .
echo ERROR: As parameter given directory or file does not exist!
echo Syntax is: call_Uncrustify.bat dirname filesuffix
echo Syntax is: call_Uncrustify.bat filename
echo Example: call_Uncrustify.bat temp cpp
echo .

:ende