[9fans] Rc here documents in function

2019-07-01 Thread dexen deVries
is there a patch for Rc out there that lets it handle here documents inside
a function body?

--
dx


[9fans] Upas and Message-ID?

2018-11-30 Thread dexen deVries
by chance found[1] the following passage:
>(...) and the Bell Labs upas mailer never creates Message-ID.
out of curiosity, any particular rationale behind that?

[1] https://cr.yp.to/immhf/thread.html



[9fans] pass list from Rc to awk (p9p vs plan9)

2018-08-17 Thread dexen deVries
mental note, as it took me a second to put it together:

#!/usr/bin/env rc

flag e +

myList = ( aa bb cc)

awk '
BEGIN {
split(ENVIRON["myList"], myList, "\001") # "\000" on plan9 proper
for (n in myList)
print n, myList[n]
}
'


Re: [9fans] What are you using Plan 9 for?

2018-06-21 Thread dexen deVries
i'm using plan9port (thanks, rsc) on linux for some 8 years now, for all
coding - mostly low-brow web dev
primarily Acme as IDE, Rc and awk for scripting the necessary tooling

back when i was stuck at a corpo and had to use Windows on workstation, i
installed
p9p on one of build servers and ran Acme over LAN, through Xming
there was no noticeable latency; it felt snappier than the corpo blessed
IDE on windows

my typical setup is: slackware linux, p9p, Acme maximized on the right
screen.

a few years ago i've coded a minimalist IRC client for Acme, was
surprisingly comfy, but never followed it up
another small use case was simplistic HTTP server for game map files coded
in Rc;
just enough to handle HTTP GET with Range header. was maybe 50 lines of
shell.


On Thu, Jun 21, 2018 at 11:06 AM, Rui Carmo  wrote:

> I’m late to the thread, but this seems like a good point to step in.
>
> I’m using plan9 on a quad-core Raspberry Pi as a sort of universal
> terminal to manage some of my home machines, and recently deleted the
> 9front VM I had on my home KVM server because even though the programming
> model and Go support were nice, most of my day-to-day work is on cloud
> solutions and there was no easy way to make those co-exist with Plan9 usage.
>
> There were a few discussions in this thread around dev stacks, browsers,
> etc., and my $0.02 on that is that I could probably work in Plan9 on a
> daily basis _if_ it had a usable (i.e., all the warts including JavaScript
> and fonts) web browser, but that the lack of alignment (intended or
> otherwise) with Linux tools and app stacks (SSH, Node, Python, Java) would
> make it very painful.
>
> Running a remote browser (which is what I do often in that Pi) sort of
> works, but you never get the full benefits you’d get with a native process.
> And lack of access to modern app stacks renders the platform unattractive
> for mainstream development work.
>
> But what killed it for me was the need for chording (mouse or keys). Using
> a modern trackpad on a MacBook or Surface device is a quantum leap beyond
> using a mouse for general use, and the lack of a modernised Rio with enough
> thoughtful design to overcome the differences in philosophy is the first
> barrier to continued usage.
>
> Acme is something I miss on occasion, but modern GUI editors compensate in
> other ways (at the expense of resource usage, etc., but with a massive
> boost in productivity for me). Also, I’m typing this on an iMac 5K with
> nearly unmatched font rendering and legibility (the only thing that comes
> close is the Surface Pro alongside it). Visuals matter a great deal.
>
> There is an unmatchable degree of purity in Plan9, but (even though the
> diehards will stick their ground and claim it’s perfect to the exclusion of
> other modern comforts) to coexist successfully it has to provide more
> affordances.
>
> Kind Regards,
>
> R.
>
> > On 14 Jun 2018, at 04:53, 刘宇宝  wrote:
> >
> > Compared to "not for you", "don't care",  "intend to not be successful",
> I like more the topic of cat-v irc channel on freenode set by aiju:  "fun
> fact: you can use multiple operating systems at the same time".
> >
> > Certainly Plan 9 can't replace Linux/macOS/BSD/Windows, I'm still
> curious its upper bound for a sensible daily usage,  and the best practice
> from you happy experienced Plan 9 users.
> >
> > I checked mail headers in this mailing list, seems all use Apple Mail,
> iPhone Mail, WebMail with AJAX, Gmail(a lot), ProtonMail,  these emails
> went through Postfix and Exim servers, probably on Linux.
> >
> > In great harmony, we use kinds of operating system and kinds of software
> on them.
> >
> > Regards,
> > Yubao Liu
> >
> >> On Jun 14, 2018, at 10:53 AM, N. S. Montanaro  wrote:
> >>
> >> I think a lot of people discover Plan 9 and want it to be something it
> isn’t, rather than stumble upon it out of necessity. As the FQA says, “Plan
> 9 is not for you."
> >
>
>
>


[9fans] Acme - built in command; external command

2018-04-27 Thread dexen deVries
is it possible to execute built-in command
and external command with one mouse click in Acme?

something like: Putall; mk



Re: [9fans] simple rc problem in p9p (on OpenBSD)

2018-04-26 Thread dexen deVries
use a list. lists are created either by the parentheses:

% w = ( A B C )
% # note no space before the backslash
% wMultiline = (\
X\
Y\
Z\
)
% echo $w $wMultiline
A B C X Y Z
% for(i in $w) {echo $i; echo XXX}
A
XXX
B
XXX
C
XXX

or by globbing:
% text_files = *.txt

or by expanding a whitespaced text:
% text_files = `{ 9 ls *.txt }

note the p9p's "ls" quotes whitespace in file names properly for Rc

lists are single-level; merging two lists produces new one of single
level, with all the elements in order
% a = ( foo bar )
% b = ( aa $a bb )
% echo $a
foo bar
% echo $b
aa foo bar bb

side note, the ^ operator has interesting uses for lists:

% a = ( foo bar baz)
% b = ( aa bb cc )
% flat = ( first $a last )
% echo $a
foo bar baz
% echo $flat
first foo bar baz last
% car = $a ^ $b
% echo prefix ^ $a
prefixfoo prefixbar prefixbaz
% echo $car
fooaa barbb bazcc



[9fans] Acme: moving the cursor to tag line

2018-04-19 Thread dexen deVries
i've realized i never use the Esc key in Acme.
meanwhile, i often go through cycle of:
- type chunk of code
- grab mouse, focus tag line
- type a command
- grab mouse, execute the command

would it make more sense to have Esc function as the "position cursor
& focus at the end of tag line of the current window" shortcut? bit of
a vi-like behavior; semi mode-switch, from input to execution *area*.

have anything like that been tried in Acme?

--
dx



[9fans] test(1) support for string length (-l) in p9p?

2018-04-10 Thread dexen deVries
the man page of test(1) mentions "-l string" as string length operator
for -eq, -gt, etc.
but there seems to be nothing in the plan9port's src/cmd/test.c, nor
in 9p.io/sources/cmd/test.c

is there any implementation of this floating around?



[9fans] awk handling NUL-terminated records

2017-06-07 Thread dexen deVries
i was mildly surprised that p9p awk handles NUL-terminated records just fine.
either via -v 'RS=\0', or via BEGIN { RS="\0" }
needed it to handle output of git status --porcelain=v2



Re: [9fans] Acme Edit to remove lines

2017-05-26 Thread dexen deVries
thanks, that did the trick indeed.



[9fans] Acme Edit to remove lines

2017-05-26 Thread dexen deVries
given multi-line dot, spanning only part of a file, how do i construct
an Edit command to remove lines matching certain regular expression?

wanted to delete lines starting with one particular character; without
leaving an empty line behind, thus Edit s/X.+//d is not sufficient.



[9fans] equality sign in Rc

2017-05-01 Thread dexen deVries
does anybody have a version of Rc that allows unquoted equality sign?

having to quote the character get a bit annoying on POSIX systems (plan9port)



[9fans] Slack via Acme?

2017-04-03 Thread dexen deVries
was there any attempt at using Slack through Acme?

the default desktop GUI, a browser AFAICT, is taking 1+ GB of RAM
after a few hours



[9fans] rc expression question

2017-03-31 Thread dexen deVries
given
pathnames = ( foo/a.txt bar/b.txt baz/c.txt )

how do i construct arguments to test(1) that test for existence of
those files in one go?

wanted:
test -e foo/a.txt -o -e bar/b.txt -o -e baz/c.txt

assuming the pathnames may contain space characters.



Re: [9fans] linux / p9p abomination

2017-03-01 Thread dexen deVries
rc is a thing of beauty.

apologies for HTML in the previous message.

On Wed, Mar 1, 2017 at 1:10 PM, erik quanstrom  wrote:
>> while (true)
>> if ($watch)
>> while (!$cmd)
>> $watch || true
>
> rc allows empty conditionals, which are true.
>
> - erik
>



[9fans] linux / p9p abomination

2017-03-01 Thread dexen deVries
runs build upon file change, repeats on failure

#!/usr/bin/env rc

flag e +

cmd = ( $* )

watch = ( inotifywait -q --recursive -e modify -e moved_to -e create -t 3 .
)

while (true)
if ($watch)
while (!$cmd)
$watch || true


Re: [9fans] Plumbing - Files with spaces

2015-07-22 Thread dexen deVries
there is trfs(4), not sure if applicable to plan9port.
trfs -  translate spaces and other runes in file names file system
http://9p.io/magic/webls?dir=/sources/contrib/nemo


Re: [9fans] Acme 2-1 chord arguments

2015-07-15 Thread dexen deVries
dirty 1.) rc -c 'git '^
note the space after git

idiomatic 1.) use win(1), pass 'command' argument a script which executes
git for each line of input as arguments through rc(1) to evaluate the
arguments in the usual way

2.) you can pass complex regular expression as argument to grep(1), without
rc(1) choking on metacharacters.
the argument is guaranteed not to have unforeseen side effects.


example win(1) script:
#!/usr/bin/env rc

orig_ifs = $ifs

PAGER=cat

while (true) {
ifs=''
echo -n 'git '
line = `{read}
ifs = $orig_ifs
rc -c 'git '^ $line
}


