X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=lib%2Fsilcutil%2Fsymbian%2Fsilcsymbianutil.cpp;h=691ec677d4f4b386bd9a01ea625c3fc5dbbc1c08;hb=196824372226561334cd638d6471267cbffb354c;hp=93ae79ab41b05c6334ed1bcbf62730593bc56a54;hpb=8fd8212bcd16f2b53fbedff2a9b9a4e8c15b9695;p=silc.git diff --git a/lib/silcutil/symbian/silcsymbianutil.cpp b/lib/silcutil/symbian/silcsymbianutil.cpp index 93ae79ab..691ec677 100644 --- a/lib/silcutil/symbian/silcsymbianutil.cpp +++ b/lib/silcutil/symbian/silcsymbianutil.cpp @@ -1,74 +1,99 @@ -/* - - silcsymbianutil.cpp - - Author: Pekka Riikonen - - Copyright (C) 2006 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#include "silc.h" - -/* Returns the username of the user. */ - -char *silc_get_username() -{ - char *logname = NULL; - - logname = getlogin(); - if (!logname) { - struct passwd *pw; - - pw = getpwuid(getuid()); - if (!pw) - return strdup("User"); - - logname = pw->pw_name; - } - - return strdup(logname); -} - -/* Returns the real name of ther user. */ - -char *silc_get_real_name() -{ - char *realname = NULL; - struct passwd *pw; - - pw = getpwuid(getuid()); - if (!pw) - return strdup("No Name"); - - if (strchr(pw->pw_gecos, ',')) - *strchr(pw->pw_gecos, ',') = 0; - - if (!strlen(pw->pw_gecos)) - return strdup("No Name"); - - realname = strdup(pw->pw_gecos); - - return realname; -} - -/* Return current time to struct timeval. */ - -int silc_gettimeofday(struct timeval *p) -{ - return gettimeofday(p, NULL); -} - -int silc_file_set_nonblock(int fd) -{ - return 0; -} +/* + + silcsymbianutil.cpp + + Author: Pekka Riikonen + + Copyright (C) 2006 - 2007 Pekka Riikonen + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + +*/ + +#include "silc.h" +#include +#include + +extern "C" { + +/* Returns the username of the user. */ + +char *silc_get_username() +{ +#if 0 + char *logname = NULL; + + logname = getlogin(); + if (!logname) { + struct passwd *pw; + + pw = getpwuid(getuid()); + if (!pw) + return strdup("User"); + + logname = pw->pw_name; + } + + return strdup(logname); +#else + return strdup("Symbian"); +#endif /* 0 */ +} + +/* Returns the real name of ther user. */ + +char *silc_get_real_name() +{ +#if 0 + char *realname = NULL; + struct passwd *pw; + + pw = getpwuid(getuid()); + if (!pw) + return strdup("No Name"); + + if (strchr(pw->pw_gecos, ',')) + *strchr(pw->pw_gecos, ',') = 0; + + if (!strlen(pw->pw_gecos)) + return strdup("No Name"); + + realname = strdup(pw->pw_gecos); + + return realname; +#else + return strdup("Lastname"); +#endif /* 0 */ +} + +/* Return current time to struct timeval. */ + +int silc_gettimeofday(struct timeval *p) +{ + return gettimeofday(p, NULL); +} + +int silc_file_set_nonblock(int fd) +{ + return 0; +} + +void silc_symbian_usleep(long microseconds) +{ + User::After(microseconds / 1000); +} + +void silc_symbian_debug(const char *function, int line, char *string) +{ + fprintf(stderr, "%s:%d: %s\n", function, line, string); + // RDebug::Print(_L("%s:%d: %s"), function, line, string); +} + +} /* extern "C" */