Annotation of hatari/tools/hatari-local-rs232.sh, revision 1.1.1.2

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.
1.1.1.2 ! root        6: #
        !             7: # To run development version of Hatari, use something like:
        !             8: #      PATH=../../build/src:$PATH hatari-local-rs232.sh <options>
1.1       root        9: 
                     10: # open fifos
                     11: for i in 1 2; do
                     12:        mkfifo rs232-$i
                     13: done
                     14: 
1.1.1.2 ! root       15: # show full path
        !            16: hatari=$(which hatari)
        !            17: 
1.1       root       18: # pass all args to the Hatari instances
1.1.1.2 ! root       19: args=$*
1.1       root       20: 
                     21: # connect the Hatari instances with fifos
1.1.1.2 ! root       22: echo "$hatari --rs232-in rs232-1 --rs232-out rs232-2 $args &"
        !            23: hatari --rs232-in rs232-1 --rs232-out rs232-2 $args &
        !            24: echo "$hatari --rs232-in rs232-2 --rs232-out rs232-1 $args &"
        !            25: hatari --rs232-in rs232-2 --rs232-out rs232-1 $args &
1.1       root       26: 
                     27: # Without this Hataris would deadlock as fifos
                     28: # block the process until both ends are opened.
                     29: # Hatari opens rs232 output first (for writing),
                     30: # so this needs to read it.
                     31: catpids=""
                     32: cat rs232-2 >/dev/null &
                     33: catpids="$catpids $!"
                     34: cat rs232-1 >/dev/null &
                     35: catpids="$catpids $!"
                     36: 
                     37: # after connections are open, fifo files can be removed
                     38: sleep 2
                     39: for i in 1 2; do
                     40:        rm rs232-$i
                     41: done
                     42: # as can the 'cat' processes
                     43: kill -9 $catpids

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.