[2794] in BarnOwl Developers
Re: [PATCH 1/2] Fixed :unsub to make it work if ~/.zephyr.subs is a symlink (trac 133)
daemon@ATHENA.MIT.EDU (Karl Ramm)
Mon Nov 15 21:59:04 2010
From: Karl Ramm <kcr@1ts.org>
To: Jason Gross <jasongross9@gmail.com>
Cc: David A Benjamin <davidben@mit.edu>, Kevin Chen <kchen@mit.edu>,
barnowl-dev@mit.edu
Date: Mon, 15 Nov 2010 21:59:01 -0500
In-Reply-To: <AANLkTi=FNfUkiq+joNM3UPdjn1X1a7t7m_7dDnwkFhB=@mail.gmail.com>
(Jason Gross's message of "Mon, 15 Nov 2010 17:51:19 -0500")
Jason Gross <jasongross9@gmail.com> writes:
> Where do I find information about where a function is supported?
the man page, e.g.
kcr@grognard$ man -k readlink
kpsereadlink (1) - print contents of symbolic link
readlink (1) - print value of a symbolic link or canonical file name
readlink (2) - read value of a symbolic link
readlinkat (2) - read value of a symbolic link relative to a directory file descriptor
# okay, it's a system call, in section 2
kcr@grognard$ man 2 readlink
(you have to specify the section because it's both a command and a system
call) also, another example:
kcr@grognard$ man -k realpath
realpath (1) - return the canonicalised absolute pathname
realpath (3) - return the canonicalized absolute pathname
kcr@grognard$ man 3 realpath
> I found canonicalize_file_name at
> http://www.gnu.org/s/libc/manual/html_node/Symbolic-Links.html, which I
> found by searching google (
> http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=resolve+symbolic+link+c).
> It also gave the function readlink and the code
>
> char *
> readlink_malloc (const char *filename)
> {
> int size = 100;
> char *buffer = NULL;
>
> while (1)
> {
> buffer = (char *) xrealloc (buffer, size);
> int nchars = readlink (filename, buffer, size);
> if (nchars < 0)
> {
> free (buffer);
> return NULL;
> }
> if (nchars < size)
> return buffer;
> size *= 2;
> }
> }
>
> Is this a GNUism, or is readlink generally available? Should we use this
> instead? (I think Python uses readlink for its realpath.)
>
> -Jason
>
> On Mon, Nov 15, 2010 at 5:14 PM, David A Benjamin <davidben@mit.edu> wrote:
>
>> On Mon, 15 Nov 2010, David A Benjamin wrote:
>>
>> On Mon, 15 Nov 2010, Kevin Chen wrote:
>>>
>>> On Mon, 15 Nov 2010, Karl Ramm wrote:
>>>>
>>>> David A Benjamin <davidben@MIT.EDU> writes:
>>>>>
>>>>> The man pages says it's equivalent to realpath(path, NULL)
>>>>>> which... doesn't appear to be a GNUism?
>>>>>>
>>>>>> We can also add another AC_REPLACE_FUNCS, but they're annoying.
>>>>>>
>>>>>> David
>>>>>>
>>>>>
>>>>> It's in POSIX 2001 so we.. probably get to point and laugh if someone
>>>>> doesn't have it?
>>>>>
>>>>
>>>> My manpage (for realpath) says that passing NULL as the second argument
>>>> is a non-standard glibc extension.
>>>>
>>>>
>>> Lovely. Meh, we can allocate a PATH_MAX-sized buffer. Not terribly
>>> exciting.
>>>
>>>
>> Err, on second thought, reading all the NOTES in my version of the man
>> page, can I run away screaming now?
>>
>> Maybe glib has an implementation that isn't awful.
>>
>> David
>>