diff options
author | Marcus Brinkmann <[email protected]> | 2003-05-15 18:52:35 +0000 |
---|---|---|
committer | Marcus Brinkmann <[email protected]> | 2003-05-15 18:52:35 +0000 |
commit | 40488ccd933a06da0faac9aa057e3dab6ca2dbec (patch) | |
tree | 39496d8766d0151c741319bca54bf8a26c7fb6c4 | |
parent | New repository initialized by cvs2svn. (diff) | |
download | libgpg-error-40488ccd933a06da0faac9aa057e3dab6ca2dbec.tar.gz libgpg-error-40488ccd933a06da0faac9aa057e3dab6ca2dbec.zip |
2003-05-15 Marcus Brinkmann <[email protected]>
* Initial check-in.
-rw-r--r-- | AUTHORS | 19 | ||||
-rw-r--r-- | COPYING | 340 | ||||
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | INSTALL | 229 | ||||
-rw-r--r-- | Makefile.am | 5 | ||||
-rw-r--r-- | NEWS | 15 | ||||
-rw-r--r-- | README | 61 | ||||
-rw-r--r-- | README.CVS | 7 | ||||
-rw-r--r-- | configure.ac | 62 | ||||
-rw-r--r-- | m4/ChangeLog | 21 | ||||
-rw-r--r-- | m4/Makefile.am | 1 | ||||
-rw-r--r-- | po/ChangeLog | 11 | ||||
-rw-r--r-- | po/LINGUAS | 1 | ||||
-rw-r--r-- | po/Makevars | 25 | ||||
-rw-r--r-- | po/POTFILES.in | 13 | ||||
-rw-r--r-- | src/Makefile.am | 40 | ||||
-rw-r--r-- | src/err-codes.h.in | 166 | ||||
-rw-r--r-- | src/err-sources.h.in | 35 | ||||
-rw-r--r-- | src/gettext.h | 69 | ||||
-rw-r--r-- | src/gpg/error.h | 287 | ||||
-rw-r--r-- | src/mkstrtable.awk | 127 | ||||
-rw-r--r-- | src/strerror.c | 36 | ||||
-rw-r--r-- | src/strsource.c | 36 | ||||
-rw-r--r-- | tests/Makefile.am | 27 | ||||
-rw-r--r-- | tests/t-strerror.c | 63 |
25 files changed, 1709 insertions, 0 deletions
@@ -0,0 +1,19 @@ +Package: libgpg-error +Maintainer: Marcus Brinkmann <[email protected]> +Bug reports: [email protected] +Security related bug reports: [email protected] + + +g10 Code GmbH <[email protected]> + - Design and implementation. + + + Copyright 2003 g10 Code GmbH + + This file is free software; as a special exception the author gives + unlimited permission to copy and/or distribute it, with or without + modifications, as long as this notice is preserved. + + This file is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY, to the extent permitted by law; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + 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; either version 2 of the License, or + (at your option) any later version. + + 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. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..17cce48 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,13 @@ +2003-05-15 Marcus Brinkmann <[email protected]> + + * Initial check-in. + + Copyright 2003 g10 Code GmbH + + This file is free software; as a special exception the author gives + unlimited permission to copy and/or distribute it, with or without + modifications, as long as this notice is preserved. + + This file is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY, to the extent permitted by law; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -0,0 +1,229 @@ +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software +Foundation, Inc. + + This file is free documentation; the Free Software Foundation gives +unlimited permission to copy, distribute and modify it. + +Basic Installation +================== + + These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. (Caching is +disabled by default to prevent problems with accidental use of stale +cache files.) + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You only need +`configure.ac' if you want to change it or regenerate `configure' using +a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. Run `./configure --help' +for details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not support the `VPATH' +variable, you have to compile the package for one architecture at a +time in the source code directory. After you have installed the +package for one architecture, use `make distclean' before reconfiguring +for another architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=PATH' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + + There may be some features `configure' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, `configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the `--target=TYPE' option to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + + Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +will cause the specified gcc to be used as the C compiler (unless it is +overridden in the site shell script). + +`configure' Invocation +====================== + + `configure' recognizes the following options to control how it +operates. + +`--help' +`-h' + Print a summary of the options to `configure', and exit. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. + diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..fcf05d8 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,5 @@ +SUBDIRS = m4 src tests po + +ACLOCAL_AMFLAGS = -I m4 + +EXTRA_DIST = config.rpath @@ -0,0 +1,15 @@ +Noteworthy changes in version 0.1 (unreleased) +---------------------------------------------- + + * Initial release. + + + Copyright 2003 g10 Code GmbH + + This file is free software; as a special exception the author gives + unlimited permission to copy and/or distribute it, with or without + modifications, as long as this notice is preserved. + + This file is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY, to the extent permitted by law; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -0,0 +1,61 @@ +libgpg-error +============ + +This is a library that defines common error values for all GnuPG +components. Among these are GPG, GPGSM, GPGME, GPG-Agent, libgcrypt, +pinentry, SmartCard Daemon and possibly more in the future. + +See the file COPYING for copyright and warranty information. + +Installation +------------ + +Please read the file INSTALL! + +Here is a quick summary: + +1) Check that you have unmodified sources. The below on how to do + this. Don't skip it - this is an important step! + +2) Unpack the TAR. With GNU tar you can do it this way: + "tar xzvf libgpg-error-x.y.z.tar.gz" + +3) "cd libgpg-error-x.y.z" + +4) "./configure" + +5) "make" + +6) "make install" + + +How to Verify the Source +------------------------ + +In order to check that the version of libgpg-error which you are going +to install is an original and unmodified one, you can do it in one of +the following ways: + +a) If you already have a trusted Version of GnuPG installed, you can +simply check the supplied signature: + +$ gpg --verify libgpg-error-x.y.z.tar.gz.sig + +This checks that the detached signature libgpg-error-x.y.z.tar.gz.sig +is indeed a a signature of libgpg-error-x.y.z.tar.gz. + +Please note, that you have to use an old version of GnuPG to do all +this stuff. *Never* use the version which you are going to check! + + +b) If you don't have any of the above programs, you have to verify the +MD5 checksum: + +$ md5sum libgpg-error-x.y.z.tar.gz + +This should yield an output _similar_ to this: + +fd9351b26b3189c1d577f0970f9dcadc libgpg-error-x.y.z.tar.gz + +Now check that this checksum is _exactly_ the same as the one +published via the announcement list and probably via Usenet. diff --git a/README.CVS b/README.CVS new file mode 100644 index 0000000..678319d --- /dev/null +++ b/README.CVS @@ -0,0 +1,7 @@ +If you are building from CVS, make sure that you have all the +necessary maintainer tools installed. Then run: + +$ autoreconf -f -i -s + +and configure the source with the option --enable-maintainer-mode. + diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..4906531 --- /dev/null +++ b/configure.ac @@ -0,0 +1,62 @@ +# configure.ac for libgpg-error +# Copyright (C) 2003 g10 Code GmbH +# +# This file is part of libgpg-error. +# +# libgpg-error 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. +# +# libgpg-error 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. +# +# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + +# (Process this file with autoconf to produce a configure script.) + +# Version number: Remember to change it immediately *after* a release. +AC_INIT(libgpg-error, 0.1, [email protected]) +# LT Version numbers, remember to change them just *before* a release. +# (Code changed: REVISION++) +# (Interfaces added/removed/changed: CURRENT++, REVISION=0) +# (Interfaces added: AGE++) +# (Interfaces removed: AGE=0) +LIBGPG_ERROR_LT_CURRENT=0 +LIBGPG_ERROR_LT_AGE=0 +LIBGPG_ERROR_LT_REVISION=0 +AC_SUBST(LIBGPG_ERROR_LT_CURRENT) +AC_SUBST(LIBGPG_ERROR_LT_AGE) +AC_SUBST(LIBGPG_ERROR_LT_REVISION) + +AC_PREREQ(2.57) +AM_INIT_AUTOMAKE +AM_MAINTAINER_MODE +AC_CONFIG_SRCDIR([src/err-sources.h.in]) +AC_CONFIG_HEADER([config.h]) + +# Checks for programs. +AC_PROG_CC +AC_PROG_LIBTOOL +AC_PROG_AWK + +# Checks for libraries. +AM_GNU_GETTEXT([external]) +AM_GNU_GETTEXT_VERSION(0.11.5) + +# Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS([stdlib.h]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST + +# Checks for library functions. +AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([po/Makefile.in m4/Makefile]) +AC_CONFIG_FILES([src/Makefile tests/Makefile]) +AC_OUTPUT diff --git a/m4/ChangeLog b/m4/ChangeLog new file mode 100644 index 0000000..60743c0 --- /dev/null +++ b/m4/ChangeLog @@ -0,0 +1,21 @@ +2003-05-15 gettextize <[email protected]> + + * codeset.m4: New file, from gettext-0.11.5. + * gettext.m4: New file, from gettext-0.11.5. + * glibc21.m4: New file, from gettext-0.11.5. + * iconv.m4: New file, from gettext-0.11.5. + * intdiv0.m4: New file, from gettext-0.11.5. + * inttypes.m4: New file, from gettext-0.11.5. + * inttypes_h.m4: New file, from gettext-0.11.5. + * inttypes-pri.m4: New file, from gettext-0.11.5. + * isc-posix.m4: New file, from gettext-0.11.5. + * lcmessage.m4: New file, from gettext-0.11.5. + * lib-ld.m4: New file, from gettext-0.11.5. + * lib-link.m4: New file, from gettext-0.11.5. + * lib-prefix.m4: New file, from gettext-0.11.5. + * progtest.m4: New file, from gettext-0.11.5. + * stdint_h.m4: New file, from gettext-0.11.5. + * uintmax_t.m4: New file, from gettext-0.11.5. + * ulonglong.m4: New file, from gettext-0.11.5. + * Makefile.am: New file. + diff --git a/m4/Makefile.am b/m4/Makefile.am new file mode 100644 index 0000000..42126ac --- /dev/null +++ b/m4/Makefile.am @@ -0,0 +1 @@ +EXTRA_DIST = codeset.m4 gettext.m4 glibc21.m4 iconv.m4 intdiv0.m4 inttypes.m4 inttypes_h.m4 inttypes-pri.m4 isc-posix.m4 lcmessage.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 progtest.m4 stdint_h.m4 uintmax_t.m4 ulonglong.m4 diff --git a/po/ChangeLog b/po/ChangeLog new file mode 100644 index 0000000..b4cdfb1 --- /dev/null +++ b/po/ChangeLog @@ -0,0 +1,11 @@ +2003-05-15 gettextize <[email protected]> + + * Makefile.in.in: New file, from gettext-0.11.5. + * boldquot.sed: New file, from gettext-0.11.5. + * [email protected]: New file, from gettext-0.11.5. + * [email protected]: New file, from gettext-0.11.5. + * insert-header.sin: New file, from gettext-0.11.5. + * quot.sed: New file, from gettext-0.11.5. + * remove-potcdate.sin: New file, from gettext-0.11.5. + * Rules-quot: New file, from gettext-0.11.5. + diff --git a/po/LINGUAS b/po/LINGUAS new file mode 100644 index 0000000..8bba9bc --- /dev/null +++ b/po/LINGUAS @@ -0,0 +1 @@ +# Set of available languages. diff --git a/po/Makevars b/po/Makevars new file mode 100644 index 0000000..ed8a1e7 --- /dev/null +++ b/po/Makevars @@ -0,0 +1,25 @@ +# Makefile variables for PO directory in any package using GNU gettext. + +# Usually the message domain is the same as the package name. +DOMAIN = $(PACKAGE) + +# These two variables depend on the location of this directory. +subdir = po +top_builddir = .. + +# These options get passed to xgettext. +XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ + +# This is the copyright holder that gets inserted into the header of the +# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding +# package. (Note that the msgstr strings, extracted from the package's +# sources, belong to the copyright holder of the package.) Translators are +# expected to transfer the copyright for their translations to this person +# or entity, or to disclaim their copyright. The empty string stands for +# the public domain; in this case the translators are expected to disclaim +# their copyright. +COPYRIGHT_HOLDER = g10 Code GmbH + +# This is the list of locale categories, beyond LC_MESSAGES, for which the +# message catalogs shall be used. It is usually empty. +EXTRA_LOCALE_CATEGORIES = diff --git a/po/POTFILES.in b/po/POTFILES.in new file mode 100644 index 0000000..7b07154 --- /dev/null +++ b/po/POTFILES.in @@ -0,0 +1,13 @@ +# List of source files containing translatable strings. +# Copyright 2003 g10 Code GmbH +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This file is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +src/err-sources.h +src/err-codes.h diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..2972be5 --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,40 @@ +# Makefile.am for libgpg-error. +# Copyright (C) 2003 g10 Code GmbH +# +# This file is part of libgpg-error. +# +# libgpg-error 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. +# +# libgpg-error 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. +# +# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + +EXTRA_DIST = mkstrtable.awk err-sources.h.in err-codes.h.in +BUILT_SOURCES = err-sources.h err-codes.h +CLEANFILES = err-sources.h err-codes.h + +nobase_include_HEADERS = gpg/error.h + +lib_LTLIBRARIES = libgpg-error.la + +libgpg_error_la_LDFLAGS = -version-info \ + @LIBGPG_ERROR_LT_CURRENT@:@LIBGPG_ERROR_LT_REVISION@:@LIBGPG_ERROR_LT_AGE@ + +libgpg_error_la_SOURCES = gpg/error.h gettext.h \ + err-sources.h strsource.c err-codes.h strerror.c + +libgpg_error_la_LIBADD = @LTLIBINTL@ + +err-sources.h: Makefile mkstrtable.awk err-sources.h.in + $(AWK) -f $(srcdir)/mkstrtable.awk $(srcdir)/err-sources.h.in >$@ + +err-codes.h: Makefile mkstrtable.awk err-codes.h.in + $(AWK) -f $(srcdir)/mkstrtable.awk $(srcdir)/err-codes.h.in >$@ diff --git a/src/err-codes.h.in b/src/err-codes.h.in new file mode 100644 index 0000000..708a82e --- /dev/null +++ b/src/err-codes.h.in @@ -0,0 +1,166 @@ +# List of error codes and their description. +# Copyright (C) 2003 g10 Code GmbH +# +# This file is part of libgpg-error. +# +# libgpg-error 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. +# +# libgpg-error 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. +# +# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + +# Empty lines are ignored. Other lines must have an error code +# number, followed by exactly one <tab>, followed by the error +# message. Trailing whitespace is removed. The error codes should be +# sorted. The last line should not have a number, but only a <tab>, +# followed by a description for error codes that are not in the list. + +0 Success +1 General error +2 Unknown packet +3 Unknown version in packet +4 Invalid public key algorithm +5 Invalid digest algorithm +6 Bad public key +7 Bad secret key +8 Bad signature +9 No public key +10 Checksum error +11 Bad passphrase +12 Invalid cipher algorithm +13 Keyring open +14 Invalid packet +15 Invalid armor +16 No user ID +17 No secret key +18 Wrong secret key used +19 Bad session key +20 Unknown compression algorithm +21 Reading file failed +22 Writing file failed +23 Opening file failed +24 Creating file failed +25 Closing file failed +26 Renaming file failed +27 Deleting file failed +28 File exists +29 File error +30 Bad MPI value +31 Invalid passphrase +32 Invalid signature class +33 Resources exhausted +34 Invalid keyring +35 Trust DB error +36 Bad certificate +37 Invalid user ID +38 Unexpected error +39 Time conflict +40 Keyserver error +41 Wrong public key algorithm +42 I/O error +43 Weak encryption key +44 Invalid key length +45 Invalid argument +46 Syntax error in URI +47 Invalid URI +48 Network error +49 Unknown host +50 Selftest failed +51 Data not encrypted +52 Data not processed +53 Unusable public key +54 Unusable secret key +55 Invalid value +56 Bad certificate chain +57 Missing certificate +58 No data +59 Bug +60 Not supported +61 Invalid operation code +62 Out of core +63 Internal error +64 EOF (gcrypt) +65 Invalid object +66 Provided object is too short +67 Provided object is too large +68 Missing item in object +69 Not implemented +70 Conflicting use +71 Invalid cipher mode +72 Invalid flag +73 Read error +74 Write error +75 Incomplete line +76 Invalid response +77 No agent running +78 agent error +79 Invalid data +80 Assuan server fault +81 Assuan error +82 Invalid session key +83 Invalid S-expression +84 Unsupported algorithm +85 No pinentry +86 pinentry error +87 Bad PIN +88 Invalid name +89 Bad data +90 Invalid parameter +91 Tribute to D. A. +92 No dirmngr +93 dirmngr error +94 Certificate revoced +95 No CRL known +96 CRL too old +97 Line too long +98 Not trusted +99 Operation cancelled +100 Bad CA certificate +101 Certificate expired +102 Certificate too young +103 Unsupported certificate +104 Unknown S-expression +105 Unsupported protection +106 Corrupted protection +107 Ambiguous name +108 Card error +109 Card reset +110 Card removed +111 Invalid card +112 Card not present +113 No PKCS15 application +114 Not confirmed +115 Configuration error +116 No policy match +117 Invalid index +118 Invalid ID +119 No SmartCard daemon +120 SmartCard daemon error +121 Unsupported protocol +122 Bad PIN method +123 Card not initialized +124 Unsupported operation +125 Wrong key usage +201 Invalid length specifier in S-expression +202 String too long in S-expression +203 Unmatched parentheses in S-expression +204 S-expression not canonical +205 Bad character in S-expression +206 Bad quotation in S-expression +207 Zero prefix in S-expression +208 Nested display hints in S-expression +209 Unmatched display hints +210 Unexpected reserved punctuation in S-expression +211 Bad hexadecimal character in S-expression +212 Odd hexadecimal numbers in S-expression +213 Bad octadecimal character in S-expression +16383 End of file + Unknown error code diff --git a/src/err-sources.h.in b/src/err-sources.h.in new file mode 100644 index 0000000..62d2437 --- /dev/null +++ b/src/err-sources.h.in @@ -0,0 +1,35 @@ +# List of error sources and their description. +# Copyright (C) 2003 g10 Code GmbH +# +# This file is part of libgpg-error. +# +# libgpg-error 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. +# +# libgpg-error 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. +# +# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + +# Empty lines are ignored. Other lines must have an error code +# number, followed by exactly one <tab>, followed by the error +# message. Trailing whitespace is removed. The error sources should +# be sorted. The last line should not have a number, but only a +# <tab>, followed by a description for error sources that are not in +# the list. + +0 Unspecified source +1 gcrypt +2 GnuPG +3 GpgSM +4 GPG Agent +5 Pinentry +6 SCD +7 GPGME + Unknown source diff --git a/src/gettext.h b/src/gettext.h new file mode 100644 index 0000000..8b262f4 --- /dev/null +++ b/src/gettext.h @@ -0,0 +1,69 @@ +/* Convenience header for conditional use of GNU <libintl.h>. + Copyright (C) 1995-1998, 2000-2002 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU Library General Public License as published + by the Free Software Foundation; either version 2, or (at your option) + any later version. + + 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + USA. */ + +#ifndef _LIBGETTEXT_H +#define _LIBGETTEXT_H 1 + +/* NLS can be disabled through the configure --disable-nls option. */ +#if ENABLE_NLS + +/* Get declarations of GNU message catalog functions. */ +# include <libintl.h> + +#else + +/* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which + chokes if dcgettext is defined as a macro. So include it now, to make + later inclusions of <locale.h> a NOP. We don't include <libintl.h> + as well because people using "gettext.h" will not include <libintl.h>, + and also including <libintl.h> would fail on SunOS 4, whereas <locale.h> + is OK. */ +#if defined(__sun) +# include <locale.h> +#endif + +/* Disabled NLS. + The casts to 'const char *' serve the purpose of producing warnings + for invalid uses of the value returned from these functions. + On pre-ANSI systems without 'const', the config.h file is supposed to + contain "#define const". */ +# define gettext(Msgid) ((const char *) (Msgid)) +# define dgettext(Domainname, Msgid) ((const char *) (Msgid)) +# define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid)) +# define ngettext(Msgid1, Msgid2, N) \ + ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) +# define dngettext(Domainname, Msgid1, Msgid2, N) \ + ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) +# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ + ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) +# define textdomain(Domainname) ((const char *) (Domainname)) +# define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname)) +# define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset)) + +#endif + +/* A pseudo function call that serves as a marker for the automated + extraction of messages, but does not call gettext(). The run-time + translation is done at a different place in the code. + The argument, String, should be a literal string. Concatenated strings + and other string expressions won't work. + The macro's expansion is not parenthesized, so that it is suitable as + initializer for static 'char[]' or 'const char[]' variables. */ +#define gettext_noop(String) String + +#endif /* _LIBGETTEXT_H */ diff --git a/src/gpg/error.h b/src/gpg/error.h new file mode 100644 index 0000000..9ddf09b --- /dev/null +++ b/src/gpg/error.h @@ -0,0 +1,287 @@ +/* gpg/error.h - Public interface to libgpg-error. + Copyright (C) 2003 g10 Code GmbH + + This file is part of libgpg-error. + + libgpg-error 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. + + libgpg-error 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. + + You should have received a copy of the GNU General Public License + along with GPGME; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifndef GPG_ERROR_H +#define GPG_ERROR_H 1 + +/* The GnuPG project consists of many components. Error codes are + exchanged between all components. The common error codes and their + user-presentable descriptions are kept into a shared library to + allow adding new error codes and components without recompiling any + of the other components. The interface will not change in a + backward incompatible way. + + An error code together with an error source build up an error + value. As the error value is been passed from one component to + another, it preserver the information about the source and nature + of the error. + + A component of the GnuPG project can define the following macro to + tune the behaviour of the library: + + GPG_ERR_SOURCE_DEFAULT: Define to an error source of type + gpg_err_source_t to make that source the default for gpg_error(). + Otherwise GPG_ERR_SOURCE_UNKNOWN is used as default. */ + + +/* The error source type gpg_err_source_t. */ + +/* Only add to the end of the list, never change or reorder the + existing entries. */ +typedef enum + { + GPG_ERR_SOURCE_UNKNOWN = 0, + GPG_ERR_SOURCE_GCRYPT = 1, + GPG_ERR_SOURCE_GPG = 2, + GPG_ERR_SOURCE_GPGSM = 3, + GPG_ERR_SOURCE_GPGAGENT = 4, + GPG_ERR_SOURCE_PINENTRY = 5, + GPG_ERR_SOURCE_SCD = 6, + GPG_ERR_SOURCE_GPGME = 7, + + /* This is one more than the largest allowed entry. */ + GPG_ERR_SOURCE_DIM = 256 + } gpg_err_source_t; + + +/* The error code type gpg_err_code_t. */ + +/* Only add to the end of the list, never change or reorder the + existing entries. */ +typedef enum + { + GPG_ERR_NO_ERROR = 0, /* An error that is not an error. */ + GPG_ERR_GENERAL = 1, + GPG_ERR_UNKNOWN_PACKET = 2, + GPG_ERR_UNKNOWN_VERSION = 3, /* Unknown version (in packet). */ + GPG_ERR_PUBKEY_ALGO = 4, /* Invalid public key algorithm. */ + GPG_ERR_DIGEST_ALGO = 5, /* Invalid digest algorithm. */ + GPG_ERR_BAD_PUBKEY = 6, /* Bad public key. */ + GPG_ERR_BAD_SECKEY = 7, /* Bad secret key. */ + GPG_ERR_BAD_SIGNATURE = 8, /* Bad signature. */ + GPG_ERR_NO_PUBKEY = 9, /* Public key not found. */ + GPG_ERR_CHECKSUM = 10, /* Checksum error. */ + GPG_ERR_BAD_PASSPHRASE = 11, /* Bad passphrase. */ + GPG_ERR_CIPHER_ALGO = 12, /* Invalid cipher algorithm. */ + GPG_ERR_KEYRING_OPEN = 13, + GPG_ERR_INV_PACKET = 14, + GPG_ERR_INV_ARMOR = 15, + GPG_ERR_NO_USER_ID = 16, + GPG_ERR_NO_SECKEY = 17, /* Secret key not available. */ + GPG_ERR_WRONG_SECKEY = 18, /* Wrong secret key used. */ + GPG_ERR_BAD_KEY = 19, /* Bad (session) key. */ + GPG_ERR_COMPR_ALGO = 20, /* Unknown compress algorithm. */ + GPG_ERR_FILE_READ = 21, + GPG_ERR_FILE_WRITE = 22, + GPG_ERR_FILE_OPEN = 23, + GPG_ERR_FILE_CREATE = 24, + GPG_ERR_FILE_CLOSE = 25, + GPG_ERR_FILE_RENAME = 26, + GPG_ERR_FILE_DELETE = 27, + GPG_ERR_FILE_EXISTS = 28, + GPG_ERR_FILE = 29, + GPG_ERR_BAD_MPI = 30, /* Problem with an MPI's value. */ + GPG_ERR_INV_PASSPHRASE = 31, /* Invalid passphrase. */ + GPG_ERR_SIG_CLASS = 32, + GPG_ERR_RESOURCE_LIMIT = 33, + GPG_ERR_INV_KEYRING = 34, + GPG_ERR_TRUSTDB = 35, /* A problem with the trustdb. */ + GPG_ERR_BAD_CERT = 36, /* Bad certicate. */ + GPG_ERR_INV_USER_ID = 37, + GPG_ERR_UNEXPECTED = 38, + GPG_ERR_TIME_CONFLICT = 39, + GPG_ERR_KEYSERVER = 40, + GPG_ERR_WRONG_PUBKEY_ALGO = 41, /* Wrong public key algorithm. */ + GPG_ERR_IO = 42, /* I/O error. */ + GPG_ERR_WEAK_KEY = 43, /* Weak encryption key. */ + GPG_ERR_INV_KEYLEN = 44, /* Invalid length of a key. */ + GPG_ERR_INV_ARG = 45, /* Invalid argument. */ + GPG_ERR_BAD_URI = 46, /* Syntax error in URI. */ + GPG_ERR_INV_URI = 47, /* Unsupported scheme and similar. */ + GPG_ERR_NETWORK = 48, /* General network error. */ + GPG_ERR_UNKNOWN_HOST = 49, + GPG_ERR_SELFTEST_FAILED = 50, /* Selftest failed. */ + GPG_ERR_NOT_ENCRYPTED = 51, + GPG_ERR_NOT_PROCESSED = 52, + GPG_ERR_UNUSABLE_PUBKEY = 53, + GPG_ERR_UNUSABLE_SECKEY = 54, + GPG_ERR_INV_VALUE = 55, /* Invalid value. */ + GPG_ERR_BAD_CERT_CHAIN = 56, + GPG_ERR_MISSING_CERT = 57, + GPG_ERR_NO_DATA = 58, + GPG_ERR_BUG = 59, + GPG_ERR_NOT_SUPPORTED = 60, + GPG_ERR_INV_OP = 61, /* Invalid operation code. */ + GPG_ERR_OUT_OF_CORE = 62, /* Out of core ("Keine Kerne"). */ + GPG_ERR_INTERNAL = 63, /* Internal error. */ + GPG_ERR_EOF_GCRYPT = 64, /* Compatibility for gcrypt. */ + GPG_ERR_INV_OBJ = 65, /* An object is not valid. */ + GPG_ERR_TOO_SHORT = 66, /* Provided object is too short. */ + GPG_ERR_TOO_LARGE = 67, /* Provided object is too large. */ + GPG_ERR_NO_OBJ = 68, /* Missing item in an object. */ + GPG_ERR_NOT_IMPLEMENTED = 69, /* Not implemented. */ + GPG_ERR_CONFLICT = 70, /* Conflicting use. */ + GPG_ERR_INV_CIPHER_MODE = 71, /* Invalid cipher mode. */ + GPG_ERR_INV_FLAG = 72, /* Invalid flag. */ + GPG_ERR_READ_ERROR = 73, + GPG_ERR_WRITE_ERROR = 74, + GPG_ERR_INCOMPLETE_LINE = 75, + GPG_ERR_INVALID_RESPONSE = 76, + GPG_ERR_NO_AGENT = 77, + GPG_ERR_AGENT_ERROR = 78, + GPG_ERR_INV_DATA = 79, + GPG_ERR_ASSUAN_SERVER_FAULT = 80, + GPG_ERR_ASSUAN_ERROR = 81, /* Catch all assuan error. */ + GPG_ERR_INV_SESSION_KEY = 82, + GPG_ERR_INV_SEXP = 83, + GPG_ERR_UNSUPPORTED_ALGORITHM = 84, + GPG_ERR_NO_PIN_ENTRY = 85, + GPG_ERR_PIN_ENTRY_ERROR = 86, + GPG_ERR_BAD_PIN = 87, + GPG_ERR_INV_NAME = 88, + GPG_ERR_BAD_DATA = 89, + GPG_ERR_INV_PARAMETER = 90, + GPG_ERR_TRIBUTE_TO_D_A = 91, + GPG_ERR_NO_DIRMNGR = 92, + GPG_ERR_DIRMNGR_ERROR = 93, + GPG_ERR_CERT_REVOKED = 94, + GPG_ERR_NO_CRL_KNOWN = 95, + GPG_ERR_CRL_TOO_OLD = 96, + GPG_ERR_LINE_TOO_LONG = 97, + GPG_ERR_NOT_TRUSTED = 98, + GPG_ERR_CANCELED = 109, + GPG_ERR_BAD_CA_CERT = 100, + GPG_ERR_CERT_EXPIRED = 101, + GPG_ERR_CERT_TOO_YOUNG = 102, + GPG_ERR_UNSUPPORTED_CERT = 103, + GPG_ERR_UNKNOWN_SEXP = 104, + GPG_ERR_UNSUPPORTED_PROTECTION = 105, + GPG_ERR_CORRUPTED_PROTECTION = 106, + GPG_ERR_AMBIGUOUS_NAME = 107, + GPG_ERR_CARD_ERROR = 108, + GPG_ERR_CARD_RESET = 109, + GPG_ERR_CARD_REMOVED = 110, + GPG_ERR_INVALID_CARD = 111, + GPG_ERR_CARD_NOT_PRESENT = 112, + GPG_ERR_NO_PKCS15_APP = 113, + GPG_ERR_NOT_CONFIRMED = 114, + GPG_ERR_CONFIGURATION_ERROR = 115, + GPG_ERR_NO_POLICY_MATCH = 116, + GPG_ERR_INVALID_INDEX = 117, + GPG_ERR_INVALID_ID = 118, + GPG_ERR_NO_SCDAEMON = 119, + GPG_ERR_SCDAEMON_ERROR = 120, + GPG_ERR_UNSUPPORTED_PROTOCOL = 121, + GPG_ERR_BAD_PIN_METHOD = 122, + GPG_ERR_CARD_NOT_INITIALIZED = 123, + GPG_ERR_UNSUPPORTED_OPERATION = 124, + GPG_ERR_WRONG_KEY_USAGE = 125, + + /* Error codes pertaining to S-expressions. */ + GPG_ERR_SEXP_INV_LEN_SPEC = 201, + GPG_ERR_SEXP_STRING_TOO_LONG = 202, + GPG_ERR_SEXP_UNMATCHED_PAREN = 203, + GPG_ERR_SEXP_NOT_CANONICAL = 204, + GPG_ERR_SEXP_BAD_CHARACTER = 205, + GPG_ERR_SEXP_BAD_QUOTATION = 206, /* Or invalid hex or octal value. */ + GPG_ERR_SEXP_ZERO_PREFIX = 207, /* First character of length is 0. */ + GPG_ERR_SEXP_NESTED_DH = 208, /* Nested display hints. */ + GPG_ERR_SEXP_UNMATCHED_DH = 209, /* Unmatched display hint. */ + GPG_ERR_SEXP_UNEXPECTED_PUNC = 210, /* Unexpected reserved punctuation. */ + GPG_ERR_SEXP_BAD_HEX_CHAR = 211, + GPG_ERR_SEXP_ODD_HEX_NUMBERS = 212, + GPG_ERR_SEXP_BAD_OCT_CHAR = 213, + + GPG_ERR_EOF = 16383, /* This was once a -1. Pity. */ + + /* This is one more than the largest allowed entry. */ + GPG_ERR_CODE_DIM = 16384 + } gpg_err_code_t; + + +/* The error value type gpg_error_t. */ + +/* We would really like to use bit-fields in a struct, but using + structs as return values can cause binary compatibility issues, in + particular if you want to do it effeciently (also see + -freg-struct-return option to GCC). */ +typedef unsigned long gpg_error_t; + +/* We use the lowest 16 bits of gpg_error_t for error codes. */ +#define GPG_ERR_CODE_MASK (GPG_ERR_CODE_DIM - 1) + +/* Bits 17 to 24 are reserved. */ + +/* We use the upper 8 bits of gpg_error_t for error sources. */ +#define GPG_ERR_SOURCE_MASK (GPG_ERR_SOURCE_DIM - 1) +#define GPG_ERR_SOURCE_SHIFT 24 + + +/* Constructor and accessor functions. */ + +/* Construct an error value from an error code and source. Within a + subsystem, use gpg_error. */ +static __inline__ gpg_error_t +gpg_make_error (gpg_err_source_t source, gpg_err_code_t code) +{ + return ((source & GPG_ERR_SOURCE_MASK) << GPG_ERR_SOURCE_SHIFT) + | (code & GPG_ERR_CODE_MASK); +} + + +/* The user should define GPG_ERR_SOURCE_DEFAULT before including this + file to specify a default source for gpg_error. */ +#ifndef GPG_ERR_SOURCE_DEFAULT +#define GPG_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_UNKNOWN +#endif + +static __inline__ gpg_error_t +gpg_error (gpg_err_code_t code) +{ + return gpg_make_error (GPG_ERR_SOURCE_DEFAULT, code); +} + + +/* Retrieve the error code from an error value. */ +static __inline__ gpg_err_code_t +gpg_err_code (gpg_error_t err) +{ + return err & GPG_ERR_CODE_MASK; +} + + +/* Retrieve the error source from an error value. */ +static __inline__ gpg_err_source_t +gpg_err_source (gpg_error_t err) +{ + return (err >> GPG_ERR_SOURCE_SHIFT) & GPG_ERR_SOURCE_MASK; +} + + +/* String functions. */ + +/* Return a pointer to a string containing a description of the error + code in the error value ERR. */ +const char *gpg_strerror (gpg_error_t err); + +/* Return a pointer to a string containing a description of the error + source in the error value ERR. */ +const char *gpg_strsource (gpg_error_t err); + +#endif /* GPG_ERROR_H */ diff --git a/src/mkstrtable.awk b/src/mkstrtable.awk new file mode 100644 index 0000000..a42bc07 --- /dev/null +++ b/src/mkstrtable.awk @@ -0,0 +1,127 @@ +# Copyright (C) 2003 g10 Code GmbH +# This file is part of libgpg-error. + +# libgpg-error 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. + +# libgpg-error 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 the GNU C Library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +# 02111-1307 USA. + +# This script outputs a source file that does define the following +# symbols: +# +# static const char msgstr[]; +# A string containing all messages in the list. +# +# static const int msgidx[]; +# A list of index numbers, one for each message, that points to the +# beginning of the string in msgstr. +# +# msgidxof (code); +# A macro that maps code numbers to idx numbers. If a DEFAULT MESSAGE +# is provided (see below), its index will be returned for unknown codes. +# Otherwise -1 is returned for codes that do not appear in the list. +# You can lookup the message with code CODE with: +# msgstr + msgidx[msgidxof (code)]. +# +# The input file has the following format: +# CODE1 MESSAGE1 (Code number, <tab>, message string) +# CODE2 MESSAGE2 (Code number, <tab>, message string) +# ... +# CODEn MESSAGEn (Code number, <tab>, message string) +# DEFAULT MESSAGE (<tab>, fall-back message string) +# +# Comments (starting with # and ending at the end of the line) are removed, +# as is trailing whitespace. The last line is optional; if no DEFAULT +# MESSAGE is given, msgidxof will return the number -1 for unknown +# index numbers. + +BEGIN { + FS = "\t"; +# cpos holds the current position in the message string. + cpos = 0; +# msg holds the number of messages. + msg = 0; + print "/* Output of mkstrtable.awk. DO NOT EDIT. */"; + print ""; + print "/* The purpose of this complex string table is to produce"; + print " optimal code with a minimum of relocations. */"; + print ""; + print "static const char msgstr[] = "; +} + +{ + sub (/\#.+/, ""); + sub (/[ ]+$/, ""); # Strip trailing space and tab characters. + if (/^$/) + next; + +# Print the string msgstr line by line. We delay output by one line to be able +# to treat the last line differently (see END). + if (last_msgstr) + print " gettext_noop (\"" last_msgstr "\") \"\\0\""; + last_msgstr = $2; + +# Remember the error code and msgidx of each error message. + code[msg] = $1; + pos[msg] = cpos; + cpos += length ($2) + 1; + msg++; + + if ($1 == "") + { + has_default = 1; + exit; + } +} +END { + if (has_default) + coded_msgs = msg - 1; + else + coded_msgs = msg; + + print " gettext_noop (\"" last_msgstr "\");"; + print ""; + print "static const int msgidx[] ="; + print " {"; + for (i = 0; i < coded_msgs; i++) + print " " pos[i] ","; + print " " pos[coded_msgs]; + print " };"; + print ""; + print "#define msgidxof(code) (0 ? -1 \\"; + +# Gather the ranges. + skip = code[0]; + start = code[0]; + stop = code[0]; + for (i = 1; i < coded_msgs; i++) + { + if (code[i] == stop + 1) + stop++; + else + { + print " : ((code >= " start ") && (code <= " stop ")) ? (code - " \ + skip ") \\"; + skip += code[i] - stop - 1; + start = code[i]; + stop = code[i]; + } + } + print " : ((code >= " start ") && (code <= " stop ")) ? (code - " \ + skip ") \\"; + if (has_default) + print " : " stop + 1 " - " skip ")"; + else + print " : -1)"; + + } diff --git a/src/strerror.c b/src/strerror.c new file mode 100644 index 0000000..8c41c38 --- /dev/null +++ b/src/strerror.c @@ -0,0 +1,36 @@ +/* strerror.c - Describing an error code. + Copyright (C) 2003 g10 Code GmbH + + This file is part of libgpg-error. + + libgpg-error 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. + + libgpg-error 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. + + You should have received a copy of the GNU General Public License + along with GPGME; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#if HAVE_CONFIG_H +#include <config.h> +#endif + +#include <gpg/error.h> + +#include "gettext.h" +#include "err-codes.h" + +/* Return a pointer to a string containing a description of the error + code in the error value ERR. */ +const char * +gpg_strerror (gpg_error_t err) +{ + gpg_err_code_t code = gpg_err_code (err); + return dgettext (PACKAGE, msgstr + msgidx[msgidxof (code)]); +} diff --git a/src/strsource.c b/src/strsource.c new file mode 100644 index 0000000..c0c4c8f --- /dev/null +++ b/src/strsource.c @@ -0,0 +1,36 @@ +/* strsource.c - Describing an error source. + Copyright (C) 2003 g10 Code GmbH + + This file is part of libgpg-error. + + libgpg-error 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. + + libgpg-error 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. + + You should have received a copy of the GNU General Public License + along with GPGME; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#if HAVE_CONFIG_H +#include <config.h> +#endif + +#include <gpg/error.h> + +#include "gettext.h" +#include "err-sources.h" + +/* Return a pointer to a string containing a description of the error + source in the error value ERR. */ +const char * +gpg_strsource (gpg_error_t err) +{ + gpg_err_source_t source = gpg_err_source (err); + return dgettext (PACKAGE, msgstr + msgidx[msgidxof (source)]); +} diff --git a/tests/Makefile.am b/tests/Makefile.am new file mode 100644 index 0000000..57024de --- /dev/null +++ b/tests/Makefile.am @@ -0,0 +1,27 @@ +# Copyright (C) 2003 g10 Code GmbH +# +# This file is part of libgpg-error. +# +# libgpg-error 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. +# +# libgpg-error 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. +# +# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + +## Process this file with automake to produce Makefile.in + +TESTS = t-strerror + +INCLUDES = -I$(top_srcdir)/src + +LDADD = ../src/libgpg-error.la + +noinst_PROGRAMS = $(TESTS) diff --git a/tests/t-strerror.c b/tests/t-strerror.c new file mode 100644 index 0000000..6ff5440 --- /dev/null +++ b/tests/t-strerror.c @@ -0,0 +1,63 @@ +/* t-strerror.c - Regression test. + Copyright (C) 2003 g10 Code GmbH + + This file is part of libgpg-error. + + libgpg-error 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. + + libgpg-error 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. + + You should have received a copy of the GNU General Public License + along with GPGME; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#if HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#if HAVE_STDLIB_H +#include <stdlib.h> +#endif + +#include <gpg/error.h> + +int +main (int argc, char *argv[]) +{ + if (argc > 1) + { + int i = 1; + while (i + 1 < argc) + { + gpg_error_t err = gpg_make_error (atoi (argv[i]), + atoi (argv[i + 1])); + printf ("%s: %s\n", gpg_strsource (err), gpg_strerror (err)); + i += 2; + } + } + else + { + struct + { + gpg_err_source_t src; + gpg_err_code_t code; + } list[] = { { 0, 0 }, { 1, 201 }, { 2, 2 }, { 3, 102 }, + { 4, 100 }, { 5, 99 }, { 6, 110 }, { 7, 7 }, { 8, 888 } }; + int i = 0; + + while (i < sizeof (list) / sizeof (list[0])) + { + gpg_error_t err = gpg_make_error (list[i].src, list[i].code); + printf ("%s: %s\n", gpg_strsource (err), gpg_strerror (err)); + i++; + } + } + return 0; +} |