Re: [9fans] [9pi] standardize \ normalize setting dns in

2013-04-04 Thread c117152
On Wednesday, April 3, 2013 1:51:25 PM UTC+3, Richard Miller wrote:
 Go ahead.  It's called termrc.'local' because it's your own local
 
 configuration to play with as you like.  There's no standard.  The
 
 one on sources is an empty template, and the one on the raspberry pi
 
 image is just an initial suggestion.

Oh, I see. I'm just used to trying to separate code from data so much I thought 
a default that keeps the users from editing scripts is the norm and would get 
upstreamed. In practice my concern was that I'll replica\pull over it by 
mistake... I suppose you can tell I'm a linux user :P

On Wednesday, April 3, 2013 1:54:45 PM UTC+3, Bence Fábián wrote:
 what does ndb/query sys $sysname say?
 
 try to add ether and dom like this:
 
 
 ip=10.0.0.13 sys=9pi ether=x... dom=9pi.Home
 

Ops. Good call. It returned the ip as the sysname. :)
All better now. Here's some breadcrumbs for any brave adventurers lucky enough 
to google this discussion:

term% cat /lib/ndb/local

#
#  files comprising the database, use as many as you like, see ndb(6)
#
database=
file=/lib/ndb/local
file=/lib/ndb/common

auth=sources.cs.bell-labs.com authdom=outside.plan9.bell-labs.com

#
#  because the public demands the name localsource
#
ip=127.0.0.1 sys=localhost dom=localhost

ipnet=HOME
ip=10.0.0.0
ipmask=255.255.255.0
ipsubmask=255.255.255.0
ipgw=10.0.0.138
auth=9pi
cpu=9pi
fs=9pi
dns=1.2.3.4
dns=8.8.8.8
dns=8.8.4.4
dns=10.0.0.138
dnsdomain=HOME

ip=10.0.0.13 sys=9pi dom=9pi.HOME proto=il

auth=10.0.0.13 authdom=9pi.HOME

term% ndb/query sys $sysname
ip=10.0.0.13 sys=9pi dom=9pi.HOME proto=il 

Thanks !



Re: [9fans] documentation suggestion

2013-04-04 Thread Mark van Atten
Would it be possible to add an option to p9p acme so that its tags
will always remain one line, i.e., show Plan 9's acme behaviour?

Mark.



Re: [9fans] [9pi] standardize \ normalize setting dns in

2013-04-04 Thread Bence Fábián
2013/4/4 c117...@rmqkr.net

 term% cat /lib/ndb/local

 #
 #  files comprising the database, use as many as you like, see ndb(6)
 #
 database=
 file=/lib/ndb/local
 file=/lib/ndb/common

 auth=sources.cs.bell-labs.com authdom=outside.plan9.bell-labs.com

 #
 #  because the public demands the name localsource
 #
 ip=127.0.0.1 sys=localhost dom=localhost

 ipnet=HOME
 ip=10.0.0.0
 ipmask=255.255.255.0
 ipsubmask=255.255.255.0
 ipgw=10.0.0.138
 auth=9pi
 cpu=9pi
 fs=9pi
 dns=1.2.3.4
 dns=8.8.8.8
 dns=8.8.4.4
 dns=10.0.0.138
 dnsdomain=HOME

 ip=10.0.0.13 sys=9pi dom=9pi.HOME proto=il

 auth=10.0.0.13 authdom=9pi.HOME

 term% ndb/query sys $sysname
 ip=10.0.0.13 sys=9pi dom=9pi.HOME proto=il

 Thanks !


Suppose you have

ip=10.0.0.13 sys=9pi1 dom=9pi.HOME proto=il

ip=10.0.0.14 sys=9pi4 dom=9pi.HOME proto=il

which one is this machine?
add the 'ether='

excerpt from my /lib/ndb/local:

ipnet=9front ip=10.0.2.0 ipmask=255.255.255.0
ipgw=10.0.2.2
dns=10.150.128.15

