[2791] in BarnOwl Developers

home help back first fref pref prev next nref lref last post

Re: [PATCH 1/2] Fixed :unsub to make it work if ~/.zephyr.subs is a

daemon@ATHENA.MIT.EDU (Jason Gross)
Mon Nov 15 17:51:51 2010

In-Reply-To: <alpine.DEB.1.10.1011151713120.15631@dr-wily.mit.edu>
From: Jason Gross <jasongross9@gmail.com>
Date: Mon, 15 Nov 2010 17:51:19 -0500
To: David A Benjamin <davidben@MIT.EDU>
Cc: Kevin Chen <kchen@MIT.EDU>, Karl Ramm <kcr@1ts.org>, barnowl-dev@MIT.EDU

--000e0cd4a71818dd1404951f49eb
Content-Type: text/plain; charset=ISO-8859-1

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
>

--000e0cd4a71818dd1404951f49eb
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Where do I find information about where a function is supported?<div><br></=
div><div>I found=A0<span class=3D"Apple-style-span" style=3D"font-family: a=
rial, sans-serif; font-size: 13px; border-collapse: collapse; ">canonicaliz=
e_file_name at</span>=A0<a href=3D"http://www.gnu.org/s/libc/manual/html_no=
de/Symbolic-Links.html">http://www.gnu.org/s/libc/manual/html_node/Symbolic=
-Links.html</a>, which I found by searching google (<a href=3D"http://www.g=
oogle.com/search?sourceid=3Dchrome&amp;ie=3DUTF-8&amp;q=3Dresolve+symbolic+=
link+c">http://www.google.com/search?sourceid=3Dchrome&amp;ie=3DUTF-8&amp;q=
=3Dresolve+symbolic+link+c</a>). =A0It also gave the function <font class=
=3D"Apple-style-span" face=3D"&#39;courier new&#39;, monospace">readlink</f=
ont><font class=3D"Apple-style-span" face=3D"arial, helvetica, sans-serif">=
 and the code</font></div>

<div><meta http-equiv=3D"content-type" content=3D"text/html; charset=3Dutf-=
8"><meta http-equiv=3D"content-type" content=3D"text/html; charset=3Dutf-8"=
><pre class=3D"smallexample"><font class=3D"Apple-style-span" face=3D"&#39;=
courier new&#39;, monospace">char *
readlink_malloc (const char *filename)
{
  int size =3D 100;
  char *buffer =3D NULL;

  while (1)
    {
      buffer =3D (char *) xrealloc (buffer, size);
      int nchars =3D readlink (filename, buffer, size);
      if (nchars &lt; 0)
        {
          free (buffer);
          return NULL;
        }
      if (nchars &lt; size)
        return buffer;
      size *=3D 2;
    }
}</font></pre></div><div><font class=3D"Apple-style-span" face=3D"arial, he=
lvetica, sans-serif">Is this a GNUism, or is readlink generally available? =
=A0Should we use this instead? =A0(I think Python uses readlink for its rea=
lpath.)</font></div>

<div><font class=3D"Apple-style-span" face=3D"arial, helvetica, sans-serif"=
><br></font></div><div><font class=3D"Apple-style-span" face=3D"arial, helv=
etica, sans-serif">-Jason</font></div><meta http-equiv=3D"content-type" con=
tent=3D"text/html; charset=3Dutf-8"><meta http-equiv=3D"content-type" conte=
nt=3D"text/html; charset=3Dutf-8"><div>

<div><br><div class=3D"gmail_quote">On Mon, Nov 15, 2010 at 5:14 PM, David =
A Benjamin <span dir=3D"ltr">&lt;<a href=3D"mailto:davidben@mit.edu">davidb=
en@mit.edu</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" style=
=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div><div></div><div class=3D"h5">On Mon, 15 Nov 2010, David A Benjamin wro=
te:<br>
<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">
On Mon, 15 Nov 2010, Kevin Chen wrote:<br>
<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">
On Mon, 15 Nov 2010, Karl Ramm wrote:<br>
<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">
David A Benjamin &lt;<a href=3D"mailto:davidben@MIT.EDU" target=3D"_blank">=
davidben@MIT.EDU</a>&gt; writes:<br>
<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">
The man pages says it&#39;s equivalent to realpath(path, NULL)<br>
which... doesn&#39;t appear to be a GNUism?<br>
<br>
We can also add another AC_REPLACE_FUNCS, but they&#39;re annoying.<br>
<br>
David<br>
</blockquote>
<br>
It&#39;s in POSIX 2001 so we.. probably get to point and laugh if someone<b=
r>
doesn&#39;t have it?<br>
</blockquote>
<br>
My manpage (for realpath) says that passing NULL as the second argument is =
a non-standard glibc extension.<br>
<br>
</blockquote>
<br>
Lovely. Meh, we can allocate a PATH_MAX-sized buffer. Not terribly exciting=
.<br>
<br>
</blockquote>
<br></div></div>
Err, on second thought, reading all the NOTES in my version of the man page=
, can I run away screaming now?<br>
<br>
Maybe glib has an implementation that isn&#39;t awful.<br><font color=3D"#8=
88888">
<br>
David<br>
</font></blockquote></div><br></div></div>

--000e0cd4a71818dd1404951f49eb--

home help back first fref pref prev next nref lref last post