anchor.diff:  		if "restart"=="%1" (
   			call :restart
   		) else (
  -			echo Usage: %0 {start^|stop^|restart}
  -			exit /b
  +			call :print_usage
   		)
   	)
   ) 
  
positive.code: @echo off
  
  setlocal
  
  if "%selfWrapped%"=="" (
    SET selfWrapped=true
  
negative.code: 
  
  
  :print_usage
  	echo Usage: mmx-server.bat [-p] {start^|stop^|restart}
  	echo.
  	echo Start, stop, or restart the Magnet Mesaging server.
  	echo. 
  	echo Options:
  	echo    -p    No port check when starting.
  	echo. 
  exit /b
  
  
  
  :start
  	if %check_port%==true (
  		call :check_ports
  	)
  	call :check_java
  
  	if exist %PROG%.pid (
  		echo Error! %PROG% is already running or you have a stale pid file. If %PROG% is not running delete %PROG%.pid file and try again.
  		exit 1
  	)	
  	call :check_java_home
  	start %TITLE% "%JAVA_HOME%\bin\java" -server -DopenfireHome="%OPENFIRE_HOME%" -jar ..\lib\startup.jar
  	FOR /F "usebackq tokens=2" %%i IN (`tasklist /nh /fi "WINDOWTITLE eq %TITLE%"`) DO echo %%i > .\%PROG%.pid
  goto :end
  
  
  
  :check_ports
  	netstat -aon | findstr "%PORT_TO_CHECK%" 1>NUL
  	if %ERRORLEVEL% equ 0 (
  		echo TCP port "%PORT_TO_CHECK%" is already in use, cannot start messaging server
  		exit 1
  	)
  	echo Using ports "%PORT_TO_CHECK%"
  goto :eof
  
  
  
  :stop
  	set /p pid=<.\%PROG%.pid
  	taskkill /f /pid %pid% /t
  	del .\%PROG%.pid
  goto :end
  
  
  