#!/bin/sh

# This file is associated with `prcs.el' and shares its copyright and
# disclaimers. Contact Jesse Glick <Jesse.Glick@netbeans.com> for
# information and to report bugs.
#
# $PrcsModeVersion: 1.61 on Sat, 06 Feb 1999 17:57:04 -0500 $

# When called with some number of arguments, this script:
#
# 1. Prints a special magic token on a line by itself.
# 2. Prints the number of args on a line by itself.
# 3. Prints each of the args in turn on their own lines.
# 4. Waits for input.
# 5. Reads a line (should be an integer), and exits with that status.

# Used by prcs.el as a value for $PRCS_DIFF_COMMAND or $PRCS_MERGE_COMMAND.
# The token is used to identify its execution in a general comint buffer.

# Do not let the uninterrupted token itself appear in any source code!
magic_1='MaGiC-PrCs-'
magic_2='CaLlBaCk-ToKeN'
# Read & write from/to tty because o.w. PRCS tries to snatch up our
# input and incorrectly buffer our output, devilishly.
(
    echo "$magic_1$magic_2"
    echo "$#"
    for arg; do echo "$arg"; done
) > /dev/tty
read status < /dev/tty
# echo $* $status >>/tmp/pc-trace
exit $status