Re: [9fans] make passive aggressive gcc

2015-06-15 Thread dexen deVries

 I don't know what gcc authors are smoking, but strcpy(tmp,
 what.); will be compiled to a few mov instructions with -O0, while
 -Os still has a call to strcpy, just the way it *should* always be,
 imho.


not that it's any excuse, but -fno-builtin helps.

On Mon, Jun 15, 2015 at 4:56 PM, Siarhei Zirukin ftrvxm...@gmail.com
wrote:

 On Mon, Jun 15, 2015 at 3:41 PM, Ethan Grammatikidis
 eeke...@fastmail.fm wrote:
  On Mon, 15 Jun 2015 09:21:56 +0100
  Charles Forsyth charles.fors...@gmail.com wrote:
 
  If you're using gcc 4.8.2 to compile ... anything, really ... but
 certainly
  Plan 9 or Inferno components,
  and those use for loops with arrays, be sure to include the compilation
  options
  -fno-strict-aliasing\
  -fno-aggressive-loop-optimizations\
  and it will save you some time and effort.
  It will save compilation time (not that you'll notice with that
 sluggard)
  because it won't
  fuss even more with your program, and it will save effort, because you
  won't have
  to debug simple loops that have bounds changed, are removed completely,
 or
  otherwise wrecked.
  You can find discussions of it elsewhere (which is how I found compiler
  options to stop it).
  I'd forgotten all about it until it surfaced again.
 
  Thanks. Reminds me I liked gcc when it applied very few optimizations.
  I guess it must have been focused on machine-specific optimizations
  back in 2007/2008. I had a cpu newer than gcc had support for, and
  compilation was actually quick. Anyone know if -O0 is a reasonable
  option these days? (I mean tested well enough to be reasonably
  bug-free.)

 I've recenetly seen a few examples where -O0 would produce a
 segfaulting executable, while any other -Ox would work fine.
 Also, I don't know what gcc authors are smoking, but strcpy(tmp,
 what.); will be compiled to a few mov instructions with -O0, while
 -Os still has a call to strcpy, just the way it *should* always be,
 imho. I just checked this once again (gcc-4.8.4) and it still applies.




[9fans] mk - how to work around environment size limit on linux

2015-05-25 Thread dexen deVries
i'm using plan9port mk on linux and just hit the environment+argument
length limit -- linux' execve($PLAN9/bin/rc, ... ) returns E2BIG because
$newprereq gets too large.

how do i work around? is there an idiomatic way of splitting up $newprereq
into smaller chunks?

the mkfile is:

TIMESTAMP_FILE:
  for (i in $newprereq)
do_stuff $i

|./generate-rules-for-files PATTERN

where ./generate-rules-for-files outputs rules like TIMESTAMP_FILE:
file_matching_pattern


[9fans] p9p Acme - how to turn off output output buffering

2014-11-28 Thread dexen deVries
how do i turn off output buffering in p9p Acme for particular fd?

a braindead linux application does dup(2), and proceeds using FD 3 as error
output, which results in buffered output in Acme.


[9fans] $ifs equivalent in mk?

2014-06-12 Thread dexen deVries
i have a mkfile which does:

alljs=`{find -name '*.js'}

my_target:Q: ... $alljs
my_recipe;

and it breaks for files with spaces in pathname -- each space-separated token 
of pathname is treated as separate prerequisite.

in Rc, i could set $ifs to bare LF and be done with it. can equivalent be done 
in Mk?

-- 
dexen deVries

[[[↓][→]]]




Re: [9fans] $ifs equivalent in mk?

2014-06-12 Thread dexen deVries
On Thursday 12 of June 2014 07:27:18 erik quanstrom wrote:
  i have a mkfile which does:
  
  alljs=`{find -name '*.js'}
  
  my_target:Q: ... $alljs
  
  my_recipe;
  
  and it breaks for files with spaces in pathname -- each space-separated
  token of pathname is treated as separate prerequisite.
 
 if you rc-quote the terms, it should work.
 
 ; find|grep b
 './a b'
 ; cat mkfile
 x=`{find|grep b}
 
 all:
   echo $x|wc
   for(i in $x)
   echo $i
 ; mk
 echo ./a b|wc
 for(i in ./a b)
   echo $i
   1   2   6
 ./a b


here the var is processed by Rc inside recipe; in my case i need it processed 
by Mk inside prerequisite list


-- 
dexen deVries

[[[↓][→]]]




Re: [9fans] $ifs equivalent in mk?

2014-06-12 Thread dexen deVries
On Thursday 12 of June 2014 07:41:51 erik quanstrom wrote:
 
 i was demoing a technique that you might use.  have you tried it?
 


thanks, tried and works.


used sed for quoting; end result is perl-ugly:

alljs=`{find -name '*.js' | 9 sed 's/''//g; s/^|$/''/g' }
or
alljs=`{find -name '*.js' | 9 sed 's/^|$|''/''/g' }


-- 
dexen deVries

[[[↓][→]]]




Re: [9fans] $ifs equivalent in mk?

2014-06-12 Thread dexen deVries
On Thursday 12 of June 2014 07:59:45 erik quanstrom wrote:
 
 great.  glad that worked.  though it is always a bit sad
 when one has to outwit one's tools.
 

still better than managing an anthill^W^W a pile of .xml `build specs'

-- 
dexen deVries

[[[↓][→]]]




Re: [9fans] Plan9 users in Poland

2014-04-11 Thread dexen deVries
On Friday 11 of April 2014 13:28:05 Szymon Olewniczak wrote:
 I'm very curious about that so I would like to ask if there are any Plan
 9 users in Poland or am I the only one in my entire country?


cheers, using plan9port, toying with 9front.


-- 
dexen deVries

[[[↓][→]]]




Re: [9fans] New internal command for acme proposal (with implementations)

2014-02-05 Thread dexen deVries
On Wednesday 05 of February 2014 08:04:04 Bakul Shah wrote:
 On Feb 5, 2014, at 3:36 AM, erik quanstrom quans...@quanstro.net wrote:
  once one thinks about major modifications, i think it becomes attractive
  to think about a new editor.  i miss having graphics.
 
 If you mean mixed text and image, you will end up with some sort of
 structured markup language and a word processor!

does Abaco [1] support inline editing and HTTP PUT method (or PATCH)?



 What I want is support for complex text layout rendering (for Indian
 languages among others). This requires supporting OpenType fonts, not an
 easy task. Mac's TextEdit seems to do a decent job of this but I don't like
 it as an editor.


