Hello
http://plan9.aichi-u.ac.jp/pegasus/cgitools/formparse.html
It works well for me, seems than Kenji Arisawa thought about this when
developing his http tools pegasus and rit.
Take a look a it, may be it helps you.
Slds.
Gabi
On 18/03/09 2:23, Russ Cox r...@swtch.com wrote:
On Tue,
not every environment is Plan 9 so /env is not an option.
Arbitrary limits seem a bit, well, arbitrary ! (not that I'm complaining).
With a flat memory address space and Gbs of memory chucking a realloc in
there is not totally out of technical bounds.
Using rc in werc neutralizes OS
2009/3/17 erik quanstrom quans...@quanstro.net:
it is unreasonable to expect to be able to generate tokens
that are bigger than 8k.
i'm not sure i agree. they're not just tokens, they're strings,
and there are lots of reasons why one might wish to
have a string longer than 8k read from a file.
But parsing is not the big issue (thanks Charles for sending me a
small program that does just that), the issue here is sticking the
results in a variable (or variables), Russ' suggestion would work, but
only in native Plan 9 and not in p9p.
Still, I might be able to hack something up if
2009/3/17 erik quanstrom quans...@quanstro.net:
it is unreasonable to expect to be able to generate tokens
that are bigger than 8k.
i'm not sure i agree. they're not just tokens, they're strings,
and there are lots of reasons why one might wish to
have a string longer than 8k read from a
2009/3/18 erik quanstrom quans...@quanstro.net:
- ewd = wd+l+100-1;
one small comment, based on a totally superficial scan of that diff:
might it not be better to grow the buffer by some multiplicative
factor, to avoid linear behaviour when reading large files?
i
On Wed Mar 18 09:54:54 EDT 2009, rogpe...@gmail.com wrote:
2009/3/18 erik quanstrom quans...@quanstro.net:
- ewd = wd+l+100-1;
one small comment, based on a totally superficial scan of that diff:
might it not be better to grow the buffer by some multiplicative
2009/3/18 erik quanstrom quans...@coraid.com:
the total cost is O(maximum token length) for the
whole input. how could this be a problem?
well, if there's only one token (e.g. when ifs=''), it's actually
O(n^2), assuming
that realloc copies every time.
but your first argument is sufficient. i
Thanks Geoff for the prompt explanation, but I'm getting the same
results with ifs=() Not sure why, but I'm not sure I understand the
difference between setting ifs to '' and ().
Thanks again
uriel
On Tue, Mar 17, 2009 at 1:40 AM, ge...@plan9.bell-labs.com wrote:
Setting ifs='' defeats rc's
On Tue Mar 17 18:17:53 EDT 2009, urie...@gmail.com wrote:
Thanks Geoff for the prompt explanation, but I'm getting the same
results with ifs=() Not sure why, but I'm not sure I understand the
difference between setting ifs to '' and ().
in your test, try this
echo $#x
- erik
On Tue Mar 17 18:29:14 EDT 2009, urie...@gmail.com wrote:
Thanks martin for your analysis, this makes some sense to me, but as I
pointed out, even setting ifs to () doesn't solve the issue, so it
would be nice to find a solution to this.
Right now having the output of `{} corrupted can be
On Tue, Mar 17, 2009 at 11:43 PM, erik quanstrom quans...@quanstro.net wrote:
On Tue Mar 17 18:29:14 EDT 2009, urie...@gmail.com wrote:
Thanks martin for your analysis, this makes some sense to me, but as I
pointed out, even setting ifs to () doesn't solve the issue, so it
would be nice to
in your test, try this
echo $#x
I tried that too, I'm getting the same result for an ifs of '' or ().
% ifs=() {x=`{cat f}; echo $#x}
2
% ifs='' {x=`{cat f}; echo $#x}
2
I'm doing something else wrong?
uriel
Right now having the output of `{} corrupted can be quite inconvenient...
it is unreasonable to expect to be able to generate tokens
that are bigger than 8k.
Well, I would prefer if such limit didn't exist ;) But it doesn't seem
like a totally unreasonable limit either.
why can't you
why can't you just let ifs = $newline (formatted to fit your screen) ?
Unfortunately that doesn't work in this case, my input is HTTP post
data, which is a single line of URL-encoded text which I have to
decode into multiple parameters of arbitrary length.
Still, if no characters were getting
On Tue, Mar 17, 2009 at 5:26 PM, Uriel urie...@gmail.com wrote:
Unfortunately that doesn't work in this case, my input is HTTP post
data, which is a single line of URL-encoded text which I have to
decode into multiple parameters of arbitrary length.
writing a shell script doesn't mean you have
On Tue Mar 17 20:29:50 EDT 2009, urie...@gmail.com wrote:
why can't you just let ifs = $newline (formatted to fit your screen) ?
Unfortunately that doesn't work in this case, my input is HTTP post
data, which is a single line of URL-encoded text which I have to
decode into multiple
At first I thought very big rc variables seem to become strangely corrupted.
% for(i in `{seq 1000}) { echo 0123456789 f }
% ifs='' {x=`{cat f}}
% echo -n $x f2
% diff f f2
745c745
0123456789
---
01234567 9
But the bug seems to be in `{ } because replacing the use of the x var
with simply:
Setting ifs='' defeats rc's tokenisation, so the result
of `{} will be a series of rc `words', each limited to
Wordmax (8192) bytes and with the next byte of the input
stream after each word set to NUL.
Did you perhaps intend to write ifs=(), which has different
meaning?
Hi,
I think the following gives a clue:
% cmp f f2
f f2 differ: char 8193
The following snippet from the Xbackq code seems to be the culprit:
char wd[8193];
int c;
char *s, *ewd=wd[8192], *stop;
...
while((c = rchr(f))!=EOF){
On second thought (and in the light of Geoffs reply) I probably won't.
If you do care, the following change to the loop in question will at
least preserve all input:
while((c = rchr(f))!=EOF){
if(strchr(stop, c)){
if(s!=wd){
21 matches
Mail list logo