@echo off
rem	fix ssh args to be compatible with plink (putty)
rem	Required for Unison synchronisation over ssh.
rem	Following options are probably compatible:
rem	-l name, -[1246AaCiNstTvVxX]
rem	incompatible:
rem	-p nnn (replaced by P); -e none (no equivalent)

setlocal

rem	Edit this to point to your location for plink.exe
set PLINKEXE=P:\apps\putty\plink

set ARGLIST=-ssh

:nextarg

if "x%1" == "x" goto doneargs

if NOT "%1" == "-p" goto checkesc
	rem plink uses upper case P to flag port number
	set ARGLIST=%ARGLIST% -P %2
	shift
	shift
	goto nextarg

:checkesc

if NOT "%1" == "-e" goto useit
	rem unison likes to include "-e none" which plink does not support.
	shift
	shift
	goto nextarg

:useit

	set ARGLIST=%ARGLIST%  %1
	shift
	
goto nextarg

endlocal

:doneargs

%PLINKEXE%  %ARGLIST%
