With putty, the following batch file will do the trick (pass the destination host as the first argument):
echo ssh %1 > "%DATFILE%"
start putty -load "<putty session name>" <intermediate> -t -m "%DATFILE%"
Coding FTW
Perforce lets you share workspaces between Cygwin and Windows. The same technique can be used to share between Linux and Windows, when sharing the data via Samba – but there’s a pretty big catch.
If you run p4 sync in Linux from outside the AltRoot location, p4 will sync to a new directory with the name of the p4 Root. Say you accidentally run p4 sync from the /etc dir – you’ll end up with a directory like /etc/S:\workspace, and your real workspace directory will now be out of sync. (This isn’t a problem with p4 for cygwin, since cygwin can interpret Windows paths.)
Here’s a workaround:
1) Remove the base directory from the Root and AltRoot paths
2) Add the base directory to all paths in the workspace mapping
3) Add / as a second AltRoot
4) Create a symlink in / with the name of the base directory, pointing to the real location.
By using / as a second AltRoot, every linux directory will match, and the default root will never be used.
Update:
Here's a simpler workaround that instead just results in a an error message when running p4 outside of the workspace root.
1) Set P4CLIENT to something invalid like `XXXXX - Running from invalid root`
2) Set P4CONFIG to `.p4config`
3) Create a file called `.p4config` in your workspace root. Inside add the line `P4CLIENT=[Name]` substituting [Name] with your real client name
@echo off
REM --------------------------------------------------------------------------
REM Starts the android emulator and sets up the custom su executable on the
REM system image. This must be done each time the emulator starts, since the
REM emulator will not persist the system image when it exits (see
REM http://developer.android.com/guide/developing/tools/emulator.html).
REM
REM Usage:
REM * Arguments to this command are passed on to the emulator command. You'll
REM need to pass in an AVD name.
REM * The android sdk tools directory must be your path.
REM * You'll need to put the appropriate su binary in the same directory as
REM this script. You can get it from the zip files linked here:
REM http://forum.xda-developers.com/showthread.php?t=682828
REM * You'll need to a separate, one-time install of the superuser app. Just
REM run adb install with the apk in the zip file from the previous step.
REM
REM
REM A few implementation details:
REM * By default, the emulator's system image has no free space, since it's
REM meant to be read-only. The -partition-size argument makes it bigger so
REM there's space to work with (I gave it a somewhat arbitrary 160MB). The
REM adb remount command gives write access to the system the image.
REM * The emulator is launched via runhidden.js to hide the useless console
REM window that pops up.
REM --------------------------------------------------------------------------
if (%1)==() echo "MUST SPECIFY AN AVD!" && exit /B
cd /d %~dp0
@echo on
wscript runhidden.js "emulator -partition-size 160 %*"
adb wait-for-device
adb remount
adb push su /system/bin
adb shell chmod 6755 /system/bin/su
adb shell rm /system/xbin/su
adb shell ln -s /system/bin/su /system/xbin/su
// Runs a command with it's initial window hidden. Useful for programs that
// allocate a useless console (many java apps do this, and you don't always
// have the ability to run them with javaw).
//
// Requires the entire command to be passed in as the first parameter
// (because WSH doesn't provide simple access to the entire command line).
WScript.CreateObject("WScript.Shell").Run(WScript.Arguments(0), 0)