`having all the bells and whistles' doesn't make a great editor for 
programmers.


right now Acme is simple enough to be easily extensible and customizable for 
*your*  needs.
right now Acme is fast enough.
right now Acme uses fonts simple enough to be easily converted from other 
fonts.
...and the list goes on...



[1] http://lab-fgb.com/abaco/

-- 
dexen deVries

[[[↓][→]]]




Re: [9fans] New internal command for acme proposal (with implementations)

2014-01-24 Thread dexen deVries
On Friday 24 of January 2014 12:44:08 Uvelichitel wrote:
   Hi 9fans. While working with large sources in acme I feeling some lack
 of navigation capacity. So two new cmd. 1) 'Rev' , works precisely as
 'Look' but in reverse direction. It also change behavior of right mouse
 button search to search reverse. You will notice change with pointer
 position and little symbol near pipe in tag. Executing 'Look' instantly
 change behavior back. 

:-/REGEX



 After all navigation 2) 'Tip' , return pointer to
 last typing point. It understand 2-1 chording, so you can handy insert
 selection to last insert point without snarfing, including same window.

Left/Right Arrow keys takes you to the position where selection (cursor) 
currently is.

if the selection covers several lines, Left takes you to beginning, and Right 
to the end.


this plays well with double-click on any open/close parenthesis/bracket/brace. 
to quickly move to the other end of code block etc.


-- 
dexen deVries

[[[↓][→]]]




Re: [9fans] devdraw memory corruption

2014-01-14 Thread dexen deVries
On Tuesday 14 of January 2014 00:44:47 cinap_len...@felloff.net wrote:
 when user does read of exactly 12*12 bytes on draw
 ctl file, the snprint() adds one more \0 byte writing
 beyond the user buffer and corrupting memory.

what symptoms were you getting?

i'm seeing rare, seemingly random glitches in plan9port Acme.

some windows get only partially re-drawn -- any combination of borders, 
background and text can be missing, as per attachment. the top right window 
should be showing file list, but only background was drawn.


i've ported this patch to p9p to see if the breakage stops.

-- 
dexen deVries

[[[↓][→]]]
attachment: borken-acme.png

Re: [9fans] Acme, dump, and $HOME

2014-01-13 Thread dexen deVries
On Monday 13 of January 2014 08:42:22 Paul Lalonde wrote:
 Can anyone explain to me the rationale of Dump dropping acme.dump in $HOME
 instead of $PWD?
 I know I can pass it a different filename, but it seems odd to put it in
 $HOME instead of where acme is called from.
 My use case is this: I'm working on two projects, and so want to maintain
 two long-term sessions.  Dump does most of what I need when I move from
 one to the other, but if I don't chord in the project root directory to
 save the dump to, I kill my other project session.
 A one line change to looking at $PWD instead of $HOME makes acme much more
 useful for my case, but am I missing an important other use?


from acme(1):

Dump Write the state of acme to the file name, if specified, or 
$home/acme.dump by default.


i.e., Dump takes one optional argument: file pathname.


-- 
dexen deVries

[[[↓][→]]]




[9fans] [p9p] restart program on Acme Load

2014-01-10 Thread dexen deVries
hi list,


this is plan 9 port Acme question: how do i make Acme restart application upon 
Load? the only thing i care about is the correct working directory.


i'm running `git gui' from Acme; the tag indicates it with `git' word. upon 
Dump, restart Acme, Load, the `git' word is recreated in tag, but the program 
is not started.

-- 
dexen deVries

[[[↓][→]]]




[9fans] 9P on FPGA?

2014-01-10 Thread dexen deVries
is there any known 9P implementation for FPGA? or has anyone been working on 
communicating with FPGAs over 9P?


-- 
dexen deVries

[[[↓][→]]]




Re: [9fans] 9P on FPGA?

2014-01-10 Thread dexen deVries
On Friday 10 of January 2014 12:25:24 Richard Miller wrote:
 Technically yes, because inferno runs hosted on microCOS on a Nios2 soft cpu
 on Altera FPGAs.  But I imagine you're looking for something lower level?

thanks, will look into that.
but i imagine this particular implementation may be somewhat coupled to 
inferno and/or Nios.


 But I imagine you're looking for something lower level?

anything goes, Verilog preferred. i'm simply trying to learn something new :^)


-- 
dexen deVries

[[[↓][→]]]




Re: [9fans] [p9p] restart program on Acme Load

2014-01-10 Thread dexen deVries
On Friday 10 of January 2014 17:03:07 Alexander Sychev wrote:
 But Dump command doesn't save the info back to acme.dump
 
 
 Maybe this is a bug in rowdump function?


found `dump' in acme(4)

echo 'dump git gui' | 9p write acme/$winid/ctl 
and then Dump
got me close -- but the `git gui' was started in wrong dir -- in Acme's 
getwd() rather than window's directory.


--
dexen deVries

[[[↓][→]]]




[9fans] split(1): -e vs. -n, -f

2013-12-30 Thread dexen deVries
hi list,


both behavior and code indicate that split(1)'s  `-e' (split by regular 
expression) doesn't play along with either `-n' (line count) or `-f' (output 
file prefix). the former is somewhat understandable, but the later is strange 
in lieu of `-s' (output file suffix) working just fine.

that by accident or is there some rationale?


-- 
dexen deVries

[[[↓][→]]]




Re: [9fans] split(1): -e vs. -n, -f [patch]

2013-12-30 Thread dexen deVries
On Monday 30 of December 2013 11:10:45 you wrote: 
 both behavior and code indicate that split(1)'s  `-e' (split by regular
 expression) doesn't play along with either `-n' (line count) or `-f' (output
 file prefix). the former is somewhat understandable, but the later is
 strange in lieu of `-s' (output file suffix) working just fine.
 
 that by accident or is there some rationale?


-- 
dexen deVries

[[[↓][→]]]
From 01ae77413e4249776124727e797b0172e7874987 Mon Sep 17 00:00:00 2001
From: dexen deVries dexen.devr...@gmail.com
Date: Mon, 30 Dec 2013 15:47:24 +0100
Subject: [PATCH] make stat(1)'s `-e' play along with `-f' (output file
 prefix)

also make the file pathname buffer a bit larger.
---
 src/cmd/split.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/cmd/split.c b/src/cmd/split.c
index e758786..4820930 100644
--- a/src/cmd/split.c
+++ b/src/cmd/split.c
@@ -8,7 +8,7 @@ char	digit[] = 0123456789;
 char	*suffix = ;
 char	*stem = x;
 char	suff[] = aa;
-char	name[200];
+char	name[2048];
 Biobuf	bout;
 Biobuf	*output = bout;
 
@@ -130,9 +130,11 @@ int
 matchfile(Resub *match)
 {
 	if(match[1].s.sp) {
-		int len = match[1].e.ep - match[1].s.sp;
-		strncpy(name, match[1].s.sp, len);
-		strcpy(name+len, suffix);
+		int len_match = match[1].e.ep - match[1].s.sp;
+		int len_stem = strlen(stem);
+		strcpy(name, stem);
+		strncpy(name+len_stem, match[1].s.sp, len_match);
+		strcpy(name+len_stem+len_match, suffix);
 		openf();
 		return 1;
 	} 
-- 
1.7.12.1



Re: [9fans] mk time-check/slice issue

2013-12-27 Thread dexen deVries
On Thursday 19 of December 2013 14:09:05 a...@9srv.net wrote:
 
 There is a reason (or set of reasons) we're using Plan 9, as
 opposed to doing everything on Linux or whatnot. The
 system is designed with a different set of principles in mind.


as a resident contrarian, let me say:

there is a reason i prefer using p9p (mk, rc, acme) when working on linux -- 
rather than just linux (or GNU Make, Bash, emacs/vi), with all the assorted 
bells and whistles.


call it zen, call it time saver,
i debug my projects, not the meta-projects.
commit.


-- 
dexen deVries

[[[↓][→]]]




Re: [9fans] Problem with mk

2013-12-19 Thread dexen deVries
the problem is not solved, merely one of the manifestation is eliminated.
actual solution requires stating all the dependencies.

if your list of sources and/or targets is dynamic, consider using mk include:
| GEN_DEPS
where `GEN_DEPS' is your script generating deps in form TARGET: PREREQUISITE

On Wed, Dec 18, 2013 at 10:14 PM, Blake McBride bl...@mcbride.name wrote:
 Thanks.  That is what I was wondering.  In the interim, and having a better
 understanding of what is going on, I was able to re-work my mkfile to
 support parallel builds where possible.  I am, however, experiencing a new
 problem.  I will write that up in a separate post.

 Thank for the info!

 Blake



 On Wed, Dec 18, 2013 at 3:04 PM, Jacob Todd jaketodd...@gmail.com wrote:

 You could put NPROC=1 in the mkfile.





Re: [9fans] Problem with mk

2013-12-18 Thread dexen deVries
On Wednesday 18 of December 2013 09:23:19 Blake McBride wrote:
 
 Problem 1:
 


it seems you have an un-stated dependency/cies among your intermediate targets 
/ prerequisites.

Say, foo.o depends on foo.c and foo.h -- but foo.h also depends on 
generated_foo.h, which should be generated by make.

in such case, explicitly state (no recipe is necessary):


foo.h: generated_foo.h


