* [9fans] is there any good reason why awk does this?
@ 2003-09-01 2:50 boyd
2003-09-01 7:01 ` Charles Forsyth
0 siblings, 1 reply; 19+ messages in thread
From: boyd @ 2003-09-01 2:50 UTC (permalink / raw)
To: 9fans
brahma% awk 'END {exit "foo"}' /dev/null ; echo $status
brahma% awk 'END {exit 1}' /dev/null ; echo $status
awk 8186: 1
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] is there any good reason why awk does this?
2003-09-01 2:50 [9fans] is there any good reason why awk does this? boyd
@ 2003-09-01 7:01 ` Charles Forsyth
2003-09-01 13:53 ` boyd, rounin
0 siblings, 1 reply; 19+ messages in thread
From: Charles Forsyth @ 2003-09-01 7:01 UTC (permalink / raw)
To: 9fans
[-- Attachment #1: Type: text/plain, Size: 456 bytes --]
same reason as this, i suspect:
awk 'END {print 1 * "hello"}' /dev/null
0
the rules aren't really given in the manual page except perhaps
by implication in the BUGS, but in a context where a number is
expected (operand of arithmetic operator) the string is converted
to a number, and "hello" or "foo" are both zero, but "5hello" is 5.
exit takes an expression but doesn't say whether it's integer or
string (but it's integer, as usual on Unix).
[-- Attachment #2: Type: message/rfc822, Size: 1956 bytes --]
From: boyd@sdgm.net
To: 9fans@cse.psu.edu
Subject: [9fans] is there any good reason why awk does this?
Date: Sun, 31 Aug 2003 22:50:34 -0400
Message-ID: <1ef339d30bfee33810aa4e1d0c4488af@sdgm.net>
brahma% awk 'END {exit "foo"}' /dev/null ; echo $status
brahma% awk 'END {exit 1}' /dev/null ; echo $status
awk 8186: 1
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] is there any good reason why awk does this?
2003-09-01 7:01 ` Charles Forsyth
@ 2003-09-01 13:53 ` boyd, rounin
2003-09-01 17:35 ` rob pike, esq.
2003-09-01 17:41 ` Joel Salomon
0 siblings, 2 replies; 19+ messages in thread
From: boyd, rounin @ 2003-09-01 13:53 UTC (permalink / raw)
To: 9fans
i think awk should be able to exit with a string like everything
else does/should with exits().
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] is there any good reason why awk does this?
2003-09-01 13:53 ` boyd, rounin
@ 2003-09-01 17:35 ` rob pike, esq.
2003-09-02 0:38 ` boyd, rounin
2003-09-01 17:41 ` Joel Salomon
1 sibling, 1 reply; 19+ messages in thread
From: rob pike, esq. @ 2003-09-01 17:35 UTC (permalink / raw)
To: 9fans
> i think awk should be able to exit with a string like everything
> else does/should with exits().
it's ported from and maintained as a posix program; it calls exit.
regex wasn't kept compatible, though, so i suppose exit could
go too, but it seems not worth the trouble.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] is there any good reason why awk does this?
2003-09-01 17:41 ` Joel Salomon
@ 2003-09-01 17:37 ` Dan Cross
2003-09-03 0:33 ` boyd, rounin
0 siblings, 1 reply; 19+ messages in thread
From: Dan Cross @ 2003-09-01 17:37 UTC (permalink / raw)
To: 9fans
That's right. Awk was brought in under the ape, and so doesn't really
do exits....
- Dan C.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] is there any good reason why awk does this?
2003-09-01 13:53 ` boyd, rounin
2003-09-01 17:35 ` rob pike, esq.
@ 2003-09-01 17:41 ` Joel Salomon
2003-09-01 17:37 ` Dan Cross
1 sibling, 1 reply; 19+ messages in thread
From: Joel Salomon @ 2003-09-01 17:41 UTC (permalink / raw)
To: 9fans
On Mon, 1 Sep 2003, boyd, rounin wrote:
> i think awk should be able to exit with a string like everything
> else does/should with exits().
>
Taking the original example:
>brahma% awk 'END {exit "foo"}' /dev/null ; echo $status
>
>brahma% awk 'END {exit 1}' /dev/null ; echo $status
>awk 8186: 1
I would guess that awk *is* using exits() but first exit converts is arg
to a number (if necessary), presumably for compatability w/ unix awk,
then converts the num to a string which gets sent to exits().
Ugh.
--Joel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] is there any good reason why awk does this?
2003-09-01 17:35 ` rob pike, esq.
@ 2003-09-02 0:38 ` boyd, rounin
0 siblings, 0 replies; 19+ messages in thread
From: boyd, rounin @ 2003-09-02 0:38 UTC (permalink / raw)
To: 9fans
> it's ported from and maintained as a posix program; it calls exit.
> regex wasn't kept compatible, though, so i suppose exit could
> go too, but it seems not worth the trouble.
i 'call bullshit on dat'.
this plan 9 and we have exits(2).
i'll fix it if someone will apply it to the source tree.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] is there any good reason why awk does this?
2003-09-01 17:37 ` Dan Cross
@ 2003-09-03 0:33 ` boyd, rounin
2003-09-03 8:48 ` Douglas A. Gwyn
0 siblings, 1 reply; 19+ messages in thread
From: boyd, rounin @ 2003-09-03 0:33 UTC (permalink / raw)
To: 9fans
> That's right. Awk was brought in under the ape, and so doesn't really
> do exits....
bugger it, i'm porting it away from ape.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] is there any good reason why awk does this?
2003-09-03 0:33 ` boyd, rounin
@ 2003-09-03 8:48 ` Douglas A. Gwyn
2003-09-03 9:31 ` Lyndon Nerenberg
2003-09-03 12:08 ` boyd, rounin
0 siblings, 2 replies; 19+ messages in thread
From: Douglas A. Gwyn @ 2003-09-03 8:48 UTC (permalink / raw)
To: 9fans
boyd, rounin wrote:
> bugger it, i'm porting it away from ape.
But there is still a specification for awk to which
I urge you to conform. awk runs on a multitude of
platforms and it would be nice if awk programs were
portable.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] is there any good reason why awk does this?
2003-09-03 8:48 ` Douglas A. Gwyn
@ 2003-09-03 9:31 ` Lyndon Nerenberg
2003-09-03 12:20 ` boyd, rounin
2003-09-03 12:08 ` boyd, rounin
1 sibling, 1 reply; 19+ messages in thread
From: Lyndon Nerenberg @ 2003-09-03 9:31 UTC (permalink / raw)
To: 9fans
> > bugger it, i'm porting it away from ape.
> But there is still a specification for awk to which
> I urge you to conform.
awk?
nawk?
gawk?
mawk?
bawk?
squawk?
Frobbing exit[s] (and making it grok UTF-8?) are not evil designs on life,
the universe, and everything.
--lyndon
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] is there any good reason why awk does this?
2003-09-03 8:48 ` Douglas A. Gwyn
2003-09-03 9:31 ` Lyndon Nerenberg
@ 2003-09-03 12:08 ` boyd, rounin
1 sibling, 0 replies; 19+ messages in thread
From: boyd, rounin @ 2003-09-03 12:08 UTC (permalink / raw)
To: 9fans
> awk runs on a multitude of platforms and it would be nice if
> awk programs were portable.
that's always been the plan.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] is there any good reason why awk does this?
2003-09-03 9:31 ` Lyndon Nerenberg
@ 2003-09-03 12:20 ` boyd, rounin
2003-09-03 12:56 ` Russ Cox
2003-09-03 13:30 ` Ralph Corderoy
0 siblings, 2 replies; 19+ messages in thread
From: boyd, rounin @ 2003-09-03 12:20 UTC (permalink / raw)
To: 9fans
> Frobbing exit[s] (and making it grok UTF-8?) are not evil designs on life,
> the universe, and everything.
it will behave just like it does now on plan 9 except you can go:
exit "foo"
now testing it is probably going to be a bugger.
i did find this bug:
/dev/std* were being used instead of /fd/*
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] is there any good reason why awk does this?
2003-09-03 12:20 ` boyd, rounin
@ 2003-09-03 12:56 ` Russ Cox
2003-09-03 21:19 ` boyd, rounin
2003-09-03 22:15 ` boyd, rounin
2003-09-03 13:30 ` Ralph Corderoy
1 sibling, 2 replies; 19+ messages in thread
From: Russ Cox @ 2003-09-03 12:56 UTC (permalink / raw)
To: 9fans
[-- Attachment #1: Type: text/plain, Size: 236 bytes --]
I think you're wrong. The only occurrence of /dev/std* in the source
is in a table that makes them work in awk programs. That is,
awk 'BEGIN {print "hello world" >"/dev/stderr" }'
works because of that table. It's not a bug.
[-- Attachment #2: Type: message/rfc822, Size: 2361 bytes --]
From: "boyd, rounin" <boyd@insultant.net>
To: <9fans@cse.psu.edu>
Subject: Re: [9fans] is there any good reason why awk does this?
Date: Wed, 3 Sep 2003 14:20:28 +0200
Message-ID: <01cb01c37215$c5a7e420$b9844051@insultant.net>
> Frobbing exit[s] (and making it grok UTF-8?) are not evil designs on life,
> the universe, and everything.
it will behave just like it does now on plan 9 except you can go:
exit "foo"
now testing it is probably going to be a bugger.
i did find this bug:
/dev/std* were being used instead of /fd/*
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] is there any good reason why awk does this?
2003-09-03 12:20 ` boyd, rounin
2003-09-03 12:56 ` Russ Cox
@ 2003-09-03 13:30 ` Ralph Corderoy
2003-09-03 21:18 ` boyd, rounin
1 sibling, 1 reply; 19+ messages in thread
From: Ralph Corderoy @ 2003-09-03 13:30 UTC (permalink / raw)
To: 9fans
boyd wrote:
> it will behave just like it does now on plan 9 except you can go:
>
> exit "foo"
What will it do for
exit foo
Cheers,
--
Ralph Corderoy. http://inputplus.co.uk/ralph/ http://troff.org/
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] is there any good reason why awk does this?
2003-09-03 13:30 ` Ralph Corderoy
@ 2003-09-03 21:18 ` boyd, rounin
2003-09-08 9:09 ` Ralph Corderoy
0 siblings, 1 reply; 19+ messages in thread
From: boyd, rounin @ 2003-09-03 21:18 UTC (permalink / raw)
To: 9fans
> What will it do for
>
> exit foo
smash it into a string.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] is there any good reason why awk does this?
2003-09-03 12:56 ` Russ Cox
@ 2003-09-03 21:19 ` boyd, rounin
2003-09-03 22:15 ` boyd, rounin
1 sibling, 0 replies; 19+ messages in thread
From: boyd, rounin @ 2003-09-03 21:19 UTC (permalink / raw)
To: 9fans
> I think you're wrong. The only occurrence of /dev/std* in the source
> is in a table that makes them work in awk programs. That is,
>
> awk 'BEGIN {print "hello world" >"/dev/stderr" }'
noted.
> works because of that table. It's not a bug.
maybe.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] is there any good reason why awk does this?
2003-09-03 12:56 ` Russ Cox
2003-09-03 21:19 ` boyd, rounin
@ 2003-09-03 22:15 ` boyd, rounin
1 sibling, 0 replies; 19+ messages in thread
From: boyd, rounin @ 2003-09-03 22:15 UTC (permalink / raw)
To: 9fans
> awk 'BEGIN {print "hello world" >"/dev/stderr" }'
you're right. i've un-broken it.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] is there any good reason why awk does this?
2003-09-03 21:18 ` boyd, rounin
@ 2003-09-08 9:09 ` Ralph Corderoy
2003-09-08 9:53 ` boyd, rounin
0 siblings, 1 reply; 19+ messages in thread
From: Ralph Corderoy @ 2003-09-08 9:09 UTC (permalink / raw)
To: 9fans
Hi boyd,,
> > What will it do for
> >
> > exit foo
>
> smash it into a string.
Oh dear. Why not leave awk's `exit' alone so it works as every awk
script in the world expects and add `exits'?
Cheers,
Ralph.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [9fans] is there any good reason why awk does this?
2003-09-08 9:09 ` Ralph Corderoy
@ 2003-09-08 9:53 ` boyd, rounin
0 siblings, 0 replies; 19+ messages in thread
From: boyd, rounin @ 2003-09-08 9:53 UTC (permalink / raw)
To: 9fans
> Oh dear. Why not leave awk's `exit' alone so it works as every awk
> script in the world expects and add `exits'?
nope. it's smashed into a string _anyway_.
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2003-09-08 9:53 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-01 2:50 [9fans] is there any good reason why awk does this? boyd
2003-09-01 7:01 ` Charles Forsyth
2003-09-01 13:53 ` boyd, rounin
2003-09-01 17:35 ` rob pike, esq.
2003-09-02 0:38 ` boyd, rounin
2003-09-01 17:41 ` Joel Salomon
2003-09-01 17:37 ` Dan Cross
2003-09-03 0:33 ` boyd, rounin
2003-09-03 8:48 ` Douglas A. Gwyn
2003-09-03 9:31 ` Lyndon Nerenberg
2003-09-03 12:20 ` boyd, rounin
2003-09-03 12:56 ` Russ Cox
2003-09-03 21:19 ` boyd, rounin
2003-09-03 22:15 ` boyd, rounin
2003-09-03 13:30 ` Ralph Corderoy
2003-09-03 21:18 ` boyd, rounin
2003-09-08 9:09 ` Ralph Corderoy
2003-09-08 9:53 ` boyd, rounin
2003-09-03 12:08 ` boyd, rounin
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).