Ethereal-dev: [Ethereal-dev] RFC: .ethereal location on Windows
Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.
From: "Mark Clayton" <mark@xxxxxxxxxxxxxxxxx>
Date: Tue, 11 Dec 2001 14:48:24 -0800
I would like to propose adding %HOME% as a possible location for the .ethereal directory on Windows. For me and my co-workers, the directory %HOMEDRIVE%%HOMEPATH% is write protected. I've included a patch below if no one has any objections. Please note that I am not setup to build ethereal so this patch has not been compiled or tested. Also, my Mailer is wrapping the lines of the patch. I apologize for this in advance. Thanks, Mark C:\home\claytom>diff -Naurd origfilesystem.c filesystem.c --- origfilesystem.c Tue Dec 11 17:14:13 2001 +++ filesystem.c Tue Dec 11 17:31:46 2001 @@ -286,48 +286,49 @@ /* Return the cached value, if available */ if (home) return home; -#ifdef WIN32 - /* - * XXX - should we use USERPROFILE anywhere in this process? - * Is there a chance that it might be set but one or more of - * HOMEDRIVE or HOMEPATH isn't set? - */ - homedrive = getenv("HOMEDRIVE"); - if (homedrive != NULL) { - homepath = getenv("HOMEPATH"); - if (homepath != NULL) { - /* - * This is cached, so we don't need to worry about - * allocating multiple ones of them. - */ - homestring = - g_malloc(strlen(homedrive) + strlen (homepath) + 1); - strcpy(homestring, homedrive); - strcat(homestring, homepath); - /* - * Trim off any trailing slash or backslash. - */ - lastsep = find_last_pathname_separator (homestring); - if (lastsep != NULL && *(lastsep + 1) == '\0') { - /* - * Last separator is the last character - * in the string. Nuke it. - */ - *lastsep = '\0'; - } - home = homestring; - } else - home = homedrive; - } else { - /* - * Try using "windir? - */ - home = "C:"; - } -#else home = getenv("HOME"); if (home == NULL) { +#ifdef WIN32 + /* + * XXX - should we use USERPROFILE anywhere in this process? + * Is there a chance that it might be set but one or more of + * HOMEDRIVE or HOMEPATH isn't set? + */ + homedrive = getenv("HOMEDRIVE"); + if (homedrive != NULL) { + homepath = getenv("HOMEPATH"); + if (homepath != NULL) { + /* + * This is cached, so we don't need to worry ab out + * allocating multiple ones of them. + */ + homestring = + g_malloc(strlen(homedrive) + strlen (homepat h) + 1); + strcpy(homestring, homedrive); + strcat(homestring, homepath); + + /* + * Trim off any trailing slash or backslash. + */ + lastsep = find_last_pathname_separator (homestri ng); + if (lastsep != NULL && *(lastsep + 1) == '\0') { + /* + * Last separator is the last character + * in the string. Nuke it. + */ + *lastsep = '\0'; + } + home = homestring; + } else + home = homedrive; + } else { + /* + * Try using "windir? + */ + home = "C:"; + } +#else /* * Get their home directory from the password file. * If we can't even find a password file entry for them, @@ -342,8 +343,8 @@ home = g_strdup(pwd->pw_dir); } else home = "/tmp"; - } #endif + } return home; } -- Mark Clayton S/V Brown Pelican http://www.brown-pelican.com
- Follow-Ups:
- Re: [Ethereal-dev] RFC: .ethereal location on Windows
- From: Guy Harris
- Re: [Ethereal-dev] RFC: .ethereal location on Windows
- Prev by Date: Re: [Ethereal-dev] Some strange behavior(wiretap on netxray)
- Next by Date: Re: [Ethereal-dev] RFC: .ethereal location on Windows
- Previous by thread: RE: [Ethereal-dev] TCP Reset packets
- Next by thread: Re: [Ethereal-dev] RFC: .ethereal location on Windows
- Index(es):