so mk knows the `generated_foo.h' must be completed first.


 Problem 2:
 
 Even though I am executing mk with the -s option, it still seems like it
 is running in parallel because a subsequent command can't find a file
 created by a prior command - as if it didn't wait for the prior command to
 finish.  Remember this build fine, and without error codes, when executed
 manually.



-s won't help you there, because it regards processing of /command line/ 
arguments, not of prerequisites. consider:

$ NPROC=1 mk my_target

also investigate -d[egp] debug stuff.


have fun with mk, it's a great little tool :-)



-- 
dexen deVries

[[[↓][→]]]

Take care of the luxuries and the necessities will take care of themselves.
-- L. Long




Re: [9fans] Can't start multiple copies of acme

2013-12-16 Thread dexen deVries
i'm using two Acmes all the time, with:


'EOF'

#!/usr/bin/env rc

flag e +

NAMESPACE=`{namespace}^-2
mkdir -p `{namespace}
plumber || true
exec acme

EOF;


of course plumber sends to the first copy.

-- 
dexen deVries

[[[↓][→]]]

Take care of the luxuries and the necessities will take care of themselves.
-- L. Long




[9fans] marking lines in Acme

2013-12-11 Thread dexen deVries
hi list,


i reckon the subject of multi-selections in Acme has been discussed back and 
forth, but please hear me out.

use case: i want to indicate in Acme which lines of a file has been changed.

a script executes `git show HEAD' (last commited changes) or `git diff' 
(uncommited changes), opens indicated files and marks what has been changed.

as of now, the script marks only first changed range in file via selection.

any /other/ sensible way of indicating other changes in this file?


-- 
dexen deVries

[[[↓][→]]]





[9fans] p9p mk rc help

2013-11-20 Thread dexen deVries
Hi list,

apologies for the keyword overload ;-)

I have a plan9port mkfile using Rc (MKSHELL=$PLAN9/bin/rc), a recipe
contains pipeline: FOO_COMMAND | BAR_COMMAND.

What is the correct way of detecting failure exit status of
FOO_COMMAND (a networked operation) and ignoring exit status of
BAR_COMMAND?
the best i came up with is very ugly:

target: prereq
FOO_COMMAND | BAR_COMMAND
st = $status
if (~ $st ?* ^ '|' ^ *) {
echo FOO_COMMAND failed
exit 3 }

seems the | in pattern has to be quoted, otherwise is interpreted as
pipe operator.

regards,
--
dx



Re: [9fans] i'm afraid we've had it wrong

2013-09-29 Thread dexen deVries
On Sunday 29 of September 2013 10:39:40 Rob Pike wrote:
 He appears not to understand the concept of research.


and he fails to note that every single thing he mentions has already made its 
way into commercial OSes (at least RedHat has 100% of it; MacOS X has some).

even the /net is widespread in a bastardized form thanks to the 
`/dev/tcp/$IP/$PORT' hack in bash.

-- 
dexen deVries

[[[↓][→]]]

I have seen the Great Pretender and he is not what he seems.




[9fans] how to output NUL byte from awk?

2013-09-17 Thread dexen deVries
awk(1) says, ``[s]tring constants are quoted  , with the usual C escapes 
recognized within.'', but \0 seems to terminate internal string 
reprezentation...

so how do i output a real NUL byte?



-- 
dexen deVries

[[[↓][→]]]




Re: [9fans] how to output NUL byte from awk?

2013-09-17 Thread dexen deVries
On Tuesday 17 of September 2013 14:03:11 Kurt H Maier wrote:
 Quoting dexen deVries dexen.devr...@gmail.com:
  awk(1) says, ``[s]tring constants are quoted  , with the usual C escapes
  recognized within.'', but \0 seems to terminate internal string
  reprezentation...
  
  so how do i output a real NUL byte?
 
 Does printf not do this?


thanks
i feel really dumb now ;-)


--
dx



Re: [9fans] how to output NUL byte from awk?

2013-09-17 Thread dexen deVries
On Tuesday 17 of September 2013 12:50:07 erik quanstrom wrote:
 On Tue Sep 17 10:04:20 EDT 2013, k...@sciops.net wrote:
  Quoting dexen deVries dexen.devr...@gmail.com:
   awk(1) says, ``[s]tring constants are quoted  , with the usual C
   escapes
   recognized within.'', but \0 seems to terminate internal string
   reprezentation...
   
   so how do i output a real NUL byte?
  
  Does printf not do this?
 
 no, awk's printf does not do that:
 minooka;  awk 'BEGIN{printf %c, utf(0)}' | wc
   0   0   0
 minooka; awk 'BEGIN{printf %.5s, 12\034567890}' | xd -1
 000  31 32 1c 35 36
 minooka; awk 'BEGIN{printf %.5s, 12\0\034567890}' | xd -1
 000  31 32


printf %c, 0


-- 
dexen deVries

[[[↓][→]]]

Take care of the luxuries and the necessities will take care of themselves.
-- L. Long




Re: [9fans] how to output NUL byte from awk?

2013-09-17 Thread dexen deVries
On Tuesday 17 of September 2013 12:50:07 erik quanstrom wrote:
 On Tue Sep 17 10:04:20 EDT 2013, k...@sciops.net wrote:
  Quoting dexen deVries dexen.devr...@gmail.com:
   awk(1) says, ``[s]tring constants are quoted  , with the usual C
   escapes
   recognized within.'', but \0 seems to terminate internal string
   reprezentation...
   
   so how do i output a real NUL byte?
  
  Does printf not do this?
 
 no, awk's printf does not do that:
 minooka;  awk 'BEGIN{printf %c, utf(0)}' | wc
   0   0   0
 minooka; awk 'BEGIN{printf %.5s, 12\034567890}' | xd -1
 000  31 32 1c 35 36
 minooka; awk 'BEGIN{printf %.5s, 12\0\034567890}' | xd -1
 000  31 32



utf() is the problem, %c expect int, not string:

9 awk ' BEGIN { printf %c, 0 } ' | 9 wc
  0   1   1


9 awk ' BEGIN { printf X%cX, 0 } ' | 9 xd
000  58005800


--
dx



Re: [9fans] Look vs. Edit?

2013-09-11 Thread dexen deVries
On Wednesday 11 of September 2013 12:28:16 Lee Fallat wrote:
 Personally, I have replaced Look with Edit because I just highlight-B3 and
 it searches. Plus I use the sam command language a lot.


Look is guaranteed to be side-effect free, while B3 can end up invoking any 
program as defined in /usr/$user/lib/plumbing.


i used to have a (now long forgotten) script perform some operation on current 
Git repository upon B3 on SHA1.


-- 
dexen deVries

[[[↓][→]]]

Take care of the luxuries and the necessities will take care of themselves.
-- L. Long




[9fans] programmable pathname completion in Acme?

2013-09-09 Thread dexen deVries
currently the ^F pathname completion is handled internally by Acme. is there a 
way to pass the argument of ^F to a script instead?


my use case: find an existing pathname by supplying /any/ substring of it and 
invoking completion, as opposed to current requirement of providing whole 
leading part. i have a script that takes part of pathname in $1 and returns 
all (hopefully exactly one) matching pathnames, and i want to plumb the ^F 
from Acme to it.


-- 
dexen deVries

[[[↓][→]]]




Re: [9fans] p9p mk(1) syntax

2013-09-07 Thread dexen deVries
thanks to you both.

http://github.com/dexen/plan9port-custom/commit/6a67d4d8c97bc682737ae1cf59544fb4c969a105.patch

cinap's version also supports rc block statements; tested with:

MKSHELL = rc

foo = `{ echo aaa; { date; }; pwd; }
bar = `{ echo zzz `{ date } zzz }

test:VQ:
echo foo $foo
echo bar $bar

On Sat, Sep 7, 2013 at 5:05 PM,  cinap_len...@gmx.de wrote:
 why not this?

 +   if(term == '}'  c == '{')
 +   depth++;

 --
 cinap




[9fans] p9p mk(1) syntax

2013-09-06 Thread dexen deVries
in p9p mk, this works as expected:
foo = `{echo bar}

but the following does not -- rc(1) indicates syntax error:
foo = `{echo `{echo bar}}


strace indicates that mk(1) passes input to rc(1) with no closing braces at 
all.


i'm using MKSHELL = rc.

-- 
dexen deVries

[[[↓][→]]]




[9fans] p9p mk(1) syntax

2013-09-06 Thread dexen deVries
in p9p mk, this works as expected:
foo = `{echo bar}

but the following does not -- rc(1) indicates syntax error:
foo = `{echo `{echo bar}}


strace indicates that mk(1) passes input to rc(1) with no closing braces at 
all.


i'm using MKSHELL = rc.

-- 
dexen deVries

