9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Gorka Guardiola <paurea@lsub.org>
To: 9fans@cse.psu.edu
Subject: [9fans] acme tags for shell scripts
Date: Thu, 14 Oct 2004 15:28:09 +0200	[thread overview]
Message-ID: <8df3e4b1f270ba00f6d3c533753751f9@plan9.escet.urjc.es> (raw)

I was trying to access the tag of the current window on acme from a
shell script and found it impossible.  The problem is that there is no
way to get back the id of the current window (the one the script is
run on) in the shell script in order to access to /dev/wsys/%d.  I have
looked the way win does it (binding the current window on /dev/wsys/id
and done it for every script run in acme).  It is a little change,
which makes ID obsolete (it can be a shell script now), and makes
scripts on acme more powerful.  It doesn't seem to break anything.
What do you think about it?.  Does it break anything, is it
necessary?.  Is there anything I haven't seen?.



I will create a patch tonight as I don't have time now, but the
diff is very simple... (I haven't taken ID out yet, that will take
some more work as I am not that familiar with acme).

term% yesterday -D /sys/src/cmd/acme
post...
diff -n /n/dump/2004/1014/sys/src/cmd/acme /sys/src/cmd/acme
diff -n /n/dump/2004/1014/sys/src/cmd/acme/exec.c /sys/src/cmd/acme/exec.c
/n/dump/2004/1014/sys/src/cmd/acme/exec.c:1206 c /sys/src/cmd/acme/exec.c:1206
< 		c->md = fsysmount(rdir, ndir, incl, nincl);
---
> 		c->md = fsysmount(rdir, ndir, incl, nincl, win->id);
diff -n /n/dump/2004/1014/sys/src/cmd/acme/fns.h /sys/src/cmd/acme/fns.h
/n/dump/2004/1014/sys/src/cmd/acme/fns.h:66 c /sys/src/cmd/acme/fns.h:66
< Mntdir*	fsysmount(Rune*, int, Rune**, int);
---
> Mntdir*	fsysmount(Rune*, int, Rune**, int, int);
diff -n /n/dump/2004/1014/sys/src/cmd/acme/fsys.c /sys/src/cmd/acme/fsys.c
/n/dump/2004/1014/sys/src/cmd/acme/fsys.c:246 c /sys/src/cmd/acme/fsys.c:246
< fsysmount(Rune *dir, int ndir, Rune **incl, int nincl)
---
> fsysmount(Rune *dir, int ndir, Rune **incl, int nincl, int winid)
/n/dump/2004/1014/sys/src/cmd/acme/fsys.c:248 c /sys/src/cmd/acme/fsys.c:248
< 	char buf[256];
---
> 	char buf[256], *wpath;
/n/dump/2004/1014/sys/src/cmd/acme/fsys.c:264 a /sys/src/cmd/acme/fsys.c:265,270
> 	wpath=smprint("/mnt/acme/%d", winid);
> 	if(bind(wpath, "/dev/acme", MBEFORE) < 0){
> 		fsysdelid(m);
> 		return nil;
> 	}
> 	free(wpath);


An example of use of this (for the tags program by nemo) is using T tag to mark
the current file:

#!/bin/rc

acmepath=`{cat /dev/acme/tag|awk '{print $1}'}
if(~ $#* 0){	
	grep -n $acmepath $home/lib/*.tags
}
if not{
	tag/Tag $acmepath $*
}


ID as a shell script:

#!/bin/rc

cat /dev/acme/ctl|awk '{print $1}'



             reply	other threads:[~2004-10-14 13:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-14 13:28 Gorka Guardiola [this message]
2004-10-14 14:39 ` Russ Cox
2004-10-14 14:47   ` Gorka Guardiola
2004-10-15 13:27     ` Russ Cox
2004-10-15 13:54       ` Gorka Guardiola

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=8df3e4b1f270ba00f6d3c533753751f9@plan9.escet.urjc.es \
    --to=paurea@lsub.org \
    --cc=9fans@cse.psu.edu \
    /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).