9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] % $stem & $target in mk
@ 2008-05-29 13:32 matt
  2008-05-29 13:42 ` Russ Cox
  2008-05-29 13:53 ` Gorka Guardiola
  0 siblings, 2 replies; 5+ messages in thread
From: matt @ 2008-05-29 13:32 UTC (permalink / raw)
  To: 9fans

Hi,

crazily I've been using mk to build a website (trying to mimic SSI but
pre-request)

and I've run into a "shortcoming" with mk

this is something like my mkfile :

-------------------snip---------------------------------------

PAGES =  public_html/index.html public_html/news.html

all:V: $PAGES

nuke:V:
    rm -f $PAGES tmp/*

public_html/index.html: `{cpp -M src/index.html }
    makepage src/`{basename $target}  > $target

public_html/news.html: `{cpp -M src/news.html }
    makepage src/`{basename $target}  > $target


---------------------snip-------------------------------------



Whereas what would make like *much* easier would be if I could do this :

public_html/%.html: `{cpp -M src/%.html }
    makepage src/$stem.html > $target


but mk doesn't expand the % in `{}

Any magic I missed before hacking & slashing /sys/src/cmd/mk  ?








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

* Re: [9fans] % $stem & $target in mk
  2008-05-29 13:32 [9fans] % $stem & $target in mk matt
@ 2008-05-29 13:42 ` Russ Cox
  2008-05-29 14:57   ` matt
  2008-05-29 13:53 ` Gorka Guardiola
  1 sibling, 1 reply; 5+ messages in thread
From: Russ Cox @ 2008-05-29 13:42 UTC (permalink / raw)
  To: 9fans

make a script, called mkrules:

	#!/bin/rc
	for(i in src/*.html)
		cpp -M $i | sed 's;^src;public; s;\$O:;:;'

include its output:

	<|mkrules

russ



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

* Re: [9fans] % $stem & $target in mk
  2008-05-29 13:32 [9fans] % $stem & $target in mk matt
  2008-05-29 13:42 ` Russ Cox
@ 2008-05-29 13:53 ` Gorka Guardiola
  1 sibling, 0 replies; 5+ messages in thread
From: Gorka Guardiola @ 2008-05-29 13:53 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Thu, May 29, 2008 at 3:32 PM, matt <mattmobile@proweb.co.uk> wrote:
> public_html/%.html: `{cpp -M src/%.html }
>   makepage src/$stem.html > $target
>
>
> but mk doesn't expand the % in `{}
>
> Any magic I missed before hacking & slashing /sys/src/cmd/mk  ?
>

I would have expected $stem in there to be set (it isn't either).

--
- curiosity sKilled the cat



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

* Re: [9fans] % $stem & $target in mk
  2008-05-29 13:42 ` Russ Cox
@ 2008-05-29 14:57   ` matt
  2008-05-29 15:09     ` Russ Cox
  0 siblings, 1 reply; 5+ messages in thread
From: matt @ 2008-05-29 14:57 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Thanks, this was perfect, as usual. Someone clone Russ please :>


btw. I've done a little  HTTP testing suite (nothing amazing) & popped
it in sources
I did it in a hurry & didn't package it up

/n/sources/contrib/maht/{httplib.rc tlspipeclient.c dechunk.c
getuserpasswd.c}

. httplib.rc

GET https://www.rangboom.com/

GET http://slashdot.org/ | dechunk


you choose to include dechunk in your pipeline if you need it (though it
is idempotent on non-chunked data (modulo speed)
getuserpasswd isn't used by httplib.rc but is handy for getting
passwords from factoum

it uses tee for logging to testlog in the current dir so watch out for
that :)

matt


> make a script, called mkrules:
>
> 	#!/bin/rc
> 	for(i in src/*.html)
> 		cpp -M $i | sed 's;^src;public; s;\$O:;:;'
>
> include its output:
>
> 	<|mkrules
>
> russ
>
>
>
>




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

* Re: [9fans] % $stem & $target in mk
  2008-05-29 14:57   ` matt
@ 2008-05-29 15:09     ` Russ Cox
  0 siblings, 0 replies; 5+ messages in thread
From: Russ Cox @ 2008-05-29 15:09 UTC (permalink / raw)
  To: 9fans

> getuserpasswd.c}

You might also be interested in the
(apparently undocumented) program
auth/userpasswd.

Russ



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

end of thread, other threads:[~2008-05-29 15:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-29 13:32 [9fans] % $stem & $target in mk matt
2008-05-29 13:42 ` Russ Cox
2008-05-29 14:57   ` matt
2008-05-29 15:09     ` Russ Cox
2008-05-29 13:53 ` Gorka Guardiola

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