Files
RedBear-OS/recipes/shells/zsh/source/Functions/TCP/tcp_proxy
T
vasilito ff4ff35918 feat: track all source trees in git — full fork offline-first model
Red Bear OS is a full fork. All sources must be available from git clone
with zero network access. Removed gitignore rules that excluded fetched
source trees under recipes/*/source/, local/recipes/kde/*/source/,
local/recipes/qt/*/source/, and vendor source trees.

Build artifacts (target/, build/, source.tar, *.o, *.so) remain excluded.

127291 files added — kernel, relibc, base, bootloader, pkgar, all KDE/Qt
frameworks, mesa, wayland, DRM drivers, and every other recipe source.
2026-05-14 10:55:53 +01:00

32 lines
849 B
Plaintext

# Listen on the given port and for every connection, start a new
# command (defaults to $SHELL) in the background on the accepted fd.
# WARNING: this can leave your host open to the universe. For use
# in a restricted fashion on a secure network.
#
# Remote logins are much more efficient...
local TCP_LISTEN_FD
trap '[[ -n $TCP_LISTEN_FD ]] && ztcp -c $TCP_LISTEN_FD; return 1' \
HUP INT TERM EXIT PIPE
if [[ $1 != <-> ]]; then
print "Usage: $0 port [cmd args... ]" >&2
return 1
fi
integer port=$1
shift
ztcp -l $port || return 1
TCP_LISTEN_FD=$REPLY
(( $# )) || set -- ${SHELL:-zsh}
local cmd=$1
shift
while ztcp -a $TCP_LISTEN_FD; do
# hack to expand aliases without screwing up arguments
eval $cmd '$* <&$REPLY >&$REPLY 2>&$REPLY &'
# Close the session fd; we don't need it here any more.
ztcp -c $REPLY
done