Cleanup misc functions.

git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@453 7dcaeef0-15fb-0310-b436-a5af3365683c
This commit is contained in:
Andreas Schneider
2009-04-10 09:06:27 +00:00
parent c841e984ba
commit e4624d6ed7

View File

@@ -67,7 +67,19 @@
/** \addtogroup ssh_misc
* @{ */
#ifndef _WIN32
#ifdef _WIN32
char *ssh_get_user_home_dir(void) {
static char szPath[MAX_PATH] = {0};
if (SHGetSpecialFolderPathA(NULL, szPath, CSIDL_PROFILE, TRUE)) {
return szPath;
}
return NULL;
}
#else /* _WIN32 */
char *ssh_get_user_home_dir(void) {
static char szPath[PATH_MAX] = {0};
struct passwd *pwd = NULL;
@@ -82,25 +94,17 @@ char *ssh_get_user_home_dir(void) {
return szPath;
}
#else /* _WIN32 */
char *ssh_get_user_home_dir(void) {
static char szPath[MAX_PATH];
if (SHGetSpecialFolderPathA(NULL, szPath, CSIDL_PROFILE, TRUE))
return szPath;
else
return NULL;
}
#endif
/* we have read access on file */
int ssh_file_readaccess_ok(const char *file) {
if(!access(file,R_OK))
return 1;
if (access(file, R_OK) < 0) {
return 0;
}
return 1;
}
u64 ntohll(u64 a) {
#ifdef WORDS_BIGENDIAN
return a;
@@ -109,6 +113,7 @@ u64 ntohll(u64 a){
u32 high = a >> 32 ;
low = ntohl(low);
high = ntohl(high);
return ((((u64) low) << 32) | ( high));
#endif
}