@echo off
set base_dir="%~dp0"

if "%1"=="-f" (
shift
goto :find_file
) else (
if "%1"=="-d" (
shift
goto :extract_pkg
) else (
if "%1"=="-r" (
shift
goto :extract_2pkgs
) else (
if "%1"=="-l" (
shift
goto :list_pkg
) else (
echo "unknown option!"
exit /b 1
)
)
)
)
goto :eof


:find_file
cd /d %1
%base_dir%\find . -name %2
exit /b

:extract_pkg
echo %1
echo %2
cd /d %1
%base_dir%\rpm2cpio -x %2
exit /b

:extract_2pkgs
echo %1
echo %2
echo %3
cd /d %1
call %base_dir%\rpm2cpio -x %2
call %base_dir%\rpm2cpio -x %3
exit /b

:list_pkg
echo %1
%base_dir%\rpm2cpio -l %1
exit /b
