* [9fans] pwd(1)
@ 2003-11-01 14:09 lucio
2003-11-01 14:34 ` Russ Cox
0 siblings, 1 reply; 4+ messages in thread
From: lucio @ 2003-11-01 14:09 UTC (permalink / raw)
To: 9fans
Does it really return the value of the pathname which it failed to
retrieve when it fails to retrieve it?
if(getwd(pathname, sizeof(pathname)) == 0) {
print("pwd: %r\n");
exits(pathname);
}
I hope I'm looking at old code. Did somebody forget to put quotes
around the exits() argument?
++L
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [9fans] pwd(1)
2003-11-01 14:09 [9fans] pwd(1) lucio
@ 2003-11-01 14:34 ` Russ Cox
2003-11-01 14:57 ` Lucio De Re
0 siblings, 1 reply; 4+ messages in thread
From: Russ Cox @ 2003-11-01 14:34 UTC (permalink / raw)
To: 9fans
> Does it really return the value of the pathname which it failed to
> retrieve when it fails to retrieve it?
>
> if(getwd(pathname, sizeof(pathname)) == 0) {
> print("pwd: %r\n");
> exits(pathname);
> }
>
> I hope I'm looking at old code. Did somebody forget to put quotes
> around the exits() argument?
You're looking at half-old code. The truly old code says:
g% cat /n/bootes/sys/src/cmd/pwd.c
#include <u.h>
#include <libc.h>
/*
* Print working (current) directory
*/
void
main(int argc, char *argv[])
{
char pathname[512];
USED(argc, argv);
if(getwd(pathname, sizeof(pathname)) == 0) {
print("pwd: %s\n", pathname);
exits(pathname);
}
print("%s\n", pathname);
exits(0);
}
g%
which is the way getwd worked before 9P2000.
I changed the current pwd just to exits("getwd")
when getwd fails (after printing %r).
Russ
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [9fans] pwd(1)
2003-11-01 14:34 ` Russ Cox
@ 2003-11-01 14:57 ` Lucio De Re
2003-11-01 15:04 ` Russ Cox
0 siblings, 1 reply; 4+ messages in thread
From: Lucio De Re @ 2003-11-01 14:57 UTC (permalink / raw)
To: 9fans
On Sat, Nov 01, 2003 at 09:34:46AM -0500, Russ Cox wrote:
>
> which is the way getwd worked before 9P2000.
> I changed the current pwd just to exits("getwd")
> when getwd fails (after printing %r).
>
Would it be silly to ask for the error message to be output to stderr
rather than stdout?
++L
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [9fans] pwd(1)
2003-11-01 14:57 ` Lucio De Re
@ 2003-11-01 15:04 ` Russ Cox
0 siblings, 0 replies; 4+ messages in thread
From: Russ Cox @ 2003-11-01 15:04 UTC (permalink / raw)
To: 9fans
> Would it be silly to ask for the error message to be output to stderr
> rather than stdout?
done
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-11-01 15:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-01 14:09 [9fans] pwd(1) lucio
2003-11-01 14:34 ` Russ Cox
2003-11-01 14:57 ` Lucio De Re
2003-11-01 15:04 ` Russ Cox
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).