sam-fans - fans of the sam editor
 help / color / mirror / Atom feed
* Re: sam's pipe
@ 1995-04-20 22:09 Mark H. Wilkinson
  0 siblings, 0 replies; 2+ messages in thread
From: Mark H. Wilkinson @ 1995-04-20 22:09 UTC (permalink / raw)
  To: Steve_Kilbane, sam-fans

Steve_Kilbane wrote:
> Subject: sam's pipe
> 
> Does anyone actually use sam's input pipe, apart from with
> the B command?

I've been using this rc function for a while:

fn mk {
	if (test -f Errors) {
		builtin mk $* |[2] tee Errors
		test -s Errors && { { echo b Errors ; echo e } | samsend }
	} else {
		builtin mk $*
	}
}

samsend is a stripped-down version of B which sends stdin to the pipe,
rsh'ing to a remote machine if necessary to avoid NFS problems. I also
have scripts to do B, D and cd operations from rc using samsend.

-Mark.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Mark H. Wilkinson <mhw@minster.york.ac.uk>  : Research student in user
University of York, England                 : interface management systems



^ permalink raw reply	[flat|nested] 2+ messages in thread
* sam's pipe
@ 1995-04-20 17:20 Steve_Kilbane
  0 siblings, 0 replies; 2+ messages in thread
From: Steve_Kilbane @ 1995-04-20 17:20 UTC (permalink / raw)
  To: sam-fans

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
	}
}


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1995-04-21  0:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-04-20 22:09 sam's pipe Mark H. Wilkinson
  -- strict thread matches above, loose matches on Subject: below --
1995-04-20 17:20 Steve_Kilbane

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).