diff options
author | Werner Koch <wk@gnupg.org> | 2006-10-02 13:54:35 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2006-10-02 13:54:35 +0200 |
commit | 4b48bcacc9a242365e85ca788c4c966d8aeb1c10 (patch) | |
tree | 21e803ec571bbe4d9288e014a16ccafe0ac45056 /jnlib | |
parent | 2006-10-02 Marcus Brinkmann <marcus@g10code.de> (diff) | |
download | gnupg2-4b48bcacc9a242365e85ca788c4c966d8aeb1c10.tar.xz gnupg2-4b48bcacc9a242365e85ca788c4c966d8aeb1c10.zip |
Fix for bug 537
Diffstat (limited to 'jnlib')
-rw-r--r-- | jnlib/ChangeLog | 72 | ||||
-rw-r--r-- | jnlib/Makefile.am | 36 | ||||
-rw-r--r-- | jnlib/README | 11 | ||||
-rw-r--r-- | jnlib/argparse.c | 28 | ||||
-rw-r--r-- | jnlib/argparse.h | 28 | ||||
-rw-r--r-- | jnlib/dotlock.c | 26 | ||||
-rw-r--r-- | jnlib/dotlock.h | 31 | ||||
-rw-r--r-- | jnlib/libjnlib-config.h | 31 | ||||
-rw-r--r-- | jnlib/logging.c | 30 | ||||
-rw-r--r-- | jnlib/logging.h | 28 | ||||
-rw-r--r-- | jnlib/mischelp.c | 88 | ||||
-rw-r--r-- | jnlib/mischelp.h | 38 | ||||
-rw-r--r-- | jnlib/stringhelp.c | 75 | ||||
-rw-r--r-- | jnlib/stringhelp.h | 49 | ||||
-rw-r--r-- | jnlib/strlist.c | 26 | ||||
-rw-r--r-- | jnlib/strlist.h | 32 | ||||
-rw-r--r-- | jnlib/types.h | 118 | ||||
-rw-r--r-- | jnlib/utf8conv.c | 28 | ||||
-rw-r--r-- | jnlib/utf8conv.h | 28 | ||||
-rw-r--r-- | jnlib/w32-afunix.c | 38 | ||||
-rw-r--r-- | jnlib/w32-afunix.h | 15 | ||||
-rw-r--r-- | jnlib/w32-pth.c | 12 | ||||
-rw-r--r-- | jnlib/w32-pth.h | 12 | ||||
-rw-r--r-- | jnlib/xmalloc.c | 28 | ||||
-rw-r--r-- | jnlib/xmalloc.h | 28 |
25 files changed, 565 insertions, 371 deletions
diff --git a/jnlib/ChangeLog b/jnlib/ChangeLog index 6c38de2b1..7273f0e5f 100644 --- a/jnlib/ChangeLog +++ b/jnlib/ChangeLog @@ -1,3 +1,33 @@ +2006-09-27 Werner Koch <wk@g10code.com> + + * mischelp.c: New. + (timegm): Copied from gnupg 1.4, Changed from LGPL to GPL. Fixed + a memory leak. + + * stringhelp.h (isascii): New. + + * stringhelp.c (strsep): New. Copied from gnupg 1.4.5 + util/strgutil.c. + + * strlist.h (STRLIST): Removed deprecated typedef. + + * types.h: Made cpp commands work with old compilers. Also shows + up nicer with Emacs' font locking. + + * w32-afunix.c (_w32_sock_connect): Set ERRNO for an invalid port. + + Changed license from GPL to LGPL. Note that all code has either + been written by me, David, employees of g10 Code or taken from + glibc. + + * libjnlib-config.h, stringhelp.c, stringhelp.h: + * strlist.c, strlist.h, utf8conv.c, utf8conv.h: + * argparse.c, argparse.h, logging.c, logging.h: + * dotlock.c, dotlock.h, types.h, mischelp.h: + * xmalloc.c, xmalloc.h, w32-pth.c, w32-pth.h: + * w32-afunix.c, w32-afunix.h: Tagged them to be long to jnlib + which is a part of GnuPG but also used by other projetcs. + 2006-09-22 Werner Koch <wk@g10code.com> * utf8conv.c: Reworked to match the gnupg 1.4.5 code. This now @@ -342,53 +372,53 @@ 2000-07-26 10:02:51 Werner Koch (wk@habibti.openit.de) - * stringhelp.c.: Add stdarg.h - * argparse.h: s/ulong/unsigned long/ although this should be defined - by types.h. + * stringhelp.c.: Add stdarg.h + * argparse.h: s/ulong/unsigned long/ although this should be defined + by types.h. 2000-06-28 19:40:23 Werner Koch (wk@habibti.openit.de) - * Makefile.am: Replaced second logging.c by .h + * Makefile.am: Replaced second logging.c by .h 2000-05-24 08:58:15 Werner Koch (wk@habibti.openit.de) - * logging.c (log_get_errorcount): New. + * logging.c (log_get_errorcount): New. 2000-05-24 08:44:47 Werner Koch (wk@habibti.openit.de) - * stringhelp.c: Added a few filename related helper functions. + * stringhelp.c: Added a few filename related helper functions. 2000-05-11 18:04:43 Werner Koch (wk@habibti.openit.de) - * xmalloc.c (xstrcat2): Replaced stpcpy to quickly address W32 - problems. + * xmalloc.c (xstrcat2): Replaced stpcpy to quickly address W32 + problems. 2000-05-02 19:43:38 Werner Koch (wk@habibti.openit.de) - * xmalloc.c (xstrcat2): New. + * xmalloc.c (xstrcat2): New. Mon Jan 24 13:04:28 CET 2000 Werner Koch <wk@gnupg.de> - * README: New. - * Makefile.am: new. - * argparse.c argparse.h logging.c logging.h - mischelp.h stringhelp.c stringhelp.h xmalloc.c - xmalloc.h dotlock.c: Moved from ../util to here. - * dotlock.h: New. - * libjnlib-config.h: New. + * README: New. + * Makefile.am: new. + * argparse.c, argparse.h, logging.c, logging.h: + * mischelp.h, stringhelp.c, stringhelp.h, xmalloc.c: + * xmalloc.h, dotlock.c: Moved from ../util to here. + * dotlock.h: New. + * libjnlib-config.h: New. - * logging.c (log_set_file): New. - (log_printf): New. - (do_logv): Add kludge to insert LFs. + * logging.c (log_set_file): New. + (log_printf): New. + (do_logv): Add kludge to insert LFs. *********************************************************** - * Please note that Jnlib is maintained as part of GnuPG. * + * Please note that JNLIB is maintained as part of GnuPG. * * You may find it source-copied in other packages. * *********************************************************** Copyright 2000, 2001, 2002, 2003, 2004, - 2005 Free Software Foundation, Inc. + 2005, 2006 Free Software Foundation, Inc. This file is free software; as a special exception the author gives unlimited permission to copy and/or distribute it, with or without diff --git a/jnlib/Makefile.am b/jnlib/Makefile.am index 5fd48495c..951c562f2 100644 --- a/jnlib/Makefile.am +++ b/jnlib/Makefile.am @@ -1,21 +1,24 @@ -# Copyright (C) 1999, 2000, 2001, 2004 Feee Software Soundation, Inc. +# Makefile for the JNLIB part of GnuPG +# Copyright (C) 1999, 2000, 2001, 2004, +# 2006 Feee Software Soundation, Inc. # -# This file is part of GnuPG +# This file is part of JNLIB. # -# GnuPG 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; either version 2 of the License, or -# (at your option) any later version. +# JNLIB is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as +# published by the Free Software Foundation; either version 2.1 of +# the License, or (at your option) any later version. # -# GnuPG 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. +# JNLIB 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 +# Lesser General Public License for more details. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -# USA. +# You should have received a copy of the GNU Lesser General Public +# License along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + ## Process this file with automake to produce Makefile.in @@ -38,9 +41,10 @@ libjnlib_a_SOURCES = \ argparse.c argparse.h \ logging.c logging.h \ dotlock.c dotlock.h \ - types.h mischelp.h \ + types.h mischelp.c mischelp.h \ w32-pth.c w32-pth.h \ w32-afunix.c w32-afunix.h -# xmalloc.c xmalloc.h +# For GnuPG we don't need the xmalloc stuff. +# xmalloc.c xmalloc.h diff --git a/jnlib/README b/jnlib/README index e49ef4450..5536e1ade 100644 --- a/jnlib/README +++ b/jnlib/README @@ -1,7 +1,8 @@ -jnlib - this is a collection of utility function which are -too small to put into a library. +JNLIB - This is a collection of utility function which are too small +to put into a library. The code here is licensed under the LGPL. + +libjnlib-config.h should be be modified for each project to make these +functions fit into the software. Mainly these are memory functions in +case you need another allocator. -libjnlib-config.h should be be modified for each project -to make these functions fit into the software. Mainly these -are memory functions in case you need another allocator. diff --git a/jnlib/argparse.c b/jnlib/argparse.c index 15a7c546e..c4fb057c2 100644 --- a/jnlib/argparse.c +++ b/jnlib/argparse.c @@ -1,22 +1,22 @@ /* [argparse.c wk 17.06.97] Argument Parser for option handling - * Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + * Copyright (C) 1998, 1999, 2000, 2001, 2006 Free Software Foundation, Inc. * - * This file is part of GnuPG. + * This file is part of JNLIB. * - * GnuPG 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; either version 2 of the License, or - * (at your option) any later version. + * JNLIB is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. * - * GnuPG 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. + * JNLIB 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 + * Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA. + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. */ #include <config.h> diff --git a/jnlib/argparse.h b/jnlib/argparse.h index 531622ea5..3528d8156 100644 --- a/jnlib/argparse.h +++ b/jnlib/argparse.h @@ -1,22 +1,22 @@ /* argparse.h - * Copyright (C) 1998,1999,2000,2001 Free Software Foundation, Inc. + * Copyright (C) 1998,1999,2000,2001,2006 Free Software Foundation, Inc. * - * This file is part of GnuPG. + * This file is part of JNLIB. * - * GnuPG 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; either version 2 of the License, or - * (at your option) any later version. + * JNLIB is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. * - * GnuPG 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. + * JNLIB 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 + * Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA. + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. */ #ifndef LIBJNLIB_ARGPARSE_H diff --git a/jnlib/dotlock.c b/jnlib/dotlock.c index f5de8fa54..ba89bcea6 100644 --- a/jnlib/dotlock.c +++ b/jnlib/dotlock.c @@ -2,22 +2,22 @@ * Copyright (C) 1998, 2000, 2001, 2003, 2004, * 2005, 2006 Free Software Foundation, Inc. * - * This file is part of GnuPG. + * This file is part of JNLIB. * - * GnuPG 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; either version 2 of the License, or - * (at your option) any later version. + * JNLIB is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. * - * GnuPG 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. + * JNLIB 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 + * Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA. + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. */ #include <config.h> diff --git a/jnlib/dotlock.h b/jnlib/dotlock.h index 1c0f05cb2..054900522 100644 --- a/jnlib/dotlock.h +++ b/jnlib/dotlock.h @@ -1,22 +1,22 @@ /* dotlock.h - * Copyright (C) 2000, 2001 Free Software Foundation, Inc. + * Copyright (C) 2000, 2001, 2006 Free Software Foundation, Inc. * - * This file is part of GnuPG. + * This file is part of JNLIB. * - * GnuPG 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; either version 2 of the License, or - * (at your option) any later version. + * JNLIB is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. * - * GnuPG 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. + * JNLIB 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 + * Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA. + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. */ #ifndef LIBJNLIB_DOTLOCK_H @@ -33,6 +33,3 @@ int release_dotlock (DOTLOCK h); void dotlock_remove_lockfiles (void); #endif /*LIBJNLIB_DOTLOCK_H*/ - - - diff --git a/jnlib/libjnlib-config.h b/jnlib/libjnlib-config.h index ded6e057b..4554b9d1a 100644 --- a/jnlib/libjnlib-config.h +++ b/jnlib/libjnlib-config.h @@ -1,22 +1,22 @@ /* libjnlib-config.h - local configuration of the jnlib functions * Copyright (C) 2000, 2001, 2006 Free Software Foundation, Inc. * - * This file is part of GnuPG. + * This file is part of JNLIB. * - * GnuPG 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; either version 2 of the License, or - * (at your option) any later version. + * JNLIB is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. * - * GnuPG 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. + * JNLIB 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 + * Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA. + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. */ /**************** @@ -33,6 +33,8 @@ /* We require support for utf-8 conversion. */ #define JNLIB_NEED_UTF8CONV 1 + +/* Gettext stuff */ #ifdef USE_SIMPLE_GETTEXT int set_gettext_file( const char *filename ); const char *gettext( const char *msgid ); @@ -59,13 +61,14 @@ #endif #endif /* !USE_SIMPLE_GETTEXT */ - +/* Malloc functions to be jused by jnlib. */ #define jnlib_xmalloc(a) gcry_xmalloc( (a) ) #define jnlib_xcalloc(a,b) gcry_xcalloc( (a), (b) ) #define jnlib_xrealloc(a,n) gcry_xrealloc( (a), (n) ) #define jnlib_xstrdup(a) gcry_xstrdup( (a) ) #define jnlib_free(a) gcry_free( (a) ) +/* Logging functions to be jused by jnlib. */ #define jnlib_log_debug log_debug #define jnlib_log_info log_info #define jnlib_log_error log_error diff --git a/jnlib/logging.c b/jnlib/logging.c index 568c67247..dce5ab2ea 100644 --- a/jnlib/logging.c +++ b/jnlib/logging.c @@ -1,23 +1,23 @@ -/* logging.c - useful logging functions +/* logging.c - Useful logging functions * Copyright (C) 1998, 1999, 2000, 2001, 2003, - * 2004, 2005 Free Software Foundation, Inc. + * 2004, 2005, 2006 Free Software Foundation, Inc. * - * This file is part of GnuPG. + * This file is part of JNLIB. * - * GnuPG 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; either version 2 of the License, or - * (at your option) any later version. + * JNLIB is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. * - * GnuPG 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. + * JNLIB 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 + * Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA. + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. */ diff --git a/jnlib/logging.h b/jnlib/logging.h index 3ad43b4ec..ed54b473e 100644 --- a/jnlib/logging.h +++ b/jnlib/logging.h @@ -1,22 +1,22 @@ /* logging.h - * Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc. + * Copyright (C) 1999, 2000, 2001, 2004, 2006 Free Software Foundation, Inc. * - * This file is part of GnuPG. + * This file is part of JNLIB. * - * GnuPG 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; either version 2 of the License, or - * (at your option) any later version. + * JNLIB is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. * - * GnuPG 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. + * JNLIB 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 + * Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA. + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. */ #ifndef LIBJNLIB_LOGGING_H diff --git a/jnlib/mischelp.c b/jnlib/mischelp.c new file mode 100644 index 000000000..7f8e671cd --- /dev/null +++ b/jnlib/mischelp.c @@ -0,0 +1,88 @@ +/* mischelp.c - Miscellaneous helper functions + * Copyright (C) 1998, 2000, 2001, 2006 Free Software Foundation, Inc. + * + * This file is part of JNLIB. + * + * JNLIB is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * JNLIB 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +#include <config.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> + +#include "libjnlib-config.h" +#include "mischelp.h" + +/* A dummy function to prevent an empty compilation unit. Some + compilers bail out in this case. */ +time_t +libjnlib_dummy_mischelp_func (void) +{ + return time (NULL); +} + + +/* + timegm() is a GNU function that might not be available everywhere. + It's basically the inverse of gmtime() - you give it a struct tm, + and get back a time_t. It differs from mktime() in that it handles + the case where the struct tm is UTC and the local environment isn't. + + Note, that this replacement implementaion is not thread-safe! + + Some BSDs don't handle the putenv("foo") case properly, so we use + unsetenv if the platform has it to remove environment variables. +*/ +#ifndef HAVE_TIMEGM +time_t +timegm (struct tm *tm) +{ + time_t answer; + char *zone; + + zone=getenv("TZ"); + putenv("TZ=UTC"); + tzset(); + answer=mktime(tm); + if(zone) + { + static char *old_zone; + + if (!old_zone) + { + old_zone = malloc(3+strlen(zone)+1); + if (old_zone) + { + strcpy(old_zone,"TZ="); + strcat(old_zone,zone); + } + } + if (old_zone) + putenv (old_zone); + } + else +#ifdef HAVE_UNSETENV + unsetenv("TZ"); +#else + putenv("TZ"); +#endif + + tzset(); + return answer; +} +#endif /*!HAVE_TIMEGM*/ + diff --git a/jnlib/mischelp.h b/jnlib/mischelp.h index 8e7f9c346..7c07c3c3f 100644 --- a/jnlib/mischelp.h +++ b/jnlib/mischelp.h @@ -1,28 +1,35 @@ -/* mischelp.h - * Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +/* mischelp.h - Miscellaneous helper macros and functions + * Copyright (C) 1999, 2000, 2001, 2002, 2003, + * 2006 Free Software Foundation, Inc. * - * This file is part of GnuPG. + * This file is part of JNLIB. * - * GnuPG 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; either version 2 of the License, or - * (at your option) any later version. + * JNLIB is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. * - * GnuPG 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. + * JNLIB 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 + * Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA. + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. */ #ifndef LIBJNLIB_MISCHELP_H #define LIBJNLIB_MISCHHELP_H +#ifndef HAVE_TIMEGM +#include <time.h> +time_t timegm (struct tm *tm); +#endif /*!HAVE_TIMEGM*/ + + #define DIM(v) (sizeof(v)/sizeof((v)[0])) #define DIMof(type,member) DIM(((type *)0)->member) @@ -51,5 +58,4 @@ - #endif /*LIBJNLIB_MISCHELP_H*/ diff --git a/jnlib/stringhelp.c b/jnlib/stringhelp.c index 9df852754..4e2768251 100644 --- a/jnlib/stringhelp.c +++ b/jnlib/stringhelp.c @@ -2,22 +2,22 @@ * Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2005, * 2006 Free Software Foundation, Inc. * - * This file is part of GnuPG. + * This file is part of JNLIB. * - * GnuPG 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; either version 2 of the License, or - * (at your option) any later version. + * JNLIB is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. * - * GnuPG 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. + * JNLIB 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 + * Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA. + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. */ #include <config.h> @@ -707,6 +707,55 @@ stpcpy(char *a,const char *b) } #endif +#ifndef HAVE_STRSEP +/* Code taken from glibc-2.2.1/sysdeps/generic/strsep.c. */ +char * +strsep (char **stringp, const char *delim) +{ + char *begin, *end; + + begin = *stringp; + if (begin == NULL) + return NULL; + + /* A frequent case is when the delimiter string contains only one + character. Here we don't need to call the expensive `strpbrk' + function and instead work using `strchr'. */ + if (delim[0] == '\0' || delim[1] == '\0') + { + char ch = delim[0]; + + if (ch == '\0') + end = NULL; + else + { + if (*begin == ch) + end = begin; + else if (*begin == '\0') + end = NULL; + else + end = strchr (begin + 1, ch); + } + } + else + /* Find the end of the token. */ + end = strpbrk (begin, delim); + + if (end) + { + /* Terminate the token and set *STRINGP past NUL character. */ + *end++ = '\0'; + *stringp = end; + } + else + /* No more delimiters; this is the last token. */ + *stringp = NULL; + + return begin; +} +#endif /*HAVE_STRSEP*/ + + #ifndef HAVE_STRLWR char * strlwr(char *s) diff --git a/jnlib/stringhelp.h b/jnlib/stringhelp.h index b8f4dbec0..5de50befe 100644 --- a/jnlib/stringhelp.h +++ b/jnlib/stringhelp.h @@ -1,22 +1,23 @@ /* stringhelp.h - * Copyright (C) 1998,1999,2000,2001,2003 Free Software Foundation, Inc. + * Copyright (C) 1998, 1999, 2000, 2001, 2003, + * 2006 Free Software Foundation, Inc. * - * This file is part of GnuPG. + * This file is part of JNLIB. * - * GnuPG 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; either version 2 of the License, or - * (at your option) any later version. + * JNLIB is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. * - * GnuPG 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. + * JNLIB 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 + * Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA. + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. */ #ifndef LIBJNLIB_STRINGHELP_H @@ -79,21 +80,33 @@ int memicmp( const char *a, const char *b, size_t n ); #ifndef HAVE_STPCPY char *stpcpy(char *a,const char *b); #endif +#ifndef HAVE_STRSEP +char *strsep (char **stringp, const char *delim); +#endif #ifndef HAVE_STRLWR char *strlwr(char *a); #endif #ifndef HAVE_STRTOUL - #define strtoul(a,b,c) ((unsigned long)strtol((a),(b),(c))) +# define strtoul(a,b,c) ((unsigned long)strtol((a),(b),(c))) #endif #ifndef HAVE_MEMMOVE - #define memmove(d, s, n) bcopy((s), (d), (n)) +# define memmove(d, s, n) bcopy((s), (d), (n)) #endif #ifndef HAVE_STRICMP - #define stricmp(a,b) strcasecmp( (a), (b) ) +# define stricmp(a,b) strcasecmp( (a), (b) ) #endif +#ifndef HAVE_ISASCII +static inline int +isascii (int c) +{ + return (((c) & ~0x7f) == 0); +} +#endif /* !HAVE_ISASCII */ + + #ifndef STR - #define STR(v) #v +# define STR(v) #v #endif #define STR2(v) STR(v) diff --git a/jnlib/strlist.c b/jnlib/strlist.c index 87e121705..01f483a8a 100644 --- a/jnlib/strlist.c +++ b/jnlib/strlist.c @@ -1,22 +1,22 @@ /* strlist.c - string helpers * Copyright (C) 1998, 2000, 2001, 2006 Free Software Foundation, Inc. * - * This file is part of GnuPG. + * This file is part of JNLIB. * - * GnuPG 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; either version 2 of the License, or - * (at your option) any later version. + * JNLIB is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. * - * GnuPG 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. + * JNLIB 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 + * Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA. + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. */ #include <config.h> diff --git a/jnlib/strlist.h b/jnlib/strlist.h index ee9f1fa60..a5f1a082f 100644 --- a/jnlib/strlist.h +++ b/jnlib/strlist.h @@ -1,33 +1,33 @@ /* strlist.h - * Copyright (C) 1998, 2000, 2001 Free Software Foundation, Inc. + * Copyright (C) 1998, 2000, 2001, 2006 Free Software Foundation, Inc. * - * This file is part of GnuPG. + * This file is part of JNLIB. * - * GnuPG 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; either version 2 of the License, or - * (at your option) any later version. + * JNLIB is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. * - * GnuPG 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. + * JNLIB 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 + * Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA. + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. */ #ifndef LIBJNLIB_STRLIST_H #define LIBJNLIB_STRLIST_H -struct string_list { +struct string_list +{ struct string_list *next; unsigned int flags; char d[1]; }; -typedef struct string_list *STRLIST; /* Deprecated. */ typedef struct string_list *strlist_t; void free_strlist (strlist_t sl); diff --git a/jnlib/types.h b/jnlib/types.h index 89d245943..f8548b58a 100644 --- a/jnlib/types.h +++ b/jnlib/types.h @@ -1,22 +1,22 @@ -/* types.h - * Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. +/* types.h - define some extra types + * Copyright (C) 1999, 2000, 2001, 2006 Free Software Foundation, Inc. * - * This file is part of GnuPG. + * This file is part of JNLIB. * - * GnuPG 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; either version 2 of the License, or - * (at your option) any later version. + * JNLIB is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. * - * GnuPG 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. + * JNLIB 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 + * Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA. + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. */ #ifndef LIBJNLIB_TYPES_H @@ -25,16 +25,16 @@ /* The AC_CHECK_SIZEOF() in configure fails for some machines. * we provide some fallback values here */ #if !SIZEOF_UNSIGNED_SHORT - #undef SIZEOF_UNSIGNED_SHORT - #define SIZEOF_UNSIGNED_SHORT 2 +# undef SIZEOF_UNSIGNED_SHORT +# define SIZEOF_UNSIGNED_SHORT 2 #endif #if !SIZEOF_UNSIGNED_INT - #undef SIZEOF_UNSIGNED_INT - #define SIZEOF_UNSIGNED_INT 4 +# undef SIZEOF_UNSIGNED_INT +# define SIZEOF_UNSIGNED_INT 4 #endif #if !SIZEOF_UNSIGNED_LONG - #undef SIZEOF_UNSIGNED_LONG - #define SIZEOF_UNSIGNED_LONG 4 +# undef SIZEOF_UNSIGNED_LONG +# define SIZEOF_UNSIGNED_LONG 4 #endif @@ -42,65 +42,63 @@ #ifndef HAVE_BYTE_TYPEDEF - #undef byte /* maybe there is a macro with this name */ +# undef byte /* There might be a macro with this name. */ /* Windows typedefs byte in the rpc headers. Avoid warning about double definition. */ #if !(defined(_WIN32) && defined(cbNDRContext)) typedef unsigned char byte; #endif - #define HAVE_BYTE_TYPEDEF +# define HAVE_BYTE_TYPEDEF #endif #ifndef HAVE_USHORT_TYPEDEF - #undef ushort /* maybe there is a macro with this name */ - typedef unsigned short ushort; - #define HAVE_USHORT_TYPEDEF +# undef ushort /* There might be a macro with this name. */ + typedef unsigned short ushort; +# define HAVE_USHORT_TYPEDEF #endif #ifndef HAVE_ULONG_TYPEDEF - #undef ulong /* maybe there is a macro with this name */ - typedef unsigned long ulong; - #define HAVE_ULONG_TYPEDEF +# undef ulong /* There might be a macro with this name. */ + typedef unsigned long ulong; +# define HAVE_ULONG_TYPEDEF #endif #ifndef HAVE_U16_TYPEDEF - #undef u16 /* maybe there is a macro with this name */ - #if SIZEOF_UNSIGNED_INT == 2 - typedef unsigned int u16; - #elif SIZEOF_UNSIGNED_SHORT == 2 - typedef unsigned short u16; - #else - #error no typedef for u16 - #endif - #define HAVE_U16_TYPEDEF +# undef u16 /* There might be a macro with this name. */ +# if SIZEOF_UNSIGNED_INT == 2 + typedef unsigned int u16; +# elif SIZEOF_UNSIGNED_SHORT == 2 + typedef unsigned short u16; +# else +# error no typedef for u16 +# endif +# define HAVE_U16_TYPEDEF #endif #ifndef HAVE_U32_TYPEDEF - #undef u32 /* maybe there is a macro with this name */ - #if SIZEOF_UNSIGNED_INT == 4 - typedef unsigned int u32; - #elif SIZEOF_UNSIGNED_LONG == 4 - typedef unsigned long u32; - #else - #error no typedef for u32 - #endif - #define HAVE_U32_TYPEDEF +# undef u32 /* There might be a macro with this name. */ +# if SIZEOF_UNSIGNED_INT == 4 + typedef unsigned int u32; +# elif SIZEOF_UNSIGNED_LONG == 4 + typedef unsigned long u32; +# else +# error no typedef for u32 +# endif +# define HAVE_U32_TYPEDEF #endif #ifndef HAVE_U64_TYPEDEF - #undef u64 /* maybe there is a macro with this name */ - #if SIZEOF_UNSIGNED_INT == 8 - typedef unsigned int u64; - #define HAVE_U64_TYPEDEF - #elif SIZEOF_UNSIGNED_LONG == 8 - typedef unsigned long u64; - #define HAVE_U64_TYPEDEF - #elif __GNUC__ >= 2 || defined(__SUNPRO_C) - typedef unsigned long long u64; - #define HAVE_U64_TYPEDEF - #endif +# undef u64 /* There might be a macro with this name. */ +# if SIZEOF_UNSIGNED_INT == 8 + typedef unsigned int u64; +# define HAVE_U64_TYPEDEF +# elif SIZEOF_UNSIGNED_LONG == 8 + typedef unsigned long u64; +# define HAVE_U64_TYPEDEF +# elif __GNUC__ >= 2 || defined(__SUNPRO_C) + typedef unsigned long long u64; +# define HAVE_U64_TYPEDEF +# endif #endif - - #endif /*LIBJNLIB_TYPES_H*/ diff --git a/jnlib/utf8conv.c b/jnlib/utf8conv.c index ebb6ef3fd..ec04a52ad 100644 --- a/jnlib/utf8conv.c +++ b/jnlib/utf8conv.c @@ -1,23 +1,23 @@ /* utf8conf.c - UTF8 character set conversion * Copyright (C) 1994, 1998, 1999, 2000, 2001, - * 2003 Free Software Foundation, Inc. + * 2003, 2006 Free Software Foundation, Inc. * - * This file is part of GnuPG. + * This file is part of JNLIB. * - * GnuPG 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; either version 2 of the License, or - * (at your option) any later version. + * JNLIB is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. * - * GnuPG 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. + * JNLIB 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 + * Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA. + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. */ #include <config.h> diff --git a/jnlib/utf8conv.h b/jnlib/utf8conv.h index 344c47f92..f0eb4ec0f 100644 --- a/jnlib/utf8conv.h +++ b/jnlib/utf8conv.h @@ -1,22 +1,22 @@ /* utf8conf.h - * Copyright (C) 2003 Free Software Foundation, Inc. + * Copyright (C) 2003, 2006 Free Software Foundation, Inc. * - * This file is part of GnuPG. + * This file is part of JNLIB. * - * GnuPG 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; either version 2 of the License, or - * (at your option) any later version. + * JNLIB is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. * - * GnuPG 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. + * JNLIB 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 + * Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA. + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. */ #ifndef LIBJNLIB_UTF8CONF_H diff --git a/jnlib/w32-afunix.c b/jnlib/w32-afunix.c index 84d799f1f..dcce423c7 100644 --- a/jnlib/w32-afunix.c +++ b/jnlib/w32-afunix.c @@ -1,27 +1,29 @@ -/* w32-afunix.c - * Copyright (C) 2004 g10 Code GmbH +/* w32-afunix.c - AF_UNIX emulation for Windows. + * Copyright (C) 2004, 2006 g10 Code GmbH * - * This file is part of GnuPG. + * This file is part of JNLIB. * - * GnuPG 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; either version 2 of the License, or - * (at your option) any later version. + * JNLIB is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. * - * GnuPG 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. + * JNLIB 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 + * Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA. + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. */ + #ifdef _WIN32 #include <stdio.h> #include <windows.h> #include <io.h> +#include <errno.h> #include "w32-afunix.h" @@ -59,9 +61,11 @@ _w32_sock_connect (int sockfd, struct sockaddr * addr, int addrlen) fscanf (fp, "%d", &port); fclose (fp); - /* XXX: set errno in this case */ if (port < 0 || port > 65535) - return -1; + { + errno = EINVAL; + return -1; + } myaddr.sin_family = AF_INET; myaddr.sin_port = port; diff --git a/jnlib/w32-afunix.h b/jnlib/w32-afunix.h index d0eb8cf7e..d16e86557 100644 --- a/jnlib/w32-afunix.h +++ b/jnlib/w32-afunix.h @@ -1,23 +1,24 @@ -/* w32-afunix.h - * Copyright (C) 2004 g10 Code GmbH +/* w32-afunix.h - AF_UNIX emulation for Windows + * Copyright (C) 2004, 2006 g10 Code GmbH * - * This file is part of GnuPG. + * This file is part of JNLIB. * - * GnuPG is free software; you can redistribute it and/or modify it + * JNLIB is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * - * GnuPG is distributed in the hope that it will be useful, but + * JNLIB 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. */ + #ifdef _WIN32 #ifndef W32AFUNIX_DEFS_H #define W32AFUNIX_DEFS_H diff --git a/jnlib/w32-pth.c b/jnlib/w32-pth.c index 4107c7cb3..0ef4d9e4e 100644 --- a/jnlib/w32-pth.c +++ b/jnlib/w32-pth.c @@ -1,23 +1,23 @@ /* w32-pth.c - GNU Pth emulation for W32 (MS Windows). * Copyright (c) 1999-2003 Ralf S. Engelschall <rse@engelschall.com> - * Copyright (C) 2004 g10 Code GmbH + * Copyright (C) 2004, 2006 g10 Code GmbH * - * This file is part of GnuPG. + * This file is part of JNLIB. * - * GnuPG is free software; you can redistribute it and/or modify it + * JNLIB is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * - * GnuPG is distributed in the hope that it will be useful, but + * JNLIB 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. * * ------------------------------------------------------------------ * This code is based on Ralf Engelschall's GNU Pth, a non-preemptive diff --git a/jnlib/w32-pth.h b/jnlib/w32-pth.h index 524010d92..e351a9f0a 100644 --- a/jnlib/w32-pth.h +++ b/jnlib/w32-pth.h @@ -1,23 +1,23 @@ /* w32-pth.h - GNU Pth emulation for W32 (MS Windows). * Copyright (c) 1999-2003 Ralf S. Engelschall <rse@engelschall.com> - * Copyright (C) 2004 g10 Code GmbH + * Copyright (C) 2004, 2006 g10 Code GmbH * - * This file is part of GnuPG. + * This file is part of JNLIB. * - * GnuPG is free software; you can redistribute it and/or modify it + * JNLIB is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * - * GnuPG is distributed in the hope that it will be useful, but + * JNLIB 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. * * ------------------------------------------------------------------ * This code is based on Ralf Engelschall's GNU Pth, a non-preemptive diff --git a/jnlib/xmalloc.c b/jnlib/xmalloc.c index f5b92ba41..1dafe55a6 100644 --- a/jnlib/xmalloc.c +++ b/jnlib/xmalloc.c @@ -1,22 +1,22 @@ /* xmalloc.c - standard malloc wrappers - * Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. + * Copyright (C) 1999, 2000, 2001, 2006 Free Software Foundation, Inc. * - * This file is part of GnuPG. + * This file is part of JNLIB. * - * GnuPG 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; either version 2 of the License, or - * (at your option) any later version. + * JNLIB is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. * - * GnuPG 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. + * JNLIB 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 + * Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA. + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. */ #include <config.h> diff --git a/jnlib/xmalloc.h b/jnlib/xmalloc.h index 8bfa7df79..21cfd508d 100644 --- a/jnlib/xmalloc.h +++ b/jnlib/xmalloc.h @@ -1,22 +1,22 @@ /* xmalloc.h - * Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. + * Copyright (C) 1999, 2000, 2001, 2006 Free Software Foundation, Inc. * - * This file is part of GnuPG. + * This file is part of JNLIB. * - * GnuPG 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; either version 2 of the License, or - * (at your option) any later version. + * JNLIB is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. * - * GnuPG 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. + * JNLIB 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 + * Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA. + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. */ #ifndef LIBJNLIB_XMALLOC_H |