Subject: sam's pipe

From: [email-masked] (Steve_Kilbane)
Date: Thu, 20 Apr 1995 13:20:46 -0400

Does anyone actually use sam's input pipe, apart from with
the B command? Generally, I've hardly used it at all, but I
was reading Rob's Acme paper the other day, and it mentioned
sam interacting with the compiler and debugger, and I thought,
why not?

Took about five minutes to write a script for handling compiler
errors: the script reads error messages <sent> to its stdin,
and tells sam to go to the appropriate file/line. The input
"make" is an exception; it does just that. feels quite nice.
And no, I haven't done anything about debugger interaction.:-)

So, I was just wondering if anyone else has written any
other useful applications with sam's pipe....

steve

#!/bin/rc
# Script for going to lines with errors in. Usage: run with
# no arguments, and <send> the error lines to stdin. Sends
# commands to sam's pipe.

# First bit comes straight from 'B':

if (~ $#USER 0)
	USER=$LOGNAME
pipe=/tmp/.sam.$USER

if (! ~ $#DISPLAY 0)
	pipe=$pipe.$DISPLAY

if (! test -r $pipe) {
	echo `{basename $0}^': No pipe "'$pipe'" to sam.' >[1=2]
	exit 1
}

while (cmd = `line) {
	if (~ $cmd '') {
		exit
	}
	if (~ $cmd (make exit)) {
		$cmd
	} else {
		cmd = `{echo $cmd | sed -ne 's/^"\([^"]*\)", line \([0-9]*\).*/f=''\1''; line=\2/p'}
		eval $cmd
		echo B $f >> $pipe
		echo $line >> $pipe
	}
}