From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <8df3e4b1f270ba00f6d3c533753751f9@plan9.escet.urjc.es> To: 9fans@cse.psu.edu From: Gorka Guardiola Date: Thu, 14 Oct 2004 15:28:09 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: [9fans] acme tags for shell scripts Topicbox-Message-UUID: ee1a11f6-eacd-11e9-9e20-41e7f4b1d025 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}'