Annotation of embedaddon/php/ext/session/mod_files.bat, revision 1.1
1.1 ! misho 1: @ECHO OFF
! 2: SETLOCAL ENABLEDELAYEDEXPANSION
! 3:
! 4: IF _%1_==_AUTO_ (
! 5: GOTO MakeDirs
! 6: )
! 7:
! 8: IF _%2_==__ (
! 9: ECHO Usage %0 ^<basedir^> ^<depth^> ^[^hash_bits^]
! 10: ECHO.
! 11: ECHO Where ^<basedir^> is the session directory
! 12: ECHO ^<depth^> is the number of levels defined in session.save_path
! 13: ECHO ^[hash_bits^] is the number of bits defined in session.hash_bits_per_character
! 14: EXIT /B 1
! 15: )
! 16:
! 17: SET /A Depth=%2 + 0 2>NUL
! 18: IF /I %ERRORLEVEL% EQU 9167 GOTO DepthError
! 19: IF _%Depth%_==__ GOTO DepthError
! 20: IF /I %Depth% LEQ 0 GOTO DepthError
! 21:
! 22: IF _%3_==__ GOTO DefaultBits
! 23:
! 24: SET /A Bits=%3 + 0 2>NUL
! 25: IF /I %ERRORLEVEL% EQU 9167 GOTO BitsError
! 26: IF _%Bits%_==__ GOTO BitsError
! 27: IF /I %Bits% LSS 4 GOTO BitsError
! 28: IF /I %Bits% GTR 6 GOTO BitsError
! 29: GOTO BitsSet
! 30:
! 31: :DefaultBits
! 32: SET Bits=4
! 33: :BitsSet
! 34:
! 35: SET HashChars=0 1 2 3 4 5 6 7 8 9 A B C D E F
! 36: IF /I %Bits% GEQ 5 SET HashChars=!HashChars! G H I J K L M N O P Q R S T U V
! 37: IF /I %Bits% GEQ 6 SET HashChars=!HashChars! W X Y Z - ,
! 38:
! 39: FOR %%A IN (%HashChars%) DO (
! 40: ECHO Making %%A
! 41: CALL "%~0" AUTO "%~1\%%~A" %Depth%
! 42: )
! 43: GOTO :EOF
! 44:
! 45: :MakeDirs
! 46: MKDIR "%~2"
! 47: SET /A ThisDepth=%3 - 1
! 48: IF /I %ThisDepth% GTR 0 FOR %%A IN (%HashChars%) DO CALL "%~0" AUTO "%~2\%%~A" %ThisDepth%
! 49: GOTO :EOF
! 50:
! 51: :DepthError
! 52: ECHO ERROR: Invalid depth : %2
! 53: EXIT /B 0
! 54:
! 55: :BitsError
! 56: ECHO ERROR: Invalid hash_bits : %3
! 57: EXIT /B 0
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>