9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] APE notes
@ 2010-04-13 18:52 tlaronde
  2010-04-13 19:04 ` Stuart Morrow
  2010-04-13 19:47 ` Federico G. Benavento
  0 siblings, 2 replies; 3+ messages in thread
From: tlaronde @ 2010-04-13 18:52 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Hello,

These notes about APE could be of some use to others.

Context : I'm verifying that my compilation framework, made for POSIX,
is able to work for Plan9 too (for TeX and al.: everything works on
Unix, so time to verify the whole thing on Plan9).

Note: this is not a plea to add more. ape/psh is not supposed, IMO, to
end in profile...

- some utilities are included in POSIX.2, but are not in Plan9,
including under APE : find(1), id(1), expr(1) --- of course ln(1)---. 
These are just the ones I stumbled upon since they were used in my
scripts. I have find a way, so you may find one to do differently.
Note: expr(1) is typically a thing I do _not_ use, since I always feel
uncomfortable with it; but I guess I wanted to "optimize" and avoid
forking a "| sed ..." -> that just highlights indeed that an interpreter
must have regexp handling natively à la rc(1) ~.

- "grep -q" (with -s) is in SUS.v3, but Plan9 has "only" traditionnal 
"grep -s". To not be eaten by a system that has "-q" and not "-s", I 
ended with grep ... >/dev/null 2>&1.

- sed(1) does not support single character duplication : \{m,n\}---I
have "unrolled" the patterns, since ".+" is not supported by POSIX
sed(1) (..* does the thing in this case for example).

- I have been hit by aux/getflags I think that doesn't like too many
arguments (typically a sed(1) with a bunch of "-e s/.../.../g"). I have
simply put the rules in a temporary file, and used sed -f.
-- 
        Thierry Laronde <tlaronde +AT+ polynum +dot+ com>
                      http://www.kergis.com/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] APE notes
  2010-04-13 18:52 [9fans] APE notes tlaronde
@ 2010-04-13 19:04 ` Stuart Morrow
  2010-04-13 19:47 ` Federico G. Benavento
  1 sibling, 0 replies; 3+ messages in thread
From: Stuart Morrow @ 2010-04-13 19:04 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On 4/13/10, tlaronde@polynum.com <tlaronde@polynum.com> wrote:
> - se d(1)  does not support single  character duplication : \{m,n\}---I

Just to clarify, it's Plan9's libregexp that doesn't support {n,m} quantifiers.

stuart



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] APE notes
  2010-04-13 18:52 [9fans] APE notes tlaronde
  2010-04-13 19:04 ` Stuart Morrow
@ 2010-04-13 19:47 ` Federico G. Benavento
  1 sibling, 0 replies; 3+ messages in thread
From: Federico G. Benavento @ 2010-04-13 19:47 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

check: http://plan9.bell-labs.com/sources/plan9/sys/src/ape/cmd/README

ln? come on!

for quick stuff when running configure some big crap that needs it
fn ln { cp $1 $2 }
or even better
fn ln { aux/stub $2; bind $1 $2 }
for egrep and fgrep I get by with:

 aux/stub /bin/fgrep; bind /bin/grep /bin/fgrep

I once ran a cross a weird cat so I had to:

lotte% cat /rc/bin/ape/cat
#!/bin/rc
rfork e
files=()
for(i) {
	if (~ $i -)
		files=($files /fd/0)
	if not
		files=($files $i)
}
exec /$cputype/bin/cat $files

and when everything fails:

lotte% cat /bin/bison
#!/bin/rc
exec linuxemu.rc /tmp/mroot /usr/bin/bison $*

On Tue, Apr 13, 2010 at 3:52 PM,  <tlaronde@polynum.com> wrote:
> Hello,
>
> These notes about APE could be of some use to others.
>
> Context : I'm verifying that my compilation framework, made for POSIX,
> is able to work for Plan9 too (for TeX and al.: everything works on
> Unix, so time to verify the whole thing on Plan9).
>
> Note: this is not a plea to add more. ape/psh is not supposed, IMO, to
> end in profile...
>
> - some utilities are included in POSIX.2, but are not in Plan9,
> including under APE : find(1), id(1), expr(1) --- of course ln(1)---.
> These are just the ones I stumbled upon since they were used in my
> scripts. I have find a way, so you may find one to do differently.
> Note: expr(1) is typically a thing I do _not_ use, since I always feel
> uncomfortable with it; but I guess I wanted to "optimize" and avoid
> forking a "| sed ..." -> that just highlights indeed that an interpreter
> must have regexp handling natively à la rc(1) ~.
>
> - "grep -q" (with -s) is in SUS.v3, but Plan9 has "only" traditionnal
> "grep -s". To not be eaten by a system that has "-q" and not "-s", I
> ended with grep ... >/dev/null 2>&1.
>
> - sed(1) does not support single character duplication : \{m,n\}---I
> have "unrolled" the patterns, since ".+" is not supported by POSIX
> sed(1) (..* does the thing in this case for example).
>
> - I have been hit by aux/getflags I think that doesn't like too many
> arguments (typically a sed(1) with a bunch of "-e s/.../.../g"). I have
> simply put the rules in a temporary file, and used sed -f.
> --
>        Thierry Laronde <tlaronde +AT+ polynum +dot+ com>
>                      http://www.kergis.com/
> Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C
>
>



-- 
Federico G. Benavento



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-04-13 19:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-13 18:52 [9fans] APE notes tlaronde
2010-04-13 19:04 ` Stuart Morrow
2010-04-13 19:47 ` Federico G. Benavento

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).