|
|
1.1 root 1: #!/bin/sh
2: #
3: # Start two Hatari instances connected through emulated rs232 connection.
4: # Given arguments (if any) are passed to the invoked Hatari instances.
5: # Their rs232 connection goes through shared local fifo file.
6:
7: # open fifos
8: for i in 1 2; do
9: mkfifo rs232-$i
10: done
11:
12: # pass all args to the Hatari instances
13: hatari="hatari $*"
14:
15: # connect the Hatari instances with fifos
16: echo "$hatari --rs232-in rs232-1 --rs232-out rs232-2 &"
17: $hatari --rs232-in rs232-1 --rs232-out rs232-2 &
18: echo "$hatari --rs232-in rs232-2 --rs232-out rs232-1 &"
19: $hatari --rs232-in rs232-2 --rs232-out rs232-1 &
20:
21: # Without this Hataris would deadlock as fifos
22: # block the process until both ends are opened.
23: # Hatari opens rs232 output first (for writing),
24: # so this needs to read it.
25: catpids=""
26: cat rs232-2 >/dev/null &
27: catpids="$catpids $!"
28: cat rs232-1 >/dev/null &
29: catpids="$catpids $!"
30:
31: # after connections are open, fifo files can be removed
32: sleep 2
33: for i in 1 2; do
34: rm rs232-$i
35: done
36: # as can the 'cat' processes
37: kill -9 $catpids
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.