Created
July 5, 2012 11:52
-
-
Save coderofsalvation/3053260 to your computer and use it in GitHub Desktop.
winetalk - named pipes for communication between wine and linux bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# setup named pipes for wine<->linux shell communication | |
# | |
# APPLICATIONS: glue linux & wine, use linux in .bat scripts, system() C-calls etc | |
# USAGE: | |
# | |
# [linux] | |
# mkfifo /tmp/wine_in | |
# mkfifo /tmp/wine_out | |
# ./winetalk /tmp/wine_in /tmp/wine_out | |
# | |
# [in wine (dos)] | |
# echo ls>z:\tmp\wine_in | |
# type z:\tmp\wine_out | |
# | |
test $# -eq 3 || echo "Usage: $0 <infifoname> <outfifoname>"; exit; | |
wine_in="$1" | |
wine_out="$2" | |
if [ ! -p "$wine_in" ]; then mkfifo "$wine_in"; fi | |
if [ ! -p "$wine_out" ]; then mkfifo "$wine_out"; fi | |
if [ ! -p "$wine_in" ]; then echo "[!] could not make '$wine_in'"; exit; fi | |
if [ ! -p "$wine_out" ]; then echo "[!] could not make '$wine_in'"; exit; fi | |
(while [ 1 ]; do | |
cat < "$wine_in" | while read line; do | |
cmd=$(printf "$line"| sed 's/\r//g'); ($cmd) > "$wine_out"; | |
done; | |
done ) & | |
echo "[x] done setting up wine pipes '$1' and '$2'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment