curl-users
Re: proposed patch for windows for using _netrc
Date: Wed, 11 Apr 2012 11:46:26 -0500
On 11/04/2012 03:13 a.m., Gisle Vanem wrote:
> "Cesar Romani" <cesar.romani_at_gmail.com> wrote:
>
>> On Windows normally you don't have a HOME environment variable, but you
>> have USERPROFILE, available in all versions of windows.
>> The following patch take this into account:
>>
>> --------------------
>> --- ./lib/netrc.c.org 2012-04-03 19:14:56 -0500
>> +++ ./lib/netrc.c 2012-04-03 19:15:50 -0500
>> @@ -81,6 +81,8 @@
>>
>> if(!netrcfile) {
>> home = curl_getenv("HOME"); /* portable environment reader */
>> + if(!home)
>> + home = curl_getenv("USERPROFILE");
>
> Normally %USERPROFILE points to "x:\Documents and Settings\<user's
name>".
> While %HOME should point to the data-directory for <user's name>. I.e.
> "%USERPROFILE\\ProgramData" or "%USERPROFILE\\Application Data" . (I
> think the default is OS dependant; Win-XP / Win-Vista+. Not sure).
>
> In my case (Win-XP) these are:
> USERPROFILE=f:\Documents and Settings\Gisle Vanem
> HOME=f:\Documents and Settings\Gisle Vanem\ProgramData
>
> While %APPDATA should point to the *data-directory* of <user 's name>.
>
> So, I think this patch is more correct:
> + if(!home)
> + home = curl_getenv("APPDATA");
>
> Maybe more heuristics is needed? See:
> http://technet.microsoft.com/en-us/library/cc749104(v=ws.10).aspx
>
> %USERPROFILE -> CSIDL_PROFILE and
> %APPDATA -> CSIDL_APPDATA.
On windows XP, Vista or 7, you have that less, winzsh, ncftp, TexLive,
asymptote and others use USERPROFILE when HOME isn't defined.
Regards,
-- Cesar ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-users FAQ: http://curl.haxx.se/docs/faq.html Etiquette: http://curl.haxx.se/mail/etiquette.htmlReceived on 2012-04-11