From: erik quanstrom <quanstro@quanstro.net>
To: lucio@proxima.alt.za, 9fans@9fans.net
Subject: Re: [9fans] Ogg/Vorbis ported
Date: Fri, 30 Jan 2009 11:21:08 -0500 [thread overview]
Message-ID: <90d40644058566409e8dd75c49fe716f@quanstro.net> (raw)
In-Reply-To: <42aa45f7d293eb1405d891253a687a65@proxima.alt.za>
>> As with exit(), it can be replaced automatically with exits() but you
>> still have to figure out what message you want in your exits().
>
> If anyone is interested, this is what I used as a compatibility shim:
>
> #include <u.h>
> #include <libc.h>
>
> void
> exit (int code) {
> switch (code) {
> case -1:
> exits("FAILURE");
> case 0:
> exits(0);
> default:
> exits("Unknown condition");
> }
> }
>
> One could instead print("%d", code), or print("FAILURE: %d", code).
>
> Two cents, please!
printing would not make sense. neither unix nor plan 9
print exit codes.
this seems to me too complicated and not complicated enough.
on the not-complicated-enough side, to get every last program,
you would need to make exit do something like
int
exit(int r)
{
static char buf[16];
if(r == 0)
exits(0);
snprint(buf, sizeof buf, "%d", r);
exits(buf);
}
and you would need to rewrite wait to atoi(w->msg).
this would catch programs like postfix that don't treat
exit status as a boolean. (as god intended.)
but once you've done this, you're going half-way down
the ape path.
otoh, if you design in unix/plan 9 portability, it's too
much.
int
exits(char *s)
{
/* missing atexits */
exit(s && *s);
}
porting is rancid, isn't it?
- erik
next prev parent reply other threads:[~2009-01-30 16:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-28 17:53 Mathieu Lonjaret
2009-01-28 18:22 ` hiro
2009-01-29 16:27 ` ron minnich
2009-01-29 20:27 ` [9fans] porting GNU code Steve Simon
2009-01-29 20:30 ` erik quanstrom
2009-01-29 20:35 ` Steve Simon
2009-01-29 22:47 ` [9fans] Ogg/Vorbis ported Mathieu
2009-01-30 4:38 ` lucio
2009-01-30 16:21 ` erik quanstrom [this message]
2009-02-23 10:05 ` lejatorn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=90d40644058566409e8dd75c49fe716f@quanstro.net \
--to=quanstro@quanstro.net \
--cc=9fans@9fans.net \
--cc=lucio@proxima.alt.za \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).