[2793] in BarnOwl Developers
Re: [PATCH 1/2] Fixed :unsub to make it work if ~/.zephyr.subs is a
daemon@ATHENA.MIT.EDU (Jason Gross)
Mon Nov 15 21:21:35 2010
In-Reply-To: <uussjz2xkmy.fsf@1ts.org>
From: Jason Gross <jasongross9@gmail.com>
Date: Mon, 15 Nov 2010 21:21:02 -0500
To: Karl Ramm <kcr@1ts.org>
Cc: David A Benjamin <davidben@mit.edu>, Kevin Chen <kchen@mit.edu>,
barnowl-dev@mit.edu
--000e0cd4d4bc1aefbf04952237cf
Content-Type: text/plain; charset=ISO-8859-1
So should I rewrite the code to use readlink instead? If so, is there a
problem with naming the code readlink_malloc, or should I give it a name
with an owl_ prefix to avoid conflicts? Is an inline citation of
http://www.gnu.org/s/libc/manual/html_node/Symbolic-Links.html sufficient?
-Jason
On Mon, Nov 15, 2010 at 5:55 PM, Karl Ramm <kcr@1ts.org> wrote:
> Readlink is a syscall available on any UNIX with symlinks, which is any
> you're going to be running barnowl on.
>
> kcr
> Jason Gross <jasongross9@gmail.com> writes:
>
> > Where do I find information about where a function is supported?
> >
> > 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
> >>
>
--000e0cd4d4bc1aefbf04952237cf
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
So should I rewrite the code to use readlink instead? =A0If so, is there a =
problem with naming the code=A0<meta http-equiv=3D"content-type" content=3D=
"text/html; charset=3Dutf-8">readlink_malloc,=A0or should I give it a name =
with an owl_ prefix to avoid conflicts? =A0Is an inline citation of=A0<a hr=
ef=3D"http://www.gnu.org/s/libc/manual/html_node/Symbolic-Links.html">http:=
//www.gnu.org/s/libc/manual/html_node/Symbolic-Links.html</a>=A0sufficient?=
<div>
<br></div><div>-Jason<br><br><div class=3D"gmail_quote">On Mon, Nov 15, 201=
0 at 5:55 PM, Karl Ramm <span dir=3D"ltr"><<a href=3D"mailto:kcr@1ts.org=
">kcr@1ts.org</a>></span> wrote:<br><blockquote class=3D"gmail_quote" st=
yle=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Readlink is a syscall available on any UNIX with symlinks, which is any<br>
you're going to be running barnowl on.<br>
<br>
kcr<br>
<div><div></div><div class=3D"h5">Jason Gross <<a href=3D"mailto:jasongr=
oss9@gmail.com">jasongross9@gmail.com</a>> writes:<br>
<br>
> Where do I find information about where a function is supported?<br>
><br>
> I found canonicalize_file_name at<br>
> <a href=3D"http://www.gnu.org/s/libc/manual/html_node/Symbolic-Links.h=
tml" target=3D"_blank">http://www.gnu.org/s/libc/manual/html_node/Symbolic-=
Links.html</a>, which I<br>
> found by searching google (<br>
> <a href=3D"http://www.google.com/search?sourceid=3Dchrome&ie=3DUTF=
-8&q=3Dresolve+symbolic+link+c" target=3D"_blank">http://www.google.com=
/search?sourceid=3Dchrome&ie=3DUTF-8&q=3Dresolve+symbolic+link+c</a=
>).<br>
> =A0It also gave the function readlink and the code<br>
><br>
> char *<br>
> readlink_malloc (const char *filename)<br>
> {<br>
> =A0 int size =3D 100;<br>
> =A0 char *buffer =3D NULL;<br>
><br>
> =A0 while (1)<br>
> =A0 =A0 {<br>
> =A0 =A0 =A0 buffer =3D (char *) xrealloc (buffer, size);<br>
> =A0 =A0 =A0 int nchars =3D readlink (filename, buffer, size);<br>
> =A0 =A0 =A0 if (nchars < 0)<br>
> =A0 =A0 =A0 =A0 {<br>
> =A0 =A0 =A0 =A0 =A0 free (buffer);<br>
> =A0 =A0 =A0 =A0 =A0 return NULL;<br>
> =A0 =A0 =A0 =A0 }<br>
> =A0 =A0 =A0 if (nchars < size)<br>
> =A0 =A0 =A0 =A0 return buffer;<br>
> =A0 =A0 =A0 size *=3D 2;<br>
> =A0 =A0 }<br>
> }<br>
><br>
> Is this a GNUism, or is readlink generally available? =A0Should we use=
this<br>
> instead? =A0(I think Python uses readlink for its realpath.)<br>
><br>
> -Jason<br>
><br>
> On Mon, Nov 15, 2010 at 5:14 PM, David A Benjamin <<a href=3D"mailt=
o:davidben@mit.edu">davidben@mit.edu</a>> wrote:<br>
><br>
>> On Mon, 15 Nov 2010, David A Benjamin wrote:<br>
>><br>
>> =A0On Mon, 15 Nov 2010, Kevin Chen wrote:<br>
>>><br>
>>> =A0On Mon, 15 Nov 2010, Karl Ramm wrote:<br>
>>>><br>
>>>> =A0David A Benjamin <<a href=3D"mailto:davidben@MIT.EDU=
">davidben@MIT.EDU</a>> writes:<br>
>>>>><br>
>>>>> =A0The man pages says it's equivalent to realpath(=
path, NULL)<br>
>>>>>> which... doesn't appear to be a GNUism?<br>
>>>>>><br>
>>>>>> We can also add another AC_REPLACE_FUNCS, but they=
're annoying.<br>
>>>>>><br>
>>>>>> David<br>
>>>>>><br>
>>>>><br>
>>>>> It's in POSIX 2001 so we.. probably get to point a=
nd laugh if someone<br>
>>>>> doesn't have it?<br>
>>>>><br>
>>>><br>
>>>> My manpage (for realpath) says that passing NULL as the se=
cond argument<br>
>>>> is a non-standard glibc extension.<br>
>>>><br>
>>>><br>
>>> Lovely. Meh, we can allocate a PATH_MAX-sized buffer. Not terr=
ibly<br>
>>> exciting.<br>
>>><br>
>>><br>
>> Err, on second thought, reading all the NOTES in my version of the=
man<br>
>> page, can I run away screaming now?<br>
>><br>
>> Maybe glib has an implementation that isn't awful.<br>
>><br>
>> David<br>
>><br>
</div></div></blockquote></div><br></div>
--000e0cd4d4bc1aefbf04952237cf--