9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@9fans.net
Subject: Re: [9fans] Input/output
Date: Thu,  3 Dec 2009 14:34:37 -0500	[thread overview]
Message-ID: <7b20ed61c1b8ecf1d0ee9c766a185837@ladd.quanstro.net> (raw)
In-Reply-To: <<hf8tg7$hed$1@ger.gmane.org>>

On Thu Dec  3 12:49:01 EST 2009, mauricio.antunes@gmail.com wrote:
> I would like to write a script that takes text from standard
> input, lets the user edit it with 'sam -d' and then prints it to
> standard output.
>
> Do you think that makes sense? After all, 'sam -d' needs standard
> input and output in order to edit anything.

i don't think ssam is what you want, since you want interactive
editing.  i think what you want is a modified ssam that reopens
the console.  the reason for this is to seperate the editing from
the command stream. something like (for plan 9, run once)

#!/bin/rc
tmp=()
fn sighup sigint sigexit{
	rm -f $tmp
}
tmp = /tmp/esam.$pid
cat $* > $tmp
tty = /dev/cons
sam -d $tmp <>[0]$tty >[1=0]
cat $tmp
exit ''

or for linux (untested)

#!/bin/rc
tmp=()
fn sighup sigint sigexit{
	rm -f $tmp
}
if(~ $#TMPDIR 0)
	TMPDIR=/tmp
tmp=$TMPDIR/ssam.tmp.$USER.$pid
cat $* >$tmp
tty = `{tty}
sam -d $tmp <>[0]$tty >[1=0]
cat $tmp

- erik



       reply	other threads:[~2009-12-03 19:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <<hf8tg7$hed$1@ger.gmane.org>
2009-12-03 19:34 ` erik quanstrom [this message]
2009-12-04 13:13   ` Maurí­cio CA
2009-12-04 18:51     ` Russ Cox
2009-12-04 22:44       ` Maurí­cio CA
2009-12-05  1:45       ` Jorden Mauro
     [not found] <<3aaafc130912041745ub300dc6w498ddedfea62d837@mail.gmail.com>
2009-12-05  1:53 ` erik quanstrom
2009-12-05  4:16   ` Jorden Mauro
2009-12-03 17:45 Maurí­cio CA
2009-12-03 18:27 ` Russ Cox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7b20ed61c1b8ecf1d0ee9c766a185837@ladd.quanstro.net \
    --to=quanstro@quanstro.net \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).