[[[↓][→]]]

Take care of the luxuries and the necessities will take care of themselves.
-- L. Long




Re: [9fans] reading addr always returns #0,#0?

2013-09-02 Thread dexen deVries
On Monday 02 of September 2013 14:13:56 Alexander Sychev wrote:
 The problem is the addr file is closed between your calls. When you open
 the addr file next time, an internal address is set to 0,0.
 But after the writing the address is actual and if you read data file you
 will see the text according to your address.
 
 I you write the code on C or Go without a closing a descriptor of addr
 file, everything will be ok :-)


or use 9p rdwr:


echo -n , | 9p write acme/2/addr
echo 'dot=addr' | 9p rdwr acme/2/ctl 

-- 
dexen deVries

[[[↓][→]]]

Take care of the luxuries and the necessities will take care of themselves.
-- L. Long




Re: [9fans] [plan9] acme noscrool feature enable

2013-09-02 Thread dexen deVries
On Monday 02 of September 2013 14:19:17 Alexander Sychev wrote:
 Hi,
 As far as I know Acme doesn't have the noscroll feature at all.


if `win' is of any help, it has the following property:
 Win windows follow the
 same scrolling heuristic as in 9term(1): the window scrolls
 on output only if the window is displaying the end of the
 buffer.



-- 
dexen deVries

[[[↓][→]]]

Take care of the luxuries and the necessities will take care of themselves.
-- L. Long




Re: [9fans] [plan9] acme noscrool feature enable

2013-09-02 Thread dexen deVries
On Monday 02 of September 2013 12:58:28 Giovanni Casano wrote:
 9term windows default behaviour does not scroll when output reaches
 the end of the window: this is what I am trying to do.
 Few months ago I succeded in that... now I do not remember how I did :(


when executed in Acme, the following scrolls by default, but will pause 
scrolling when you scroll up so far that the last line of output goes out of 
window (becomes invisible):

win ANY_COMMAND 

for example:

win rc -c 'while (true) date  sleep 1'
win ssh dexen@baron



-- 
dexen deVries

[[[↓][→]]]

Take care of the luxuries and the necessities will take care of themselves.
-- L. Long




Re: [9fans] acme: send dot to the stdin of a more complicated command

2013-08-28 Thread dexen deVries
On Wednesday 28 of August 2013 10:05:14 Rudolf Sykora wrote:
 Hello,
 
 I tried to modify Russ' script below to be usable on p9p. I came up with
 
 #!/usr/local/plan9/bin/rc
 
 if(! ~ $#* 1) {
 echo 'usage: Run title' [1=2]
 exit 1
 }
 
 id=`{awk -v 'pat='$1 '$6 ~ pat {print $1}' {9p read acme/index}}
 if(~ $#id 0) {
 echo 'no match for pattern' [1=2]
 exit 2
 }
 if(! ~ $#id 1) {
 echo 'ambiguous pattern' [1=2]
 exit 3
 }
 if(~ `{wc -w {9p read acme/$id/rdsel}} 0) {
 echo 'no command selected' [1=2]
 exit 4
 }
 #exec cat {9p read acme/$id/rdsel}
 exec /usr/local/plan9/bin/rc {9p read acme/$id/rdsel}
 
 
 but the last line doesn't really do what I want, yielding the error:
 Run: exit 1
 rc: /dev/fd/5:2: token EOF: syntax error


your selection lacks the final LF to make Rc happy ;-)

a quick and dirty hack would be to always append LF:
exec /usr/local/plan9/bin/rc {9p read acme/$id/rdsel;echo;}

tested with:
echo foo bar
rc {9p read acme/$winid/rdsel; echo; }

selecting bare `echo foo bar' (without LF) gives syntax error; selecting whole 
line works a-OK


-- 
dexen deVries

[[[↓][→]]]

Take care of the luxuries and the necessities will take care of themselves.
-- L. Long




Re: [9fans] cifs fails on nodes named aux

2013-08-28 Thread dexen deVries
On Wednesday 28 of August 2013 10:26:01 Erik Quanstrom wrote:
 the claim that the devices are in the directories and thus the file system
 is still false.  even if explorer has some unnecessary code.  and plan 9 is
 not immune from unnecessary weird bits e.g. the export protocol.



a somewhat official specification confirms that -- by not listing those magic 
files as implied:
http://msdn.microsoft.com/en-us/windows/hardware/gg463084

some more info:
http://msdn.microsoft.com/en-us/library/aa365247(v=vs.85).aspx#file_and_directory_names


-- 
dexen deVries

[[[↓][→]]]

Take care of the luxuries and the necessities will take care of themselves.
-- L. Long




[9fans] [p9p] rc script fails silently in conditional expression calling a function

2013-08-06 Thread dexen deVries
on Plan 9 Port, the following Rc script fails silently, upon calling the `foo' 
function in ``if (foo)''. i expected it to output `FAIL' instead. is that by 
design, or is it some sort of a bug?


#!/usr/bin/env rc

flag e +

fn foo {
/bin/false
}

if (foo)
echo SUCCESS
if not
echo FAIL



for contrast, the following script outputs `FAIL' as expected -- the 
difference being in calling the /bin/false directly in ``if(/bin/false)''

#!/usr/bin/env rc

flag e +

if (/bin/false)
echo SUCCESS
if not
echo FAIL

-- 
dexen deVries

[[[↓][→]]]

Take care of the luxuries and the necessities will take care of themselves.
-- L. Long




[9fans] mk: the `D' flag

2013-06-18 Thread dexen deVries
in mk(1), why is the `D' flag (if the recipe exits with a non-null status, the 
target is deleted) optional, rather than default?

i can see why it makes little sense with together `V' flag, but for non-V 
rules, targeting plain files, i'd like it by default.

-- 
dexen deVries

[[[↓][→]]]




Re: [9fans] Win starting rc?

2013-06-11 Thread dexen deVries
On Tuesday 11 of June 2013 13:06:15 Matthew Veety wrote:
 On Jun 11, 2013, at 16:09, Brian Vito brian.v...@gmail.com wrote:
  Is there a way to have Acme's Win command start an rc session rather
  than bash? Also, is it possible to set the bash prompt to PS1=: {\w}
  %;  if bash is started by Win? Thanks again.
 
 Bash was ported to plan 9? 

the other way around: http://swtch.com/plan9port/


also p9p mk defaults to bash , so it's good to set MKSHELL=rc on top of 
mkfiles.


-- 
dexen deVries

[[[↓][→]]]

I have seen the Great Pretender and he is not what he seems.




Re: [9fans] btcd: A Full Alternative Bitcoin Implementation, Written In Go

2013-05-09 Thread dexen deVries
On Thursday 09 of May 2013 21:47:48 Antonio Barrones wrote:
 Hi,
 I have read this article:
 btcd: A Full Alternative Bitcoin Implementation, Written In Go
 http://bitcoinmagazine.com/btcd-a-full-bitcoin-alternative-written-in-go
 
 and I wonder if this could be a way to have Bitcoin in the Plan9
 environment.


do you /really/ need Yet Another Networked Filesystem in Plan9? ;-)

-- 
dexen deVries

[[[↓][→]]]




Re: [9fans] btcd: A Full Alternative Bitcoin Implementation, Written In Go

2013-05-09 Thread dexen deVries
On Thursday 09 of May 2013 15:04:32 erik quanstrom wrote:
 On Thu May  9 15:00:26 EDT 2013, dexen.devr...@gmail.com wrote:
  do you /really/ need Yet Another Networked Filesystem in Plan9? ;-)
 
 yes, but what does that have to do with bitcoin?

a silly joke was silly...

the way i see it -- bitcoin is a distributed, append-only, content-addressable 
filesystem with eventual consistency. ostensibly designed for transferring 
coins, but can just as well house arbitrary binary data , be it a portrait and 
a tribute to departed people [1] or alternative DNS [2].


[1] https://bitcointalk.org/index.php?topic=33618.0
[2] http://en.wikipedia.org/wiki/Namecoin#Namecoin_DNS


-- 
dexen deVries

[[[↓][→]]]




Re: [9fans] Octets regexp

2013-05-02 Thread dexen deVries
please pardon the silly question, but... how about piping the binary data 
through xd(1) before sending it to regexp(3)?

-- 
dexen deVries

[[[↓][→]]]

I have seen the Great Pretender and he is not what he seems.




[9fans] open file in awk script?

