Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Dec 1997 18:13:11 +0900
From:      Shigio Yamaguchi <shigio@wafu.netgate.net>
To:        John Polstra <jdp@polstra.com>
Cc:        shigio@wafu.netgate.net, hackers@freebsd.org
Subject:   Re: [RFC] path converting functions. 
Message-ID:  <199712110115.BAA10321@wafu.netgate.net>

next in thread | raw e-mail | index | archive | help
In article <199712110527.VAA24691@austin.polstra.com>,
John Polstra <jdp@polstra.com> wrote:

> Well, in my opinion the example set by realpath(3) is bad and it
> shouldn't be copied in new code.  I say again, if a function writes
> into a caller-supplied buffer then the caller should also specify
> how large the buffer is.  Using a compiled in assumption such as
> MAXPATHLEN is risky at best.  What if you build your program on one
> machine and then run it on a machine where MAXPATHLEN has a different
> value?  Or, for that matter, on the same machine after some wiz has
> decided to change the value of MAXPATHLEN?

You are right.
It seems your style is better and I understood getcwd(3) which is
the new interface of getwd(3) uses your style.
I'll change the interface like this.

SYNOPSIS
     #include <sys/param.h>

     char *
     abs2rel(const char *path, const char *base, char result[MAXPATHLEN])

			|
			v
SYNOPSIS
     char *
     abs2rel(const char *path, const char *base, char *result, size_t size)
                                                 ~~~~~~~~~~~~  ~~~~~~~~~~~
						buffer address, buffer size
> 
> Anyway, that's all the arguing I want to do.  You asked for opinions
> and I gave you mine. :-)

It's precious to me. Thank you. :)
--
Shigio Yamaguchi (Freelance programmer)
	Mail: shigio@wafu.netgate.net, WWW: http://wafu.netgate.net/tama/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199712110115.BAA10321>