9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Arvindh Rajesh Tamilmani <arvindht@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] assigning acme windows to columns programmatically
Date: Wed, 19 Jan 2011 00:50:24 +0530	[thread overview]
Message-ID: <AANLkTi=sDw86dmqaw4K8UYU1vFxdVfO4scxdxkSM5k1N@mail.gmail.com> (raw)
In-Reply-To: <AANLkTi=nNZ+odDk9xCF0tG2tghWBJ-6p0XyvPAQ+n1_R@mail.gmail.com>

the inferno sh script below shows a rather terrible way to
open a file in a given acme column.

arvindh

#!/dis/sh

load std expr string

usage := 'usage: bcol colnum file'

fn xcmd{
	(cwin cmd) := $*

	q0 := `{wc -c </mnt/acme/$cwin/tag}
	q1 := ${expr $q0 ${len $"cmd} +}
	echo -n $cmd > /mnt/acme/$cwin/tag
	echo Mx$q0 $q1 > /mnt/acme/$cwin/event
}

if{! ~ $#* 2}{
	echo $usage >[1=2]
	raise fail:usage
}
(col file) := $*
(d0 d1) := /tmp/bcol ^ (0 1) ^ .${pid}

(cwin _) := `{cat /mnt/acme/new/ctl}
xcmd $cwin (Dump $d0)
{sed 4q $d0
echo f^${padr 11 $col}^'           0           0           0           0 '
echo '          0           0           0           0           0 ' ^
	$file ^
	' Del Snarf | Look '
} > $d1
xcmd $cwin (Load $d1)

rm $d0 $d1
echo delete > /mnt/acme/$cwin/ctl



  parent reply	other threads:[~2011-01-18 19:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-17  8:04 Joseph Xu
2011-01-18  9:43 ` Sergey Zhilkin
2011-01-18 19:20 ` Arvindh Rajesh Tamilmani [this message]
2011-01-19  8:47   ` Joseph Xu
2011-01-19  8:49     ` Joseph Xu

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='AANLkTi=sDw86dmqaw4K8UYU1vFxdVfO4scxdxkSM5k1N@mail.gmail.com' \
    --to=arvindht@gmail.com \
    --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).