sys=thor ether=525400123456 dom=thor.9front
ip=10.0.2.15


and the output on my qemu terminal looks like this:

term% ndb/query sys $sysname
ip=10.0.2.15 ipmask=/120 ipgw=10.0.2.2 sys=thor dns=10.150.128.15
sys=thor ether=525400123456 dom=thor.9front ip=10.0.2.15
term%


Re: [9fans] Acme Edit scriptlets

2013-04-04 Thread Mark van Atten
On Friday, 29 March 2013 01:38:06 UTC+1, Bence Fábián  wrote:

 I did a quick writeup on little Edit scripts

Many thanks, this thread is very useful.

There is also Jason Catena's list of Edit idioms at
https://raw.github.com/catenate/acme-fonts/master/test/1/acme/Edit/sam

When editing and re-editing latex, I regularly pipe selections
through a simple-minded script called `chunk' which does most of
the work for obtaining semantic linebreaks. That goes back to a
recommendation by Kernighan in his paper `Unix for beginners' of
1974; see the quotation, comments and link at [1].



#!/usr/local/plan9/bin/rc 
# chunk up (to prepare) for semantic linebreaks

# do  not break within \cite 
# do not break within $$ math 
# break after closing parentheses ),] 
# break before an opening parentheses (,[

ssam -e 'x/(^[^%].+\n)+/  y/\\cite[^{]*{(\n|.)*}/ y/\$.*\$/
x/(([^A-Z]\.)|[,;:!?]|\)|\]) | (\(|\[)/ s/ /\n/' \ | 9 fmt -w 60
-j


For batch processing probably something more sophisticated would
be needed to leave various environments unchunked. But I don't use
it that way, and just apply it to selections where I know its use
makes sense. Usually these are areas where I have just been doing
a lot of rewriting.

There's no point in chunking up commented material, and sometimes
it is actually convenient to have a place where I can keep things
unchunked for reference.

The original chunk command in Writer's Workbench [2], for troff not
latex, was  based on a parser for English, I think. I find I don't
want that (because I write in other languages as well), and that
even in English I don't need it (because the chunking based on
interpunction is always fine with me, and where I care about the
remaining cases, I prefer to do it myself; but see [3]).

Mark.


[1] http://rhodesmill.org/brandon/2012/one-sentence-per-line/

[2] http://man.cat-v.org/unix_WWB/1/chunk

[3] https://github.com/waldir/semantic-linebreaker



Re: [9fans] [9pi] standardize \ normalize setting dns in

2013-04-04 Thread Richard Miller
 my concern was that I'll replica\pull over it by mistake

pull will not update anything you have locally modified, unless
you explicitly tell it to with a '-s file-or-directory-name' parameter.
You get an error message instead.




Re: [9fans] Acme Edit scriptlets

2013-04-04 Thread dexen deVries
On Thursday 04 of April 2013 10:19:23 Mark van Atten wrote:
 On Friday, 29 March 2013 01:38:06 UTC+1, Bence Fábián  wrote:
  I did a quick writeup on little Edit scripts


(p9p specific)

attached is my dirty hack for automagic grepping of $% file or recursively %s 
dir or pipe.

a funky goodie:
automatically supplies `.' (dot) between arguments, so for example:

$ G some token here

becomes `grep some.token.here'


-- 
dexen deVries

[[[↓][→]]]


``we, the humanity'' is the greatest experiment we, the humanity, ever 
undertook. 
#!/usr/bin/env rc


. 9.rc


s=()
arg=()

fn addS {
if (~ $#s 0)
s=$1
if not
s=$s.$1
}

while (! ~ $#* 0) {
if (~ $1 -*)
arg=($arg $1)
if not
addS $1
shift
}


if (u test -p /dev/stdin) {
grep -n $arg $s
exit
}
if (test -f $%)
grep -n $arg $s /dev/null `{basename $%}
if not
find . -type f | grep -v 
'[.]/share/doc/doxygen/|/[.]git/|/[.]svn/|[.](mo|pot)$' | xargs grep -n $arg $s 
/dev/null


Re: [9fans] Acme Edit scriptlets

2013-04-04 Thread Bence Fábián
Cool.


Here's a script i use to generate case
insensitive regexes. It turns

FooBar

into

[Ff][Oo][Oo][Bb][Aa][Rr]

term% cat /bin/uncase
#!/bin/rc

exec awk '{
lower = tolower($0)
upper = toupper($0)
len = length($0)

for( i = 1 ; i = len ; i++ )
printf [ substr(upper, i, 1) substr(lower, i, 1) ]
printf \n
}'




2013/4/4 Mark van Atten vanattenm...@gmail.com

 On Friday, 29 March 2013 01:38:06 UTC+1, Bence Fábián  wrote:

  I did a quick writeup on little Edit scripts

 Many thanks, this thread is very useful.

 There is also Jason Catena's list of Edit idioms at
 https://raw.github.com/catenate/acme-fonts/master/test/1/acme/Edit/sam

 When editing and re-editing latex, I regularly pipe selections
 through a simple-minded script called `chunk' which does most of
 the work for obtaining semantic linebreaks. That goes back to a
 recommendation by Kernighan in his paper `Unix for beginners' of
 1974; see the quotation, comments and link at [1].



 #!/usr/local/plan9/bin/rc
 # chunk up (to prepare) for semantic linebreaks

 # do  not break within \cite
 # do not break within $$ math
 # break after closing parentheses ),]
 # break before an opening parentheses (,[

 ssam -e 'x/(^[^%].+\n)+/  y/\\cite[^{]*{(\n|.)*}/ y/\$.*\$/
 x/(([^A-Z]\.)|[,;:!?]|\)|\]) | (\(|\[)/ s/ /\n/' \ | 9 fmt -w 60
 -j


 For batch processing probably something more sophisticated would
 be needed to leave various environments unchunked. But I don't use
 it that way, and just apply it to selections where I know its use
 makes sense. Usually these are areas where I have just been doing
 a lot of rewriting.

 There's no point in chunking up commented material, and sometimes
 it is actually convenient to have a place where I can keep things
 unchunked for reference.

 The original chunk command in Writer's Workbench [2], for troff not
 latex, was  based on a parser for English, I think. I find I don't
 want that (because I write in other languages as well), and that
 even in English I don't need it (because the chunking based on
 interpunction is always fine with me, and where I care about the
 remaining cases, I prefer to do it myself; but see [3]).

 Mark.


 [1] http://rhodesmill.org/brandon/2012/one-sentence-per-line/

 [2] http://man.cat-v.org/unix_WWB/1/chunk

 [3] https://github.com/waldir/semantic-linebreaker




Re: [9fans] Acme Edit scriptlets

2013-04-04 Thread erik quanstrom
On Thu Apr  4 08:17:13 EDT 2013, beg...@gmail.com wrote:

 Cool.
 
 
 Here's a script i use to generate case
 insensitive regexes. It turns
 
 FooBar
 
 into
 
 [Ff][Oo][Oo][Bb][Aa][Rr]

see also rune(1), http://9atom.org/magic/man2html/1/rune
which generalizes this idea to all of unicode (rune/case),
and also to diacritical and other markers (rune/fold; rune/unfold).
for the latter also see grep(1)'s -I flag, 
http://9atom.org/magic/man2html/1/grep

- erik



Re: [9fans] [9pi] standardize \ normalize setting dns in

2013-04-04 Thread erik quanstrom
 ipnet=9front ip=10.0.2.0 ipmask=255.255.255.0
 ipgw=10.0.2.2
 dns=10.150.128.15
 
 

5: r
!/bin/upas/marshal -s 'Re: [9fans] [9pi] standardize \ normalize setting dns 
in' -R /mail/fs/mbox/1698 9fans@9fans.net
 sys=thor ether=525400123456 dom=thor.9front
 ip=10.0.2.15
 
 
 and the output on my qemu terminal looks like this:
 
 term% ndb/query sys $sysname
 ip=10.0.2.15 ipmask=/120 ipgw=10.0.2.2 sys=thor dns=10.150.128.15
 sys=thor ether=525400123456 dom=thor.9front ip=10.0.2.15
 term%

that doesn't look right.  using the ndb excerpt posed,
i get this

; ndb/query -f /tmp/test.ndb sys thor
sys=thor ether=525400123456 dom=thor.9front 

were some bits left out of your example?

- erik



Re: [9fans] Acme Edit scriptlets

2013-04-04 Thread Bence Fábián
whoa. nice job.



2013/4/4 erik quanstrom quans...@quanstro.net

 On Thu Apr  4 08:17:13 EDT 2013, beg...@gmail.com wrote:

  Cool.
 
 
  Here's a script i use to generate case
  insensitive regexes. It turns
 
  FooBar
 
  into
 
  [Ff][Oo][Oo][Bb][Aa][Rr]

 see also rune(1), http://9atom.org/magic/man2html/1/rune
 which generalizes this idea to all of unicode (rune/case),
 and also to diacritical and other markers (rune/fold; rune/unfold).
 for the latter also see grep(1)'s -I flag,
 http://9atom.org/magic/man2html/1/grep

 - erik




[9fans] Acme script request (was: Acme Edit scriptlets)

2013-04-04 Thread dexen deVries
an Edit script, or an Rc script for Acme, to close all windows which names 
start with given (literal) prefix.

use case: several files and directories of two projects open in one Acme 
instance. want to close all windows related to one of the projects, and leave 
the other project's windows open.

-- 
dexen deVries

[[[↓][→]]]




Re: [9fans] Acme script request (was: Acme Edit scriptlets)

2013-04-04 Thread Bence Fábián
for (dir in `{grep -l '^'$pattern /mnt/acme/[0-9]*/tag | sed 's/tag//'}){
echo delete $dir/ctl
}

where $pattern is the pattern you want to match


2013/4/4 dexen deVries dexen.devr...@gmail.com

 an Edit script, or an Rc script for Acme, to close all windows which names
 start with given (literal) prefix.

 use case: several files and directories of two projects open in one Acme
 instance. want to close all windows related to one of the projects, and
 leave
 the other project's windows open.

 --
 dexen deVries

 [[[↓][→]]]





Re: [9fans] [9pi] standardize \ normalize setting dns in

2013-04-04 Thread Bence Fábián
I tried with a dummy file and I get the same results as you.
My guess (haven't checked anything) that it gets the other
information from /net/ndb.

However I'm in no way an ndb expert. Maybe someone
knowledgable can weigh in on this.


2013/4/4 erik quanstrom quans...@quanstro.net

  ipnet=9front ip=10.0.2.0 ipmask=255.255.255.0
  ipgw=10.0.2.2
  dns=10.150.128.15
 
 

 5: r
 !/bin/upas/marshal -s 'Re: [9fans] [9pi] standardize \ normalize setting
 dns in' -R /mail/fs/mbox/1698 9fans@9fans.net
  sys=thor ether=525400123456 dom=thor.9front
  ip=10.0.2.15
 
 
  and the output on my qemu terminal looks like this:
 
  term% ndb/query sys $sysname
  ip=10.0.2.15 ipmask=/120 ipgw=10.0.2.2 sys=thor dns=10.150.128.15
  sys=thor ether=525400123456 dom=thor.9front ip=10.0.2.15
  term%

 that doesn't look right.  using the ndb excerpt posed,
 i get this

 ; ndb/query -f /tmp/test.ndb sys thor
 sys=thor ether=525400123456 dom=thor.9front

 were some bits left out of your example?

 - erik




[9fans] p9p vs. linux 9fs mount

2013-04-04 Thread dexen deVries
p9p/linux question.

i can't get seem to get write access to acme's files as mounted via linux 9p 
driver (v9fs). read works OK, but writes are rejected.


# mount -t 9p '/tmp/ns.root.localhost:13/acme' /mnt/acme -o 
'trans=unix,uname=root'
# ls /mnt/acme
1/  2/  3/  4/  acme/  cons  consctl  draw/  editout  index  label  new/
# echo delete  /mnt/acme/1/ctl 
-bash: /mnt/acme/1/ctl: Permission denied


when mounted with debug=0x04, i see in dmesg that TRSTAT gets passed 
`uname=root', but TWSTAT gets `uname=(null)'.


what am i doing wrong?


tested with linux kernel version 3.9.0-rc3 and 3.5.0 and with recent p9p 
version.

-- 
dexen deVries

[[[↓][→]]]




Re: [9fans] p9p vs. linux 9fs mount

2013-04-04 Thread Alexander Sychev
Hi,

On Thu, Apr 4, 2013 at 5:59 PM, dexen deVries dexen.devr...@gmail.comwrote:

 p9p/linux question.

 i can't get seem to get write access to acme's files as mounted via linux
 9p
 driver (v9fs). read works OK, but writes are rejected.


I understand my next question is not quite related, but do you need just to
mount Acme's file system  or to mount the file system via v9fs?
Acme has an experimental feature to mount the file system via FUSE, and
this solution works almost without troubles, you need just to specify a
mount point with flag '-m'.

-- 
Best regards,
  santucco


Re: [9fans] p9p vs. linux 9fs mount

2013-04-04 Thread erik quanstrom
  p9p/linux question.
 
  i can't get seem to get write access to acme's files as mounted via linux
  9p
  driver (v9fs). read works OK, but writes are rejected.
 
 
 I understand my next question is not quite related, but do you need just to
 mount Acme's file system  or to mount the file system via v9fs?
 Acme has an experimental feature to mount the file system via FUSE, and
 this solution works almost without troubles, you need just to specify a
 mount point with flag '-m'.

guess.  try  instead of .   may try to remove the file first.

- erik



Re: [9fans] documentation suggestion

2013-04-04 Thread Rudolf Sykora
On 4 April 2013 10:49, Mark van Atten vanattenm...@gmail.com wrote:
 Would it be possible to add an option to p9p acme so that its tags
 will always remain one line, i.e., show Plan 9's acme behaviour?

I don't understand this question.
In p9p you have an option to use multiline tag,
if you press ENTER somewhere on the tag-line,
but if you don't do that, the behaviour is the same
as in p9, afaik.

Ruda



Re: [9fans] p9p vs. linux 9fs mount

2013-04-04 Thread dexen deVries
On Thursday 04 of April 2013 11:19:53 erik quanstrom wrote:
 
 guess.  try  instead of .   may try to remove the file first.

...

how do i send you cookies? ;-)


 # strace for `'
open(/mnt/acme/2/ctl, O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = -1 
EACCES (Permission denied)

 # strace for `'
open(/mnt/acme/2/ctl, O_WRONLY|O_CREAT|O_APPEND|O_LARGEFILE, 0666) = 3

with the difference being `O_TRUNC'.


cheers,
-- 
dexen deVries

[[[↓][→]]]




Re: [9fans] documentation suggestion

2013-04-04 Thread erik quanstrom
On Thu Apr  4 11:25:12 EDT 2013, rudolf.syk...@gmail.com wrote:
 On 4 April 2013 10:49, Mark van Atten vanattenm...@gmail.com wrote:
  Would it be possible to add an option to p9p acme so that its tags
  will always remain one line, i.e., show Plan 9's acme behaviour?
 
 I don't understand this question.
 In p9p you have an option to use multiline tag,
 if you press ENTER somewhere on the tag-line,
 but if you don't do that, the behaviour is the same
 as in p9, afaik.

that's incorrect.  window tags will take up multiple lines
if they wrap in the p9p version.  this is not true for the
plan 9 version.

- erik



Re: [9fans] documentation suggestion

2013-04-04 Thread Rudolf Sykora
On 4 April 2013 17:46, erik quanstrom quans...@labs.coraid.com wrote:
 On Thu Apr  4 11:25:12 EDT 2013, rudolf.syk...@gmail.com wrote:
 On 4 April 2013 10:49, Mark van Atten vanattenm...@gmail.com wrote:
  Would it be possible to add an option to p9p acme so that its tags
  will always remain one line, i.e., show Plan 9's acme behaviour?

 I don't understand this question.
 In p9p you have an option to use multiline tag,
 if you press ENTER somewhere on the tag-line,
 but if you don't do that, the behaviour is the same
 as in p9, afaik.

 that's incorrect.  window tags will take up multiple lines
 if they wrap in the p9p version.  this is not true for the
 plan 9 version.

Well. Before posting I tried it.
And before replying now I again tried it (I use p9p acme).
And the behaviour is kind of more complicated.
I had two windows, each behaved differently (the two mentioned attempts).
One did not wrap, the other did wrap. So I am a bit surprised. :)
Anyway, you may toggle between multiline and singleline mode
with the mouse-wheel.
(Thus only what is a default for a window is now somehow missing knowledge
to me.)

Ruda



Re: [9fans] documentation suggestion

2013-04-04 Thread Mark van Atten
If I click 'New' to open a window in a column, go into its tag, and
start typing after `Look', the tag becomes multiline and wraps my
text when I hit the border.

Mark.



Re: [9fans] documentation suggestion

2013-04-04 Thread Rudolf Sykora
On 4 April 2013 18:05, Mark van Atten vanattenm...@gmail.com wrote:
 If I click 'New' to open a window in a column, go into its tag, and
 start typing after `Look', the tag becomes multiline and wraps my
 text when I hit the border.

Yes. The wrapping mode seems to be the default.
However:
If you, even before typing anything, position the cursor
in the tag line and use your wheel (of course only if you
have one) and try to sroll up (one 'click' is enough),
and then you start to type your text, there will be no wrap-up.
Scrolling changed the mode to a p9-like one.
(Down-scrolling then undoes it.)

If you ask to have a p9-like behaviour a default, there definitely
will be a way, but I do not have a good (simple) suggestion.


Ruda



Re: [9fans] documentation suggestion

2013-04-04 Thread a
I have not tried this, but I suspect that if you change
w-tagexpand to FALSE in /src/cmd/acme/wind.c:/^wininit
and recompile, you'll get the Plan 9 behavior. The code
paths are still a bit different, but on cursory examination it
looks like that'll give you what you want.

Anthony




[9fans] IOHDRSZ

2013-04-04 Thread erik quanstrom
i wonder if  the typical use of IOHDRSZ is correct.

many programs set
msize = bufsize + IOHDRSIZE
but Twrite has 2+4+8+4=18 bytes overhead, so
i think this assumption is going to lead to
6-byte buffer overruns.

- erik



Re: [9fans] IOHDRSZ

2013-04-04 Thread Charles Forsyth
On 4 April 2013 20:50, erik quanstrom quans...@quanstro.net wrote:

 so
 i think this assumption is going to lead to
 6-byte buffer overruns.


I don't follow the reasoning. bufsize + Rread or Twrite will always fit.
bufsize is the limit for application data. The receiving 9P also trims the
count
to match the receiving buffer.


Re: [9fans] IOHDRSZ

2013-04-04 Thread erik quanstrom
 On 4 April 2013 20:50, erik quanstrom quans...@quanstro.net wrote:
 
  so
  i think this assumption is going to lead to
  6-byte buffer overruns.
 
 
 I don't follow the reasoning. bufsize + Rread or Twrite will always fit.
 bufsize is the limit for application data. The receiving 9P also trims the
 count
 to match the receiving buffer.

i'm thinking of applications that have a seperate buffer for data.
in this case, i can't think of a clean way of sizing that seperate buffer
correctly.  if msize=bufsize+IOHDRSZ, then incoming bytes would
be too big.

- erik