#!/bin/sh
# Stand-in for ssh when Frame Control's server runs on the Frame itself
# (FRAME_LOCAL=1, started by the iPhone app). The server and its helpers call
# `ssh [options] frame COMMAND`, and rsync calls it as its transport; here that
# means: run COMMAND in the home directory, as ssh would, with the same stdin.
while [ $# -gt 0 ]; do
  case "$1" in
    -[bcDEeFIiJLlmOoPpQRSWwB]) shift 2 ;;  # options that take a value
    -?*) shift ;;
    *) break ;;
  esac
done
[ $# -gt 0 ] && shift  # the host alias
cd "$HOME" || exit 255
[ $# -eq 0 ] && exit 0  # -N: nothing to run
exec "${SHELL:-/bin/sh}" -c "$*"
