I’ve decided to go with a remote tactic that’s slightly more reliable than my previous tactic: Name the gvim server by the contents of the $DISPLAY variable. I have side-by-side PCs with their own X-servers, so I want to send the file to the gvim server that is outputting the same place as my cscope session. I now grep the $DISPLAY out of the gvim server list, to determing whether I am going to set up a new server or use an existing one.
gvim –serverlist | grep -i "$DISPLAY" 2>/dev/null
if [ $? -ne 0 ]
gvim –servername $DISPLAY $*
gvim –remote-send “<ESC>:sp $CSCOPE_ROOT/$2<CR>:0<CR>:$1<CR>:-1<CR>” 2>/dev/null