2013-04-08 Thread dexen deVries
trying to create a standalone awk script (#!/usr/local/plan9/bin/awk -f).

how to open a file in BEGIN pattern section and set it as next input file?

not helped so far: FILENAME=foo.txt
nor ARGV[1]=foo.txt; nextfile;


-- 
dexen deVries

[[[↓][→]]]




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

2013-04-05 Thread dexen deVries
On Friday 05 of April 2013 14:35:58 Martin Kühl wrote:
 or using 9p(1):
 
 for (num in `{9p ls acme | grep '^[0-9]'}) {
 if (9p read acme/$num/tag | grep -s '^'$pattern)
 echo delete | 9p write acme/$num/ctl
 }


thanks, this version supports using two Acmes, each in separate namespace :-)


-- 
dexen deVries

[[[↓][→]]]




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


[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

[[[↓][→]]]




[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 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

[[[↓][→]]]




[9fans] p9p acme vs. firefox

2013-04-03 Thread dexen deVries
probably more of a firefox question, but hey.


once in a blue moon† the www-based software i'm developing displays a 
backtrace. is there a sensible way to plumb it to p9p Acme?

all's running on linux/x11


-- 
dexen deVries

[[[↓][→]]]

† lies, damn lies and bug metrics ;-)




Re: [9fans] 9FRONT ANNOUNCES INTEL WIFI DRIVER, WPA/WPA2 SUPPORT

2013-04-02 Thread dexen deVries
On Monday 01 of April 2013 08:13:19 andrey mirtchovski wrote:
  Looking forward to a backport of this to the stock Plan 9.
 
 ... and plan9port!


i reckon you wrote that for fun, but nonetheless i'd gladly use a small p9p-
centric linux distro. basically linux kernel for the drivers + p9p + perhaps 
some filesystem recovery tools.

this leaves open the question of providing devdraw(1) -- perhaps via fbdev -- 
and the usual x11 goodies of mouse, clipboard etc.?


-- 
dexen deVries

[[[↓][→]]]




Re: [9fans] Acme Edit scriptlets

2013-03-29 Thread dexen deVries
On Friday 29 of March 2013 01:38:06 Bence Fábián wrote:
 I did a quick writeup on little Edit scripts
 (well basicly sam(1) scripts)
 If anyone have more feel free to contribute.
 Maybe someone could put them on the wiki even.

stuff i use:

# clear whole window -- usefull with +Errors
Edit ,d 

# decrease TAB indentation of selection
Edit s,^TAB,,g


# increase TAB indentation of selection
# the ^. part ensures we indent only lines with content
# and leave empty lines undisturbed
Edit s,^.,TAB,g

-- 
dexen deVries

[[[↓][→]]]




Re: [9fans] Acme Edit scriptlets

2013-03-29 Thread dexen deVries
On Friday 29 of March 2013 09:25:47 Peter A. Cejchan wrote:
 Also, could you share the plumbing rules you use (for my
 inspiration/learning)?


1) re-format PHP's strange error mesages into standard 
FILE_PATHNAME:LINE_NUMBER


# ... called in FILE_PATHNAME on line LINE_NUMBER and defined in FILE_PATHNAME 
on line LINE_NUMBER

data matchesmultiline '.*rror.*called in ([^ ]+) on line ([0-9]+) and defined 
in ([^ ]+) on line ([0-9]+).*'
arg isfile $1
data set $file
attr add addr=$2
type is text
plumb to edit


#file / line in PHP format
data matchesmultiline '(.+) on line ([0-9]+).*'
arg isfile $1
data set $file
attr add addr=$2
type is text
plumb to edit


2) display php's function prototypes on right-click on a function name with an 
opening parenthesis. the `W' script greps a flat text file list of functions 
(with arguments and return types) and outputs to +Errors window.


type is text
data matches '[a-zA-Z_][a-zA-Z_0-9]*[(]'
plumb start W --wdir $wdir $data


* * *

a half-hearted support for displaying SQL table schema; again, `Wtable' is a 
script outputting definition of indicated table.

type is text
data matches '.*(FROM|JOIN)[ ]+([^ ]+).*'
data set $2
plumb start Wtable --wdir $wdir $data

-- 
dexen deVries

[[[↓][→]]]




Re: [9fans] Plan 9 ``propaganda server'' back on line

2013-03-29 Thread dexen deVries
On Friday 29 of March 2013 06:57:55 s...@9front.org wrote:
 NO STRINGS ATTACHED

it made my day, too.

technically those are zero-terminated arrays of Runes... ;-)

-- 
dexen deVries

[[[↓][→]]]




Re: [9fans] FAT32 question

2013-03-27 Thread dexen deVries
On Wednesday 27 of March 2013 08:24:57 Comeau At9Fans wrote:
 I'm mounting a FAT32 flashdrive on a RPi.  However, it seems that some
 sort of legacy 8.3 filename situation is existing.  For instance, if I
 have a directory containing x.c and a23456789.c that the former is
 taken as X.C and the latter is taken as shown.  Therefore, to compile
 x.c is not possible.  So for instance, echo *.c produces a different
 result than echo *.C.  I tried mv'ing the problem files and then back
 but same results.
 
 I do believe that historically there was some sort of interpretations
 such as this in the evolution from FAT to FAT32, but not sure it
 should be so in current version, or, at least, other operating systems
 don't take this interpretation.  Is there an option or something I'm
 missing?  How do I get to process x.c as x.c and not X.C.


there's no difference between FAT12/16 and FAT32 in treatment of file names, it 
is entirely up to FS driver to create or skip creation of LFN (Long File Name) 
entry, and to use or skip reading an LFN.

every file on FAT has 8.3 name, and may, but does not have to have, an LFN. the 
8.3 name is of limited charset (one of DOS or WINDOWS codepages) and upcase 
only, at least in canonical format. to store lowercase characters, you need 
LFN.

IIRC, some version(s?) of fat drivers on linux did not create LFN for a file 
when the long filename was matching case INsensitive the 8.3 file name, 
essentially leading to loss of character case information.

perhaps something alike is at play here.

-- 
dexen deVries

[[[↓][→]]]


``we, the humanity'' is the greatest experiment we, the humanity, ever 
undertook. 




Re: [9fans] gcc not an option for Plan9

2013-03-26 Thread dexen deVries
On Tuesday 26 of March 2013 13:11:11 Rubén Berenguel wrote:
 I'm starting to wonder why I decided to subscribe to yet another newsgroup,
 after having unsubscribed from so many in the past for lack of content. I
 guess I never learn the required lessons.


as a counterport, picol...@software-lab.de has never let me down ;-)

(archives at http://www.mail-archive.com/picolisp@software-lab.de/ )


cheers,

-- 
dexen deVries

[[[↓][→]]]


``we, the humanity'' is the greatest experiment we, the humanity, ever 
undertook. 




[9fans] mk and transitive dependencies (was: gcc not an option for Plan9)

2013-03-25 Thread dexen deVries
On Saturday 23 of March 2013 12:37:17 Rob Pike wrote:
 (...) and because go install does
 transitive dependencies correctly, which mk does not.

anybody care to explain what is the limitation of mk here? can't wrap my head 
around it...


-- 
dexen deVries

[[[↓][→]]]




Re: [9fans] mk and transitive dependencies (was: gcc not an option for Plan9)

2013-03-25 Thread dexen deVries
On Monday 25 of March 2013 11:33:55 hiro wrote:
  It does not understand the real dependencies in your software.
 
 what does understand mean in that context?
 I would think if this is all done automagically with go it would need
 to follow even more general rules, no?

if mk understood 8c's construct ``#pragma lib libbio.a'' and used it to link 
correct libraries, it could be said to understand the actual dependencies as 
expressed by code.

of course, the deeper you go into this rabbit hole, the closer you get to 
something resembling GNU autotools.

-- 
dexen deVries

[[[↓][→]]]


``we, the humanity'' is the greatest experiment we, the humanity, ever 
undertook. 




Re: [9fans] mk and transitive dependencies (was: gcc not an option for Plan9)

2013-03-25 Thread dexen deVries
On Monday 25 of March 2013 11:40:32 Bence Fábián wrote:
 mk doesn't parses '#include' directives in C

gnu make can use output of gcc -M as rules describing prerequisites. it's 
somewhat tedious and error-prone, though, as indicated by multitude of -Mx 
file options.


-- 
dexen deVries

[[[↓][→]]]




Re: [9fans] Acme hack - a week later

2013-03-21 Thread dexen deVries
On Thursday 14 of March 2013 15:38:08 yy wrote:
 Not that I have any problem with this but, isn't it easier to just Del the
 window so that a new one is created when you need it?


one week in, i've became much more cavalier about Del-ing an +Errors window, 
while still using the Edit ,d quite often.

turns out, i was affraid of having to re-type the Edit ,d in every new window.


all hail Acme,
-- 
dexen deVries

[[[↓][→]]]




[9fans] p9p rc flag e +

2013-03-21 Thread dexen deVries
in p9p rc, an `if (/bin/false)' statement without `if not' statement causes 
non-empty $status, and thus will terminate mk.

for example, the attached mkfile returns error for target `breaks', but works 
for target `works', with the difference being that of trailing `if not'.

from my point of view, the `if (/bin/false)' statement spills the non-empty 
$status from the conditional expression to its outern scope. perhaps this is 
to simplify implementation of `if not', but it irks me.

is that really the expected behavior, or is it a quirk of p9p rc?

is there a point to, or an use case for this behavior?


-- 
dexen deVries

[[[↓][→]]]
MKSHELL=$PLAN9/bin/rc

test:VQ: positive negative
echo success.

positive:VQ:
if (test -e mkfile)
echo the file exists

negative:VQ:
# any file or dir that is sure not to exist
# if we have a file `mkfile', then for sure we don't have a dir 
`mkfile/'
if (test -e mkfile/)
echo SHOULD NOT BE REACHED


Re: [9fans] p9p rc flag e +

2013-03-21 Thread dexen deVries
On Thursday 21 of March 2013 10:22:54 erik quanstrom wrote:
 the more idiomatic way to write this is if(~ 0 1); plan 9 has no
 /bin/false.  plan 9 rc behaves in the same way, and the usual
 solution is to use ~ 0 0 to clear the status, or exit ''.
 
 i have seen scripts reuse the status, especially of a pipe
 inside the if.  (obviously the status is the same in either
 branch.)


thanks Erik, it makes sense to me now :-)


i'd rather have if's $status visible only to the first statement following it, 
for example:

if (foo | bar | baz) {  # sets $status
  if (! ~ $status ) {  # uses $status
handle_particular_kind_of_pipeline_failure
  }
  do_other_stuff   # should not be affected
}
do_yet_other_stuff   # should not be affected either


...but guess rc's semantics are almost set in stone by now :-)


cheers,
-- 
dexen deVries

[[[↓][→]]]






Re: [9fans] Acme button 1 working like button 3

2013-03-19 Thread dexen deVries
On Monday 18 of March 2013 16:56:00 Patrick Higgins wrote:
 I am trying out Acme after watching rsc's tour at
 http://research.swtch.com/acme
 
 So far I have been liking it, but I just hit an issue: mouse button 1
 now acts the same as button 3. It was working normally just a few
 minutes ago. Other X windows including xev still work normally.
 
 I would appreciate some help in understanding/resolving this.


there's been a recent commit in p9p
(html)
http://code.swtch.com/plan9port/commits/c1bd38a11c42d18b53ee5d6a6084eccb9728f2c2
(raw)
http://code.swtch.com/plan9port/commits/c1bd38a11c42d18b53ee5d6a6084eccb9728f2c2/raw/


...and i've been suffering from randomly stuck Ctrl or Alt in recent X.org or 
KDE.


-- 
dexen deVries

[[[↓][→]]]




[9fans] Acme hack

2013-03-14 Thread dexen deVries
I like my +Errors window clean once in a while. Attached patch provides
 Edit ,d
by default in +Errors window tagline.

-- 
dexen deVries

[[[↓][→]]]
From b4edef7c40de4c4a8678622e11eee8bd9aef8523 Mon Sep 17 00:00:00 2001
From: dexen deVries dexen.devr...@gmail.com
Date: Thu, 14 Mar 2013 14:41:22 +0100
Subject: [PATCH] acme: provide Edit ,d in +Error windows

---
 src/cmd/acme/wind.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/src/cmd/acme/wind.c b/src/cmd/acme/wind.c
index d2bec16..5e952ed 100644
--- a/src/cmd/acme/wind.c
+++ b/src/cmd/acme/wind.c
@@ -451,6 +451,7 @@ winsettag1(Window *w)
 	static Rune Lget[] = { ' ', 'G', 'e', 't', 0 };
 	static Rune Lput[] = { ' ', 'P', 'u', 't', 0 };
 	static Rune Llook[] = { ' ', 'L', 'o', 'o', 'k', ' ', 0 };
+	static Rune Leditcomad[] = { ' ', 'E', 'd', 'i', 't', ' ', ',', 'd', 0 };
 	static Rune Lpipe[] = { ' ', '|', 0 };
 
 	/* there are races that get us here with stuff in the tag cache, so we take extra care to sync it */
@@ -509,6 +510,10 @@ winsettag1(Window *w)
 runemove(new+i, Llook, 6);
 i += 6;
 			}
+			else if (!w-filemenu){
+runemove(new+i, Leditcomad, 8);
+i += 8;
+			}
 			else{
 static Rune foo[] = { ' ', 0 };
 runemove(new+i, foo, 1);
-- 
1.8.1.4



Re: [9fans] Acme hack

2013-03-14 Thread dexen deVries
On Thursday 14 of March 2013 15:38:08 yy wrote:
 
 Not that I have any problem with this but, isn't it easier to just Del the
 window so that a new one is created when you need it?


you are right. i use Edit ,d to preserve general window layout.

i'm not happy with Acme's placement of +Errors window in my default workflow. 
in two columns, i keep one directory (project root) window, one +Errors window 
beneath it (syntax errors, upload progress †, scratchpad) and some 1...6 
source code file windows spread 'round.

btw., the patch may not apply cleanly since my p9p fork has `Look' disabled 
via if(0) {...}


-- 
dexen deVries

[[[↓][→]]]


† i'm a LAMP webdeveloper by day.




[9fans] Acme: indicator of running process

2013-03-05 Thread dexen deVries
hi list,


a long running process (e.g. `git submodule update') does not give any 
indication as to whether it is running or dead already, save for some progress 
messages, if any. i would like a clear indicator in Acme's $cwd+Error window 
the process outputs to.

i guess the state of the /dev/stdout of Acme's child process whould be a good 
indicator for most cases. is there any handy hack to indicate whether the 
/dev/stdout is open in any particular Acme window? or any other indicator 
whether a process is still working or dead?

yes, i know names of processes are displayed in top Tag line, but in my cases, 
usually several gits are ran along (git gui, git submodule, etc.etc.)

using p9p Acme.


cheers,
-- 
dexen deVries

[[[↓][→]]]




Re: [9fans] Git (Was: Acme: indicator of running process)

2013-03-05 Thread dexen deVries
On Tuesday 05 of March 2013 16:49:58 lu...@proxima.alt.za wrote:
  (e.g. `git submodule update')
 
 You got git running under Plan 9?

sorry, no.

IMHO it would make more sense to implement git-like toolkit, protocol- and 
fast-export/fast-import compatible with git, using Venti as storage backend.

would heavy use of git-rebase fill up the Venti storage too quickly?


* * *

is it too much noise to ask about p9p Acme on this mailing list?

-- 
dexen deVries

[[[↓][→]]]




Re: [9fans] X11

2013-02-28 Thread dexen deVries
On Thursday 28 of February 2013 14:21:08 Charles Forsyth wrote:
 ANSI C has a _Noreturn attribute that I started to implement,
 but I think I might fall back to a #pragma, which would be quicker to do.

another quick hack:

#define exit(status) do { exit(status); return 0; } while (0)

with do{}while() guarding against treating it as an expression.


-- 
dexen deVries

[[[↓][→]]]




[9fans] fortune nomination

2013-02-21 Thread dexen deVries
 Too many renames; must be X source!

from output of p9p `acid -q', ran on basically any GNU software.

the offending code:
$PLAN9/src/cmd/acid/util.c:/must.be.X.source
if(renamed  5  !quiet) {
print(Too many renames; must be X source!\n);


-- 
dexen deVries

[[[↓][→]]]



Re: [9fans] Why should I invest[tigate] plan9?

2013-01-28 Thread dexen deVries
On Monday 28 of January 2013 09:24:37 Kurt H Maier wrote:
 Let me start out by saying I love this message.  I thought fakeposting
 had died, but clearly there are still some practitioners out there.
 Here are a few hints:
 
 - Nobody's ISP tells them what OS to run, even back in 1995.  This
 excessive detail deprives your message of the credibility it deserves.


888 boring rant 888

my isp -- a local venture in poland -- did around 2008.

they request we use ms windows on the router/gateway machine, instead of `some 
strange os' -- linux. otherwise they won't take responsibility for the 
downtime we were having.  turned out, they forgot to whitelist our MAC 
address.

but hey -- it worked with their technician's ms windows notebook.

888 boring rant 888


-- 
dexen deVries

[[[↓][→]]]


``One disadvantage of the Univac system is that it does not use Unix, a 
recently developed program which translates from one computer language to 
another and has a built-in editing system which identifies errors in the 
original program.'' - student newspaper




Re: [9fans] ctags or sth else with acme?

2013-01-17 Thread dexen deVries
On Thursday 17 of January 2013 16:50:35 Rudolf Sykora wrote:
 Hello,
 
 I'd like to know what you use for orientation in a code when running acme.
 Is the 'g' command sufficient for you, or you use some form of ctags?

a g-like script to match symbol names coupled with certain PHP, JS or SQL 
keywords.

also a custom plumber rule  script to display function prototype upon right-
click.


-- 
dexen deVries

[[[↓][→]]]

I have seen the Great Pretender and he is not what he seems.




Re: [9fans] How to do this with [acme | sam | sed ] ?

2013-01-11 Thread dexen deVries
On Friday 11 of January 2013 13:24:12 Peter A. Cejchan wrote:
 I am now on p9p and this does not work - at least with (... )*
 
  using the \1 (used to be undocumented on plan9) may be sometimes easier
  Edit s/\+\+([A-Za-z]+[A-Za-z0-9])*/\1++/

oughta be 
Edit s/\+\+([A-Za-z]+[A-Za-z0-9]*)/\1++/
the * moves to the left.


also, probably oughta be
Edit ,s/../g

to work on all lines, and change multiple matches in one go.

-- 
dexen deVries

[[[↓][→]]]


Reality is just a convenient measure of complexity.
-- Alvy Ray Smith



Re: [9fans] awk, connect a string to a variable or a function

2012-12-20 Thread dexen deVries
On Thursday 20 of December 2012 08:44:36 Rudolf Sykora wrote:
 Hello,
 
 awk doesn't have arrays with array members, which is what I now need.


how about using two-level array?

BEGIN {
a[foo,1] = abc
a[foo,2] = pqr
a[foo,3] = xyz
a[bar,1] = B1
a[bar, 2] = B2
a[bar, 3] = B3
for (i in a)
if (i ~ foo)
print a[i]
}



hope that helps,
-- 
dexen deVries

[[[↓][→]]]


Reality is just a convenient measure of complexity.
-- Alvy Ray Smith



Re: [9fans] Good sample GUI code (window creation, management,

2012-12-20 Thread dexen deVries
On Wednesday 19 of December 2012 11:14:30 Luke Evans wrote:
 I thought I had bumped into a short example on the web for creating
 a window in C, but can't seem to find it again.
 
 I'm sure I could search all the sources for various examples of such
 things, but does anybody know of a good (preferably concise) sample
 that demonstrates the correct way to write GUI apps in Plan 9?


$PLAN9/src/cmd/draw/*.c
in particular, stats.c -- comes with a simple pop-up menu, at under 1kLOC.

-- 
dexen deVries

[[[↓][→]]]


Reality is just a convenient measure of complexity.
-- Alvy Ray Smith



[9fans] a small Acme annoyance

2012-12-12 Thread dexen deVries
a mis-click which touches only the vertical pipe in window tag and no other 
text causes selection to be removed. seems Acme executes a null command and 
replaces selection with the null result. any reason for the behavior?

using p9p tip.


cheers,
-- 
dexen deVries

[[[↓][→]]]


Reality is just a convenient measure of complexity.
-- Alvy Ray Smith



Re: [9fans] a small Acme annoyance

2012-12-12 Thread dexen deVries
On Wednesday 12 of December 2012 15:01:56 yy wrote:
 [1] http://9fans.net/archive/2009/08/571

neat, thanks. a small tweak to make current GCC happy:


diff --git a/src/cmd/acme/exec.c b/src/cmd/acme/exec.c
index ae6668c..36ad25a 100644
--- a/src/cmd/acme/exec.c
+++ b/src/cmd/acme/exec.c
@@ -95,0 +96 @@ static Rune LZerox[] = { 'Z', 'e', 'r', 'o', 'x', 0 };
+static Rune LPipe[] = { '|', 0 };
@@ -126,0 +128 @@ Exectab exectab[] = {
+   { LPipe,edit,   FALSE,  XXX,XXX 

},
@@ -183 +185,3 @@ execute(Text *t, uint aq0, uint aq1, int external, Text 
*argt)
-   e = lookup(r, q1-q0);
+   e = nil;
+   if(runestrncmp(r, LPipe, 1) != 0 || q1-q0 == 1)
+   e = lookup(r, q1-q0);



-- 
dexen deVries

[[[↓][→]]]


Reality is just a convenient measure of complexity.
-- Alvy Ray Smith



Re: [9fans] C++

2012-11-23 Thread dexen deVries
On Friday 23 of November 2012 10:47:09 Gorka Guardiola wrote:
 On Thu, Nov 22, 2012 at 11:32 PM, Winston Kodogo kod...@gmail.com wrote:
  But, let the record show, C++ has been scientifically shown to be an
  unbelievably crap and monstrously complex language, even though I earn
  my daily bread by using it. I was a contemporary of Dr Stroustrup when
  he was spending his time dragging the Cambridge mainframe to its knees
  using the Simula compiler - the kindest description I ever heard from
  friends in the computer lab was stubborn-  and occasionally, ok
  frequently, or indeed always, am tempted to view C++ as his revenge on
  the world for pointing out that he doesn't have a clue how to program
  efficiently.
 
 Yes, this is why most games, which do not need speed or efficiency at all
 are programmed in C++. (...)

you've just stepped on my pet peeve, apologies in advance for what follows.

'NITPICK'
the bulk of in-game graphics processing is done via OpenGL calls/DirectX 
calls/whatever goes on the PS3' Cell CPU. the C++ parts could be replaced with 
Python and noone would be any the wiser.

similarily, Youtube flash player does not decode nor scale video in Flash' 
Actionscript; the GPU does it. unless you have broken drivers like i had once, 
in which case it is /slow/.

C++ for the assembly-line-style game development [1] is choosen as PHB's safe 
bet  -- a.k.a. ``industry's stadard practice'' -- and not on technical merits. 
cue picture of Scott Adams (of Dilbert fame).

if you really must, John Carmak writes idomatic C, not C++.
NITPICK;


[1] http://news.ycombinator.com/item?id=4821152 and countless other stories.

-- 
dexen deVries

[[[↓][→]]]


Reality is just a convenient measure of complexity.
-- Alvy Ray Smith



Re: [9fans] c++

2012-11-22 Thread dexen deVries
On Thursday 22 of November 2012 09:38:06 Dan Cross wrote:
 In the big scheme of things, absolutely none of this matters.  Whether one
 programs in Java, C, Go, COBOL or 370 assembler doesn't really make any
 difference; one could die tomorrow, and would anyone care what language
 s/he programmed in?  really?  This world has bigger problems than that.
 
 Programming languages are tools; nothing more.  (...)

that assumes any programming language is (at best) a constant or linear factor 
in problem solving time and complexity. some circles hold opinion that more 
powerfull programming languages provide polynominal or exponential factor.

aside of that, in various publications number of bugs is found to correlate 
with line counts or similar metrics, making a more concise language a net win.


-- 
dexen deVries

[[[↓][→]]]


Reality is just a convenient measure of complexity.
-- Alvy Ray Smith



Re: [9fans] c++

2012-11-20 Thread dexen deVries
On Monday 19 of November 2012 22:48:09 steve wrote:
 (...)
 i have been on a 3 day course and have been reading the c++ primer,
 and have effective c++ also, so i seem well equipped. the environment
 i am to use is Qt based as it has to be cross platform, though we hope to
 try to keep the core vanilla STL based.
 (...)

frommy brief enounters with Qt: do use signal/slot mechanics. concise and seem 
to work well in both small and large (KDE-sized) projects.

semi-related: qmake is one of few sane build tools in linuxland. based on 
simple text files, `mkspecs'.


-- 
dexen deVries

[[[↓][→]]]


Reality is just a convenient measure of complexity.
-- Alvy Ray Smith



Re: [9fans] tabstops

2012-11-16 Thread dexen deVries
On Friday 16 of November 2012 11:12:38 Steve Simon wrote:
 I am working on a project that insists on 4 space indentation of code.
 
 I can change the tabstop environment variable so I layout the code
 how they want but I am still inderting tabs into my source.
 
 I can use russ's tab(1) to convert the tabs to whitespace before every
 checkin, but thats a bit painful.

create tabfs, a stacking FS? convert leading tabs to spaces on write(3), 
convert leading quartets of spaces to tabs on read(3).

IIRC there was already some stacking FS doing somet ranslation, perhaps it was 
CRLF -LF

-- 
dexen deVries

[[[↓][→]]]


Reality is just a convenient measure of complexity.
-- Alvy Ray Smith



  1   2   3   >