summaryrefslogtreecommitdiff
path: root/editors/openoffice.org-2-devel/files/patch-sal::osl::unx::system.c
diff options
context:
space:
mode:
authorMartin Blapp <mbr@FreeBSD.org>2002-03-02 19:15:00 +0000
committerMartin Blapp <mbr@FreeBSD.org>2002-03-02 19:15:00 +0000
commitf7dbd92f23bcad2a3cd986ccb5ee4c987a3549c8 (patch)
treee9d274bf60ce39987914d448506953fc2aad3888 /editors/openoffice.org-2-devel/files/patch-sal::osl::unx::system.c
parentUpgrade to the 25-Feb-2002 GCC 3.1 development snapshot. (diff)
Add patches merged from NetBSD and from other sources
Notes
Notes: svn path=/head/; revision=55408
Diffstat (limited to 'editors/openoffice.org-2-devel/files/patch-sal::osl::unx::system.c')
-rw-r--r--editors/openoffice.org-2-devel/files/patch-sal::osl::unx::system.c127
1 files changed, 127 insertions, 0 deletions
diff --git a/editors/openoffice.org-2-devel/files/patch-sal::osl::unx::system.c b/editors/openoffice.org-2-devel/files/patch-sal::osl::unx::system.c
new file mode 100644
index 000000000000..b0b93119f983
--- /dev/null
+++ b/editors/openoffice.org-2-devel/files/patch-sal::osl::unx::system.c
@@ -0,0 +1,127 @@
+--- ../sal/osl/unx/system.c.orig Wed Feb 28 13:08:45 2001
++++ ../sal/osl/unx/system.c
+@@ -126,6 +126,73 @@
+ return res;
+ }
+
++int getpwuid_r(uid_t uid, struct passwd *pwd, char *buffer,
++ size_t buflen, struct passwd **result)
++{
++ struct passwd* res;
++
++ pthread_mutex_lock(&getrtl_mutex);
++
++ if ( res = getpwuid(uid) )
++ {
++ size_t pw_name, pw_passwd, pw_class, pw_gecos, pw_dir, pw_shell;
++
++ pw_name = strlen(res->pw_name)+1;
++ pw_passwd = strlen(res->pw_passwd)+1;
++ pw_class = strlen(res->pw_class)+1;
++ pw_gecos = strlen(res->pw_gecos)+1;
++ pw_dir = strlen(res->pw_dir)+1;
++ pw_shell = strlen(res->pw_shell)+1;
++
++ if (pw_name+pw_passwd+pw_class+pw_gecos
++ +pw_dir+pw_shell < buflen)
++ {
++ memcpy(pwd, res, sizeof(struct passwd));
++
++ strncpy(buffer, res->pw_name, pw_name);
++ pwd->pw_name = buffer;
++ buffer += pw_name;
++
++ strncpy(buffer, res->pw_passwd, pw_passwd);
++ pwd->pw_passwd = buffer;
++ buffer += pw_passwd;
++
++ strncpy(buffer, res->pw_class, pw_class);
++ pwd->pw_class = buffer;
++ buffer += pw_class;
++
++ strncpy(buffer, res->pw_gecos, pw_gecos);
++ pwd->pw_gecos = buffer;
++ buffer += pw_gecos;
++
++ strncpy(buffer, res->pw_dir, pw_dir);
++ pwd->pw_dir = buffer;
++ buffer += pw_dir;
++
++ strncpy(buffer, res->pw_shell, pw_shell);
++ pwd->pw_shell = buffer;
++ buffer += pw_shell;
++
++ *result = pwd ;
++ res = 0 ;
++
++ } else {
++
++ res = ENOMEM ;
++
++ }
++
++ } else {
++
++ res = errno ;
++
++ }
++
++ pthread_mutex_unlock(&getrtl_mutex);
++
++ return res;
++}
++
+ struct tm *localtime_r(const time_t *timep, struct tm *buffer)
+ {
+ struct tm* res;
+@@ -449,3 +516,50 @@
+ }
+ #endif
+
++#if defined(NETBSD) || defined(FREEBSD)
++char *fcvt(double value, int ndigit, int *decpt, int *sign)
++{
++ static char ret[256];
++ char buf[256],zahl[256],format[256]="%";
++ char *v1,*v2;
++
++ if (value==0.0) value=1e-30;
++
++ if (value<0.0) *sign=1; else *sign=0;
++
++ if (value<1.0)
++ {
++ *decpt=(int)log10(value);
++ value*=pow(10.0,1-*decpt);
++ ndigit+=*decpt-1;
++ if (ndigit<0) ndigit=0;
++ }
++ else
++ {
++ *decpt=(int)log10(value)+1;
++ }
++
++ sprintf(zahl,"%d",ndigit);
++ strcat(format,zahl);
++ strcat(format,".");
++ strcat(format,zahl);
++ strcat(format,"f");
++
++ sprintf(buf,format,value);
++
++ if (ndigit!=0)
++ {
++ v1=strtok(buf,".");
++ v2=strtok(NULL,".");
++ strcpy(ret,v1);
++ strcat(ret,v2);
++ }
++ else
++ {
++ strcpy(ret,buf);
++ }
++
++ return(ret);
++}
++
++#endif