├── src ├── versioninfo.rc.in ├── gpg-error.pc.in ├── syscfg │ ├── lock-obj-pub.arm-unknown-linux-androideabi.h │ ├── lock-obj-pub.i686-unknown-linux-androideabi.h │ ├── lock-obj-pub.i686-unknown-linux-gnu.h │ ├── lock-obj-pub.i686-unknown-kfreebsd-gnu.h │ ├── lock-obj-pub.m68k-unknown-linux-gnu.h │ ├── lock-obj-pub.mips-unknown-linux-gnu.h │ ├── lock-obj-pub.sh3-unknown-linux-gnu.h │ ├── lock-obj-pub.sh4-unknown-linux-gnu.h │ ├── lock-obj-pub.arm-apple-darwin.h │ ├── lock-obj-pub.arm-unknown-linux-gnueabi.h │ ├── lock-obj-pub.mipsel-unknown-linux-gnu.h │ ├── lock-obj-pub.nios2-unknown-linux-gnu.h │ ├── lock-obj-pub.powerpc-unknown-linux-gnu.h │ ├── lock-obj-pub.riscv32-unknown-linux-gnu.h │ ├── lock-obj-pub.sparc-unknown-linux-gnu.h │ ├── lock-obj-pub.powerpc-unknown-linux-gnuspe.h │ ├── lock-obj-pub.i686-unknown-gnu.h │ ├── lock-obj-pub.x86_64-unknown-gnu.h │ ├── lock-obj-pub.or1k-unknown-linux-gnu.h │ ├── lock-obj-pub.x86_64-unknown-linux-gnux32.h │ ├── lock-obj-pub.aarch64-apple-darwin.h │ ├── lock-obj-pub.x86_64-apple-darwin.h │ ├── lock-obj-pub.aarch64-unknown-linux-gnu_ilp32.h │ ├── lock-obj-pub.ia64-unknown-linux-gnu.h │ ├── lock-obj-pub.s390x-unknown-linux-gnu.h │ ├── lock-obj-pub.x86_64-unknown-linux-gnu.h │ ├── lock-obj-pub.x86_64-unknown-linux-musl.h │ ├── lock-obj-pub.alpha-unknown-linux-gnu.h │ ├── lock-obj-pub.riscv64-unknown-linux-gnu.h │ ├── lock-obj-pub.sparc64-unknown-linux-gnu.h │ ├── lock-obj-pub.tilegx-unknown-linux-gnu.h │ ├── lock-obj-pub.x86_64-unknown-kfreebsd-gnu.h │ ├── lock-obj-pub.powerpc64-unknown-linux-gnu.h │ ├── lock-obj-pub.mips64-unknown-linux-gnuabi64.h │ ├── lock-obj-pub.powerpc64le-unknown-linux-gnu.h │ ├── lock-obj-pub.aarch64-unknown-linux-androideabi.h │ ├── lock-obj-pub.mips64el-unknown-linux-gnuabi64.h │ ├── lock-obj-pub.x86_64-unknown-linux-androideabi.h │ ├── lock-obj-pub.i386-apple-darwin.h │ ├── lock-obj-pub.aarch64-unknown-linux-gnu.h │ ├── lock-obj-pub.hppa-unknown-linux-gnu.h │ └── lock-obj-pub.mingw32.h ├── gpg-error.w32-manifest.in ├── lock.h ├── thread.h ├── estream.h ├── protos.h ├── posix-lock-obj.h ├── w32-lock-obj.h ├── strsource.c ├── w32-thread.c ├── code-to-errno.c ├── strsource-sym.c ├── gen-w32-lock-obj.c ├── strerror-sym.c ├── posix-thread.c ├── code-from-errno.c ├── init.h ├── README ├── syscall-clamp.c ├── err-sources.h.in ├── gpg-error-config.in ├── mkerrcodes.c ├── gettext.h ├── gen-lock-obj.sh ├── mkerrcodes1.awk ├── mkerrcodes.awk ├── errnos.in ├── gpg-error-config-test.sh.in ├── mkerrnos.awk ├── w32-add.h └── gpgrt.m4 ├── po ├── quot.sed ├── LINGUAS ├── boldquot.sed ├── .gitattributes ├── POTFILES.in ├── remove-potcdate.sin ├── insert-header.sin ├── en@quot.header ├── en@boldquot.header ├── Rules-quot ├── Makevars └── ChangeLog-2011 ├── tests ├── etc │ ├── Registry │ └── t-argparse.conf ├── Makefile.am ├── t-argparse.conf ├── t-strerror.c ├── t-syserror.c ├── t-common.h ├── t-malloc.c └── t-lock-single-posix.c ├── lang ├── README ├── cl │ ├── README │ ├── gpg-error.asd.in │ ├── Makefile.am │ └── gpg-error-package.lisp └── Makefile.am ├── m4 ├── Makefile.am ├── ltversion.m4 ├── codeset.m4 ├── autobuild.m4 ├── nls.m4 ├── gnupg-misc.m4 ├── lock.m4 ├── estream.m4 ├── readline.m4 ├── ax_cc_for_build.m4 └── progtest.m4 ├── .travis.yml ├── autogen.rc ├── ChangeLog ├── THANKS ├── .gitignore ├── gpgscm ├── ffi.h ├── scheme-config.h ├── LICENSE.TinySCHEME ├── time.scm ├── Makefile.am ├── private.h ├── ffi.scm ├── gnupg.scm ├── t-child.c ├── repl.scm └── makefile.scm ├── libgpg-error.spec.in ├── README.GIT ├── AUTHORS ├── doc ├── Makefile.am └── HACKING └── mkinstalldirs /src/versioninfo.rc.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpg/libgpg-error/master/src/versioninfo.rc.in -------------------------------------------------------------------------------- /po/quot.sed: -------------------------------------------------------------------------------- 1 | s/"\([^"]*\)"/“\1”/g 2 | s/`\([^`']*\)'/‘\1’/g 3 | s/ '\([^`']*\)' / ‘\1’ /g 4 | s/ '\([^`']*\)'$/ ‘\1’/g 5 | s/^'\([^`']*\)' /‘\1’ /g 6 | s/“”/""/g 7 | -------------------------------------------------------------------------------- /tests/etc/Registry: -------------------------------------------------------------------------------- 1 | # A test Registry emulation file for t-argparse 2 | 3 | [HKCU\Software\GNU\GnuPG] 4 | DisableAKR: fact 5 | SomeKey: Value-one 6 | 7 | [ \fhghfkhkfh ] 8 | DisableAKR: yes 9 | -------------------------------------------------------------------------------- /lang/README: -------------------------------------------------------------------------------- 1 | Language Support for libgpg-error 2 | --------------------------------- 3 | 4 | This directory contains support for other languages than C. 5 | 6 | Directory Language 7 | 8 | cl Common Lisp 9 | -------------------------------------------------------------------------------- /po/LINGUAS: -------------------------------------------------------------------------------- 1 | # Set of available languages. 2 | cs 3 | da 4 | de 5 | eo 6 | es 7 | fr 8 | hu 9 | it 10 | ja 11 | nl 12 | pl 13 | pt 14 | ro 15 | ru 16 | sr 17 | sv 18 | tr 19 | uk 20 | vi 21 | zh_CN 22 | zh_TW 23 | -------------------------------------------------------------------------------- /po/boldquot.sed: -------------------------------------------------------------------------------- 1 | s/"\([^"]*\)"/“\1”/g 2 | s/`\([^`']*\)'/‘\1’/g 3 | s/ '\([^`']*\)' / ‘\1’ /g 4 | s/ '\([^`']*\)'$/ ‘\1’/g 5 | s/^'\([^`']*\)' /‘\1’ /g 6 | s/“”/""/g 7 | s/“/“/g 8 | s/”/”/g 9 | s/‘/‘/g 10 | s/’/’/g 11 | -------------------------------------------------------------------------------- /m4/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = lock.m4 nls.m4 po.m4 codeset.m4 gettext.m4 iconv.m4 \ 2 | lib-ld.m4 lib-link.m4 lib-prefix.m4 progtest.m4 3 | 4 | EXTRA_DIST += ax_cc_for_build.m4 5 | 6 | EXTRA_DIST += autobuild.m4 estream.m4 readline.m4 gnupg-misc.m4 7 | -------------------------------------------------------------------------------- /po/.gitattributes: -------------------------------------------------------------------------------- 1 | # You should add 2 | #[filter "cleanpo"] 3 | # clean = "awk '/^\"POT-Creation-Date:/&&!s{s=1;next};!/^#: /{print}'" 4 | # to your config file. Normally, autogen.sh does this for you. 5 | 6 | /??.po filter=cleanpo 7 | /??_??.po filter=cleanpo 8 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: c 2 | 3 | os: 4 | - linux 5 | 6 | # dist: trusty 7 | # sudo: required 8 | 9 | compiler: 10 | - gcc 11 | 12 | before_install: 13 | - echo "Building for $TRAVIS_OS_NAME" 14 | - wget -q http://de.archive.ubuntu.com/ubuntu/pool/main/g/gettext/gettext_0.19.7-2ubuntu3_amd64.deb 15 | - sudo dpkg -i gettext_0.19.7-2ubuntu3_amd64.deb 16 | 17 | script: 18 | - ./autogen.sh --git-build 19 | -------------------------------------------------------------------------------- /src/gpg-error.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | includedir=@includedir@ 4 | libdir=@libdir@ 5 | host=@GPG_ERROR_CONFIG_HOST@ 6 | mtcflags=@GPG_ERROR_CONFIG_MT_CFLAGS@ 7 | mtlibs=@GPG_ERROR_CONFIG_MT_LIBS@ 8 | 9 | Name: gpg-error 10 | Description: GPG Runtime 11 | Version: @PACKAGE_VERSION@ 12 | Cflags: @GPG_ERROR_CONFIG_CFLAGS@ 13 | Libs: @GPG_ERROR_CONFIG_LIBS@ 14 | Libs.private: @GPG_ERROR_CONFIG_LIBS_PRIVATE@ 15 | URL: https://www.gnupg.org/software/libgpg-error/index.html 16 | -------------------------------------------------------------------------------- /autogen.rc: -------------------------------------------------------------------------------- 1 | # autogen.sh configuration for libgpg-error -*- sh -*- 2 | 3 | display_name="Libgpg-error" 4 | patches_to="gnupg-devel@gnupg.org" 5 | 6 | case "$myhost:$myhostsub" in 7 | w32:ce) 8 | extraoptions= 9 | ;; 10 | w32:64) 11 | extraoptions= 12 | ;; 13 | w32:) 14 | extraoptions= 15 | ;; 16 | esac 17 | 18 | case "$myhost" in 19 | w32) 20 | configure_opts= 21 | ;; 22 | esac 23 | 24 | final_info="./configure --sysconfdir=/etc --enable-maintainer-mode && make" 25 | -------------------------------------------------------------------------------- /lang/cl/README: -------------------------------------------------------------------------------- 1 | Common Lisp Support for libgpg-error 2 | ------------------------------------ 3 | 4 | Requirements: 5 | 6 | ASDF Packaging Support 7 | CFFI Foreign Function Interface 8 | 9 | Use with: 10 | 11 | > (asdf:operate 'asdf:load-op ':gpg-error) 12 | > (use-package :gpg-error) 13 | 14 | 15 | TODO 16 | ---- 17 | 18 | * We probably should define a condition base class. Currently, we do 19 | this in the user code only (eg in GPGME). 20 | 21 | * Some lispy convenience functions as need arises, for example for 22 | output. 23 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.arm-unknown-linux-androideabi.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.arm-unknown-linux-androideabi.h 2 | ## File created by gen-posix-lock-obj - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[4]; 10 | long _x_align; 11 | long *_xp_align; 12 | } u; 13 | } gpgrt_lock_t; 14 | 15 | #define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0}}} 16 | ## 17 | ## Local Variables: 18 | ## mode: c 19 | ## buffer-read-only: t 20 | ## End: 21 | ## 22 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.i686-unknown-linux-androideabi.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.i686-unknown-linux-androideabi.h 2 | ## File created by gen-lock-obj.sh - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[4]; 10 | long _x_align; 11 | long *_xp_align; 12 | } u; 13 | } gpgrt_lock_t; 14 | 15 | #define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0}}} 16 | ## 17 | ## Local Variables: 18 | ## mode: c 19 | ## buffer-read-only: t 20 | ## End: 21 | ## 22 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | No more ChangeLog files 2 | ======================== 3 | 4 | Do not modify any of the ChangeLog files in Libgpg-error. Starting on 5 | December 1st, 2011 we put change information only in the GIT commit 6 | log, and generate a top-level ChangeLog file from logs at "make dist" 7 | time. As such, there are strict requirements on the form of the 8 | commit log messages. See doc/HACKING for details. The old ChangeLog 9 | files have all be renamed to ChangeLog-2011. 10 | 11 | 12 | 13 | Local Variables: 14 | buffer-read-only: t 15 | mode: text 16 | End: 17 | -------------------------------------------------------------------------------- /po/POTFILES.in: -------------------------------------------------------------------------------- 1 | # List of source files containing translatable strings. 2 | # Copyright 2003 g10 Code GmbH 3 | # 4 | # This file is free software; as a special exception the author gives 5 | # unlimited permission to copy and/or distribute it, with or without 6 | # modifications, as long as this notice is preserved. 7 | # 8 | # This file is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the 10 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 | 12 | src/err-sources.h 13 | src/err-codes.h 14 | src/argparse.c 15 | src/gpg-error.c 16 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.i686-unknown-linux-gnu.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.i686-pc-linux-gnu.h 2 | ## File created by gen-posix-lock-obj - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[24]; 10 | long _x_align; 11 | long *_xp_align; 12 | } u; 13 | } gpgrt_lock_t; 14 | 15 | #define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \ 16 | 0,0,0,0,0,0,0,0, \ 17 | 0,0,0,0,0,0,0,0}}} 18 | ## 19 | ## Local Variables: 20 | ## mode: c 21 | ## buffer-read-only: t 22 | ## End: 23 | ## 24 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.i686-unknown-kfreebsd-gnu.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.i686-pc-kfreebsd-gnu.h 2 | ## File created by gen-posix-lock-obj - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[24]; 10 | long _x_align; 11 | long *_xp_align; 12 | } u; 13 | } gpgrt_lock_t; 14 | 15 | #define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \ 16 | 0,0,0,0,0,0,0,0, \ 17 | 0,0,0,0,0,0,0,0}}} 18 | ## 19 | ## Local Variables: 20 | ## mode: c 21 | ## buffer-read-only: t 22 | ## End: 23 | ## 24 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.m68k-unknown-linux-gnu.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.m68k-unknown-linux-gnu.h 2 | ## File created by gen-posix-lock-obj - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[24]; 10 | long _x_align; 11 | long *_xp_align; 12 | } u; 13 | } gpgrt_lock_t; 14 | 15 | #define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \ 16 | 0,0,0,0,0,0,0,0, \ 17 | 0,0,0,0,0,0,0,0}}} 18 | ## 19 | ## Local Variables: 20 | ## mode: c 21 | ## buffer-read-only: t 22 | ## End: 23 | ## 24 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.mips-unknown-linux-gnu.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.mips-unknown-linux-gnu.h 2 | ## File created by gen-posix-lock-obj - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[24]; 10 | long _x_align; 11 | long *_xp_align; 12 | } u; 13 | } gpgrt_lock_t; 14 | 15 | #define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \ 16 | 0,0,0,0,0,0,0,0, \ 17 | 0,0,0,0,0,0,0,0}}} 18 | ## 19 | ## Local Variables: 20 | ## mode: c 21 | ## buffer-read-only: t 22 | ## End: 23 | ## 24 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.sh3-unknown-linux-gnu.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.sh3-unknown-linux-gnu.h 2 | ## File created by gen-posix-lock-obj - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[24]; 10 | long _x_align; 11 | long *_xp_align; 12 | } u; 13 | } gpgrt_lock_t; 14 | 15 | #define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \ 16 | 0,0,0,0,0,0,0,0, \ 17 | 0,0,0,0,0,0,0,0}}} 18 | ## 19 | ## Local Variables: 20 | ## mode: c 21 | ## buffer-read-only: t 22 | ## End: 23 | ## 24 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.sh4-unknown-linux-gnu.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.sh4-unknown-linux-gnu.h 2 | ## File created by gen-posix-lock-obj - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[24]; 10 | long _x_align; 11 | long *_xp_align; 12 | } u; 13 | } gpgrt_lock_t; 14 | 15 | #define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \ 16 | 0,0,0,0,0,0,0,0, \ 17 | 0,0,0,0,0,0,0,0}}} 18 | ## 19 | ## Local Variables: 20 | ## mode: c 21 | ## buffer-read-only: t 22 | ## End: 23 | ## 24 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.arm-apple-darwin.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.arm-apple-darwin.h 2 | ## File created by gen-posix-lock-obj - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[44]; 10 | long _x_align; 11 | long *_xp_align; 12 | } u; 13 | } gpgrt_lock_t; 14 | 15 | #define GPGRT_LOCK_INITIALIZER {1,{{167,171,170,50,0,0,0,0, \ 16 | 0,0,0,0,0,0,0,0, \ 17 | 0,0,0,0,0,0,0,0, \ 18 | 0,0,0,0,0,0,0,0, \ 19 | 0,0,0,0,0,0,0,0, \ 20 | 0,0,0,0}}} 21 | ## 22 | ## Local Variables: 23 | ## mode: c 24 | ## buffer-read-only: t 25 | ## End: 26 | ## 27 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.arm-unknown-linux-gnueabi.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.arm-unknown-linux-gnueabi.h 2 | ## File created by gen-posix-lock-obj - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[24]; 10 | long _x_align; 11 | long *_xp_align; 12 | } u; 13 | } gpgrt_lock_t; 14 | 15 | #define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \ 16 | 0,0,0,0,0,0,0,0, \ 17 | 0,0,0,0,0,0,0,0}}} 18 | ## 19 | ## Local Variables: 20 | ## mode: c 21 | ## buffer-read-only: t 22 | ## End: 23 | ## 24 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.mipsel-unknown-linux-gnu.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.mipsel-unknown-linux-gnu.h 2 | ## File created by gen-posix-lock-obj - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[24]; 10 | long _x_align; 11 | long *_xp_align; 12 | } u; 13 | } gpgrt_lock_t; 14 | 15 | #define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \ 16 | 0,0,0,0,0,0,0,0, \ 17 | 0,0,0,0,0,0,0,0}}} 18 | ## 19 | ## Local Variables: 20 | ## mode: c 21 | ## buffer-read-only: t 22 | ## End: 23 | ## 24 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.nios2-unknown-linux-gnu.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.nios2-unknown-linux-gnu.h 2 | ## File created by gen-posix-lock-obj - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[24]; 10 | long _x_align; 11 | long *_xp_align; 12 | } u; 13 | } gpgrt_lock_t; 14 | 15 | #define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \ 16 | 0,0,0,0,0,0,0,0, \ 17 | 0,0,0,0,0,0,0,0}}} 18 | ## 19 | ## Local Variables: 20 | ## mode: c 21 | ## buffer-read-only: t 22 | ## End: 23 | ## 24 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.powerpc-unknown-linux-gnu.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.powerpc-unknown-linux-gnu.h 2 | ## File created by gen-posix-lock-obj - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[24]; 10 | long _x_align; 11 | long *_xp_align; 12 | } u; 13 | } gpgrt_lock_t; 14 | 15 | #define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \ 16 | 0,0,0,0,0,0,0,0, \ 17 | 0,0,0,0,0,0,0,0}}} 18 | ## 19 | ## Local Variables: 20 | ## mode: c 21 | ## buffer-read-only: t 22 | ## End: 23 | ## 24 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.riscv32-unknown-linux-gnu.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.riscv32-unknown-linux-gnu.h 2 | ## File created by gen-posix-lock-obj - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[24]; 10 | long _x_align; 11 | long *_xp_align; 12 | } u; 13 | } gpgrt_lock_t; 14 | 15 | #define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \ 16 | 0,0,0,0,0,0,0,0, \ 17 | 0,0,0,0,0,0,0,0}}} 18 | ## 19 | ## Local Variables: 20 | ## mode: c 21 | ## buffer-read-only: t 22 | ## End: 23 | ## 24 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.sparc-unknown-linux-gnu.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.sparc-unknown-linux-gnu.h 2 | ## File created by gen-posix-lock-obj - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[24]; 10 | long _x_align; 11 | long *_xp_align; 12 | } u; 13 | } gpgrt_lock_t; 14 | 15 | #define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \ 16 | 0,0,0,0,0,0,0,0, \ 17 | 0,0,0,0,0,0,0,0}}} 18 | ## 19 | ## Local Variables: 20 | ## mode: c 21 | ## buffer-read-only: t 22 | ## End: 23 | ## 24 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.powerpc-unknown-linux-gnuspe.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.powerpc-unknown-linux-gnuspe.h 2 | ## File created by gen-posix-lock-obj - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[24]; 10 | long _x_align; 11 | long *_xp_align; 12 | } u; 13 | } gpgrt_lock_t; 14 | 15 | #define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \ 16 | 0,0,0,0,0,0,0,0, \ 17 | 0,0,0,0,0,0,0,0}}} 18 | ## 19 | ## Local Variables: 20 | ## mode: c 21 | ## buffer-read-only: t 22 | ## End: 23 | ## 24 | -------------------------------------------------------------------------------- /THANKS: -------------------------------------------------------------------------------- 1 | 2 | Albrecht Dreß albrecht.dress at arcor de 3 | Guillaume Libersat glibersat at hurdfr org 4 | Jakub Bogusz qboosh at pld-linux org 5 | Petr Pisar petr.pisar at atlas cz 6 | 7 | 8 | Copyright 2004, 2005 g10 Code GmbH 9 | 10 | This file is free software; as a special exception the author gives 11 | unlimited permission to copy and/or distribute it, with or without 12 | modifications, as long as this notice is preserved. 13 | 14 | This file is distributed in the hope that it will be useful, but 15 | WITHOUT ANY WARRANTY, to the extent permitted by law; without even the 16 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 17 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.i686-unknown-gnu.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.i686-pc-gnu.h 2 | ## File created by gen-posix-lock-obj - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[32]; 10 | long _x_align; 11 | long *_xp_align; 12 | } u; 13 | } gpgrt_lock_t; 14 | 15 | #define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \ 16 | 0,0,0,0,0,0,0,0, \ 17 | 0,0,0,0,0,0,0,0, \ 18 | 0,0,0,0,0,0,0,0}}} 19 | ## 20 | ## Local Variables: 21 | ## mode: c 22 | ## buffer-read-only: t 23 | ## End: 24 | ## 25 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.x86_64-unknown-gnu.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.x86_64-pc-gnu.h 2 | ## File created by gen-posix-lock-obj - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[32]; 10 | long _x_align; 11 | long *_xp_align; 12 | } u; 13 | } gpgrt_lock_t; 14 | 15 | #define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \ 16 | 0,0,0,0,0,0,0,0, \ 17 | 0,0,0,0,0,0,0,0, \ 18 | 0,0,0,0,0,0,0,0}}} 19 | ## 20 | ## Local Variables: 21 | ## mode: c 22 | ## buffer-read-only: t 23 | ## End: 24 | ## 25 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.or1k-unknown-linux-gnu.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.or1k-unknown-linux-gnu.h 2 | ## File created by gen-posix-lock-obj - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[32]; 10 | long _x_align; 11 | long *_xp_align; 12 | } u; 13 | } gpgrt_lock_t; 14 | 15 | #define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \ 16 | 0,0,0,0,0,0,0,0, \ 17 | 0,0,0,0,0,0,0,0, \ 18 | 0,0,0,0,0,0,0,0}}} 19 | ## 20 | ## Local Variables: 21 | ## mode: c 22 | ## buffer-read-only: t 23 | ## End: 24 | ## 25 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.x86_64-unknown-linux-gnux32.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.x86_64-pc-linux-gnux32.h 2 | ## File created by gen-posix-lock-obj - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[32]; 10 | long _x_align; 11 | long *_xp_align; 12 | } u; 13 | } gpgrt_lock_t; 14 | 15 | #define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \ 16 | 0,0,0,0,0,0,0,0, \ 17 | 0,0,0,0,0,0,0,0, \ 18 | 0,0,0,0,0,0,0,0}}} 19 | ## 20 | ## Local Variables: 21 | ## mode: c 22 | ## buffer-read-only: t 23 | ## End: 24 | ## 25 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.aarch64-apple-darwin.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.aarch64-apple-darwin.h 2 | ## File created by gen-posix-lock-obj - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[64]; 10 | long _x_align; 11 | long *_xp_align; 12 | } u; 13 | } gpgrt_lock_t; 14 | 15 | #define GPGRT_LOCK_INITIALIZER {1,{{167,171,170,50,0,0,0,0, \ 16 | 0,0,0,0,0,0,0,0, \ 17 | 0,0,0,0,0,0,0,0, \ 18 | 0,0,0,0,0,0,0,0, \ 19 | 0,0,0,0,0,0,0,0, \ 20 | 0,0,0,0,0,0,0,0, \ 21 | 0,0,0,0,0,0,0,0, \ 22 | 0,0,0,0,0,0,0,0}}} 23 | ## 24 | ## Local Variables: 25 | ## mode: c 26 | ## buffer-read-only: t 27 | ## End: 28 | ## 29 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.x86_64-apple-darwin.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.x86_64-apple-darwin.h 2 | ## File created by gen-posix-lock-obj - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[64]; 10 | long _x_align; 11 | long *_xp_align; 12 | } u; 13 | } gpgrt_lock_t; 14 | 15 | #define GPGRT_LOCK_INITIALIZER {1,{{167,171,170,50,0,0,0,0, \ 16 | 0,0,0,0,0,0,0,0, \ 17 | 0,0,0,0,0,0,0,0, \ 18 | 0,0,0,0,0,0,0,0, \ 19 | 0,0,0,0,0,0,0,0, \ 20 | 0,0,0,0,0,0,0,0, \ 21 | 0,0,0,0,0,0,0,0, \ 22 | 0,0,0,0,0,0,0,0}}} 23 | ## 24 | ## Local Variables: 25 | ## mode: c 26 | ## buffer-read-only: t 27 | ## End: 28 | ## 29 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.aarch64-unknown-linux-gnu_ilp32.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.aarch64-unknown-linux-gnu_ilp32.h 2 | ## File created by gen-posix-lock-obj - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[32]; 10 | long _x_align; 11 | long *_xp_align; 12 | } u; 13 | } gpgrt_lock_t; 14 | 15 | #define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \ 16 | 0,0,0,0,0,0,0,0, \ 17 | 0,0,0,0,0,0,0,0, \ 18 | 0,0,0,0,0,0,0,0}}} 19 | ## 20 | ## Local Variables: 21 | ## mode: c 22 | ## buffer-read-only: t 23 | ## End: 24 | ## 25 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.ia64-unknown-linux-gnu.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.ia64-unknown-linux-gnu.h 2 | ## File created by gen-posix-lock-obj - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[40]; 10 | long _x_align; 11 | long *_xp_align; 12 | } u; 13 | } gpgrt_lock_t; 14 | 15 | #define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \ 16 | 0,0,0,0,0,0,0,0, \ 17 | 0,0,0,0,0,0,0,0, \ 18 | 0,0,0,0,0,0,0,0, \ 19 | 0,0,0,0,0,0,0,0}}} 20 | ## 21 | ## Local Variables: 22 | ## mode: c 23 | ## buffer-read-only: t 24 | ## End: 25 | ## 26 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.s390x-unknown-linux-gnu.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.s390x-ibm-linux-gnu.h 2 | ## File created by gen-posix-lock-obj - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[40]; 10 | long _x_align; 11 | long *_xp_align; 12 | } u; 13 | } gpgrt_lock_t; 14 | 15 | #define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \ 16 | 0,0,0,0,0,0,0,0, \ 17 | 0,0,0,0,0,0,0,0, \ 18 | 0,0,0,0,0,0,0,0, \ 19 | 0,0,0,0,0,0,0,0}}} 20 | ## 21 | ## Local Variables: 22 | ## mode: c 23 | ## buffer-read-only: t 24 | ## End: 25 | ## 26 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.x86_64-unknown-linux-gnu.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.x86_64-pc-linux-gnu.h 2 | ## File created by gen-posix-lock-obj - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[40]; 10 | long _x_align; 11 | long *_xp_align; 12 | } u; 13 | } gpgrt_lock_t; 14 | 15 | #define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \ 16 | 0,0,0,0,0,0,0,0, \ 17 | 0,0,0,0,0,0,0,0, \ 18 | 0,0,0,0,0,0,0,0, \ 19 | 0,0,0,0,0,0,0,0}}} 20 | ## 21 | ## Local Variables: 22 | ## mode: c 23 | ## buffer-read-only: t 24 | ## End: 25 | ## 26 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.x86_64-unknown-linux-musl.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.x86_64-pc-linux-musl.h 2 | ## File created by gen-posix-lock-obj - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[40]; 10 | long _x_align; 11 | long *_xp_align; 12 | } u; 13 | } gpgrt_lock_t; 14 | 15 | #define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \ 16 | 0,0,0,0,0,0,0,0, \ 17 | 0,0,0,0,0,0,0,0, \ 18 | 0,0,0,0,0,0,0,0, \ 19 | 0,0,0,0,0,0,0,0}}} 20 | ## 21 | ## Local Variables: 22 | ## mode: c 23 | ## buffer-read-only: t 24 | ## End: 25 | ## 26 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.alpha-unknown-linux-gnu.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.alpha-unknown-linux-gnu.h 2 | ## File created by gen-posix-lock-obj - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[40]; 10 | long _x_align; 11 | long *_xp_align; 12 | } u; 13 | } gpgrt_lock_t; 14 | 15 | #define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \ 16 | 0,0,0,0,0,0,0,0, \ 17 | 0,0,0,0,0,0,0,0, \ 18 | 0,0,0,0,0,0,0,0, \ 19 | 0,0,0,0,0,0,0,0}}} 20 | ## 21 | ## Local Variables: 22 | ## mode: c 23 | ## buffer-read-only: t 24 | ## End: 25 | ## 26 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.riscv64-unknown-linux-gnu.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.riscv64-unknown-linux-gnu.h 2 | ## File created by gen-posix-lock-obj - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[40]; 10 | long _x_align; 11 | long *_xp_align; 12 | } u; 13 | } gpgrt_lock_t; 14 | 15 | #define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \ 16 | 0,0,0,0,0,0,0,0, \ 17 | 0,0,0,0,0,0,0,0, \ 18 | 0,0,0,0,0,0,0,0, \ 19 | 0,0,0,0,0,0,0,0}}} 20 | ## 21 | ## Local Variables: 22 | ## mode: c 23 | ## buffer-read-only: t 24 | ## End: 25 | ## 26 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.sparc64-unknown-linux-gnu.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.sparc64-unknown-linux-gnu.h 2 | ## File created by gen-posix-lock-obj - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[40]; 10 | long _x_align; 11 | long *_xp_align; 12 | } u; 13 | } gpgrt_lock_t; 14 | 15 | #define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \ 16 | 0,0,0,0,0,0,0,0, \ 17 | 0,0,0,0,0,0,0,0, \ 18 | 0,0,0,0,0,0,0,0, \ 19 | 0,0,0,0,0,0,0,0}}} 20 | ## 21 | ## Local Variables: 22 | ## mode: c 23 | ## buffer-read-only: t 24 | ## End: 25 | ## 26 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.tilegx-unknown-linux-gnu.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.tilegx-unknown-linux-gnu.h 2 | ## File created by gen-posix-lock-obj - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[40]; 10 | long _x_align; 11 | long *_xp_align; 12 | } u; 13 | } gpgrt_lock_t; 14 | 15 | #define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \ 16 | 0,0,0,0,0,0,0,0, \ 17 | 0,0,0,0,0,0,0,0, \ 18 | 0,0,0,0,0,0,0,0, \ 19 | 0,0,0,0,0,0,0,0}}} 20 | ## 21 | ## Local Variables: 22 | ## mode: c 23 | ## buffer-read-only: t 24 | ## End: 25 | ## 26 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.x86_64-unknown-kfreebsd-gnu.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.x86_64-pc-kfreebsd-gnu.h 2 | ## File created by gen-posix-lock-obj - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[40]; 10 | long _x_align; 11 | long *_xp_align; 12 | } u; 13 | } gpgrt_lock_t; 14 | 15 | #define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \ 16 | 0,0,0,0,0,0,0,0, \ 17 | 0,0,0,0,0,0,0,0, \ 18 | 0,0,0,0,0,0,0,0, \ 19 | 0,0,0,0,0,0,0,0}}} 20 | ## 21 | ## Local Variables: 22 | ## mode: c 23 | ## buffer-read-only: t 24 | ## End: 25 | ## 26 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.powerpc64-unknown-linux-gnu.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.powerpc64-unknown-linux-gnu.h 2 | ## File created by gen-posix-lock-obj - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[40]; 10 | long _x_align; 11 | long *_xp_align; 12 | } u; 13 | } gpgrt_lock_t; 14 | 15 | #define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \ 16 | 0,0,0,0,0,0,0,0, \ 17 | 0,0,0,0,0,0,0,0, \ 18 | 0,0,0,0,0,0,0,0, \ 19 | 0,0,0,0,0,0,0,0}}} 20 | ## 21 | ## Local Variables: 22 | ## mode: c 23 | ## buffer-read-only: t 24 | ## End: 25 | ## 26 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.mips64-unknown-linux-gnuabi64.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.mips64-unknown-linux-gnuabi64.h 2 | ## File created by gen-posix-lock-obj - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[40]; 10 | long _x_align; 11 | long *_xp_align; 12 | } u; 13 | } gpgrt_lock_t; 14 | 15 | #define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \ 16 | 0,0,0,0,0,0,0,0, \ 17 | 0,0,0,0,0,0,0,0, \ 18 | 0,0,0,0,0,0,0,0, \ 19 | 0,0,0,0,0,0,0,0}}} 20 | ## 21 | ## Local Variables: 22 | ## mode: c 23 | ## buffer-read-only: t 24 | ## End: 25 | ## 26 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.powerpc64le-unknown-linux-gnu.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.powerpc64le-unknown-linux-gnu.h 2 | ## File created by gen-posix-lock-obj - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[40]; 10 | long _x_align; 11 | long *_xp_align; 12 | } u; 13 | } gpgrt_lock_t; 14 | 15 | #define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \ 16 | 0,0,0,0,0,0,0,0, \ 17 | 0,0,0,0,0,0,0,0, \ 18 | 0,0,0,0,0,0,0,0, \ 19 | 0,0,0,0,0,0,0,0}}} 20 | ## 21 | ## Local Variables: 22 | ## mode: c 23 | ## buffer-read-only: t 24 | ## End: 25 | ## 26 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.aarch64-unknown-linux-androideabi.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.aarch64-unknown-linux-androideabi.h 2 | ## File created by gen-lock-obj.sh - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[40]; 10 | long _x_align; 11 | long *_xp_align; 12 | } u; 13 | } gpgrt_lock_t; 14 | 15 | #define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \ 16 | 0,0,0,0,0,0,0,0, \ 17 | 0,0,0,0,0,0,0,0, \ 18 | 0,0,0,0,0,0,0,0, \ 19 | 0,0,0,0,0,0,0,0}}} 20 | ## 21 | ## Local Variables: 22 | ## mode: c 23 | ## buffer-read-only: t 24 | ## End: 25 | ## 26 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.mips64el-unknown-linux-gnuabi64.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.mips64el-unknown-linux-gnuabi64.h 2 | ## File created by gen-posix-lock-obj - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[40]; 10 | long _x_align; 11 | long *_xp_align; 12 | } u; 13 | } gpgrt_lock_t; 14 | 15 | #define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \ 16 | 0,0,0,0,0,0,0,0, \ 17 | 0,0,0,0,0,0,0,0, \ 18 | 0,0,0,0,0,0,0,0, \ 19 | 0,0,0,0,0,0,0,0}}} 20 | ## 21 | ## Local Variables: 22 | ## mode: c 23 | ## buffer-read-only: t 24 | ## End: 25 | ## 26 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.x86_64-unknown-linux-androideabi.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.x86_64-unknown-linux-androideabi.h 2 | ## File created by gen-lock-obj.sh - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[40]; 10 | long _x_align; 11 | long *_xp_align; 12 | } u; 13 | } gpgrt_lock_t; 14 | 15 | #define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \ 16 | 0,0,0,0,0,0,0,0, \ 17 | 0,0,0,0,0,0,0,0, \ 18 | 0,0,0,0,0,0,0,0, \ 19 | 0,0,0,0,0,0,0,0}}} 20 | ## 21 | ## Local Variables: 22 | ## mode: c 23 | ## buffer-read-only: t 24 | ## End: 25 | ## 26 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.i386-apple-darwin.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.i386-apple-darwin.h 2 | ## File created by gen-posix-lock-obj - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[44]; 10 | long _x_align; 11 | long *_xp_align; 12 | } u; 13 | } gpgrt_lock_t; 14 | 15 | #define GPGRT_LOCK_INITIALIZER {1,{{167,171,170,50,0,0,0,0, \ 16 | 0,0,0,0,0,0,0,0, \ 17 | 0,0,0,0,0,0,0,0, \ 18 | 0,0,0,0,0,0,0,0, \ 19 | 0,0,0,0,0,0,0,0, \ 20 | 0,0,0,0}}} 21 | ## 22 | ## Local Variables: 23 | ## mode: c 24 | ## buffer-read-only: t 25 | ## End: 26 | ## 27 | -------------------------------------------------------------------------------- /m4/ltversion.m4: -------------------------------------------------------------------------------- 1 | # ltversion.m4 -- version numbers -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004, 2011-2019, 2021-2022 Free Software Foundation, 4 | # Inc. 5 | # Written by Scott James Remnant, 2004 6 | # 7 | # This file is free software; the Free Software Foundation gives 8 | # unlimited permission to copy and/or distribute it, with or without 9 | # modifications, as long as this notice is preserved. 10 | 11 | # @configure_input@ 12 | 13 | # serial 4245 ltversion.m4 14 | # This file is part of GNU Libtool 15 | 16 | m4_define([LT_PACKAGE_VERSION], [2.4.7]) 17 | m4_define([LT_PACKAGE_REVISION], [2.4.7]) 18 | 19 | AC_DEFUN([LTVERSION_VERSION], 20 | [macro_version='2.4.7' 21 | macro_revision='2.4.7' 22 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 23 | _LT_DECL(, macro_revision, 0) 24 | ]) 25 | -------------------------------------------------------------------------------- /src/gpg-error.w32-manifest.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | Error codes and shared functions for GnuPG and others 4 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.aarch64-unknown-linux-gnu.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.aarch64-unknown-linux-gnu.h 2 | ## File created by gen-posix-lock-obj - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[48]; 10 | long _x_align; 11 | long *_xp_align; 12 | } u; 13 | } gpgrt_lock_t; 14 | 15 | #define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \ 16 | 0,0,0,0,0,0,0,0, \ 17 | 0,0,0,0,0,0,0,0, \ 18 | 0,0,0,0,0,0,0,0, \ 19 | 0,0,0,0,0,0,0,0, \ 20 | 0,0,0,0,0,0,0,0}}} 21 | ## 22 | ## Local Variables: 23 | ## mode: c 24 | ## buffer-read-only: t 25 | ## End: 26 | ## 27 | -------------------------------------------------------------------------------- /po/remove-potcdate.sin: -------------------------------------------------------------------------------- 1 | # Sed script that removes the POT-Creation-Date line in the header entry 2 | # from a POT file. 3 | # 4 | # Copyright (C) 2002 Free Software Foundation, Inc. 5 | # Copying and distribution of this file, with or without modification, 6 | # are permitted in any medium without royalty provided the copyright 7 | # notice and this notice are preserved. This file is offered as-is, 8 | # without any warranty. 9 | # 10 | # The distinction between the first and the following occurrences of the 11 | # pattern is achieved by looking at the hold space. 12 | /^"POT-Creation-Date: .*"$/{ 13 | x 14 | # Test if the hold space is empty. 15 | s/P/P/ 16 | ta 17 | # Yes it was empty. First occurrence. Remove the line. 18 | g 19 | d 20 | bb 21 | :a 22 | # The hold space was nonempty. Following occurrences. Do nothing. 23 | x 24 | :b 25 | } 26 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.hppa-unknown-linux-gnu.h: -------------------------------------------------------------------------------- 1 | ## lock-obj-pub.hppa-unknown-linux-gnu.h 2 | ## File created by gen-posix-lock-obj - DO NOT EDIT 3 | ## To be included by mkheader into gpg-error.h 4 | 5 | typedef struct 6 | { 7 | long _vers; 8 | union { 9 | volatile char _priv[48]; 10 | int _x16_align __attribute__ ((aligned (16))); 11 | long _x_align; 12 | long *_xp_align; 13 | } u; 14 | } gpgrt_lock_t; 15 | 16 | #define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \ 17 | 0,0,0,0,0,0,0,0, \ 18 | 0,0,0,0,0,0,0,0, \ 19 | 0,0,0,0,0,0,0,0, \ 20 | 0,0,0,0,0,0,0,0, \ 21 | 0,0,0,0,0,0,0,0}}} 22 | ## 23 | ## Local Variables: 24 | ## mode: c 25 | ## buffer-read-only: t 26 | ## End: 27 | ## 28 | -------------------------------------------------------------------------------- /src/lock.h: -------------------------------------------------------------------------------- 1 | /* lock.h - Declarations for *-lock.c 2 | Copyright (C) 2014 g10 Code GmbH 3 | 4 | This file is part of libgpg-error. 5 | 6 | libgpg-error is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public License 8 | as published by the Free Software Foundation; either version 2.1 of 9 | the License, or (at your option) any later version. 10 | 11 | libgpg-error is distributed in the hope that it will be useful, but 12 | WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with this program; if not, see . 18 | */ 19 | 20 | #ifndef LOCK_H 21 | #define LOCK_H 22 | 23 | 24 | #endif /*LOCK_H*/ 25 | -------------------------------------------------------------------------------- /src/thread.h: -------------------------------------------------------------------------------- 1 | /* thread.h - Declarations for *-thread.c 2 | Copyright (C) 2014 g10 Code GmbH 3 | 4 | This file is part of libgpg-error. 5 | 6 | libgpg-error is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public License 8 | as published by the Free Software Foundation; either version 2.1 of 9 | the License, or (at your option) any later version. 10 | 11 | libgpg-error is distributed in the hope that it will be useful, but 12 | WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with this program; if not, see . 18 | */ 19 | 20 | #ifndef THREAD_H 21 | #define THREAD_H 22 | 23 | 24 | #endif /*THREAD_H*/ 25 | -------------------------------------------------------------------------------- /m4/codeset.m4: -------------------------------------------------------------------------------- 1 | # codeset.m4 serial 5 (gettext-0.18.2) 2 | dnl Copyright (C) 2000-2002, 2006, 2008-2014, 2016, 2019-2021 Free Software 3 | dnl Foundation, Inc. 4 | dnl This file is free software; the Free Software Foundation 5 | dnl gives unlimited permission to copy and/or distribute it, 6 | dnl with or without modifications, as long as this notice is preserved. 7 | 8 | dnl From Bruno Haible. 9 | 10 | AC_DEFUN([AM_LANGINFO_CODESET], 11 | [ 12 | AC_CACHE_CHECK([for nl_langinfo and CODESET], [am_cv_langinfo_codeset], 13 | [AC_LINK_IFELSE( 14 | [AC_LANG_PROGRAM( 15 | [[#include ]], 16 | [[char* cs = nl_langinfo(CODESET); return !cs;]])], 17 | [am_cv_langinfo_codeset=yes], 18 | [am_cv_langinfo_codeset=no]) 19 | ]) 20 | if test $am_cv_langinfo_codeset = yes; then 21 | AC_DEFINE([HAVE_LANGINFO_CODESET], [1], 22 | [Define if you have and nl_langinfo(CODESET).]) 23 | fi 24 | ]) 25 | -------------------------------------------------------------------------------- /lang/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for libgpg-error. 2 | # Copyright (C) 2003, 2006 g10 Code GmbH 3 | # 4 | # This file is part of libgpg-error. 5 | # 6 | # libgpg-error is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU Lesser General Public License as 8 | # published by the Free Software Foundation; either version 2.1 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # libgpg-error is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public 17 | # License along with this program; if not, write to the Free Software 18 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 19 | 20 | SUBDIRS = cl 21 | 22 | EXTRA_DIST = README 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.lo 2 | *.o 3 | .deps/ 4 | .libs/ 5 | po/*.gmo 6 | po/messages.mo 7 | Makefile.in 8 | aclocal.m4 9 | autom4te.cache/ 10 | configure 11 | config.h.in 12 | src/err-codes.h 13 | src/err-sources.h 14 | /po/libgpg-error.pot 15 | /lang/Makefile 16 | /lang/cl/Makefile 17 | /lang/cl/gpg-error-codes.lisp 18 | /lang/cl/gpg-error.asd 19 | /libtool 20 | /m4/Makefile 21 | /po/Makefile 22 | /po/POTFILES 23 | /po/stamp-po 24 | /config.log 25 | /config.status 26 | /config.h 27 | /Makefile 28 | /src/Makefile 29 | /src/code-from-errno.h 30 | /src/code-to-errno.h 31 | /src/err-codes-sym.h 32 | /src/err-sources-sym.h 33 | /src/errnos-sym.h 34 | /src/extra-h.in 35 | /src/gpg-error 36 | /src/gpg-error-config 37 | /src/gpg-error.def 38 | /src/gpg-error.h 39 | /src/libgpg-error.la 40 | /src/mkerrcodes 41 | /src/mkerrcodes.h 42 | /src/mkw32errmap.map.c 43 | /src/versioninfo.rc 44 | /stamp-h1 45 | /tests/Makefile 46 | /tests/t-strerror 47 | /tests/t-syserror 48 | /doc/gpgrt.info 49 | /doc/stamp-vti 50 | /doc/version.texi 51 | /VERSION 52 | -------------------------------------------------------------------------------- /po/insert-header.sin: -------------------------------------------------------------------------------- 1 | # Sed script that inserts the file called HEADER before the header entry. 2 | # 3 | # Copyright (C) 2001 Free Software Foundation, Inc. 4 | # Written by Bruno Haible , 2001. 5 | # This file is free software; the Free Software Foundation gives 6 | # unlimited permission to use, copy, distribute, and modify it. 7 | # 8 | # At each occurrence of a line starting with "msgid ", we execute the following 9 | # commands. At the first occurrence, insert the file. At the following 10 | # occurrences, do nothing. The distinction between the first and the following 11 | # occurrences is achieved by looking at the hold space. 12 | /^msgid /{ 13 | x 14 | # Test if the hold space is empty. 15 | s/m/m/ 16 | ta 17 | # Yes it was empty. First occurrence. Read the file. 18 | r HEADER 19 | # Output the file's contents by reading the next line. But don't lose the 20 | # current line while doing this. 21 | g 22 | N 23 | bb 24 | :a 25 | # The hold space was nonempty. Following occurrences. Do nothing. 26 | x 27 | :b 28 | } 29 | -------------------------------------------------------------------------------- /src/estream.h: -------------------------------------------------------------------------------- 1 | /* gpgrt-int.h - Internal definitions 2 | * Copyright (C) 2014 g10 Code GmbH 3 | * 4 | * This file is part of libgpg-error. 5 | * 6 | * libgpg-error is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public License 8 | * as published by the Free Software Foundation; either version 2.1 of 9 | * the License, or (at your option) any later version. 10 | * 11 | * libgpg-error is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this program; if not, see . 18 | */ 19 | 20 | #ifndef ESTREAM_H 21 | #define ESTREAM_H 22 | 23 | #include "gpg-error.h" 24 | 25 | /* Local prototypes for estream. */ 26 | int _gpgrt_estream_init (void); 27 | 28 | 29 | 30 | #endif /*ESTREAM_H*/ 31 | -------------------------------------------------------------------------------- /gpgscm/ffi.h: -------------------------------------------------------------------------------- 1 | /* FFI interface for TinySCHEME. 2 | * Copyright (C) 2016 g10 Code GmbH 3 | * 4 | * This file is part of Libgpg-error. 5 | * 6 | * Libgpg-error is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public License 8 | * as published by the Free Software Foundation; either version 2.1 of 9 | * the License, or (at your option) any later version. 10 | * 11 | * Libgpg-error is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this program; if not, see . 18 | */ 19 | 20 | #ifndef GPGSCM_FFI_H 21 | #define GPGSCM_FFI_H 22 | 23 | #include "../src/gpgrt.h" 24 | #include "scheme.h" 25 | 26 | gpg_error_t ffi_init (scheme *sc, const char *argv0, const char *scriptname, 27 | int argc, const char **argv); 28 | 29 | #endif /* GPGSCM_FFI_H */ 30 | -------------------------------------------------------------------------------- /gpgscm/scheme-config.h: -------------------------------------------------------------------------------- 1 | /* TinyScheme configuration. 2 | * Copyright (C) 2016 g10 Code GmbH 3 | * 4 | * This file is part of Libgpg-error. 5 | * 6 | * Libgpg-error is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public License 8 | * as published by the Free Software Foundation; either version 2.1 of 9 | * the License, or (at your option) any later version. 10 | * 11 | * Libgpg-error is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this program; if not, see . 18 | */ 19 | 20 | #define STANDALONE 0 21 | #define USE_MATH 0 22 | #define USE_CHAR_CLASSIFIERS 1 23 | #define USE_ASCII_NAMES 1 24 | #define USE_STRING_PORTS 1 25 | #define USE_ERROR_HOOK 1 26 | #define USE_TRACING 1 27 | #define USE_COLON_HOOK 1 28 | #define USE_DL 0 29 | #define USE_PLIST 0 30 | #define USE_INTERFACE 1 31 | #define SHOW_ERROR_LINE 1 32 | -------------------------------------------------------------------------------- /m4/autobuild.m4: -------------------------------------------------------------------------------- 1 | # autobuild.m4 serial 7 2 | dnl Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, 3 | dnl Inc. 4 | dnl This file is free software; the Free Software Foundation 5 | dnl gives unlimited permission to copy and/or distribute it, 6 | dnl with or without modifications, as long as this notice is preserved. 7 | 8 | dnl From Simon Josefsson 9 | 10 | # Usage: AB_INIT([MODE]). 11 | AC_DEFUN([AB_INIT], 12 | [ 13 | AC_REQUIRE([AC_CANONICAL_BUILD]) 14 | AC_REQUIRE([AC_CANONICAL_HOST]) 15 | 16 | if test -z "$AB_PACKAGE"; then 17 | AB_PACKAGE=${PACKAGE_NAME:-$PACKAGE} 18 | fi 19 | AC_MSG_NOTICE([autobuild project... $AB_PACKAGE]) 20 | 21 | if test -z "$AB_VERSION"; then 22 | AB_VERSION=${PACKAGE_VERSION:-$VERSION} 23 | fi 24 | AC_MSG_NOTICE([autobuild revision... $AB_VERSION]) 25 | 26 | hostname=`hostname` 27 | if test "$hostname"; then 28 | AC_MSG_NOTICE([autobuild hostname... $hostname]) 29 | fi 30 | 31 | ifelse([$1],[],,[AC_MSG_NOTICE([autobuild mode... $1])]) 32 | 33 | date=`TZ=UTC0 date +%Y%m%dT%H%M%SZ` 34 | if test "$?" != 0; then 35 | date=`date` 36 | fi 37 | if test "$date"; then 38 | AC_MSG_NOTICE([autobuild timestamp... $date]) 39 | fi 40 | ]) 41 | -------------------------------------------------------------------------------- /po/en@quot.header: -------------------------------------------------------------------------------- 1 | # All this catalog "translates" are quotation characters. 2 | # The msgids must be ASCII and therefore cannot contain real quotation 3 | # characters, only substitutes like grave accent (0x60), apostrophe (0x27) 4 | # and double quote (0x22). These substitutes look strange; see 5 | # https://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html 6 | # 7 | # This catalog translates grave accent (0x60) and apostrophe (0x27) to 8 | # left single quotation mark (U+2018) and right single quotation mark (U+2019). 9 | # It also translates pairs of apostrophe (0x27) to 10 | # left single quotation mark (U+2018) and right single quotation mark (U+2019) 11 | # and pairs of quotation mark (0x22) to 12 | # left double quotation mark (U+201C) and right double quotation mark (U+201D). 13 | # 14 | # When output to an UTF-8 terminal, the quotation characters appear perfectly. 15 | # When output to an ISO-8859-1 terminal, the single quotation marks are 16 | # transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to 17 | # grave/acute accent (by libiconv), and the double quotation marks are 18 | # transliterated to 0x22. 19 | # When output to an ASCII terminal, the single quotation marks are 20 | # transliterated to apostrophes, and the double quotation marks are 21 | # transliterated to 0x22. 22 | # 23 | -------------------------------------------------------------------------------- /src/protos.h: -------------------------------------------------------------------------------- 1 | /* protos.h - Miscellaneous prototypes 2 | * Copyright (C) 2020 g10 Code GmbH 3 | * 4 | * This file is part of libgpg-error. 5 | * 6 | * libgpg-error is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public License 8 | * as published by the Free Software Foundation; either version 2.1 of 9 | * the License, or (at your option) any later version. 10 | * 11 | * libgpg-error is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this program; if not, see . 18 | * SPDX-License-Identifier: LGPL-2.1+ 19 | */ 20 | 21 | #ifndef _GPGRT_PROTOS_H 22 | #define _GPGRT_PROTOS_H 23 | 24 | /*-- w32-gettext.c --*/ 25 | wchar_t *_gpgrt_utf8_to_wchar (const char *string); 26 | void _gpgrt_free_wchar (wchar_t *wstring); 27 | char *_gpgrt_wchar_to_utf8 (const wchar_t *string, size_t length); 28 | 29 | /*-- estream.c --*/ 30 | void _gpgrt_w32_set_errno (int ec); 31 | gpg_err_code_t _gpgrt_w32_get_last_err_code (void); 32 | 33 | 34 | #endif /*_GPGRT_PROTOS_H*/ 35 | -------------------------------------------------------------------------------- /src/posix-lock-obj.h: -------------------------------------------------------------------------------- 1 | /* posic-lock-obj.h - Declaration of the POSIX lock object 2 | Copyright (C) 2014 g10 Code GmbH 3 | 4 | This file is part of libgpg-error. 5 | 6 | libgpg-error is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public License 8 | as published by the Free Software Foundation; either version 2.1 of 9 | the License, or (at your option) any later version. 10 | 11 | libgpg-error is distributed in the hope that it will be useful, but 12 | WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with this program; if not, see . 18 | */ 19 | 20 | #ifndef POSIX_LOCK_OBJ_H 21 | #define POSIX_LOCK_OBJ_H 22 | 23 | #define LOCK_ABI_NOT_AVAILABLE (-1) 24 | #if USE_POSIX_THREADS 25 | # define LOCK_ABI_VERSION 1 26 | #else 27 | # define LOCK_ABI_VERSION LOCK_ABI_NOT_AVAILABLE 28 | #endif 29 | 30 | typedef struct 31 | { 32 | long vers; 33 | #if USE_POSIX_THREADS 34 | union { 35 | pthread_mutex_t mtx; 36 | long *dummy; 37 | } u; 38 | #endif 39 | } _gpgrt_lock_t; 40 | 41 | 42 | #endif /*POSIX_LOCK_OBJ_H*/ 43 | -------------------------------------------------------------------------------- /m4/nls.m4: -------------------------------------------------------------------------------- 1 | # nls.m4 serial 6 (gettext-0.20.2) 2 | dnl Copyright (C) 1995-2003, 2005-2006, 2008-2014, 2016, 2019-2021 Free 3 | dnl Software Foundation, Inc. 4 | dnl This file is free software; the Free Software Foundation 5 | dnl gives unlimited permission to copy and/or distribute it, 6 | dnl with or without modifications, as long as this notice is preserved. 7 | dnl 8 | dnl This file can be used in projects which are not available under 9 | dnl the GNU General Public License or the GNU Lesser General Public 10 | dnl License but which still want to provide support for the GNU gettext 11 | dnl functionality. 12 | dnl Please note that the actual code of the GNU gettext library is covered 13 | dnl by the GNU Lesser General Public License, and the rest of the GNU 14 | dnl gettext package is covered by the GNU General Public License. 15 | dnl They are *not* in the public domain. 16 | 17 | dnl Authors: 18 | dnl Ulrich Drepper , 1995-2000. 19 | dnl Bruno Haible , 2000-2003. 20 | 21 | AC_PREREQ([2.50]) 22 | 23 | AC_DEFUN([AM_NLS], 24 | [ 25 | AC_MSG_CHECKING([whether NLS is requested]) 26 | dnl Default is enabled NLS 27 | AC_ARG_ENABLE([nls], 28 | [ --disable-nls do not use Native Language Support], 29 | USE_NLS=$enableval, USE_NLS=yes) 30 | AC_MSG_RESULT([$USE_NLS]) 31 | AC_SUBST([USE_NLS]) 32 | ]) 33 | -------------------------------------------------------------------------------- /src/w32-lock-obj.h: -------------------------------------------------------------------------------- 1 | /* w32-lock-obj.h - Declaration of the Windows lock object 2 | Copyright (C) 2014 g10 Code GmbH 3 | 4 | This file is part of libgpg-error. 5 | 6 | libgpg-error is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public License 8 | as published by the Free Software Foundation; either version 2.1 of 9 | the License, or (at your option) any later version. 10 | 11 | libgpg-error is distributed in the hope that it will be useful, but 12 | WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with this program; if not, see . 18 | */ 19 | 20 | #ifndef W32_LOCK_OBJ_H 21 | #define W32_LOCK_OBJ_H 22 | 23 | #define LOCK_ABI_VERSION 1 24 | 25 | /* The real definition of our lock object. The public definition is 26 | named gpgrt_lock_t and hides this internal structure. */ 27 | #pragma pack(push, 8) 28 | typedef struct 29 | { 30 | long vers; 31 | volatile long initdone; 32 | volatile long started; 33 | CRITICAL_SECTION csec; 34 | } _gpgrt_lock_t; 35 | #pragma pack(pop) 36 | 37 | 38 | #endif /*W32_LOCK_OBJ_H*/ 39 | -------------------------------------------------------------------------------- /src/strsource.c: -------------------------------------------------------------------------------- 1 | /* strsource.c - Describing an error source. 2 | Copyright (C) 2003 g10 Code GmbH 3 | 4 | This file is part of libgpg-error. 5 | 6 | libgpg-error is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public License 8 | as published by the Free Software Foundation; either version 2.1 of 9 | the License, or (at your option) any later version. 10 | 11 | libgpg-error is distributed in the hope that it will be useful, but 12 | WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with libgpg-error; if not, write to the Free 18 | Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | 02111-1307, USA. */ 20 | 21 | #if HAVE_CONFIG_H 22 | #include 23 | #endif 24 | 25 | #include 26 | 27 | #include "gettext.h" 28 | #include "err-sources.h" 29 | 30 | /* Return a pointer to a string containing a description of the error 31 | source in the error value ERR. */ 32 | const char * 33 | _gpg_strsource (gpg_error_t err) 34 | { 35 | gpg_err_source_t source = gpg_err_source (err); 36 | return dgettext (PACKAGE, msgstr + msgidx[msgidxof (source)]); 37 | } 38 | -------------------------------------------------------------------------------- /src/w32-thread.c: -------------------------------------------------------------------------------- 1 | /* w32-thread.c - GPGRT thread functions for Windows 2 | Copyright (C) 2014 g10 Code GmbH 3 | 4 | This file is part of libgpg-error. 5 | 6 | libgpg-error is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public License 8 | as published by the Free Software Foundation; either version 2.1 of 9 | the License, or (at your option) any later version. 10 | 11 | libgpg-error is distributed in the hope that it will be useful, but 12 | WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with this program; if not, see . 18 | */ 19 | 20 | #if HAVE_CONFIG_H 21 | #include 22 | #endif 23 | 24 | #ifndef HAVE_W32_SYSTEM 25 | # error This module may only be build for Windows. 26 | #endif 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | #define WIN32_LEAN_AND_MEAN 33 | #include 34 | 35 | #include "gpgrt-int.h" 36 | #include "thread.h" 37 | 38 | 39 | gpg_err_code_t 40 | _gpgrt_yield (void) 41 | { 42 | _gpgrt_pre_syscall (); 43 | Sleep (0); 44 | _gpgrt_post_syscall (); 45 | return 0; 46 | } 47 | -------------------------------------------------------------------------------- /po/en@boldquot.header: -------------------------------------------------------------------------------- 1 | # All this catalog "translates" are quotation characters. 2 | # The msgids must be ASCII and therefore cannot contain real quotation 3 | # characters, only substitutes like grave accent (0x60), apostrophe (0x27) 4 | # and double quote (0x22). These substitutes look strange; see 5 | # https://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html 6 | # 7 | # This catalog translates grave accent (0x60) and apostrophe (0x27) to 8 | # left single quotation mark (U+2018) and right single quotation mark (U+2019). 9 | # It also translates pairs of apostrophe (0x27) to 10 | # left single quotation mark (U+2018) and right single quotation mark (U+2019) 11 | # and pairs of quotation mark (0x22) to 12 | # left double quotation mark (U+201C) and right double quotation mark (U+201D). 13 | # 14 | # When output to an UTF-8 terminal, the quotation characters appear perfectly. 15 | # When output to an ISO-8859-1 terminal, the single quotation marks are 16 | # transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to 17 | # grave/acute accent (by libiconv), and the double quotation marks are 18 | # transliterated to 0x22. 19 | # When output to an ASCII terminal, the single quotation marks are 20 | # transliterated to apostrophes, and the double quotation marks are 21 | # transliterated to 0x22. 22 | # 23 | # This catalog furthermore displays the text between the quotation marks in 24 | # bold face, assuming the VT100/XTerm escape sequences. 25 | # 26 | -------------------------------------------------------------------------------- /m4/gnupg-misc.m4: -------------------------------------------------------------------------------- 1 | dnl gnupg-misc.m4 - Autoconf macros originally from GnuPG 2 | dnl Copyright (C) 2017 g10 Code GmbH 3 | dnl 4 | dnl This file is free software; as a special exception the author gives 5 | dnl unlimited permission to copy and/or distribute it, with or without 6 | dnl modifications, as long as this notice is preserved. 7 | dnl 8 | dnl This file is distributed in the hope that it will be useful, but 9 | dnl WITHOUT ANY WARRANTY, to the extent permitted by law; without even the 10 | dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 | dnl SPDX-License-Identifier: FSFULLR 12 | 13 | 14 | dnl Define MKDIR_TAKES_ONE_ARG if mkdir accepts only one argument instead 15 | dnl of the usual 2. 16 | AC_DEFUN([GNUPG_FUNC_MKDIR_TAKES_ONE_ARG], 17 | [AC_CHECK_HEADERS(sys/stat.h unistd.h direct.h) 18 | AC_CACHE_CHECK([if mkdir takes one argument], gnupg_cv_mkdir_takes_one_arg, 19 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 20 | #include 21 | #ifdef HAVE_SYS_STAT_H 22 | # include 23 | #endif 24 | #ifdef HAVE_UNISTD_H 25 | # include 26 | #endif 27 | #ifdef HAVE_DIRECT_H 28 | # include 29 | #endif]], [[mkdir ("foo", 0);]])], 30 | gnupg_cv_mkdir_takes_one_arg=no, gnupg_cv_mkdir_takes_one_arg=yes)]) 31 | if test $gnupg_cv_mkdir_takes_one_arg = yes ; then 32 | AC_DEFINE(MKDIR_TAKES_ONE_ARG,1, 33 | [Defined if mkdir() does not take permission flags]) 34 | fi 35 | ]) 36 | -------------------------------------------------------------------------------- /lang/cl/gpg-error.asd.in: -------------------------------------------------------------------------------- 1 | ;;; -*- Mode: lisp -*- 2 | 3 | ;;; Copyright (C) 2006 g10 Code GmbH 4 | ;;; 5 | ;;; This file is part of libgpg-error. 6 | ;;; 7 | ;;; libgpg-error is free software; you can redistribute it and/or 8 | ;;; modify it under the terms of the GNU Lesser General Public License 9 | ;;; as published by the Free Software Foundation; either version 2.1 of 10 | ;;; the License, or (at your option) any later version. 11 | ;;; 12 | ;;; libgpg-error is distributed in the hope that it will be useful, but 13 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | ;;; Lesser General Public License for more details. 16 | ;;; 17 | ;;; You should have received a copy of the GNU Lesser General Public 18 | ;;; License along with libgpg-error; if not, write to the Free 19 | ;;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | ;;; 02111-1307, USA. 21 | 22 | (defpackage #:gpg-error-system 23 | (:use #:common-lisp #:asdf)) 24 | 25 | (in-package #:gpg-error-system) 26 | 27 | (defsystem gpg-error 28 | :description "Common error values for all GnuPG components." 29 | :author "g10 Code GmbH" 30 | :version "@VERSION@" 31 | :licence "LGPL" 32 | :depends-on ("cffi") 33 | :components ((:file "gpg-error-package") 34 | (:file "gpg-error-codes" 35 | :depends-on ("gpg-error-package")) 36 | (:file "gpg-error" :depends-on ("gpg-error-codes")))) 37 | -------------------------------------------------------------------------------- /src/code-to-errno.c: -------------------------------------------------------------------------------- 1 | /* code-to-errno.c - Mapping error codes to errnos. 2 | Copyright (C) 2003 g10 Code GmbH 3 | 4 | This file is part of libgpg-error. 5 | 6 | libgpg-error is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public License 8 | as published by the Free Software Foundation; either version 2.1 of 9 | the License, or (at your option) any later version. 10 | 11 | libgpg-error is distributed in the hope that it will be useful, but 12 | WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with libgpg-error; if not, write to the Free 18 | Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | 02111-1307, USA. */ 20 | 21 | #if HAVE_CONFIG_H 22 | #include 23 | #endif 24 | 25 | #include 26 | 27 | #include "code-to-errno.h" 28 | 29 | /* Retrieve the system error for the error code CODE. This returns 0 30 | if CODE is not a system error code. */ 31 | int 32 | _gpg_err_code_to_errno (gpg_err_code_t code) 33 | { 34 | if (!(code & GPG_ERR_SYSTEM_ERROR)) 35 | return 0; 36 | code &= ~GPG_ERR_SYSTEM_ERROR; 37 | 38 | if (code < sizeof (err_code_to_errno) / sizeof (err_code_to_errno[0])) 39 | return err_code_to_errno[code]; 40 | else 41 | return 0; 42 | } 43 | -------------------------------------------------------------------------------- /src/strsource-sym.c: -------------------------------------------------------------------------------- 1 | /* strsource-sym.c - Describing an error source with its symbol name. 2 | Copyright (C) 2003, 2004 g10 Code GmbH 3 | 4 | This file is part of libgpg-error. 5 | 6 | libgpg-error is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public License 8 | as published by the Free Software Foundation; either version 2.1 of 9 | the License, or (at your option) any later version. 10 | 11 | libgpg-error is distributed in the hope that it will be useful, but 12 | WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with libgpg-error; if not, write to the Free 18 | Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | 02111-1307, USA. */ 20 | 21 | #if HAVE_CONFIG_H 22 | #include 23 | #endif 24 | 25 | #include 26 | 27 | #include 28 | 29 | #include "err-sources-sym.h" 30 | 31 | /* Return a pointer to a string containing the name of the symbol of 32 | the error source in the error value ERR. Returns NULL if the error 33 | code is not known. */ 34 | const char * 35 | gpg_strsource_sym (gpg_error_t err) 36 | { 37 | gpg_err_source_t source = gpg_err_source (err); 38 | 39 | if (msgidxof (source) == msgidxof (GPG_ERR_SOURCE_DIM)) 40 | return NULL; 41 | 42 | return msgstr + msgidx[msgidxof (source)]; 43 | } 44 | -------------------------------------------------------------------------------- /m4/lock.m4: -------------------------------------------------------------------------------- 1 | # lock.m4 serial 13 (gettext-0.18.2) 2 | dnl Copyright (C) 2005-2014 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | dnl From Bruno Haible. 8 | 9 | AC_DEFUN([gl_LOCK], 10 | [ 11 | AC_REQUIRE([gl_THREADLIB]) 12 | if test "$gl_threads_api" = posix; then 13 | # OSF/1 4.0 and Mac OS X 10.1 lack the pthread_rwlock_t type and the 14 | # pthread_rwlock_* functions. 15 | AC_CHECK_TYPE([pthread_rwlock_t], 16 | [AC_DEFINE([HAVE_PTHREAD_RWLOCK], [1], 17 | [Define if the POSIX multithreading library has read/write locks.])], 18 | [], 19 | [#include ]) 20 | # glibc defines PTHREAD_MUTEX_RECURSIVE as enum, not as a macro. 21 | AC_COMPILE_IFELSE([ 22 | AC_LANG_PROGRAM( 23 | [[#include ]], 24 | [[ 25 | #if __FreeBSD__ == 4 26 | error "No, in FreeBSD 4.0 recursive mutexes actually don't work." 27 | #elif (defined __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ \ 28 | && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070) 29 | error "No, in Mac OS X < 10.7 recursive mutexes actually don't work." 30 | #else 31 | int x = (int)PTHREAD_MUTEX_RECURSIVE; 32 | return !x; 33 | #endif 34 | ]])], 35 | [AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE], [1], 36 | [Define if the defines PTHREAD_MUTEX_RECURSIVE.])]) 37 | fi 38 | gl_PREREQ_LOCK 39 | ]) 40 | 41 | # Prerequisites of lib/glthread/lock.c. 42 | AC_DEFUN([gl_PREREQ_LOCK], [:]) 43 | -------------------------------------------------------------------------------- /gpgscm/LICENSE.TinySCHEME: -------------------------------------------------------------------------------- 1 | LICENSE TERMS 2 | 3 | Copyright (c) 2000, Dimitrios Souflis 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are 8 | met: 9 | 10 | Redistributions of source code must retain the above copyright notice, 11 | this list of conditions and the following disclaimer. 12 | 13 | Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in the 15 | documentation and/or other materials provided with the distribution. 16 | 17 | Neither the name of Dimitrios Souflis nor the names of the 18 | contributors may be used to endorse or promote products derived from 19 | this software without specific prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR 25 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 26 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 27 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 28 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 29 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 30 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 31 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | -------------------------------------------------------------------------------- /libgpg-error.spec.in: -------------------------------------------------------------------------------- 1 | # This is a template. The dist target uses it to create the real file. 2 | Summary: libgpg-error 3 | Name: libgpg-error 4 | Version: @pkg_version@ 5 | Release: 1 6 | URL: ftp://ftp.gnupg.org/gcrypt/alpha/libgpg-error/ 7 | Source: ftp://ftp.gnupg.org/gcrypt/alpha/libgpg-error/%{name}-%{version}.tar.gz 8 | Group: Development/Libraries 9 | Copyright: LGPL 10 | BuildRoot: %{_tmppath}/%{name}-%{version} 11 | BuildRequires: make 12 | Prereq: /sbin/ldconfig 13 | 14 | %description 15 | This is a library that defines common error values for all GnuPG 16 | components. Among these are GPG, GPGSM, GPGME, GPG-Agent, libgcrypt, 17 | pinentry, SmartCard Daemon and possibly more in the future. 18 | 19 | %prep 20 | %setup -q 21 | 22 | %build 23 | CFLAGS="$RPM_OPT_FLAGS"; export CFLAGS 24 | ./configure --prefix=/usr 25 | make 26 | 27 | %install 28 | rm -fr $RPM_BUILD_ROOT 29 | mkdir -p $RPM_BUILD_ROOT 30 | make install prefix=$RPM_BUILD_ROOT/usr 31 | 32 | %clean 33 | rm -fr $RPM_BUILD_ROOT 34 | make distclean 35 | 36 | %post 37 | /sbin/ldconfig 38 | 39 | %postun 40 | /sbin/ldconfig 41 | 42 | %files 43 | %defattr(-,root,root) 44 | %doc COPYING COPYING.LIB AUTHORS README INSTALL NEWS ChangeLog 45 | %attr(0755,root,root) %{_bindir}/gpg-error-config 46 | %attr(0755,root,root) %{_bindir}/gpg-error 47 | %attr(0755,root,root) %{_libdir}/*gpg-error.so* 48 | %attr(0755,root,root) %{_libdir}/*gpg-error.la 49 | %attr(0644,root,root) %{_libdir}/*gpg-error.a 50 | %{_includedir}/gpg-error.h 51 | %{_datadir}/aclocal/gpg-error.m4 52 | 53 | %changelog 54 | * Wed Sep 3 2003 Robert Schiele 55 | - initial specfile. 56 | 57 | # EOF 58 | -------------------------------------------------------------------------------- /src/syscfg/lock-obj-pub.mingw32.h: -------------------------------------------------------------------------------- 1 | ## w32-lock-obj-pub.in - Include fragment for gpg-error.h -*- c-*- 2 | ## Copyright (C) 2014 g10 Code GmbH 3 | ## 4 | ## This file is free software; as a special exception the author gives 5 | ## unlimited permission to copy and/or distribute it, with or without 6 | ## modifications, as long as this notice is preserved. 7 | ## 8 | ## This file is distributed in the hope that it will be useful, but 9 | ## WITHOUT ANY WARRANTY, to the extent permitted by law; without even the 10 | ## implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 | ## 12 | ## 13 | ## This file defines the public version of the lock object for 32 bit 14 | ## Windows. The actual used version is in w32-lock-obj.h. This file 15 | ## is inserted into gpg-error.h by mkheader.c. The tool 16 | ## gen-w32-lock-obj.c has been used to construct it. 17 | 18 | #ifdef _WIN64 19 | 20 | #pragma pack(push, 8) 21 | typedef struct 22 | { 23 | volatile unsigned char priv[56]; 24 | } gpgrt_lock_t; 25 | #pragma pack(pop) 26 | 27 | #define GPGRT_LOCK_INITIALIZER {{1,0,0,0,0,0,0,0,255,255,255,255, \ 28 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, \ 29 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, \ 30 | 0,0,0,0,0,0,0,0,0,0,0,0}} 31 | 32 | #else 33 | 34 | #pragma pack(push, 8) 35 | typedef struct 36 | { 37 | volatile unsigned char priv[36]; 38 | } gpgrt_lock_t; 39 | #pragma pack(pop) 40 | 41 | #define GPGRT_LOCK_INITIALIZER {{1,0,0,0,0,0,0,0,255,255,255,255, \ 42 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, \ 43 | 0,0,0,0,0,0,0,0}} 44 | #endif 45 | -------------------------------------------------------------------------------- /lang/cl/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for libgpg-error. 2 | # Copyright (C) 2003, 2006 g10 Code GmbH 3 | # 4 | # This file is part of libgpg-error. 5 | # 6 | # libgpg-error is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU Lesser General Public License as 8 | # published by the Free Software Foundation; either version 2.1 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # libgpg-error is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public 17 | # License along with this program; if not, write to the Free Software 18 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 19 | 20 | distributed_clfiles = gpg-error.asd \ 21 | gpg-error-package.lisp gpg-error.lisp 22 | 23 | generated_clfiles = gpg-error-codes.lisp 24 | 25 | clfiles = $(distributed_clfiles) $(generated_clfiles) 26 | 27 | # FIXME: Should be configurable. 28 | clfilesdir = $(datadir)/common-lisp/source/gpg-error 29 | dist_clfiles_DATA = $(distributed_clfiles) 30 | nodist_clfiles_DATA = $(generated_clfiles) 31 | 32 | EXTRA_DIST = README mkerrcodes.awk 33 | CLEANFILES = gpg-error-codes.lisp 34 | 35 | codes_file = $(top_srcdir)/src/err-codes.h.in 36 | errno_file = $(top_srcdir)/src/errnos.in 37 | 38 | gpg-error-codes.lisp: Makefile mkerrcodes.awk $(codes_file) $(errno_file) 39 | echo '@errnos@' | cat $(codes_file) - $(errno_file) \ 40 | | $(AWK) -f $(srcdir)/mkerrcodes.awk >$@ 41 | -------------------------------------------------------------------------------- /tests/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for libgpg-error/tests. 2 | # Copyright (C) 2003 g10 Code GmbH 3 | # 4 | # This file is part of libgpg-error. 5 | # 6 | # libgpg-error is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU Lesser General Public License as 8 | # published by the Free Software Foundation; either version 2.1 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # libgpg-error is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public 17 | # License along with this program; if not, write to the Free Software 18 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 19 | 20 | ## Process this file with automake to produce Makefile.in 21 | 22 | EXTRA_DIST = t-argparse.conf etc/t-argparse.conf etc/Registry 23 | 24 | gpg_error_lib = ../src/libgpg-error.la 25 | 26 | TESTS = t-version t-strerror t-syserror t-lock t-printf t-poll t-b64 \ 27 | t-argparse t-logging t-stringutils t-malloc t-spawn t-strlist \ 28 | t-name-value 29 | 30 | if HAVE_LOCK_OPTIMIZATION 31 | TESTS += t-lock-single-posix 32 | endif 33 | 34 | AM_CPPFLAGS = -I$(top_builddir)/src 35 | 36 | if HAVE_W32_SYSTEM 37 | AM_LDFLAGS = -no-fast-install 38 | else 39 | AM_LDFLAGS = -no-install 40 | endif 41 | LDADD = $(gpg_error_lib) @LDADD_FOR_TESTS_KLUDGE@ 42 | 43 | noinst_PROGRAMS = $(TESTS) 44 | noinst_HEADERS = t-common.h 45 | 46 | t_lock_LDADD = $(LDADD) $(LIBMULTITHREAD) 47 | t_poll_LDADD = $(LDADD) $(LIBMULTITHREAD) 48 | -------------------------------------------------------------------------------- /src/gen-w32-lock-obj.c: -------------------------------------------------------------------------------- 1 | /* gen-w32-lock-obj.c - Build tool to get the size of the lock object. 2 | Copyright (C) 2014 g10 Code GmbH 3 | 4 | This file is part of libgpg-error. 5 | 6 | libgpg-error is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public License 8 | as published by the Free Software Foundation; either version 2.1 of 9 | the License, or (at your option) any later version. 10 | 11 | libgpg-error is distributed in the hope that it will be useful, but 12 | WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with this program; if not, see . 18 | */ 19 | 20 | #if HAVE_CONFIG_H 21 | #include 22 | #endif 23 | 24 | #ifndef HAVE_W32_SYSTEM 25 | # error This module may only be build for Windows. 26 | #endif 27 | 28 | #include 29 | #include 30 | #include 31 | 32 | #include "w32-lock-obj.h" 33 | 34 | 35 | int 36 | main (void) 37 | { 38 | _gpgrt_lock_t lk; 39 | unsigned char *p; 40 | int i; 41 | 42 | printf ("sizeof CRITICAL_SECTION = %u\n", (int)sizeof (CRITICAL_SECTION)); 43 | printf ("sizeof _gpgrt_lock_t = %u\n", (int)sizeof lk); 44 | 45 | memset (&lk, 0, sizeof lk); 46 | lk.vers = LOCK_ABI_VERSION; 47 | lk.started = -1; 48 | printf ("#define GPGRT_LOCK_INITIALIZER {"); 49 | p = (unsigned char *)&lk; 50 | for (i=0; i < sizeof lk - 1; i++) 51 | printf ("%u,", p[i]); 52 | printf ("%u}\n", p[sizeof(lk)-1]); 53 | 54 | return 0; 55 | } 56 | -------------------------------------------------------------------------------- /m4/estream.m4: -------------------------------------------------------------------------------- 1 | dnl Autoconf macros for libestream 2 | dnl Copyright (C) 2007 g10 Code GmbH 3 | dnl 4 | dnl This file is free software; as a special exception the author gives 5 | dnl unlimited permission to copy and/or distribute it, with or without 6 | dnl modifications, as long as this notice is preserved. 7 | dnl 8 | dnl This file is distributed in the hope that it will be useful, but 9 | dnl WITHOUT ANY WARRANTY, to the extent permitted by law; without even the 10 | dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 | 12 | 13 | dnl estream_PRINTF_INIT 14 | dnl Prepare build of source included estream-printf.c 15 | dnl 16 | AC_DEFUN([estream_PRINTF_INIT], 17 | [ 18 | AC_MSG_NOTICE([checking system features for estream-printf]) 19 | AC_CHECK_HEADERS(stdint.h) 20 | AC_TYPE_LONG_LONG_INT 21 | AC_TYPE_LONG_DOUBLE 22 | AC_TYPE_INTMAX_T 23 | AC_TYPE_UINTMAX_T 24 | AC_CHECK_TYPES([ptrdiff_t]) 25 | AC_CHECK_SIZEOF([unsigned long]) 26 | AC_CHECK_SIZEOF([void *]) 27 | AC_CACHE_CHECK([for nl_langinfo and THOUSEP], 28 | estream_cv_langinfo_thousep, 29 | [AC_LINK_IFELSE( 30 | [AC_LANG_PROGRAM([[#include ]], 31 | [[char* cs = nl_langinfo(THOUSEP); return !cs;]])], 32 | estream_cv_langinfo_thousep=yes, 33 | estream_cv_langinfo_thousep=no) 34 | ]) 35 | if test $estream_cv_langinfo_thousep = yes; then 36 | AC_DEFINE(HAVE_LANGINFO_THOUSEP, 1, 37 | [Define if you have and nl_langinfo(THOUSEP).]) 38 | fi 39 | ]) 40 | 41 | 42 | dnl estream_INIT 43 | dnl Prepare build of source included estream.c 44 | dnl 45 | AC_DEFUN([estream_INIT], 46 | [ 47 | AC_REQUIRE([estream_PRINTF_INIT]) 48 | AC_MSG_NOTICE([checking system features for estream]) 49 | AC_CHECK_FUNCS([memrchr]) 50 | ]) 51 | -------------------------------------------------------------------------------- /gpgscm/time.scm: -------------------------------------------------------------------------------- 1 | ;; Simple time manipulation library. 2 | ;; Copyright (C) 2017 g10 Code GmbH 3 | ;; 4 | ;; This file is part of Libgpg-error. 5 | ;; 6 | ;; Libgpg-error is free software; you can redistribute it and/or 7 | ;; modify it under the terms of the GNU Lesser General Public License 8 | ;; as published by the Free Software Foundation; either version 2.1 of 9 | ;; the License, or (at your option) any later version. 10 | ;; 11 | ;; Libgpg-error is distributed in the hope that it will be useful, but 12 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | ;; Lesser General Public License for more details. 15 | ;; 16 | ;; You should have received a copy of the GNU Lesser General Public 17 | ;; License along with this program; if not, see . 18 | 19 | ;; This library mimics what GnuPG thinks about expiration times. 20 | ;; Granularity is one second. Its focus is not on correctness. 21 | 22 | ;; Conversion functions. 23 | (define (minutes->seconds minutes) 24 | (* minutes 60)) 25 | (define (hours->seconds hours) 26 | (* hours 60 60)) 27 | (define (days->seconds days) 28 | (* days 24 60 60)) 29 | (define (weeks->seconds weeks) 30 | (days->seconds (* weeks 7))) 31 | (define (months->seconds months) 32 | (days->seconds (* months 30))) 33 | (define (years->seconds years) 34 | (days->seconds (* years 365))) 35 | 36 | (define (time-matches? a b slack) 37 | (< (abs (- a b)) slack)) 38 | (assert (time-matches? (hours->seconds 1) (hours->seconds 2) (hours->seconds 2))) 39 | (assert (time-matches? (hours->seconds 2) (hours->seconds 1) (hours->seconds 2))) 40 | (assert (not (time-matches? (hours->seconds 4) (hours->seconds 1) (hours->seconds 2)))) 41 | (assert (not (time-matches? (hours->seconds 1) (hours->seconds 4) (hours->seconds 2)))) 42 | -------------------------------------------------------------------------------- /gpgscm/Makefile.am: -------------------------------------------------------------------------------- 1 | # TinyScheme-based test driver. 2 | # 3 | # Copyright (C) 2016 g10 Code GmbH 4 | # 5 | # This file is part of Libgpg-error. 6 | # 7 | # Libgpg-error is free software; you can redistribute it and/or 8 | # modify it under the terms of the GNU Lesser General Public License 9 | # as published by the Free Software Foundation; either version 2.1 of 10 | # the License, or (at your option) any later version. 11 | # 12 | # Libgpg-error is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | # Lesser General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU Lesser General Public 18 | # License along with this program; if not, see . 19 | 20 | EXTRA_DIST = \ 21 | LICENSE.TinySCHEME \ 22 | Manual.txt \ 23 | ffi.scm \ 24 | init.scm \ 25 | lib.scm \ 26 | makefile.scm \ 27 | repl.scm \ 28 | t-child.scm \ 29 | xml.scm \ 30 | tests.scm \ 31 | gnupg.scm \ 32 | time.scm 33 | 34 | AM_CFLAGS = 35 | 36 | CLEANFILES = 37 | 38 | bin_PROGRAMS = gpgscm 39 | noinst_PROGRAMS = t-child 40 | 41 | gpgscm_CFLAGS = -imacros scheme-config.h 42 | gpgscm_SOURCES = main.c private.h ffi.c ffi.h ffi-private.h \ 43 | scheme-config.h scheme.c scheme.h scheme-private.h \ 44 | opdefines.h small-integers.h 45 | gpgscm_LDADD = $(LDADD) $(LIBREADLINE) ../src/libgpg-error.la $(LTLIBINTL) 46 | 47 | t_child_SOURCES = t-child.c 48 | 49 | # Make sure that all libs are build before we use them. This is 50 | # important for parallel builds (i.e. make -j2). 51 | $(PROGRAMS): ../src/libgpg-error.la 52 | 53 | # Temporary disabled (2017-11-29) 54 | #check-local: gpgscm$(EXEEXT) t-child$(EXEEXT) 55 | # EXEEXT=$(EXEEXT) GPGSCM_PATH=$(srcdir) \ 56 | # ./gpgscm$(EXEEXT) $(srcdir)/t-child.scm 57 | -------------------------------------------------------------------------------- /src/strerror-sym.c: -------------------------------------------------------------------------------- 1 | /* strerror-sym.c - Describing an error code with its symbol name. 2 | Copyright (C) 2003, 2004 g10 Code GmbH 3 | 4 | This file is part of libgpg-error. 5 | 6 | libgpg-error is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public License 8 | as published by the Free Software Foundation; either version 2.1 of 9 | the License, or (at your option) any later version. 10 | 11 | libgpg-error is distributed in the hope that it will be useful, but 12 | WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with libgpg-error; if not, write to the Free 18 | Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | 02111-1307, USA. */ 20 | 21 | #if HAVE_CONFIG_H 22 | #include 23 | #endif 24 | 25 | #include 26 | 27 | #include 28 | 29 | #include "err-codes-sym.h" 30 | #include "errnos-sym.h" 31 | 32 | /* Return a pointer to a string containing the name of the symbol of 33 | the error code in the error value ERR. Returns NULL if the error 34 | code is not known. */ 35 | const char * 36 | gpg_strerror_sym (gpg_error_t err) 37 | { 38 | gpg_err_code_t code = gpg_err_code (err); 39 | 40 | if (code & GPG_ERR_SYSTEM_ERROR) 41 | { 42 | int idx; 43 | 44 | code &= ~GPG_ERR_SYSTEM_ERROR; 45 | idx = errnos_msgidxof (code); 46 | if (idx >= 0) 47 | return errnos_msgstr + errnos_msgidx[idx]; 48 | else 49 | return NULL; 50 | } 51 | 52 | if (msgidxof (code) == msgidxof (GPG_ERR_CODE_DIM)) 53 | return NULL; 54 | 55 | return msgstr + msgidx[msgidxof (code)]; 56 | } 57 | -------------------------------------------------------------------------------- /tests/t-argparse.conf: -------------------------------------------------------------------------------- 1 | # User test config file for t-argparse 2 | 3 | [-echo begin of user config (user=${user})] 4 | [+verbose] 5 | # Options applied to all user's config files 6 | echo 7 | 8 | # The next should be flagged as unexpected meta command. 9 | #[ignore] 10 | 11 | # The command mode enables git style commands. As usual it can be 12 | # prefixed with a + to enable or a with a - to disable this feature. 13 | # The last seen in any config file is used. 14 | #[command-mode] 15 | 16 | my-option 4711 17 | 18 | not-my-option 19 | 20 | verbose 21 | 22 | [let user ${_}Montgomery Scott$_$_ ] 23 | [-echo The name of the user is: "$user". ] 24 | [getenv foo FOO] 25 | [if $_verbose] 26 | [-echo foo=$foo] 27 | [fi] 28 | [getenv home HOME] 29 | [getenv path PATH ] 30 | [if $_verbose] 31 | [-echo home=$home path=$path] 32 | [fi] 33 | 34 | [-info checking user] 35 | [if $user = Scottie's engines ] 36 | [fi] 37 | [-info checking substring check] 38 | [getenv home $HOME] 39 | [if $home =~ home ] 40 | [-echo in home condition] 41 | [fi] 42 | [expand] 43 | [if $foo -n ] 44 | cross-ref "$home/project/$user.crf" 45 | [-echo FOO is set] 46 | [if $home -n] 47 | [-echo home is set] 48 | [else] 49 | [-echo home is not set] 50 | [fi] 51 | [else] 52 | [-echo FOO is not set] 53 | [fi] 54 | street Mühlenstraße 55 | 56 | [getreg x hkcu\fhghfkhkfh] 57 | [if $_windows] 58 | [if $x] 59 | street $x 60 | [fi] 61 | [fi] 62 | 63 | # Print some infos from our strusage function 64 | [-echo strusage(9)=${_strusage9}] 65 | [-echo strusage(11)=${_strusage11}] 66 | [-echo strusage(13)=${_strusage13}] 67 | [-echo pgm="$_pgm" ver="$_version"] 68 | [if $_version -v3gt 6.42.16] 69 | [-echo is > 6.42.16] 70 | [fi] 71 | [if $_version -v3ge 6.42.17] 72 | [-echo is >= 6.42.17] 73 | [fi] 74 | [if $_version -v3lt 6.42.17] 75 | [else] 76 | [-echo is not < 6.42.17] 77 | [fi] 78 | [-echo end of user config] 79 | -------------------------------------------------------------------------------- /src/posix-thread.c: -------------------------------------------------------------------------------- 1 | /* posix-thread.c - GPGRT thread functions for POSIX systems 2 | Copyright (C) 2014 g10 Code GmbH 3 | 4 | This file is part of libgpg-error. 5 | 6 | libgpg-error is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public License 8 | as published by the Free Software Foundation; either version 2.1 of 9 | the License, or (at your option) any later version. 10 | 11 | libgpg-error is distributed in the hope that it will be useful, but 12 | WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with this program; if not, see . 18 | */ 19 | 20 | #if HAVE_CONFIG_H 21 | #include 22 | #endif 23 | 24 | #ifdef HAVE_W32_SYSTEM 25 | # error This module may not be build for Windows. 26 | #endif 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include /* Get posix option macros. */ 33 | 34 | #if USE_POSIX_THREADS 35 | # ifdef _POSIX_PRIORITY_SCHEDULING 36 | # include 37 | # endif 38 | #elif USE_SOLARIS_THREADS 39 | # include 40 | #endif 41 | 42 | #include "gpgrt-int.h" 43 | 44 | #include "thread.h" 45 | 46 | 47 | 48 | gpg_err_code_t 49 | _gpgrt_yield (void) 50 | { 51 | #if USE_POSIX_THREADS 52 | # ifdef _POSIX_PRIORITY_SCHEDULING 53 | _gpgrt_pre_syscall (); 54 | sched_yield (); 55 | _gpgrt_post_syscall (); 56 | # else 57 | return GPG_ERR_NOT_SUPPORTED; 58 | # endif 59 | #elif USE_SOLARIS_THREADS 60 | _gpgrt_pre_syscall (); 61 | thr_yield (); 62 | _gpgrt_post_syscall (); 63 | #else 64 | return GPG_ERR_NOT_SUPPORTED; 65 | #endif 66 | 67 | return 0; 68 | } 69 | -------------------------------------------------------------------------------- /gpgscm/private.h: -------------------------------------------------------------------------------- 1 | /* TinyScheme-based test driver. 2 | * Copyright (C) 2016 g10 code GmbH 3 | * 4 | * This file is part of Libgpg-error. 5 | * 6 | * Libgpg-error is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public License 8 | * as published by the Free Software Foundation; either version 2.1 of 9 | * the License, or (at your option) any later version. 10 | * 11 | * Libgpg-error is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this program; if not, see . 18 | */ 19 | 20 | #ifndef GPGSCM_PRIVATE_H 21 | #define GPGSCM_PRIVATE_H 22 | 23 | 24 | #include "../src/gpgrt.h" 25 | 26 | /* 27 | * Internal i18n macros. 28 | */ 29 | #ifdef ENABLE_NLS 30 | # ifdef HAVE_W32_SYSTEM 31 | # include "gettext.h" 32 | # else 33 | # include 34 | # endif 35 | # define _(a) gettext (a) 36 | # ifdef gettext_noop 37 | # define N_(a) gettext_noop (a) 38 | # else 39 | # define N_(a) (a) 40 | # endif 41 | #else /*!ENABLE_NLS*/ 42 | # define _(a) (a) 43 | # define N_(a) (a) 44 | #endif /*!ENABLE_NLS */ 45 | 46 | #define xfree(a) gpgrt_free ((a)) 47 | #define xtrymalloc(a) gpgrt_malloc ((a)) 48 | #define xtrycalloc(a,b) gpgrt_calloc ((a),(b)) 49 | #define xtryrealloc(a,b) gpgrt_realloc ((a),(b)) 50 | 51 | 52 | static GPGRT_INLINE void * 53 | xmalloc (size_t n) 54 | { 55 | void *p = gpgrt_malloc (n); 56 | if (!p) 57 | log_fatal ("malloc failed: %s\n", strerror (errno)); 58 | return p; 59 | } 60 | 61 | static GPGRT_INLINE char * 62 | xstrdup (const char *s) 63 | { 64 | char *p = gpgrt_malloc (strlen (s) + 1); 65 | strcpy (p, s); 66 | return p; 67 | } 68 | 69 | 70 | extern int verbose; 71 | 72 | 73 | #endif /* GPGSCM_PRIVATE_H */ 74 | -------------------------------------------------------------------------------- /gpgscm/ffi.scm: -------------------------------------------------------------------------------- 1 | ;; FFI interface for TinySCHEME. 2 | ;; Copyright (C) 2016 g10 Code GmbH 3 | ;; 4 | ;; This file is part of Libgpg-error. 5 | ;; 6 | ;; Libgpg-error is free software; you can redistribute it and/or 7 | ;; modify it under the terms of the GNU Lesser General Public License 8 | ;; as published by the Free Software Foundation; either version 2.1 of 9 | ;; the License, or (at your option) any later version. 10 | ;; 11 | ;; Libgpg-error is distributed in the hope that it will be useful, but 12 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | ;; Lesser General Public License for more details. 15 | ;; 16 | ;; You should have received a copy of the GNU Lesser General Public 17 | ;; License along with this program; if not, see . 18 | 19 | 20 | ;; Foreign function wrapper. Expects F to return a list with the 21 | ;; first element being the `error_t' value returned by the foreign 22 | ;; function. The error is thrown, or the cdr of the result is 23 | ;; returned. 24 | (define (ffi-apply name f args) 25 | (let ((result (apply f args))) 26 | (cond 27 | ((string? result) 28 | (ffi-fail name args result)) 29 | ((not (= (car result) 0)) 30 | (ffi-fail name args (strerror (car result)))) 31 | ((and (= (car result) 0) (pair? (cdr result))) (cadr result)) 32 | ((= (car result) 0) '()) 33 | (else 34 | (throw (list "Result violates FFI calling convention: " result)))))) 35 | 36 | (define (ffi-fail name args message) 37 | (let ((args' (open-output-string))) 38 | (write (cons (string->symbol name) args) args') 39 | (throw (get-output-string args') message))) 40 | 41 | ;; Pseudo-definitions for foreign functions. Evaluates to no code, 42 | ;; but serves as documentation. 43 | (macro (ffi-define form)) 44 | 45 | ;; Runtime support. 46 | 47 | ;; Low-level mechanism to terminate the process. 48 | (ffi-define (_exit status)) 49 | 50 | ;; Get the current time in seconds since the epoch. 51 | (ffi-define (get-time)) 52 | -------------------------------------------------------------------------------- /tests/t-strerror.c: -------------------------------------------------------------------------------- 1 | /* t-strerror.c - Regression test. 2 | Copyright (C) 2003 g10 Code GmbH 3 | 4 | This file is part of libgpg-error. 5 | 6 | libgpg-error is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public License 8 | as published by the Free Software Foundation; either version 2.1 of 9 | the License, or (at your option) any later version. 10 | 11 | libgpg-error is distributed in the hope that it will be useful, but 12 | WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with libgpgme-error; if not, write to the Free 18 | Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | 02111-1307, USA. */ 20 | 21 | #if HAVE_CONFIG_H 22 | #include 23 | #endif 24 | 25 | #include 26 | #if HAVE_STDLIB_H 27 | #include 28 | #endif 29 | 30 | #include 31 | 32 | int 33 | main (int argc, char *argv[]) 34 | { 35 | if (argc > 1) 36 | { 37 | int i = 1; 38 | while (i + 1 < argc) 39 | { 40 | gpg_error_t err = gpg_err_make (atoi (argv[i]), atoi (argv[i + 1])); 41 | printf ("%s: %s\n", gpg_strsource (err), gpg_strerror (err)); 42 | i += 2; 43 | } 44 | } 45 | else 46 | { 47 | struct 48 | { 49 | gpg_err_source_t src; 50 | gpg_err_code_t code; 51 | } list[] = { { 0, 0 }, { 1, 201 }, { 2, 2 }, { 3, 102 }, 52 | { 4, 100 }, { 5, 99 }, { 6, 110 }, { 7, 7 }, { 8, 888 }, 53 | { 1, GPG_ERR_SYSTEM_ERROR | 1 }, 54 | { 1, GPG_ERR_SYSTEM_ERROR | 35 }, 55 | { 1, GPG_ERR_SYSTEM_ERROR | 81 } }; 56 | int i = 0; 57 | 58 | while (i < sizeof (list) / sizeof (list[0])) 59 | { 60 | gpg_error_t err = gpg_err_make (list[i].src, list[i].code); 61 | printf ("%s: %s\n", gpg_strsource (err), gpg_strerror (err)); 62 | i++; 63 | } 64 | } 65 | return 0; 66 | } 67 | -------------------------------------------------------------------------------- /gpgscm/gnupg.scm: -------------------------------------------------------------------------------- 1 | ;; Common definitions for executing gpg and related tools. 2 | ;; Copyright (C) 2016, 2017 g10 Code GmbH 3 | ;; 4 | ;; This file is part of Libgpg-error. 5 | ;; 6 | ;; Libgpg-error is free software; you can redistribute it and/or 7 | ;; modify it under the terms of the GNU Lesser General Public License 8 | ;; as published by the Free Software Foundation; either version 2.1 of 9 | ;; the License, or (at your option) any later version. 10 | ;; 11 | ;; Libgpg-error is distributed in the hope that it will be useful, but 12 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | ;; Lesser General Public License for more details. 15 | ;; 16 | ;; You should have received a copy of the GNU Lesser General Public 17 | ;; License along with this program; if not, see . 18 | 19 | ;; Evaluate a sequence of expressions with the given home directory. 20 | (define-macro (with-home-directory gnupghome . expressions) 21 | (let ((original-home-directory (gensym))) 22 | `(let ((,original-home-directory (getenv "GNUPGHOME"))) 23 | (dynamic-wind 24 | (lambda () (setenv "GNUPGHOME" ,gnupghome #t)) 25 | (lambda () ,@expressions) 26 | (lambda () (setenv "GNUPGHOME" ,original-home-directory #t)))))) 27 | 28 | ;; Evaluate a sequence of expressions with an ephemeral home 29 | ;; directory. 30 | (define-macro (with-ephemeral-home-directory setup-fn . expressions) 31 | (let ((original-home-directory (gensym)) 32 | (ephemeral-home-directory (gensym)) 33 | (setup (gensym))) 34 | `(let ((,original-home-directory (getenv "GNUPGHOME")) 35 | (,ephemeral-home-directory (mkdtemp)) 36 | (,setup (delay (,setup-fn)))) 37 | (finally (unlink-recursively ,ephemeral-home-directory) 38 | (dynamic-wind 39 | (lambda () 40 | (setenv "GNUPGHOME" ,ephemeral-home-directory #t) 41 | (with-working-directory ,ephemeral-home-directory (force ,setup))) 42 | (lambda () ,@expressions) 43 | (lambda () (setenv "GNUPGHOME" ,original-home-directory #t))))))) 44 | -------------------------------------------------------------------------------- /src/code-from-errno.c: -------------------------------------------------------------------------------- 1 | /* code-from-errno.c - Mapping errnos to error codes. 2 | Copyright (C) 2003 g10 Code GmbH 3 | 4 | This file is part of libgpg-error. 5 | 6 | libgpg-error is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public License 8 | as published by the Free Software Foundation; either version 2.1 of 9 | the License, or (at your option) any later version. 10 | 11 | libgpg-error is distributed in the hope that it will be useful, but 12 | WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with libgpg-error; if not, write to the Free 18 | Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | 02111-1307, USA. */ 20 | 21 | #if HAVE_CONFIG_H 22 | #include 23 | #endif 24 | 25 | #include 26 | 27 | #include 28 | 29 | #include "code-from-errno.h" 30 | 31 | /* Retrieve the error code for the system error ERR. This returns 32 | GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped (report 33 | this). */ 34 | gpg_err_code_t 35 | _gpg_err_code_from_errno (int err) 36 | { 37 | int idx; 38 | 39 | if (!err) 40 | return GPG_ERR_NO_ERROR; 41 | 42 | idx = errno_to_idx (err); 43 | 44 | if (idx < 0) 45 | return GPG_ERR_UNKNOWN_ERRNO; 46 | 47 | return GPG_ERR_SYSTEM_ERROR | err_code_from_index[idx]; 48 | } 49 | 50 | 51 | /* Retrieve the error code directly from the ERRNO variable. This 52 | returns GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped 53 | (report this) and GPG_ERR_MISSING_ERRNO if ERRNO has the value 0. */ 54 | gpg_err_code_t 55 | _gpg_err_code_from_syserror (void) 56 | { 57 | int err = errno; 58 | int idx; 59 | 60 | if (!err) 61 | return GPG_ERR_MISSING_ERRNO; 62 | 63 | idx = errno_to_idx (err); 64 | 65 | if (idx < 0) 66 | return GPG_ERR_UNKNOWN_ERRNO; 67 | 68 | return GPG_ERR_SYSTEM_ERROR | err_code_from_index[idx]; 69 | } 70 | -------------------------------------------------------------------------------- /src/init.h: -------------------------------------------------------------------------------- 1 | /* init.h - Declarations for init.c 2 | Copyright (C) 2010 g10 Code GmbH 3 | 4 | This file is part of libgpg-error. 5 | 6 | libgpg-error is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public License 8 | as published by the Free Software Foundation; either version 2.1 of 9 | the License, or (at your option) any later version. 10 | 11 | libgpg-error is distributed in the hope that it will be useful, but 12 | WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with this program; if not, see . 18 | */ 19 | 20 | #ifndef INIT_H 21 | #define INIT_H 22 | 23 | #if HAVE_W32_SYSTEM 24 | 25 | /* Forward declaration - defined in w32-gettext.c. */ 26 | struct loaded_domain; 27 | 28 | /* An item for a linked list of loaded domains. */ 29 | struct domainlist_s 30 | { 31 | struct domainlist_s *next; 32 | char *dname; /* Directory name for the mo file. */ 33 | char *fname; /* File name for the MO file. */ 34 | int load_failed; /* True if loading the domain failed. */ 35 | struct loaded_domain *domain; /* NULL if not loaded. Never changed 36 | once set to non-NULL. */ 37 | char name[1]; /* Name of the domain. Never changed 38 | once set. */ 39 | }; 40 | 41 | 42 | 43 | /* The TLS space definition. */ 44 | struct tls_space_s 45 | { 46 | /* Flag used by w32-gettext. */ 47 | int gt_use_utf8; 48 | }; 49 | 50 | /* Force UTF8 for new threads. */ 51 | void _gpgrt_w32_utf8_for_new_threads (void); 52 | 53 | /* Return the TLS. */ 54 | struct tls_space_s *get_tls (void); 55 | 56 | 57 | /* Explicit constructors for w32-gettext.c and w32-utils.c */ 58 | #ifndef DLL_EXPORT 59 | void _gpg_w32__init_gettext_module (void); 60 | void _gpgrt_w32__init_utils (void); 61 | #endif 62 | 63 | #endif /*HAVE_W32_SYSTEM*/ 64 | 65 | #endif /*INIT_H*/ 66 | -------------------------------------------------------------------------------- /src/README: -------------------------------------------------------------------------------- 1 | Notes on the source code 2 | ======================== 3 | 4 | The mechanism to generate the system error codes is delicate and 5 | fragile, but it's the best I could come up with that supports 6 | cross-compilation and dynamic self-configuration. Here is how it 7 | works: 8 | 9 | 1. Generate list of supported system error codes. 10 | 11 | mkerrcodes1.awk generates a list of supported system error codes from 12 | errnos.in. Each entry in the list is protected with #ifdef/#endif, 13 | and contains a GPG_ERR_* marker. The list is stored in "_mkerrcodes.h". 14 | 15 | 2. The HOST cpp is run on _mkerrcodes.h. This evaluates the known 16 | system error macros to something (may be a number, maybe a constant 17 | expression as on the GNU/Hurd), suppressing the unknown ones. The 18 | output is piped into step 3. 19 | 20 | 3. The cpp output is filtered with grep for only those lines which 21 | contain a GPG_ERR_* marker. The output is piped into step 4. 22 | 23 | 4. The filtered output is processed by mkerrcodes.awk, which produces 24 | a table of constant expressions plus GPG_ERR_* code string symbols in 25 | a format suitable for the C program mkerrcodes.c. At this point we 26 | are crossing our fingers that the constant expressions produced by the 27 | system do not contain GPG_ERR_* markers. The output is stored in 28 | mkerrcodes.h. 29 | 30 | 5. The file mkerrcodes.h is included by mkerrcodes.c, which is 31 | compiled to a binary executable on the BUILD system. At this point we 32 | are crossing our fingers that the constant expressions produced by the 33 | system do not depend on the build platform anymore. The output is 34 | post-processed by mkerrcodes2.awk and stored in "code-from-errno.h", 35 | which is subsequently used in the library. 36 | 37 | -- Marcus 38 | 39 | Copyright 2006 g10 Code GmbH 40 | 41 | This file is free software; as a special exception the author gives 42 | unlimited permission to copy and/or distribute it, with or without 43 | modifications, as long as this notice is preserved. 44 | 45 | This file is distributed in the hope that it will be useful, but 46 | WITHOUT ANY WARRANTY, to the extent permitted by law; without even the 47 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 48 | -------------------------------------------------------------------------------- /m4/readline.m4: -------------------------------------------------------------------------------- 1 | dnl Check for readline and dependencies 2 | dnl Copyright (C) 2004, 2005 Free Software Foundation, Inc. 3 | dnl 4 | dnl This file is free software, distributed under the terms of the GNU 5 | dnl General Public License. As a special exception to the GNU General 6 | dnl Public License, this file may be distributed as part of a program 7 | dnl that contains a configuration script generated by Autoconf, under 8 | dnl the same distribution terms as the rest of that program. 9 | dnl 10 | dnl Defines HAVE_LIBREADLINE to 1 if a working readline setup is 11 | dnl found, and sets @LIBREADLINE@ to the necessary libraries. 12 | 13 | 14 | AC_DEFUN([GNUPG_CHECK_READLINE], 15 | [ 16 | AC_ARG_WITH(readline, 17 | AS_HELP_STRING([--with-readline=DIR], 18 | [look for the readline library in DIR]), 19 | [_do_readline=$withval],[_do_readline=yes]) 20 | 21 | gnupg_cv_have_readline=no 22 | if test "$_do_readline" != "no" ; then 23 | if test -d "$withval" ; then 24 | CPPFLAGS="${CPPFLAGS} -I$withval/include" 25 | LDFLAGS="${LDFLAGS} -L$withval/lib" 26 | fi 27 | 28 | for _termcap in "" "-ltermcap" "-lcurses" "-lncurses" ; do 29 | _readline_save_libs=$LIBS 30 | _combo="-lreadline${_termcap:+ $_termcap}" 31 | LIBS="$LIBS $_combo" 32 | 33 | AC_MSG_CHECKING([whether readline via "$_combo" is present and sane]) 34 | 35 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 36 | #include 37 | #include 38 | #include 39 | ]],[[ 40 | rl_completion_func_t *completer; 41 | add_history("foobar"); 42 | rl_catch_signals=0; 43 | rl_inhibit_completion=0; 44 | rl_attempted_completion_function=NULL; 45 | rl_completion_matches(NULL,NULL); 46 | ]])],[_found_readline=yes],[_found_readline=no]) 47 | 48 | AC_MSG_RESULT([$_found_readline]) 49 | 50 | LIBS=$_readline_save_libs 51 | 52 | if test $_found_readline = yes ; then 53 | AC_DEFINE(HAVE_LIBREADLINE,1, 54 | [Define to 1 if you have a fully functional readline library.]) 55 | AC_SUBST(LIBREADLINE,$_combo) 56 | gnupg_cv_have_readline=yes 57 | break 58 | fi 59 | done 60 | 61 | unset _termcap 62 | unset _readline_save_libs 63 | unset _combo 64 | unset _found_readline 65 | fi 66 | ])dnl 67 | -------------------------------------------------------------------------------- /gpgscm/t-child.c: -------------------------------------------------------------------------------- 1 | /* Sanity check for the process and IPC primitives. 2 | * Copyright (C) 2016 g10 Code GmbH 3 | * 4 | * This file is part of Libgpg-error. 5 | * 6 | * Libgpg-error is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public License 8 | * as published by the Free Software Foundation; either version 2.1 of 9 | * the License, or (at your option) any later version. 10 | * 11 | * Libgpg-error is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this program; if not, see . 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #ifdef _WIN32 25 | # include 26 | # include 27 | #endif 28 | 29 | int 30 | main (int argc, char **argv) 31 | { 32 | char buffer[4096]; 33 | memset (buffer, 'A', sizeof buffer); 34 | #if _WIN32 35 | if (! setmode (fileno (stdin), O_BINARY)) 36 | return 23; 37 | if (! setmode (fileno (stdout), O_BINARY)) 38 | return 23; 39 | #endif 40 | 41 | if (argc == 1) 42 | return 2; 43 | else if (strcmp (argv[1], "return0") == 0) 44 | return 0; 45 | else if (strcmp (argv[1], "return1") == 0) 46 | return 1; 47 | else if (strcmp (argv[1], "return77") == 0) 48 | return 77; 49 | else if (strcmp (argv[1], "hello_stdout") == 0) 50 | fprintf (stdout, "hello"); 51 | else if (strcmp (argv[1], "hello_stderr") == 0) 52 | fprintf (stderr, "hello"); 53 | else if (strcmp (argv[1], "stdout4096") == 0) 54 | fwrite (buffer, 1, sizeof buffer, stdout); 55 | else if (strcmp (argv[1], "stdout8192") == 0) 56 | { 57 | fwrite (buffer, 1, sizeof buffer, stdout); 58 | fwrite (buffer, 1, sizeof buffer, stdout); 59 | } 60 | else if (strcmp (argv[1], "cat") == 0) 61 | while (! feof (stdin)) 62 | { 63 | size_t bytes_read; 64 | bytes_read = fread (buffer, 1, sizeof buffer, stdin); 65 | fwrite (buffer, 1, bytes_read, stdout); 66 | } 67 | else 68 | { 69 | fprintf (stderr, "unknown command %s\n", argv[1]); 70 | return 2; 71 | } 72 | return 0; 73 | } 74 | -------------------------------------------------------------------------------- /tests/t-syserror.c: -------------------------------------------------------------------------------- 1 | /* t-syserror.c - System error specific regression test. 2 | Copyright (C) 2006 g10 Code GmbH 3 | 4 | This file is part of libgpg-error. 5 | 6 | libgpg-error is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public License 8 | as published by the Free Software Foundation; either version 2.1 of 9 | the License, or (at your option) any later version. 10 | 11 | libgpg-error is distributed in the hope that it will be useful, but 12 | WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with libgpgme-error; if not, write to the Free 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 19 | 02110-1301, USA. */ 20 | 21 | 22 | #if HAVE_CONFIG_H 23 | #include 24 | #endif 25 | 26 | #include 27 | #if HAVE_STDLIB_H 28 | #include 29 | #endif 30 | #include 31 | 32 | #include 33 | 34 | int 35 | main (int argc, char *argv[]) 36 | { 37 | FILE *fp; 38 | int save_errno; 39 | gpg_err_code_t ec; 40 | 41 | (void)argc; 42 | (void)argv; 43 | 44 | fp = fopen ("/does-not-exist/110761/nowhere.foo", "r"); 45 | if (fp) 46 | { 47 | fclose (fp); 48 | fp = fopen (" no this file does not exists foo 4711", "r"); 49 | } 50 | if (fp) 51 | { 52 | fclose (fp); 53 | fprintf (stderr, "unable to run test\n"); 54 | return 1; 55 | } 56 | save_errno = errno; 57 | 58 | ec = gpg_err_code_from_syserror (); 59 | if (ec != GPG_ERR_ENOENT) 60 | { 61 | fprintf (stderr, "fopen failed with bad code: %d\n", save_errno); 62 | return 1; 63 | } 64 | 65 | if (ec != gpg_err_code_from_errno (save_errno)) 66 | { 67 | fprintf (stderr, "oops at %d\n",__LINE__); 68 | return 1; 69 | } 70 | 71 | gpg_err_set_errno (0); 72 | 73 | ec = gpg_err_code_from_syserror (); 74 | if (ec != GPG_ERR_MISSING_ERRNO) 75 | { 76 | fprintf (stderr, "oops at %d\n",__LINE__); 77 | return 1; 78 | } 79 | 80 | if ( gpg_err_code_from_errno (0) ) 81 | { 82 | fprintf (stderr, "oops at %d\n",__LINE__); 83 | return 1; 84 | } 85 | 86 | 87 | return 0; 88 | } 89 | -------------------------------------------------------------------------------- /README.GIT: -------------------------------------------------------------------------------- 1 | If you are building from GIT, run the script 2 | 3 | ./autogen.sh 4 | 5 | first, to make sure that you have all the necessary maintainer tools 6 | are installed and to build the actual configuration files. If you 7 | have just checked out from GIT, you should add the option "--force" to 8 | autogen.sh so that meta data is noticed by autom4te.cache. Then run 9 | 10 | ./configure --enable-maintainer-mode 11 | 12 | followed by the usual make. 13 | 14 | If autogen.sh complains about insufficient versions of the required 15 | tools, or the tools are not installed, you may use environment 16 | variables to override the default tool names: 17 | 18 | AUTOMAKE_SUFFIX is used as a suffix for all tools from the automake 19 | package. For example 20 | AUTOMAKE_SUFFIX="-1.14" ./autogen.sh 21 | uses "automake-1.14" and "aclocal-1.14. 22 | AUTOMAKE_PREFIX is used as a prefix for all tools from the automake 23 | page and may be combined with AUTOMAKE_SUFFIX. e.g.: 24 | AUTOMAKE_PREFIX=/usr/foo/bin ./autogen.sh 25 | uses "automake" and "aclocal" in the /usr/foo/bin 26 | directory. 27 | AUTOCONF_SUFFIX is used as a suffix for all tools from the automake 28 | package 29 | AUTOCONF_PREFIX is used as a prefix for all tools from the automake 30 | package 31 | GETTEXT_SUFFIX is used as a suffix for all tools from the gettext 32 | package 33 | GETTEXT_PREFIX is used as a prefix for all tools from the gettext 34 | package 35 | 36 | It is also possible to use the variable name AUTOMAKE, AUTOCONF, 37 | ACLOCAL, AUTOHEADER, GETTEXT and MSGMERGE to directly specify the name 38 | of the programs to run. It is however better to use the suffix and 39 | prefix forms as described above because that does not require 40 | knowledge about the actual tools used by autogen.sh. 41 | 42 | 43 | Please don't use autopoint, libtoolize or autoreconf unless you are 44 | the current maintainer and want to update the standard configuration 45 | files. All those files should be in GIT and only updated manually 46 | if the maintainer decides that newer versions are required. The 47 | maintainer should also make sure that the required version of automake 48 | et al. are properly indicated at the top of configure.ac and take care 49 | to copy the files and not merely use symlinks. 50 | -------------------------------------------------------------------------------- /lang/cl/gpg-error-package.lisp: -------------------------------------------------------------------------------- 1 | ;;;; libgpg-error-package.lisp 2 | 3 | ;;; Copyright (C) 2006 g10 Code GmbH 4 | ;;; 5 | ;;; This file is part of libgpg-error. 6 | ;;; 7 | ;;; libgpg-error is free software; you can redistribute it and/or 8 | ;;; modify it under the terms of the GNU Lesser General Public License 9 | ;;; as published by the Free Software Foundation; either version 2.1 of 10 | ;;; the License, or (at your option) any later version. 11 | ;;; 12 | ;;; libgpg-error is distributed in the hope that it will be useful, but 13 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | ;;; Lesser General Public License for more details. 16 | ;;; 17 | ;;; You should have received a copy of the GNU Lesser General Public 18 | ;;; License along with libgpg-error; if not, write to the Free 19 | ;;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | ;;; 02111-1307, USA. 21 | 22 | ;;; Conventions 23 | ;;; 24 | ;;; Error sources and codes are represented as keywords like 25 | ;;; :gpg-err-source-gpg and :gpg-err-unknown-packet. 26 | ;;; 27 | ;;; Errors are represented as lists '(SOURCE CODE). Other 28 | ;;; representations are also accepted in some places. 29 | ;;; 30 | ;;; The following functions are defined which are not defined in the C API: 31 | ;;; gpg-err-source-as-key, gpg-err-source-as-value 32 | ;;; gpg-err-code-as-key, gpg-err-code-as-value 33 | ;;; gpg-err-canonicalize, gpg-err-as-value 34 | ;;; Conversion between keywords and values for error sources and codes. 35 | ;;; 36 | ;;; The following functions from the C API are omitted: 37 | ;;; gpg-strerror-r 38 | ;;; 39 | ;;; The following features work slightly differently: 40 | ;;; *gpg-err-source-default* is a dynamic variable that can be set to 41 | ;;; change the default for gpg-error. 42 | 43 | (defpackage #:gpg-error 44 | (:use #:common-lisp #:cffi) 45 | 46 | (:export :gpg-err-code-as-key 47 | :gpg-err-code-as-value 48 | :gpg-err-source-as-key 49 | :gpg-err-source-as-value 50 | :gpg-err-canonicalize 51 | :gpg-err-as-value 52 | :gpg-err-make 53 | :*gpg-err-source-default* 54 | :gpg-error 55 | :gpg-err-code 56 | :gpg-err-source 57 | :gpg-strerror 58 | :gpg-strsource 59 | :gpg-err-code-from-errno 60 | :gpg-err-code-to-errno 61 | :gpg-err-code-from-syserror 62 | :gpg-err-make-from-errno 63 | :gpg-error-from-errno 64 | :gpg-error-from-syserror)) 65 | -------------------------------------------------------------------------------- /tests/etc/t-argparse.conf: -------------------------------------------------------------------------------- 1 | # Global test config file for t-argparse 2 | 3 | # Options applied to all user's config files 4 | #verbose 5 | 6 | 7 | # The meta command echo simply prints the argument. With a dash 8 | # prefix it does not prepend the file name and line number. 9 | [-echo Begin global config] 10 | 11 | [-echo use $${_user} to echo the current user (${_user})] 12 | [-echo use $${_file} to echo the current file (${_file})] 13 | [-echo use $${_line} to echo the current line (${_line})] 14 | [-echo use $${_epoch} to echo a timestamp (${_epoch})] 15 | 16 | [verbose] 17 | 18 | [user joy] 19 | # All the following options are applied only if the current user's 20 | # account name is "joy" (case-insensitive). This ends with the next 21 | # user statement. This does not affect "echo" and "verbose". 22 | 23 | # info is an alias for echo but only executed if a user secion is active. 24 | # For future compatibility do not use percent or dollar signs. 25 | [-info In user Joy but real user id ${user}] 26 | 27 | [-verbose] 28 | [+force] 29 | # All following option are forced and thus ignored when set in user 30 | # config files. Valid until the next [user] statement. Take care 31 | # that there are often "no-", "disable-", or "enable-" versions of 32 | # options; these should be explictly marked as ignored so that they 33 | # can't be used to override the force attribute. 34 | 35 | [ignore] 36 | 37 | # The compliance is set immutable for these users 38 | verbose 39 | 40 | [-force] 41 | not-my-option 42 | 43 | # If uncommented The next shall raise an error due to the garbage at the end. 44 | #[+ignore] fooo 45 | 46 | 47 | [+ignore-all] 48 | # All options are ignored. 49 | 50 | 51 | [-ignore] # Comment at line end 52 | # Options wich shall not be ignored. */ 53 | #no-verbose 54 | 55 | 56 | # Options applied only for user joy end here. 57 | [user wk ] 58 | [-info Options applied only for user wk follow] 59 | 60 | [ignore] 61 | output 62 | [-ignore] 63 | 64 | 65 | # Change the immutable attribute back to mutable. 66 | [-force] 67 | #compliance gnupg 68 | 69 | # Default key for user john 70 | my-option 42 71 | 72 | [expand] 73 | [getreg foo HKCU\Software\GNU\GnuPG:DisableAKR] 74 | disable-akr $foo 75 | [-expand] 76 | 77 | # Options applied only for user joy end here. 78 | [user *] 79 | [-info All the following options are applied only if the] 80 | [-info current user has no specific section above.] 81 | 82 | # The default algorithm for new keys is set to this. 83 | a-long-option 84 | 85 | [-echo End global config] 86 | -------------------------------------------------------------------------------- /src/syscall-clamp.c: -------------------------------------------------------------------------------- 1 | /* syscall-clamp.c - Syscall clamp related stuff 2 | * Copyright (C) 2016, 2017 g10 Code GmbH 3 | * 4 | * This file is part of Libgpg-error. 5 | * 6 | * Libgpg-error is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public License 8 | * as published by the Free Software Foundation; either version 2.1 of 9 | * the License, or (at your option) any later version. 10 | * 11 | * Libgpg-error is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this program; if not, see . 18 | * SPDX-License-Identifier: LGPL-2.1+ 19 | */ 20 | 21 | #include 22 | 23 | #include "gpgrt-int.h" 24 | 25 | /* 26 | * Functions called before and after blocking syscalls. 27 | * gpgrt_set_syscall_clamp is used to set them. 28 | */ 29 | static void (*pre_syscall_func)(void); 30 | static void (*post_syscall_func)(void); 31 | 32 | 33 | /* 34 | * Register the syscall clamp. These two functions are called 35 | * immediately before and after a possible blocking system call. This 36 | * should be used before any I/O happens. The function is commonly 37 | * used with the nPth library: 38 | * 39 | * gpgrt_set_syscall_clamp (npth_unprotect, npth_protect); 40 | * 41 | * These functions may not modify ERRNO. 42 | * 43 | * Setting the clamp is not thread-safe and should thus be done as 44 | * early as possible. 45 | */ 46 | void 47 | _gpgrt_set_syscall_clamp (void (*pre)(void), void (*post)(void)) 48 | { 49 | pre_syscall_func = pre; 50 | post_syscall_func = post; 51 | } 52 | 53 | /* 54 | * Return the current sycall clamp functions. This can be used by 55 | * other libraries which have blocking functions. 56 | */ 57 | void 58 | _gpgrt_get_syscall_clamp (void (**r_pre)(void), void (**r_post)(void)) 59 | { 60 | *r_pre = pre_syscall_func; 61 | *r_post = post_syscall_func; 62 | } 63 | 64 | 65 | /* Call this function before a blocking system or libc call. */ 66 | void 67 | _gpgrt_pre_syscall (void) 68 | { 69 | if (pre_syscall_func) 70 | pre_syscall_func (); 71 | } 72 | 73 | 74 | /* Call this function after a blocking system or libc call. */ 75 | void 76 | _gpgrt_post_syscall (void) 77 | { 78 | if (post_syscall_func) 79 | post_syscall_func (); 80 | } 81 | -------------------------------------------------------------------------------- /po/Rules-quot: -------------------------------------------------------------------------------- 1 | # Special Makefile rules for English message catalogs with quotation marks. 2 | # 3 | # Copyright (C) 2001-2017 Free Software Foundation, Inc. 4 | # This file, Rules-quot, and its auxiliary files (listed under 5 | # DISTFILES.common.extra1) are free software; the Free Software Foundation 6 | # gives unlimited permission to use, copy, distribute, and modify them. 7 | 8 | DISTFILES.common.extra1 = quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot 9 | 10 | .SUFFIXES: .insert-header .po-update-en 11 | 12 | en@quot.po-create: 13 | $(MAKE) en@quot.po-update 14 | en@boldquot.po-create: 15 | $(MAKE) en@boldquot.po-update 16 | 17 | en@quot.po-update: en@quot.po-update-en 18 | en@boldquot.po-update: en@boldquot.po-update-en 19 | 20 | .insert-header.po-update-en: 21 | @lang=`echo $@ | sed -e 's/\.po-update-en$$//'`; \ 22 | if test "$(PACKAGE)" = "gettext-tools" && test "$(CROSS_COMPILING)" != "yes"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \ 23 | tmpdir=`pwd`; \ 24 | echo "$$lang:"; \ 25 | ll=`echo $$lang | sed -e 's/@.*//'`; \ 26 | LC_ALL=C; export LC_ALL; \ 27 | cd $(srcdir); \ 28 | if $(MSGINIT) $(MSGINIT_OPTIONS) -i $(DOMAIN).pot --no-translator -l $$lang -o - 2>/dev/null \ 29 | | $(SED) -f $$tmpdir/$$lang.insert-header | $(MSGCONV) -t UTF-8 | \ 30 | { case `$(MSGFILTER) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \ 31 | '' | 0.[0-9] | 0.[0-9].* | 0.1[0-8] | 0.1[0-8].*) \ 32 | $(MSGFILTER) $(SED) -f `echo $$lang | sed -e 's/.*@//'`.sed \ 33 | ;; \ 34 | *) \ 35 | $(MSGFILTER) `echo $$lang | sed -e 's/.*@//'` \ 36 | ;; \ 37 | esac } 2>/dev/null > $$tmpdir/$$lang.new.po \ 38 | ; then \ 39 | if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ 40 | rm -f $$tmpdir/$$lang.new.po; \ 41 | else \ 42 | if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ 43 | :; \ 44 | else \ 45 | echo "creation of $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ 46 | exit 1; \ 47 | fi; \ 48 | fi; \ 49 | else \ 50 | echo "creation of $$lang.po failed!" 1>&2; \ 51 | rm -f $$tmpdir/$$lang.new.po; \ 52 | fi 53 | 54 | en@quot.insert-header: insert-header.sin 55 | sed -e '/^#/d' -e 's/HEADER/en@quot.header/g' $(srcdir)/insert-header.sin > en@quot.insert-header 56 | 57 | en@boldquot.insert-header: insert-header.sin 58 | sed -e '/^#/d' -e 's/HEADER/en@boldquot.header/g' $(srcdir)/insert-header.sin > en@boldquot.insert-header 59 | 60 | mostlyclean: mostlyclean-quot 61 | mostlyclean-quot: 62 | rm -f *.insert-header 63 | -------------------------------------------------------------------------------- /gpgscm/repl.scm: -------------------------------------------------------------------------------- 1 | ;; A read-evaluate-print-loop for gpgscm. 2 | ;; Copyright (C) 2016 g10 Code GmbH 3 | ;; 4 | ;; This file is part of Libgpg-error. 5 | ;; 6 | ;; Libgpg-error is free software; you can redistribute it and/or 7 | ;; modify it under the terms of the GNU Lesser General Public License 8 | ;; as published by the Free Software Foundation; either version 2.1 of 9 | ;; the License, or (at your option) any later version. 10 | ;; 11 | ;; Libgpg-error is distributed in the hope that it will be useful, but 12 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | ;; Lesser General Public License for more details. 15 | ;; 16 | ;; You should have received a copy of the GNU Lesser General Public 17 | ;; License along with this program; if not, see . 18 | 19 | ;; Interactive repl using 'prompt' function. P must be a function 20 | ;; that given the current entered prefix returns the prompt to 21 | ;; display. 22 | (define (repl p environment) 23 | (call/cc 24 | (lambda (exit) 25 | (let loop ((prefix "")) 26 | (let ((line (prompt (p prefix)))) 27 | (if (and (not (eof-object? line)) (= 0 (string-length line))) 28 | (exit (loop prefix))) 29 | (if (not (eof-object? line)) 30 | (let* ((next (string-append prefix line)) 31 | (c (catch (begin (echo "Parse error:" *error*) 32 | (loop prefix)) 33 | (read (open-input-string next))))) 34 | (if (not (eof-object? c)) 35 | (begin 36 | (catch (begin 37 | (display (car *error*)) 38 | (when (and (cadr *error*) 39 | (not (null? (cadr *error*)))) 40 | (display ": ") 41 | (write (cadr *error*))) 42 | (newline) 43 | (vm-history-print (caddr *error*))) 44 | (echo " ===>" (eval c environment))) 45 | (exit (loop "")))) 46 | (exit (loop next))))))))) 47 | 48 | (define (prompt-append-prefix prompt prefix) 49 | (string-append prompt (if (> (string-length prefix) 0) 50 | (string-append prefix "...") 51 | "> "))) 52 | 53 | ;; Default repl run by main.c. 54 | (define (interactive-repl . environment) 55 | (repl (lambda (p) (prompt-append-prefix "gpgscm " p)) 56 | (if (null? environment) (interaction-environment) (car environment)))) 57 | 58 | ;; Ask a yes/no question. 59 | (define (prompt-yes-no? question default) 60 | (let ((answer (prompt (string-append question "? [" 61 | (if default "Y/n" "y/N") "] ")))) 62 | (cond 63 | ((= 0 (string-length answer)) 64 | default) 65 | ((or (equal? "y" answer) (equal? "Y" answer)) 66 | #t) 67 | (else 68 | #f)))) 69 | -------------------------------------------------------------------------------- /src/err-sources.h.in: -------------------------------------------------------------------------------- 1 | # err-sources.h.in - List of error sources and their description input file. 2 | /* err-sources.h - List of error sources and their description. 3 | Copyright (C) 2003, 2004 g10 Code GmbH 4 | 5 | This file is part of libgpg-error. 6 | 7 | libgpg-error is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Lesser General Public License 9 | as published by the Free Software Foundation; either version 2.1 of 10 | the License, or (at your option) any later version. 11 | 12 | libgpg-error is distributed in the hope that it will be useful, but 13 | WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Lesser General Public 18 | License along with libgpg-error; if not, write to the Free 19 | Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | 02111-1307, USA. */ 21 | 22 | # Everything up to the first line that starts with a number in the 23 | # first column is copied into the output verbatim. Then, empty lines 24 | # are ignored. Other lines must have an error source number, followed 25 | # by one or more characters, followed by the error source 26 | # symbol, followed by one or more characters, followed by the 27 | # error source name. Trailing whitespace is removed. The error 28 | # sources should be sorted. The last line should not have a number, 29 | # but only a , followed by a description for error sources that 30 | # are not in the list. 31 | 32 | 0 GPG_ERR_SOURCE_UNKNOWN Unspecified source 33 | 1 GPG_ERR_SOURCE_GCRYPT gcrypt 34 | 2 GPG_ERR_SOURCE_GPG GnuPG 35 | 3 GPG_ERR_SOURCE_GPGSM GpgSM 36 | 4 GPG_ERR_SOURCE_GPGAGENT GPG Agent 37 | 5 GPG_ERR_SOURCE_PINENTRY Pinentry 38 | 6 GPG_ERR_SOURCE_SCD SCD 39 | 7 GPG_ERR_SOURCE_GPGME GPGME 40 | 8 GPG_ERR_SOURCE_KEYBOX Keybox 41 | 9 GPG_ERR_SOURCE_KSBA KSBA 42 | 10 GPG_ERR_SOURCE_DIRMNGR Dirmngr 43 | 11 GPG_ERR_SOURCE_GSTI GSTI 44 | 12 GPG_ERR_SOURCE_GPA GPA 45 | 13 GPG_ERR_SOURCE_KLEO Kleopatra 46 | 14 GPG_ERR_SOURCE_G13 G13 47 | 15 GPG_ERR_SOURCE_ASSUAN Assuan 48 | 16 GPG_ERR_SOURCE_TPM2D TPM2d 49 | 17 GPG_ERR_SOURCE_TLS TLS 50 | 18 GPG_ERR_SOURCE_TKD TKD 51 | 52 | # 19 to 30 are free to be used. 53 | 54 | 31 GPG_ERR_SOURCE_ANY Any source 55 | 32 GPG_ERR_SOURCE_USER_1 User defined source 1 56 | 33 GPG_ERR_SOURCE_USER_2 User defined source 2 57 | 34 GPG_ERR_SOURCE_USER_3 User defined source 3 58 | 35 GPG_ERR_SOURCE_USER_4 User defined source 4 59 | 60 | # 36 to 255 are free to be used. 61 | 62 | GPG_ERR_SOURCE_DIM Unknown source 63 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Package: libgpg-error 2 | Maintainer: Werner Koch 3 | Bug reports: bug-gnupg@gnupg.org 4 | Mailing list: gnupg-devel@gnupg.org 5 | Security related bug reports: security@gnupg.org 6 | License (library): LGPLv2.1+ 7 | License (manual tools): GPLv2+ with exception 8 | 9 | Libgpg-error is free software. See the files COPYING.LIB and COPYING 10 | for copying conditions. License copyright years may be listed using 11 | range notation, e.g., 2000-2013, indicating that every year in the 12 | range, inclusive, is a copyrightable year that would otherwise be 13 | listed individually. 14 | 15 | 16 | List of Copyright holders 17 | ========================= 18 | 19 | Copyright (C) 2001-2025 g10 Code GmbH 20 | Copyright (C) 1995-2017 Free Software Foundation, Inc. 21 | Copyright (C) 1998-2006, 2008-2017 Werner Koch 22 | Copyright (C) 2014 Jedi Lin 23 | 24 | 25 | Authors with a DCO 26 | ================== 27 | 28 | We do not collect DCOs for libgpg-error. As a supporting library for 29 | GnuPG, Libgcrypt, and GPGME a DCO for any of these projects is 30 | sufficient. 31 | 32 | 33 | Translators 34 | =========== 35 | 36 | cs - Petr Pisar 37 | da - Joe Hansen 38 | de - Werner Koch 39 | eo - Felipe Castro 40 | fr - David Prévot 41 | Stephane Roy 42 | it - Francesco Groccia 43 | jp - Takeshi Hamasaki 44 | Yasuaki Taniguchi 45 | nl - Freek de Kruijf 46 | pl - Jakub Bogusz 47 | pt - Daniel Cerqueira 48 | ro - Laurentiu Buzdugan 49 | sv - Daniel Nylander 50 | tr - Emir SARI 51 | uk - Yuri Chornoivan 52 | vi - Clytie Siddall 53 | zh_CN - Aron Xu 54 | 55 | 56 | More credits 57 | ============ 58 | 59 | Robert Schiele wrote libgpg-error.spec. 60 | 61 | Thanks to Yukihiro Nakadaira for his public domain iconv 62 | implementation for Windows. 63 | 64 | 65 | Copyright 2003-2007, 2013-2017 g10 Code GmbH 66 | 67 | This file is free software; as a special exception the author gives 68 | unlimited permission to copy and/or distribute it, with or without 69 | modifications, as long as this notice is preserved. 70 | 71 | This file is distributed in the hope that it will be useful, but 72 | WITHOUT ANY WARRANTY, to the extent permitted by law; without even the 73 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 74 | -------------------------------------------------------------------------------- /src/gpg-error-config.in: -------------------------------------------------------------------------------- 1 | #!@INSTALLSHELLPATH@ 2 | # Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc. 3 | # 4 | # This file is free software; as a special exception the author gives 5 | # unlimited permission to copy and/or distribute it, with or without 6 | # modifications, as long as this notice is preserved. 7 | # 8 | # This file is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the 10 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 | # SPDX-License-Identifier: FSFULLR 12 | 13 | prefix=@prefix@ 14 | exec_prefix=@exec_prefix@ 15 | includedir=@includedir@ 16 | libdir=@libdir@ 17 | 18 | if echo "$0" | grep gpg-error-config 2>/dev/null >/dev/null; then 19 | myname="gpg-error-config" 20 | else 21 | myname="gpgrt-config" 22 | fi 23 | 24 | output="" 25 | mt=no 26 | 27 | usage() 28 | { 29 | cat <&2 44 | fi 45 | 46 | while test $# -gt 0; do 47 | case "$1" in 48 | -*=*) 49 | optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` 50 | ;; 51 | *) 52 | optarg= 53 | ;; 54 | esac 55 | 56 | case $1 in 57 | --mt) 58 | mt=yes 59 | ;; 60 | --prefix) 61 | output="$output $prefix" 62 | ;; 63 | --exec-prefix) 64 | output="$output $exec_prefix" 65 | ;; 66 | --modversion|--version) 67 | echo "@PACKAGE_VERSION@" 68 | exit 0 69 | ;; 70 | --variable=*) 71 | case "${1#*=}" in 72 | prefix) echo "$prefix" ;; 73 | exec_prefix) echo "$exec_prefix" ;; 74 | host) echo "@GPG_ERROR_CONFIG_HOST@" ;; 75 | mtcflags) echo "@GPG_ERROR_CONFIG_MT_CFLAGS@" ;; 76 | mtlibs) echo "@GPG_ERROR_CONFIG_MT_LIBS@";; 77 | esac 78 | exit 0 79 | ;; 80 | --cflags) 81 | output="$output @GPG_ERROR_CONFIG_CFLAGS@" 82 | if test $mt = yes ; then 83 | output="$output @GPG_ERROR_CONFIG_MT_CFLAGS@" 84 | fi 85 | ;; 86 | --libs) 87 | output="$output @GPG_ERROR_CONFIG_LIBS@" 88 | if test $mt = yes ; then 89 | output="$output @GPG_ERROR_CONFIG_MT_LIBS@" 90 | fi 91 | ;; 92 | --host) 93 | echo "@GPG_ERROR_CONFIG_HOST@" 94 | exit 0 95 | ;; 96 | *) 97 | usage 1 1>&2 98 | ;; 99 | esac 100 | shift 101 | done 102 | 103 | echo $output 104 | -------------------------------------------------------------------------------- /gpgscm/makefile.scm: -------------------------------------------------------------------------------- 1 | ;; Support for parsing Makefiles 2 | ;; Copyright (C) 2016 g10 Code GmbH 3 | ;; 4 | ;; This file is part of Libgpg-error. 5 | ;; 6 | ;; Libgpg-error is free software; you can redistribute it and/or 7 | ;; modify it under the terms of the GNU Lesser General Public License 8 | ;; as published by the Free Software Foundation; either version 2.1 of 9 | ;; the License, or (at your option) any later version. 10 | ;; 11 | ;; Libgpg-error is distributed in the hope that it will be useful, but 12 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 13 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | ;; Lesser General Public License for more details. 15 | ;; 16 | ;; You should have received a copy of the GNU Lesser General Public 17 | ;; License along with this program; if not, see . 18 | 19 | (define (parse-makefile port key) 20 | (define (is-continuation? tokens) 21 | (string=? (last tokens) "\\")) 22 | (define (valid-token? s) 23 | (< 0 (string-length s))) 24 | (define (drop-continuations tokens) 25 | (let loop ((acc '()) (tks tokens)) 26 | (if (null? tks) 27 | (reverse acc) 28 | (loop (if (string=? "\\" (car tks)) 29 | acc 30 | (cons (car tks) acc)) (cdr tks))))) 31 | (let next ((acc '()) (found #f)) 32 | (let ((line (read-line port))) 33 | (if (eof-object? line) 34 | acc 35 | (let ((tokens (filter valid-token? 36 | (string-splitp (string-trim char-whitespace? 37 | line) 38 | char-whitespace? -1)))) 39 | (cond 40 | ((or (null? tokens) 41 | (string-prefix? (car tokens) "#") 42 | (and (not found) (not (and (string=? key (car tokens)) 43 | (string=? "=" (cadr tokens)))))) 44 | (next acc found)) 45 | ((not found) 46 | (assert (and (string=? key (car tokens)) 47 | (string=? "=" (cadr tokens)))) 48 | (if (is-continuation? tokens) 49 | (next (drop-continuations (cddr tokens)) #t) 50 | (drop-continuations (cddr tokens)))) 51 | (else 52 | (assert found) 53 | (if (is-continuation? tokens) 54 | (next (append acc (drop-continuations tokens)) found) 55 | (append acc (drop-continuations tokens)))))))))) 56 | 57 | (define (parse-makefile-expand filename expand key) 58 | (define (variable? v) 59 | (and (string-prefix? v "$(") (string-suffix? v ")"))) 60 | 61 | (let expand-all ((values (parse-makefile (open-input-file filename) key))) 62 | (if (any variable? values) 63 | (expand-all 64 | (let expand-one ((acc '()) (v values)) 65 | (cond 66 | ((null? v) 67 | acc) 68 | ((variable? (car v)) 69 | (let ((makefile (open-input-file filename)) 70 | (key (substring (car v) 2 (- (string-length (car v)) 1)))) 71 | (expand-one (append acc (expand filename makefile key)) 72 | (cdr v)))) 73 | (else 74 | (expand-one (append acc (list (car v))) (cdr v)))))) 75 | values))) 76 | -------------------------------------------------------------------------------- /src/mkerrcodes.c: -------------------------------------------------------------------------------- 1 | /* mkerrcodes.c - Generate list of system error values. 2 | Copyright (C) 2004 g10 Code GmbH 3 | 4 | This file is part of libgpg-error. 5 | 6 | libgpg-error is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public License 8 | as published by the Free Software Foundation; either version 2.1 of 9 | the License, or (at your option) any later version. 10 | 11 | libgpg-error is distributed in the hope that it will be useful, but 12 | WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with libgpg-error; if not, write to the Free 18 | Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 | 02111-1307, USA. */ 20 | 21 | /* This file must not include config.h, as that is for the host 22 | system, while this file will be run on the build system. */ 23 | 24 | #include 25 | 26 | #include "mkerrcodes.h" 27 | 28 | static const char header[] = 29 | "/* errnos.h - List of system error values.\n" 30 | " Copyright (C) 2004 g10 Code GmbH\n" 31 | " This file is part of libgpg-error.\n" 32 | "\n" 33 | " libgpg-error is free software; you can redistribute it and/or\n" 34 | " modify it under the terms of the GNU Lesser General Public License\n" 35 | " as published by the Free Software Foundation; either version 2.1 of\n" 36 | " the License, or (at your option) any later version.\n" 37 | "\n" 38 | " libgpg-error is distributed in the hope that it will be useful, but\n" 39 | " WITHOUT ANY WARRANTY; without even the implied warranty of\n" 40 | " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n" 41 | " Lesser General Public License for more details.\n" 42 | "\n" 43 | " You should have received a copy of the GNU Lesser General Public\n" 44 | " License along with libgpg-error; if not, write to the Free\n" 45 | " Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA\n" 46 | " 02111-1307, USA. */\n" 47 | "\n"; 48 | 49 | int 50 | main (int argc, char **argv) 51 | { 52 | int sorted; 53 | int i; 54 | 55 | printf ("%s", header); 56 | do 57 | { 58 | sorted = 1; 59 | for (i = 0; i < sizeof (err_table) / sizeof (err_table[0]) - 1; i++) 60 | if (err_table[i].err > err_table[i + 1].err) 61 | { 62 | int err = err_table[i].err; 63 | const char *err_sym = err_table[i].err_sym; 64 | 65 | err_table[i].err = err_table[i + 1].err; 66 | err_table[i].err_sym = err_table[i + 1].err_sym; 67 | err_table[i + 1].err = err; 68 | err_table[i + 1].err_sym = err_sym; 69 | sorted = 0; 70 | } 71 | } 72 | while (!sorted); 73 | 74 | for (i = 0; i < sizeof (err_table) / sizeof (err_table[0]); i++) 75 | printf ("%i\t%s\n", err_table[i].err, err_table[i].err_sym); 76 | 77 | return 0; 78 | } 79 | -------------------------------------------------------------------------------- /m4/ax_cc_for_build.m4: -------------------------------------------------------------------------------- 1 | # =========================================================================== 2 | # https://www.gnu.org/software/autoconf-archive/ax_cc_for_build.html 3 | # =========================================================================== 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_CC_FOR_BUILD 8 | # 9 | # DESCRIPTION 10 | # 11 | # Find a build-time compiler. Sets CC_FOR_BUILD and EXEEXT_FOR_BUILD. 12 | # 13 | # LICENSE 14 | # 15 | # Copyright (c) 2010 Reuben Thomas 16 | # Copyright (c) 1999 Richard Henderson 17 | # 18 | # This program is free software: you can redistribute it and/or modify it 19 | # under the terms of the GNU General Public License as published by the 20 | # Free Software Foundation, either version 3 of the License, or (at your 21 | # option) any later version. 22 | # 23 | # This program is distributed in the hope that it will be useful, but 24 | # WITHOUT ANY WARRANTY; without even the implied warranty of 25 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 26 | # Public License for more details. 27 | # 28 | # You should have received a copy of the GNU General Public License along 29 | # with this program. If not, see . 30 | # 31 | # As a special exception, the respective Autoconf Macro's copyright owner 32 | # gives unlimited permission to copy, distribute and modify the configure 33 | # scripts that are the output of Autoconf when processing the Macro. You 34 | # need not follow the terms of the GNU General Public License when using 35 | # or distributing such scripts, even though portions of the text of the 36 | # Macro appear in them. The GNU General Public License (GPL) does govern 37 | # all other use of the material that constitutes the Autoconf Macro. 38 | # 39 | # This special exception to the GPL applies to versions of the Autoconf 40 | # Macro released by the Autoconf Archive. When you make and distribute a 41 | # modified version of the Autoconf Macro, you may extend this special 42 | # exception to the GPL to apply to your modified version as well. 43 | 44 | #serial 3 45 | 46 | dnl Get a default for CC_FOR_BUILD to put into Makefile. 47 | AC_DEFUN([AX_CC_FOR_BUILD], 48 | [# Put a plausible default for CC_FOR_BUILD in Makefile. 49 | if test -z "$CC_FOR_BUILD"; then 50 | if test "x$cross_compiling" = "xno"; then 51 | CC_FOR_BUILD='$(CC)' 52 | else 53 | CC_FOR_BUILD=gcc 54 | fi 55 | fi 56 | AC_SUBST(CC_FOR_BUILD) 57 | # Also set EXEEXT_FOR_BUILD. 58 | if test "x$cross_compiling" = "xno"; then 59 | EXEEXT_FOR_BUILD='$(EXEEXT)' 60 | else 61 | AC_CACHE_CHECK([for build system executable suffix], bfd_cv_build_exeext, 62 | [rm -f conftest* 63 | echo 'int main () { return 0; }' > conftest.c 64 | bfd_cv_build_exeext= 65 | ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5 66 | for file in conftest.*; do 67 | case $file in 68 | *.c | *.o | *.obj | *.ilk | *.pdb) ;; 69 | *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;; 70 | esac 71 | done 72 | rm -f conftest* 73 | test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no]) 74 | EXEEXT_FOR_BUILD="" 75 | test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext} 76 | fi 77 | AC_SUBST(EXEEXT_FOR_BUILD)])dnl 78 | -------------------------------------------------------------------------------- /m4/progtest.m4: -------------------------------------------------------------------------------- 1 | # progtest.m4 serial 9 (gettext-0.21.1) 2 | dnl Copyright (C) 1996-2003, 2005, 2008-2021 Free Software Foundation, Inc. 3 | dnl This file is free software; the Free Software Foundation 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | dnl 7 | dnl This file can be used in projects which are not available under 8 | dnl the GNU General Public License or the GNU Lesser General Public 9 | dnl License but which still want to provide support for the GNU gettext 10 | dnl functionality. 11 | dnl Please note that the actual code of the GNU gettext library is covered 12 | dnl by the GNU Lesser General Public License, and the rest of the GNU 13 | dnl gettext package is covered by the GNU General Public License. 14 | dnl They are *not* in the public domain. 15 | 16 | dnl Authors: 17 | dnl Ulrich Drepper , 1996. 18 | 19 | AC_PREREQ([2.53]) 20 | 21 | # Search path for a program which passes the given test. 22 | 23 | dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, 24 | dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) 25 | AC_DEFUN([AM_PATH_PROG_WITH_TEST], 26 | [ 27 | # Prepare PATH_SEPARATOR. 28 | # The user is always right. 29 | if test "${PATH_SEPARATOR+set}" != set; then 30 | # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which 31 | # contains only /bin. Note that ksh looks also at the FPATH variable, 32 | # so we have to set that as well for the test. 33 | PATH_SEPARATOR=: 34 | (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ 35 | && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ 36 | || PATH_SEPARATOR=';' 37 | } 38 | fi 39 | 40 | # Find out how to test for executable files. Don't use a zero-byte file, 41 | # as systems may use methods other than mode bits to determine executability. 42 | cat >conf$$.file <<_ASEOF 43 | #! /bin/sh 44 | exit 0 45 | _ASEOF 46 | chmod +x conf$$.file 47 | if test -x conf$$.file >/dev/null 2>&1; then 48 | ac_executable_p="test -x" 49 | else 50 | ac_executable_p="test -f" 51 | fi 52 | rm -f conf$$.file 53 | 54 | # Extract the first word of "$2", so it can be a program name with args. 55 | set dummy $2; ac_word=[$]2 56 | AC_MSG_CHECKING([for $ac_word]) 57 | AC_CACHE_VAL([ac_cv_path_$1], 58 | [case "[$]$1" in 59 | [[\\/]]* | ?:[[\\/]]*) 60 | ac_cv_path_$1="[$]$1" # Let the user override the test with a path. 61 | ;; 62 | *) 63 | ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR 64 | for ac_dir in m4_if([$5], , $PATH, [$5]); do 65 | IFS="$ac_save_IFS" 66 | test -z "$ac_dir" && ac_dir=. 67 | for ac_exec_ext in '' $ac_executable_extensions; do 68 | if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then 69 | echo "$as_me: trying $ac_dir/$ac_word..." >&AS_MESSAGE_LOG_FD 70 | if [$3]; then 71 | ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext" 72 | break 2 73 | fi 74 | fi 75 | done 76 | done 77 | IFS="$ac_save_IFS" 78 | dnl If no 4th arg is given, leave the cache variable unset, 79 | dnl so AC_PATH_PROGS will keep looking. 80 | m4_if([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" 81 | ])dnl 82 | ;; 83 | esac])dnl 84 | $1="$ac_cv_path_$1" 85 | if test m4_if([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then 86 | AC_MSG_RESULT([$][$1]) 87 | else 88 | AC_MSG_RESULT([no]) 89 | fi 90 | AC_SUBST([$1])dnl 91 | ]) 92 | -------------------------------------------------------------------------------- /doc/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for libgpg-error documentation 2 | # Copyright (C) 2014 g10 Code GmbH 3 | # 4 | # This file is part of libgpg-error. 5 | # 6 | # libgpg-error is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU Lesser General Public License as 8 | # published by the Free Software Foundation; either version 2.1 of the 9 | # License, or (at your option) any later version. 10 | # 11 | # libgpg-error is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public 17 | # License along with this program; if not, see . 18 | 19 | 20 | EXTRA_DIST = HACKING errorref.txt 21 | 22 | bin_PROGRAMS = yat2m 23 | yat2m_SOURCES = yat2m.c 24 | yat2m_CFLAGS= -DPACKAGE_VERSION="\"$(PACKAGE_VERSION)\"" 25 | 26 | DISTCLEANFILES = gpgrt.cps yat2m-stamp.tmp yat2m-stamp $(myman_pages) 27 | CLEANFILES = errorref.txt.x 28 | 29 | info_TEXINFOS = gpgrt.texi 30 | gpgrt_TEXINFOS = lgpl.texi gpl.texi 31 | 32 | YAT2M_OPTIONS = -I $(srcdir) \ 33 | --release "Libgpg-error @PACKAGE_VERSION@" --source "GnuPG" 34 | 35 | myman_sources = gpgrt.texi 36 | if INSTALL_GPG_ERROR_CONFIG 37 | myman_pages = gpg-error-config.1 gpgrt-config.1 38 | else 39 | myman_pages = gpgrt-config.1 40 | endif 41 | 42 | man_MANS = $(myman_pages) 43 | 44 | if CROSS_COMPILING 45 | YAT2M_CMD = ./yat2m-for-build$(EXEEXT_FOR_BUILD) 46 | YAT2M_DEP = yat2m-for-build$(EXEEXT_FOR_BUILD) 47 | CLEANFILES += yat2m-for-build$(EXEEXT_FOR_BUILD) 48 | 49 | yat2m-for-build$(EXEEXT_FOR_BUILD): yat2m.c 50 | $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) \ 51 | $(CPPFLAGS_FOR_BUILD) -o $@ $(srcdir)/yat2m.c 52 | else 53 | YAT2M_CMD = ./yat2m$(EXEEXT) 54 | YAT2M_DEP = yat2m$(EXEEXT) 55 | endif 56 | 57 | yat2m-stamp: $(myman_sources) $(srcdir)/version.texi 58 | @rm -f yat2m-stamp.tmp 59 | @touch yat2m-stamp.tmp 60 | for file in $(myman_sources) ; do \ 61 | $(YAT2M_CMD) $(YAT2M_OPTIONS) --store \ 62 | `test -f '$$file' || echo '$(srcdir)/'`$$file ; done 63 | @mv -f yat2m-stamp.tmp $@ 64 | 65 | yat2m-stamp: $(YAT2M_DEP) 66 | 67 | $(myman_pages) : yat2m-stamp 68 | @if test -f $@; then :; else \ 69 | trap 'rm -rf yat2m-stamp yat2m-lock' 1 2 13 15; \ 70 | if mkdir yat2m-lock 2>/dev/null; then \ 71 | rm -f yat2m-stamp; \ 72 | $(MAKE) $(AM_MAKEFLAGS) yat2m-stamp; \ 73 | rmdir yat2m-lock; \ 74 | else \ 75 | while test -d yat2m-lock; do sleep 1; done; \ 76 | test -f yat2m-stamp; exit $$?; \ 77 | fi; \ 78 | fi 79 | 80 | # Make sure that gpgrt.texi is touched if any other texi file has 81 | # been modified. This is required so that the version.texi magic 82 | # updates the release date. 83 | gpgrt.texi : $(gpgrt_TEXINFOS) 84 | touch $(srcdir)/gpgrt.texi 85 | 86 | errorref.txt.x : errorref.txt 87 | sed '/^##/ d' $(srcdir)/errorref.txt >$@ 88 | echo "# Installed by $(PACKAGE_NAME) $(PACKAGE_VERSION)" >>$@ 89 | 90 | install-data-local: errorref.txt.x 91 | $(mkinstalldirs) $(DESTDIR)$(pkgdatadir) 92 | $(INSTALL_DATA) errorref.txt.x $(DESTDIR)$(pkgdatadir)/errorref.txt 93 | 94 | uninstall-local: 95 | -@rm $(DESTDIR)$(pkgdatadir)/errorref.txt 96 | -------------------------------------------------------------------------------- /src/gettext.h: -------------------------------------------------------------------------------- 1 | /* Convenience header for conditional use of GNU . 2 | Copyright (C) 1995-1998, 2000-2002 Free Software Foundation, Inc. 3 | 4 | This program is free software; you can redistribute it and/or modify it 5 | under the terms of the GNU Library General Public License as published 6 | by the Free Software Foundation; either version 2, or (at your option) 7 | any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | Library General Public License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public 15 | License along with this program; if not, write to the Free Software 16 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 17 | USA. */ 18 | 19 | #ifndef _LIBGETTEXT_H 20 | #define _LIBGETTEXT_H 1 21 | 22 | /* NLS can be disabled through the configure --disable-nls option. */ 23 | #if ENABLE_NLS 24 | 25 | #if HAVE_W32_SYSTEM 26 | /* We have a gettext implementation in gpg-error.h which get 27 | included anyway. */ 28 | #else /*!HAVE_W32_SYSTEM*/ 29 | /* Get declarations of GNU message catalog functions. */ 30 | # include 31 | #endif /*!HAVE_W32_SYSTEM*/ 32 | 33 | #else /*!ENABLE_NLS*/ 34 | 35 | /* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which 36 | chokes if dcgettext is defined as a macro. So include it now, to make 37 | later inclusions of a NOP. We don't include 38 | as well because people using "gettext.h" will not include , 39 | and also including would fail on SunOS 4, whereas 40 | is OK. */ 41 | #if defined(__sun) 42 | # include 43 | #endif 44 | 45 | /* Disabled NLS. 46 | The casts to 'const char *' serve the purpose of producing warnings 47 | for invalid uses of the value returned from these functions. 48 | On pre-ANSI systems without 'const', the config.h file is supposed to 49 | contain "#define const". */ 50 | # define gettext(Msgid) ((const char *) (Msgid)) 51 | # define dgettext(Domainname, Msgid) ((const char *) (Msgid)) 52 | # define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid)) 53 | # define ngettext(Msgid1, Msgid2, N) \ 54 | ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) 55 | # define dngettext(Domainname, Msgid1, Msgid2, N) \ 56 | ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) 57 | # define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ 58 | ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) 59 | # define textdomain(Domainname) ((const char *) (Domainname)) 60 | # define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname)) 61 | # define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset)) 62 | 63 | #endif /*!ENABLE_NLS*/ 64 | 65 | /* A pseudo function call that serves as a marker for the automated 66 | extraction of messages, but does not call gettext(). The run-time 67 | translation is done at a different place in the code. 68 | The argument, String, should be a literal string. Concatenated strings 69 | and other string expressions won't work. 70 | The macro's expansion is not parenthesized, so that it is suitable as 71 | initializer for static 'char[]' or 'const char[]' variables. */ 72 | #define gettext_noop(String) String 73 | 74 | 75 | 76 | #endif /* _LIBGETTEXT_H */ 77 | -------------------------------------------------------------------------------- /doc/HACKING: -------------------------------------------------------------------------------- 1 | # HACKING -*- org -*- 2 | #+TITLE: Various hacking notes 3 | #+STARTUP: showall 4 | 5 | * How to contribute 6 | 7 | The following stuff explains some basic procedures you need to 8 | follow if you want to contribute code or documentation. 9 | 10 | * No more ChangeLog files 11 | 12 | Do not modify any of the ChangeLog files in Libgpg-error. Starting 13 | on December 1st, 2011 we put change information only in the GIT 14 | commit log, and generate a top-level ChangeLog file from logs at 15 | "make dist" time. As such, there are strict requirements on the 16 | form of the commit log messages. The old ChangeLog files have all 17 | be renamed to ChangeLog-2011 18 | 19 | 20 | * Commit log requirements 21 | 22 | Your commit log should always start with a one-line summary, the 23 | second line should be blank, and the remaining lines are usually 24 | ChangeLog-style entries for all affected files. However, it's fine 25 | -- even recommended -- to write a few lines of prose describing the 26 | change, when the summary and ChangeLog entries don't give enough of 27 | the big picture. Omit the leading TABs that you're used to seeing 28 | in a "real" ChangeLog file, but keep the maximum line length at 72 29 | or smaller, so that the generated ChangeLog lines, each with its 30 | leading TAB, will not exceed 80 columns. 31 | 32 | * Commit log keywords 33 | 34 | - GnuPG-bug-id :: Values are comma or space delimited bug numbers 35 | from bug.gnupg.org pertaining to this commit. 36 | - Debian-bug-id :: Same as above but from the Debian bug tracker. 37 | - CVE-id :: CVE id number pertaining to this commit. 38 | - Regression-due-to :: Commit id of the regression fixed by this commit. 39 | - Fixes-commit :: Commit id this commit fixes. 40 | - Reported-by :: Value is a name or mail address of a bug reporte. 41 | - Suggested-by :: Value is a name or mail address of someone how 42 | suggested this change. 43 | - Co-authored-by :: Name or mail address of a co-author 44 | - Some-comments-by :: Name or mail address of the author of 45 | additional comments (commit log or code). 46 | - Proofread-by :: Sometimes used by translation commits. 47 | - Signed-off-by :: Name or mail address of the developer 48 | 49 | * Sending patches 50 | 51 | - submitting patches, and subsequent discussions around them, 52 | happens via the gnupg-devel@gnupg.org public mailing list 53 | 54 | - send your patches to that list, preferably PGP/MIME signed. Make 55 | sure to include a mention of 'libgpg-error' in the subject line, 56 | the list is used for several different projects 57 | 58 | - if you're working from the git repo, here's a suggested workflow: 59 | 60 | - configure git send-email defaults: 61 | 62 | git config format.subjectPrefix 'PATCH libgpg-error' 63 | git config sendemail.to gnupg-devel@gnupg.org 64 | 65 | Note that running ./autogen.sh on a fresh clone will do this for 66 | you. 67 | 68 | - hack hack hack 69 | 70 | - commit your changes; group changes into easily-reviewable commit 71 | units, feel free to submit several patches at once 72 | 73 | - e.g. if you want to submit a single patch on top of master, do: 74 | git send-email --annotate -1 75 | 76 | - e.g. if you have two commits on top of master, do: 77 | git send-email --annotate --cover-letter -2 78 | (that prompts you for a summary mail to precede your actual 79 | patch mails) 80 | 81 | - use --dry-run to test your setup 82 | -------------------------------------------------------------------------------- /src/gen-lock-obj.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # 3 | # gen-lock-obj.sh - Build tool to construct the lock object. 4 | # 5 | # Copyright (C) 2020, 2021 g10 Code GmbH 6 | # 7 | # This file is part of libgpg-error. 8 | # 9 | # libgpg-error is free software; you can redistribute it and/or 10 | # modify it under the terms of the GNU Lesser General Public License 11 | # as published by the Free Software Foundation; either version 2.1 of 12 | # the License, or (at your option) any later version. 13 | # 14 | # libgpg-error is distributed in the hope that it will be useful, but 15 | # WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | # Lesser General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU Lesser General Public 20 | # License along with this program; if not, see . 21 | # 22 | 23 | # 24 | # Following variables should be defined to invoke this script 25 | # 26 | # CC 27 | # OBJDUMP 28 | # AWK 29 | # ac_ext 30 | # ac_object 31 | # host 32 | # LOCK_ABI_VERSION 33 | # 34 | # An example: 35 | # 36 | # LOCK_ABI_VERSION=1 host=x86_64-pc-linux-gnu host_alias=x86_64-linux-gnu \ 37 | # CC=$host_alias-gcc OBJDUMP=$host_alias-objdump ac_ext=c ac_objext=o \ 38 | # AWK=gawk ./gen-lock-obj.sh 39 | # 40 | 41 | if test -n "`echo -n`"; then 42 | ECHO_C='\c' 43 | ECHO_N='' 44 | else 45 | ECHO_C='' 46 | ECHO_N='-n' 47 | fi 48 | 49 | if test "$1" = --disable-threads; then 50 | cat <conftest.$ac_ext 71 | #include 72 | pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER; 73 | EOF 74 | 75 | if $CC -c conftest.$ac_ext; then : 76 | ac_mtx_size=$($OBJDUMP -j .bss -t conftest.$ac_objext \ 77 | | $AWK $AWK_OPTION ' 78 | /mtx$/ { mtx_size = int("0x" $5) } 79 | END { print mtx_size }') 80 | else 81 | echo "Can't determine mutex size" 82 | exit 1 83 | fi 84 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 85 | 86 | cat <"; 73 | print "#ifdef _WIN32"; 74 | print "#include "; 75 | print "#endif"; 76 | print ""; 77 | header = 0; 78 | } 79 | else 80 | print; 81 | } 82 | 83 | !header { 84 | sub (/#.+/, ""); 85 | sub (/[ ]+$/, ""); # Strip trailing space and tab characters. 86 | 87 | if (/^$/) 88 | next; 89 | 90 | print "#ifdef " $errnoidx; 91 | print $errnoidx "\tGPG_ERR_" $errnoidx; 92 | print "#endif"; 93 | print "#ifdef WSA" $errnoidx; 94 | print "WSA" $errnoidx "\tGPG_ERR_" $errnoidx; 95 | print "#endif"; 96 | } 97 | -------------------------------------------------------------------------------- /src/mkerrcodes.awk: -------------------------------------------------------------------------------- 1 | # mkerrcodes.awk 2 | # Copyright (C) 2004, 2005 g10 Code GmbH 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License as 6 | # published by the Free Software Foundation; either version 2 of 7 | # the License, or (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | # General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 17 | # 18 | # As a special exception, g10 Code GmbH gives unlimited permission to 19 | # copy, distribute and modify the C source files that are the output 20 | # of mkerrcodes.awk. You need not follow the terms of the GNU General 21 | # Public License when using or distributing such scripts, even though 22 | # portions of the text of mkerrcodes.awk appear in them. The GNU 23 | # General Public License (GPL) does govern all other use of the material 24 | # that constitutes the mkerrcodes.awk program. 25 | # 26 | # Certain portions of the mkerrcodes.awk source text are designed to be 27 | # copied (in certain cases, depending on the input) into the output of 28 | # mkerrcodes.awk. We call these the "data" portions. The rest of the 29 | # mkerrcodes.awk source text consists of comments plus executable code 30 | # that decides which of the data portions to output in any given case. 31 | # We call these comments and executable code the "non-data" portions. 32 | # mkerrcodes.h never copies any of the non-data portions into its output. 33 | # 34 | # This special exception to the GPL applies to versions of mkerrcodes.awk 35 | # released by g10 Code GmbH. When you make and distribute a modified version 36 | # of mkerrcodes.awk, you may extend this special exception to the GPL to 37 | # apply to your modified version as well, *unless* your modified version 38 | # has the potential to copy into its output some of the text that was the 39 | # non-data portion of the version that you started with. (In other words, 40 | # unless your change moves or copies text from the non-data portions to the 41 | # data portions.) If your modification has such potential, you must delete 42 | # any notice of this special exception to the GPL from your modified version. 43 | 44 | # This script outputs an intermediate file that contains the following output: 45 | # static struct 46 | # { 47 | # int err; 48 | # const char *err_sym; 49 | # } err_table[] = 50 | # { 51 | # { 7, "GPG_ERR_E2BIG" }, 52 | # [...] 53 | # }; 54 | # 55 | # The input file is a list of possible system errors, followed by a GPG_ERR_* name: 56 | # 57 | # 7 GPG_ERR_E2BIG 58 | # 59 | # Comments (starting with # and ending at the end of the line) are removed, 60 | # as is trailing whitespace. 61 | 62 | BEGIN { 63 | FS="[ \t]+GPG_ERR_"; 64 | print "/* Output of mkerrcodes.awk. DO NOT EDIT. */"; 65 | print ""; 66 | header = 1; 67 | } 68 | 69 | /^#/ { next; } 70 | 71 | header { 72 | if (! /^[ \t]*$/) 73 | { 74 | header = 0; 75 | 76 | print "static struct"; 77 | print " {"; 78 | print " int err;"; 79 | print " const char *err_sym;"; 80 | print " } err_table[] = "; 81 | print "{"; 82 | } 83 | else 84 | print; 85 | } 86 | 87 | !header { 88 | sub (/#.+/, ""); 89 | sub (/[ ]+$/, ""); # Strip trailing space and tab characters. 90 | 91 | if (/^$/) 92 | next; 93 | 94 | print " { " $1 ", \"GPG_ERR_" $2 "\" },"; 95 | } 96 | 97 | END { 98 | print "};"; 99 | } 100 | -------------------------------------------------------------------------------- /src/errnos.in: -------------------------------------------------------------------------------- 1 | # errnos.in - List of system error values input file. 2 | /* errnos.in - List of system error values. 3 | Copyright (C) 2003, 2004 g10 Code GmbH 4 | 5 | This file is part of libgpg-error. 6 | 7 | libgpg-error is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Lesser General Public License 9 | as published by the Free Software Foundation; either version 2.1 of 10 | the License, or (at your option) any later version. 11 | 12 | libgpg-error is distributed in the hope that it will be useful, but 13 | WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Lesser General Public 18 | License along with libgpg-error; if not, write to the Free 19 | Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20 | 02111-1307, USA. */ 21 | 22 | # Everything up to the first line that starts with a number in the 23 | # first column is copied into the output verbatim. Then, empty lines 24 | # are ignored. Other lines must have an error code number, followed 25 | # by one or more characters, followed by the error name. 26 | # 27 | # IMPORTANT: For now, the numbering must be consecutive. Some of the 28 | # scripts (notably mkerrnos.h) do not deal correctly with a numbering 29 | # that is out of order or has gaps. 30 | 31 | 32 | 0 E2BIG 33 | 1 EACCES 34 | 2 EADDRINUSE 35 | 3 EADDRNOTAVAIL 36 | 4 EADV 37 | 5 EAFNOSUPPORT 38 | 6 EAGAIN 39 | 7 EALREADY 40 | 8 EAUTH 41 | 9 EBACKGROUND 42 | 10 EBADE 43 | 11 EBADF 44 | 12 EBADFD 45 | 13 EBADMSG 46 | 14 EBADR 47 | 15 EBADRPC 48 | 16 EBADRQC 49 | 17 EBADSLT 50 | 18 EBFONT 51 | 19 EBUSY 52 | 20 ECANCELED 53 | 21 ECHILD 54 | 22 ECHRNG 55 | 23 ECOMM 56 | 24 ECONNABORTED 57 | 25 ECONNREFUSED 58 | 26 ECONNRESET 59 | 27 ED 60 | 28 EDEADLK 61 | 29 EDEADLOCK 62 | 30 EDESTADDRREQ 63 | 31 EDIED 64 | 32 EDOM 65 | 33 EDOTDOT 66 | 34 EDQUOT 67 | 35 EEXIST 68 | 36 EFAULT 69 | 37 EFBIG 70 | 38 EFTYPE 71 | 39 EGRATUITOUS 72 | 40 EGREGIOUS 73 | 41 EHOSTDOWN 74 | 42 EHOSTUNREACH 75 | 43 EIDRM 76 | 44 EIEIO 77 | 45 EILSEQ 78 | 46 EINPROGRESS 79 | 47 EINTR 80 | 48 EINVAL 81 | 49 EIO 82 | 50 EISCONN 83 | 51 EISDIR 84 | 52 EISNAM 85 | 53 EL2HLT 86 | 54 EL2NSYNC 87 | 55 EL3HLT 88 | 56 EL3RST 89 | 57 ELIBACC 90 | 58 ELIBBAD 91 | 59 ELIBEXEC 92 | 60 ELIBMAX 93 | 61 ELIBSCN 94 | 62 ELNRNG 95 | 63 ELOOP 96 | 64 EMEDIUMTYPE 97 | 65 EMFILE 98 | 66 EMLINK 99 | 67 EMSGSIZE 100 | 68 EMULTIHOP 101 | 69 ENAMETOOLONG 102 | 70 ENAVAIL 103 | 71 ENEEDAUTH 104 | 72 ENETDOWN 105 | 73 ENETRESET 106 | 74 ENETUNREACH 107 | 75 ENFILE 108 | 76 ENOANO 109 | 77 ENOBUFS 110 | 78 ENOCSI 111 | 79 ENODATA 112 | 80 ENODEV 113 | 81 ENOENT 114 | 82 ENOEXEC 115 | 83 ENOLCK 116 | 84 ENOLINK 117 | 85 ENOMEDIUM 118 | 86 ENOMEM 119 | 87 ENOMSG 120 | 88 ENONET 121 | 89 ENOPKG 122 | 90 ENOPROTOOPT 123 | 91 ENOSPC 124 | 92 ENOSR 125 | 93 ENOSTR 126 | 94 ENOSYS 127 | 95 ENOTBLK 128 | 96 ENOTCONN 129 | 97 ENOTDIR 130 | 98 ENOTEMPTY 131 | 99 ENOTNAM 132 | 100 ENOTSOCK 133 | 101 ENOTSUP 134 | 102 ENOTTY 135 | 103 ENOTUNIQ 136 | 104 ENXIO 137 | 105 EOPNOTSUPP 138 | 106 EOVERFLOW 139 | 107 EPERM 140 | 108 EPFNOSUPPORT 141 | 109 EPIPE 142 | 110 EPROCLIM 143 | 111 EPROCUNAVAIL 144 | 112 EPROGMISMATCH 145 | 113 EPROGUNAVAIL 146 | 114 EPROTO 147 | 115 EPROTONOSUPPORT 148 | 116 EPROTOTYPE 149 | 117 ERANGE 150 | 118 EREMCHG 151 | 119 EREMOTE 152 | 120 EREMOTEIO 153 | 121 ERESTART 154 | 122 EROFS 155 | 123 ERPCMISMATCH 156 | 124 ESHUTDOWN 157 | 125 ESOCKTNOSUPPORT 158 | 126 ESPIPE 159 | 127 ESRCH 160 | 128 ESRMNT 161 | 129 ESTALE 162 | 130 ESTRPIPE 163 | 131 ETIME 164 | 132 ETIMEDOUT 165 | 133 ETOOMANYREFS 166 | 134 ETXTBSY 167 | 135 EUCLEAN 168 | 136 EUNATCH 169 | 137 EUSERS 170 | 138 EWOULDBLOCK 171 | 139 EXDEV 172 | 140 EXFULL 173 | -------------------------------------------------------------------------------- /src/gpg-error-config-test.sh.in: -------------------------------------------------------------------------------- 1 | #!@INSTALLSHELLPATH@ 2 | 3 | # For this test, we clear PKG_CONFIG_LIBDIR, so that gpgrt-config 4 | # command can access ./gpg-error.pc 5 | unset PKG_CONFIG_LIBDIR 6 | 7 | srcdir=${0%/*} 8 | 9 | PKG_CONFIG_PATH="." 10 | 11 | export PKG_CONFIG_PATH 12 | 13 | if [ "$1" = --old-new ]; then 14 | PKG_CONFIG_CMD=./gpg-error-config-old 15 | # Old gpg-error-config never supports PKG_CONFIG_SYSROOT_DIR 16 | unset PKG_CONFIG_SYSROOT_DIR 17 | else 18 | if ! pkg_config_version=$(pkg-config --version 2>/dev/null); then 19 | # Skip this test when pkg-config is not available 20 | exit 77 21 | fi 22 | case $pkg_config_version in 23 | # We know that pkgconf 1.8.0 doesn't work well 24 | 1.8.0) exit 77 ;; 25 | *) ;; 26 | esac 27 | pkg_config_min_version=0.29 28 | PKG_CONFIG_SYSROOT_DIR="/var/example-target" 29 | export PKG_CONFIG_SYSROOT_DIR 30 | PKG_CONFIG_CMD="pkg-config gpg-error" 31 | check_ver=$( ($PKG_CONFIG_CMD --version; echo $pkg_config_min_version) | \ 32 | sort -t '.' -n -k1,1 -k2,2 -k3,3 | sed 1q ) 33 | if [ $check_ver != $pkg_config_min_version ]; then 34 | exit 77 # Skip tests, because it's too old 35 | fi 36 | if ! $PKG_CONFIG_CMD --exists >/dev/null; then 37 | exit 77 # Skip tests 38 | fi 39 | fi 40 | 41 | test_failed="" 42 | 43 | failure () { 44 | ( 45 | echo "Test result: $*" 46 | echo "====================: $PKG_CONFIG_CMD" 47 | echo "$OUTPUT_OLD" 48 | echo "====================: gpgrt-config" 49 | echo "$OUTPUT_NEW" 50 | echo "====================" 51 | ) >> gpg-error-config-test.log 52 | test_failed=yes 53 | } 54 | 55 | rm -f gpg-error-config-test.log 56 | 57 | OUTPUT_OLD=$(echo $($PKG_CONFIG_CMD --libs)) 58 | OUTPUT_NEW=$($srcdir/gpgrt-config --libs) 59 | [ "$OUTPUT_OLD" = "$OUTPUT_NEW" ] || failure --libs 60 | 61 | OUTPUT_OLD=$(echo $($PKG_CONFIG_CMD --cflags)) 62 | OUTPUT_NEW=$($srcdir/gpgrt-config --cflags) 63 | [ "$OUTPUT_OLD" = "$OUTPUT_NEW" ] || failure --cflags 64 | 65 | OUTPUT_OLD=$(echo $($PKG_CONFIG_CMD --cflags --libs)) 66 | OUTPUT_NEW=$($srcdir/gpgrt-config --cflags --libs) 67 | [ "$OUTPUT_OLD" = "$OUTPUT_NEW" ] || failure --cflags --libs 68 | 69 | if [ "$PKG_CONFIG_CMD" = ./gpg-error-config-old ]; then 70 | OUTPUT_OLD=$(echo $($PKG_CONFIG_CMD --version)) 71 | OUTPUT_NEW=$($srcdir/gpgrt-config --version) 72 | [ "$OUTPUT_OLD" = "$OUTPUT_NEW" ] || failure --version 73 | 74 | OUTPUT_OLD=$(echo $($PKG_CONFIG_CMD --mt --libs)) 75 | OUTPUT_NEW=$($srcdir/gpgrt-config --mt --libs) 76 | [ "$OUTPUT_OLD" = "$OUTPUT_NEW" ] || failure --mt --libs 77 | 78 | OUTPUT_OLD=$(echo $($PKG_CONFIG_CMD --mt --cflags)) 79 | OUTPUT_NEW=$($srcdir/gpgrt-config --mt --cflags) 80 | [ "$OUTPUT_OLD" = "$OUTPUT_NEW" ] || failure --mt --cflags 81 | 82 | OUTPUT_OLD=$(echo $($PKG_CONFIG_CMD --cflags --libs)) 83 | OUTPUT_NEW=$($srcdir/gpgrt-config --cflags --libs) 84 | [ "$OUTPUT_OLD" = "$OUTPUT_NEW" ] || failure --cflags --libs 85 | 86 | OUTPUT_OLD=$(echo $($PKG_CONFIG_CMD --mt --cflags --libs)) 87 | OUTPUT_NEW=$($srcdir/gpgrt-config --mt --cflags --libs) 88 | [ "$OUTPUT_OLD" = "$OUTPUT_NEW" ] || failure --mt --cflags --libs 89 | 90 | OUTPUT_OLD=$(echo $($PKG_CONFIG_CMD --variable=mtcflags)) 91 | OUTPUT_NEW=$($srcdir/gpgrt-config --variable=mtcflags) 92 | [ "$OUTPUT_OLD" = "$OUTPUT_NEW" ] || failure --variable=mtcflags 93 | 94 | OUTPUT_OLD=$(echo $($PKG_CONFIG_CMD --variable=mtlibs)) 95 | OUTPUT_NEW=$($srcdir/gpgrt-config --variable=mtlibs) 96 | [ "$OUTPUT_OLD" = "$OUTPUT_NEW" ] || failure --variable=mtlibs 97 | 98 | OUTPUT_OLD=$(echo $($PKG_CONFIG_CMD --variable=host)) 99 | OUTPUT_NEW=$($srcdir/gpgrt-config --variable=host) 100 | [ "$OUTPUT_OLD" = "$OUTPUT_NEW" ] || failure --variable=host 101 | fi 102 | 103 | if [ -n "$test_failed" ]; then 104 | OUTPUT_OLD=$($PKG_CONFIG_CMD --version) 105 | OUTPUT_NEW=$($srcdir/gpgrt-config --version) 106 | failure --version 107 | 108 | exit 99 109 | fi 110 | 111 | exit 0 112 | -------------------------------------------------------------------------------- /tests/t-common.h: -------------------------------------------------------------------------------- 1 | /* t-common.h - Common code for the tests. 2 | * Copyright (C) 2013 g10 Code GmbH 3 | * 4 | * This file is part of libgpg-error. 5 | * 6 | * libgpg-error is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public License 8 | * as published by the Free Software Foundation; either version 2.1 of 9 | * the License, or (at your option) any later version. 10 | * 11 | * libgpg-error is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this program; if not, see . 18 | */ 19 | 20 | #include 21 | 22 | #include "../src/gpgrt.h" 23 | 24 | #ifndef PGM 25 | # error Macro PGM not defined. 26 | #endif 27 | #ifndef DIM 28 | # define DIM(array) (sizeof (array) / sizeof (*array)) 29 | #endif 30 | 31 | 32 | static int verbose; 33 | static int debug; 34 | static int errorcount; 35 | static const char *current_func; 36 | 37 | static void die (const char *format, ...) GPGRT_ATTR_NR_PRINTF(1,2); 38 | static void fail (const char *format, ...) GPGRT_ATTR_PRINTF(1,2); 39 | static void show (const char *format, ...) GPGRT_ATTR_PRINTF(1,2); 40 | 41 | 42 | /* Set the name of the function to be used in error messages. */ 43 | #define enter_test_function() do { current_func = __func__; } while(0) 44 | #define leave_test_function() do { current_func = NULL; } while(0) 45 | 46 | 47 | static void * 48 | xmalloc (size_t n) 49 | { 50 | char *p = gpgrt_malloc (n); 51 | if (!p) 52 | die ("out of core\n"); 53 | return p; 54 | } 55 | 56 | static char * 57 | xstrdup (const char *s) 58 | { 59 | char *p = gpgrt_strdup (s); 60 | if (!p) 61 | die ("out of core\n"); 62 | return p; 63 | } 64 | 65 | static void 66 | xfree (void *p) 67 | { 68 | if (p) 69 | gpgrt_free (p); 70 | } 71 | 72 | 73 | 74 | static void 75 | die (const char *format, ...) 76 | { 77 | va_list arg_ptr ; 78 | 79 | fflush (stdout); 80 | #ifdef HAVE_FLOCKFILE 81 | flockfile (stderr); 82 | #endif 83 | if (current_func) 84 | fprintf (stderr, "%s:%s: ", PGM, current_func); 85 | else 86 | fprintf (stderr, "%s: ", PGM); 87 | va_start (arg_ptr, format) ; 88 | vfprintf (stderr, format, arg_ptr); 89 | va_end (arg_ptr); 90 | if (*format && format[strlen(format)-1] != '\n') 91 | putc ('\n', stderr); 92 | #ifdef HAVE_FLOCKFILE 93 | funlockfile (stderr); 94 | #endif 95 | xfree (xstrdup ("")); /* To avoid compiler warnings. */ 96 | xfree (xmalloc (16)); /* To avoid compiler warnings. */ 97 | exit (1); 98 | } 99 | 100 | 101 | static void 102 | fail (const char *format, ...) 103 | { 104 | va_list arg_ptr; 105 | 106 | fflush (stdout); 107 | #ifdef HAVE_FLOCKFILE 108 | flockfile (stderr); 109 | #endif 110 | if (current_func) 111 | fprintf (stderr, "%s:%s: ", PGM, current_func); 112 | else 113 | fprintf (stderr, "%s: ", PGM); 114 | va_start (arg_ptr, format); 115 | vfprintf (stderr, format, arg_ptr); 116 | va_end (arg_ptr); 117 | if (*format && format[strlen(format)-1] != '\n') 118 | putc ('\n', stderr); 119 | #ifdef HAVE_FLOCKFILE 120 | funlockfile (stderr); 121 | #endif 122 | errorcount++; 123 | if (errorcount >= 50) 124 | die ("stopped after 50 errors."); 125 | } 126 | 127 | 128 | static void 129 | show (const char *format, ...) 130 | { 131 | va_list arg_ptr; 132 | 133 | if (!verbose) 134 | return; 135 | #ifdef HAVE_FLOCKFILE 136 | flockfile (stderr); 137 | #endif 138 | if (current_func) 139 | fprintf (stderr, "%s:%s: ", PGM, current_func); 140 | else 141 | fprintf (stderr, "%s: ", PGM); 142 | va_start (arg_ptr, format); 143 | vfprintf (stderr, format, arg_ptr); 144 | if (*format && format[strlen(format)-1] != '\n') 145 | putc ('\n', stderr); 146 | va_end (arg_ptr); 147 | #ifdef HAVE_FLOCKFILE 148 | funlockfile (stderr); 149 | #endif 150 | } 151 | -------------------------------------------------------------------------------- /src/mkerrnos.awk: -------------------------------------------------------------------------------- 1 | # mkerrnos.awk 2 | # Copyright (C) 2003, 2004 g10 Code GmbH 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License as 6 | # published by the Free Software Foundation; either version 2 of 7 | # the License, or (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | # General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software 16 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 17 | # 18 | # As a special exception, g10 Code GmbH gives unlimited permission to 19 | # copy, distribute and modify the C source files that are the output 20 | # of mkerrnos.awk. You need not follow the terms of the GNU General 21 | # Public License when using or distributing such scripts, even though 22 | # portions of the text of mkerrnos.awk appear in them. The GNU 23 | # General Public License (GPL) does govern all other use of the material 24 | # that constitutes the mkerrnos.awk program. 25 | # 26 | # Certain portions of the mkerrnos.awk source text are designed to be 27 | # copied (in certain cases, depending on the input) into the output of 28 | # mkerrnos.awk. We call these the "data" portions. The rest of the 29 | # mkerrnos.awk source text consists of comments plus executable code 30 | # that decides which of the data portions to output in any given case. 31 | # We call these comments and executable code the "non-data" portions. 32 | # mkerrnos.h never copies any of the non-data portions into its output. 33 | # 34 | # This special exception to the GPL applies to versions of mkerrnos.awk 35 | # released by g10 Code GmbH. When you make and distribute a modified version 36 | # of mkerrnos.awk, you may extend this special exception to the GPL to 37 | # apply to your modified version as well, *unless* your modified version 38 | # has the potential to copy into its output some of the text that was the 39 | # non-data portion of the version that you started with. (In other words, 40 | # unless your change moves or copies text from the non-data portions to the 41 | # data portions.) If your modification has such potential, you must delete 42 | # any notice of this special exception to the GPL from your modified version. 43 | 44 | # This script outputs a source file that does define the following 45 | # symbols: 46 | # 47 | # static const int err_code_to_errno[]; 48 | # A mapping of gpg_err_code_t numbers to system errno. The index of an 49 | # error code in the table can be obtained after removing the system error 50 | # code indication bit. 51 | # 52 | # The input file is a list of possible system errors in the column errnoidx 53 | # (defaults to 2). 54 | # 55 | # Comments (starting with # and ending at the end of the line) are removed, 56 | # as is trailing whitespace. 57 | 58 | BEGIN { 59 | FS="[\t]+"; 60 | header = 1; 61 | if (errnoidx == 0) 62 | errnoidx = 2; 63 | 64 | print "/* Output of mkerrnos.awk. DO NOT EDIT. */"; 65 | print ""; 66 | } 67 | 68 | /^#/ { next; } 69 | 70 | header { 71 | if ($1 ~ /^[0-9]/) 72 | { 73 | print "#include "; 74 | print "#ifdef _WIN32"; 75 | print "#include "; 76 | print "#endif"; 77 | print ""; 78 | print "static const int err_code_to_errno [] = {"; 79 | header = 0; 80 | } 81 | else 82 | print; 83 | } 84 | 85 | !header { 86 | sub (/#.+/, ""); 87 | sub (/[ ]+$/, ""); # Strip trailing space and tab characters. 88 | 89 | if (/^$/) 90 | next; 91 | 92 | print "#ifdef " $errnoidx; 93 | print " " $errnoidx ","; 94 | print "#else"; 95 | print "#ifdef WSA" $errnoidx; 96 | print " WSA" $errnoidx ","; 97 | print "#else"; 98 | print " 0,"; 99 | print "#endif"; 100 | print "#endif"; 101 | } 102 | END { 103 | print "};"; 104 | } 105 | -------------------------------------------------------------------------------- /po/ChangeLog-2011: -------------------------------------------------------------------------------- 1 | 2011-12-01 Werner Koch 2 | 3 | NB: ChangeLog files are no longer manually maintained. Starting 4 | on December 1st, 2011 we put change information only in the GIT 5 | commit log, and generate a top-level ChangeLog file from logs at 6 | "make dist". See doc/HACKING for details. 7 | 8 | 2010-09-16 Jakub Bogusz (wk) 9 | 10 | * pl.po: Update. 11 | 12 | 2010-09-16 gettextize 13 | 14 | * Makefile.in.in: Upgrade to gettext-0.17. 15 | 16 | 2010-05-06 Freek de Kruijf (wk) 17 | 18 | * nl.po: New. 19 | 20 | 2010-05-06 Clytie Siddall (wk) 21 | 22 | * vi.po: Update 23 | 24 | 2009-08-20 Werner Koch 25 | 26 | * LINGUAS: Add zh_CN, cs and it. 27 | * cs.po: New. 28 | * it.po: New. 29 | 30 | 2009-08-20 Daniel Nylander (wk) 31 | 32 | * sv.po: Update 33 | 34 | 2009-08-20 Aron Xu (wk) 35 | 36 | * zh_CN.po: New. 37 | 38 | 2009-03-29 Moritz 39 | 40 | * de.po: Fixed typo. 41 | 42 | 2008-11-12 Werner Koch 43 | 44 | * de.po: Fixed typo. 45 | 46 | 2007-10-29 Daniel Nylander (wk) 47 | 48 | * sv.po: Update. 49 | 50 | 2007-10-29 Clytie Siddall (wk) 51 | 52 | * vi.po: Update. 53 | 54 | 2007-10-29 Jakub Bogusz (wk) 55 | 56 | * pl.po: Update. 57 | 58 | 2007-08-23 Werner Koch 59 | 60 | * de.po: Typo fix [bug#828]. 61 | 62 | 2007-02-26 Werner Koch 63 | 64 | * sv.po: Update from Daniel. 65 | 66 | 2006-12-22 Werner Koch 67 | 68 | * LINGUAS, sv.po: Installed Swedish translation by Daniel Nylander. 69 | 70 | 2006-11-23 gettextize 71 | 72 | * Makefile.in.in: Upgrade to gettext-0.15. 73 | 74 | 2006-09-14 Werner Koch 75 | 76 | * de.po: Updated. 77 | 78 | 2006-09-08 Werner Koch 79 | 80 | * pl.po: Updated. 81 | 82 | 2006-03-14 gettextize 83 | 84 | * Makefile.in.in: Upgrade to gettext-0.14.5. 85 | * Rules-quot: Upgrade to gettext-0.14.5. 86 | 87 | 2006-01-11 Werner Koch 88 | 89 | * vi.po: New. 90 | * LINGUAS: Add vi. 91 | 92 | 2005-09-29 Marcus Brinkmann 93 | 94 | * fr.po: New file. 95 | * LINGUAS: Add fr. 96 | 97 | 2005-07-04 Werner Koch 98 | 99 | * ro.po: New. 100 | 101 | 2005-06-16 Marcus Brinkmann 102 | 103 | * de.po: Apply typo fixes from Debian #313977. 104 | 105 | 2004-04-22 Marcus Brinkmann 106 | 107 | * POTFILES.in: Add src/gpg-error.c. 108 | * pl.po: Add messages for gpg-error.c. 109 | * de.po: Likewise. 110 | 111 | * pl.po: Update. 112 | 113 | 2004-04-20 Marcus Brinkmann 114 | 115 | * LINGUAS: Add pl. 116 | * pl.po: New file. 117 | 118 | 2003-12-08 gettextize 119 | 120 | * Makefile.in.in: Upgrade to gettext-0.12.1. 121 | 122 | 2003-11-14 Werner Koch 123 | 124 | * de.po: New. 125 | 126 | 2003-05-15 gettextize 127 | 128 | * Makefile.in.in: New file, from gettext-0.11.5. 129 | * boldquot.sed: New file, from gettext-0.11.5. 130 | * en@boldquot.header: New file, from gettext-0.11.5. 131 | * en@quot.header: New file, from gettext-0.11.5. 132 | * insert-header.sin: New file, from gettext-0.11.5. 133 | * quot.sed: New file, from gettext-0.11.5. 134 | * remove-potcdate.sin: New file, from gettext-0.11.5. 135 | * Rules-quot: New file, from gettext-0.11.5. 136 | 137 | 138 | Copyright 2003, 2010 g10 Code GmbH 139 | 140 | This file is free software; as a special exception the author gives 141 | unlimited permission to copy and/or distribute it, with or without 142 | modifications, as long as this notice is preserved. 143 | 144 | This file is distributed in the hope that it will be useful, but 145 | WITHOUT ANY WARRANTY, to the extent permitted by law; without even the 146 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 147 | -------------------------------------------------------------------------------- /tests/t-malloc.c: -------------------------------------------------------------------------------- 1 | /* t-malloc.c - Check some malloc functions 2 | * Copyright (C) 2020 g10 Code GmbH 3 | * 4 | * This file is part of Libgpg-error. 5 | * 6 | * Libgpg-error is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public License 8 | * as published by the Free Software Foundation; either version 2.1 of 9 | * the License, or (at your option) any later version. 10 | * 11 | * Libgpg-error is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, see . 18 | * SPDX-License-Identifier: LGPL-2.1-or-later 19 | */ 20 | 21 | #ifdef HAVE_CONFIG_H 22 | #include 23 | #endif 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #define PGM "t-malloc" 33 | #include "t-common.h" 34 | 35 | 36 | static const char * 37 | my_strusage (int level) 38 | { 39 | const char *p; 40 | 41 | switch (level) 42 | { 43 | case 9: p = "LGPL-2.1-or-later"; break; 44 | case 11: p = PGM; break; 45 | default: p = NULL; 46 | } 47 | return p; 48 | } 49 | 50 | 51 | static void 52 | check_reallocarray (void) 53 | { 54 | struct foo_s { const char *a; int b; } *array; 55 | size_t n; 56 | 57 | array = gpgrt_calloc (10, sizeof *array); 58 | if (!array) 59 | die ("%s: malloc failed\n", __func__); 60 | 61 | for (n=0; n < 10; n++) 62 | if (array[n].a || array[n].b) 63 | fail ("%s: array not cleared at index %zu\n", __func__, n); 64 | 65 | for (n=0; n < 10; n++) 66 | { 67 | array[n].a = "dummy string"; 68 | array[n].b = 100+n; 69 | } 70 | 71 | array = gpgrt_reallocarray (array, 10, 20, sizeof *array); 72 | if (!array) 73 | die ("%s: realloc failed\n", __func__); 74 | 75 | for (n=0; n < 10; n++) 76 | { 77 | if (!array[n].a || strcmp (array[n].a, "dummy string")) 78 | fail ("%s: string in realloced array changed at index %zu\n", 79 | __func__, n); 80 | 81 | if (array[n].b != 100 + n) 82 | fail ("%s: number in realloced array changed at index %zu\n", 83 | __func__, n); 84 | } 85 | for (n=10; n < 20; n++) 86 | if (array[n].a || array[n].b) 87 | fail ("%s: realloced array not cleared at index %zu\n", __func__, n); 88 | 89 | /* We can't easily check whether the reallocated array does not 90 | * iniitialze in the case OLDN is equal or larger to N, so we skip 91 | * this. Let's do a simple shrink test instead. */ 92 | 93 | array = gpgrt_reallocarray (array, 20, 7, sizeof *array); 94 | if (!array) 95 | die ("%s: realloc (shrinking) failed\n", __func__); 96 | 97 | for (n=0; n < 7; n++) 98 | { 99 | if (!array[n].a || strcmp (array[n].a, "dummy string")) 100 | fail ("%s: string in shrunk array changed at index %zu\n", 101 | __func__, n); 102 | 103 | if (array[n].b != 100 + n) 104 | fail ("%s: number in shrunk array changed at index %zu\n", 105 | __func__, n); 106 | } 107 | 108 | xfree (array); 109 | } 110 | 111 | 112 | int 113 | main (int argc, char **argv) 114 | { 115 | gpgrt_opt_t opts[] = { 116 | ARGPARSE_x ('v', "verbose", NONE, 0, "Print more diagnostics"), 117 | ARGPARSE_s_n('d', "debug", "Flyswatter"), 118 | ARGPARSE_end() 119 | }; 120 | gpgrt_argparse_t pargs = { &argc, &argv, 0 }; 121 | 122 | gpgrt_set_strusage (my_strusage); 123 | gpgrt_log_set_prefix (gpgrt_strusage (11), GPGRT_LOG_WITH_PREFIX); 124 | 125 | while (gpgrt_argparse (NULL, &pargs, opts)) 126 | { 127 | switch (pargs.r_opt) 128 | { 129 | case 'v': verbose++; break; 130 | case 'd': debug++; break; 131 | default : pargs.err = ARGPARSE_PRINT_ERROR; break; 132 | } 133 | } 134 | gpgrt_argparse (NULL, &pargs, NULL); 135 | 136 | show ("testing malloc functions\n"); 137 | 138 | check_reallocarray (); 139 | 140 | return !!errorcount; 141 | } 142 | -------------------------------------------------------------------------------- /mkinstalldirs: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # mkinstalldirs --- make directory hierarchy 3 | 4 | scriptversion=2009-04-28.21; # UTC 5 | 6 | # Original author: Noah Friedman 7 | # Created: 1993-05-16 8 | # Public domain. 9 | # 10 | # This file is maintained in Automake, please report 11 | # bugs to or send patches to 12 | # . 13 | 14 | nl=' 15 | ' 16 | IFS=" "" $nl" 17 | errstatus=0 18 | dirmode= 19 | 20 | usage="\ 21 | Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... 22 | 23 | Create each directory DIR (with mode MODE, if specified), including all 24 | leading file name components. 25 | 26 | Report bugs to ." 27 | 28 | # process command line arguments 29 | while test $# -gt 0 ; do 30 | case $1 in 31 | -h | --help | --h*) # -h for help 32 | echo "$usage" 33 | exit $? 34 | ;; 35 | -m) # -m PERM arg 36 | shift 37 | test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } 38 | dirmode=$1 39 | shift 40 | ;; 41 | --version) 42 | echo "$0 $scriptversion" 43 | exit $? 44 | ;; 45 | --) # stop option processing 46 | shift 47 | break 48 | ;; 49 | -*) # unknown option 50 | echo "$usage" 1>&2 51 | exit 1 52 | ;; 53 | *) # first non-opt arg 54 | break 55 | ;; 56 | esac 57 | done 58 | 59 | for file 60 | do 61 | if test -d "$file"; then 62 | shift 63 | else 64 | break 65 | fi 66 | done 67 | 68 | case $# in 69 | 0) exit 0 ;; 70 | esac 71 | 72 | # Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and 73 | # mkdir -p a/c at the same time, both will detect that a is missing, 74 | # one will create a, then the other will try to create a and die with 75 | # a "File exists" error. This is a problem when calling mkinstalldirs 76 | # from a parallel make. We use --version in the probe to restrict 77 | # ourselves to GNU mkdir, which is thread-safe. 78 | case $dirmode in 79 | '') 80 | if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then 81 | echo "mkdir -p -- $*" 82 | exec mkdir -p -- "$@" 83 | else 84 | # On NextStep and OpenStep, the 'mkdir' command does not 85 | # recognize any option. It will interpret all options as 86 | # directories to create, and then abort because '.' already 87 | # exists. 88 | test -d ./-p && rmdir ./-p 89 | test -d ./--version && rmdir ./--version 90 | fi 91 | ;; 92 | *) 93 | if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 && 94 | test ! -d ./--version; then 95 | echo "mkdir -m $dirmode -p -- $*" 96 | exec mkdir -m "$dirmode" -p -- "$@" 97 | else 98 | # Clean up after NextStep and OpenStep mkdir. 99 | for d in ./-m ./-p ./--version "./$dirmode"; 100 | do 101 | test -d $d && rmdir $d 102 | done 103 | fi 104 | ;; 105 | esac 106 | 107 | for file 108 | do 109 | case $file in 110 | /*) pathcomp=/ ;; 111 | *) pathcomp= ;; 112 | esac 113 | oIFS=$IFS 114 | IFS=/ 115 | set fnord $file 116 | shift 117 | IFS=$oIFS 118 | 119 | for d 120 | do 121 | test "x$d" = x && continue 122 | 123 | pathcomp=$pathcomp$d 124 | case $pathcomp in 125 | -*) pathcomp=./$pathcomp ;; 126 | esac 127 | 128 | if test ! -d "$pathcomp"; then 129 | echo "mkdir $pathcomp" 130 | 131 | mkdir "$pathcomp" || lasterr=$? 132 | 133 | if test ! -d "$pathcomp"; then 134 | errstatus=$lasterr 135 | else 136 | if test ! -z "$dirmode"; then 137 | echo "chmod $dirmode $pathcomp" 138 | lasterr= 139 | chmod "$dirmode" "$pathcomp" || lasterr=$? 140 | 141 | if test ! -z "$lasterr"; then 142 | errstatus=$lasterr 143 | fi 144 | fi 145 | fi 146 | fi 147 | 148 | pathcomp=$pathcomp/ 149 | done 150 | done 151 | 152 | exit $errstatus 153 | 154 | # Local Variables: 155 | # mode: shell-script 156 | # sh-indentation: 2 157 | # eval: (add-hook 'write-file-hooks 'time-stamp) 158 | # time-stamp-start: "scriptversion=" 159 | # time-stamp-format: "%:y-%02m-%02d.%02H" 160 | # time-stamp-time-zone: "UTC" 161 | # time-stamp-end: "; # UTC" 162 | # End: 163 | -------------------------------------------------------------------------------- /src/w32-add.h: -------------------------------------------------------------------------------- 1 | ## w32-add.h - Snippet to be be included into gpg-error.h. 2 | ## Comments are indicated by a double hash mark. Due to a 3 | ## peculiarity of the script the first used line must not 4 | ## start with a hash mark. 5 | 6 | /* Decide whether to use the format_arg attribute. */ 7 | #if _GPG_ERR_GCC_VERSION > 20800 8 | # define _GPG_ERR_ATTR_FORMAT_ARG(a) __attribute__ ((__format_arg__ (a))) 9 | #else 10 | # define _GPG_ERR_ATTR_FORMAT_ARG(a) 11 | #endif 12 | 13 | /* A lean gettext implementation based on GNU style mo files which are 14 | required to be encoded in UTF-8. There is a limit on 65534 entries 15 | to save some RAM. Only Germanic plural rules are supported. */ 16 | const char *_gpg_w32_bindtextdomain (const char *domainname, 17 | const char *dirname); 18 | const char *_gpg_w32_textdomain (const char *domainname); 19 | const char *_gpg_w32_gettext (const char *msgid) 20 | _GPG_ERR_ATTR_FORMAT_ARG (1); 21 | const char *_gpg_w32_dgettext (const char *domainname, const char *msgid) 22 | _GPG_ERR_ATTR_FORMAT_ARG (2); 23 | const char *_gpg_w32_dngettext (const char *domainname, const char *msgid1, 24 | const char *msgid2, unsigned long int n) 25 | _GPG_ERR_ATTR_FORMAT_ARG (2) _GPG_ERR_ATTR_FORMAT_ARG (3); 26 | const char *_gpg_w32_gettext_localename (void); 27 | 28 | /* With a VALUE of 1 switch the gettext functions into utf8 mode; with 29 | * 2 or 3 all new threads will initially be using UTF8 (this new 30 | * default init can't be reverted, though). That is the strings are 31 | * returned without translation to the native charset. A VALUE of 0 32 | * switches back to translated strings. A VALUE of -1 returns the 33 | * current value (1 or 0). */ 34 | int _gpg_w32_gettext_use_utf8 (int value); 35 | 36 | #ifdef GPG_ERR_ENABLE_GETTEXT_MACROS 37 | # define bindtextdomain(a,b) _gpg_w32_bindtextdomain ((a), (b)) 38 | # define textdomain(a) _gpg_w32_textdomain ((a)) 39 | # define gettext(a) _gpg_w32_gettext ((a)) 40 | # define dgettext(a,b) _gpg_w32_dgettext ((a), (b)) 41 | # define ngettext(a,b,c) _gpg_w32_dngettext (NULL, (a), (b), (c)) 42 | # define dngettext(a,b,c,d) _gpg_w32_dngettext ((a), (b), (c), (d)) 43 | # define gettext_localename() _gpg_w32_gettext_localename () 44 | # define gettext_use_utf8(a) _gpg_w32_gettext_use_utf8 (a) 45 | #endif /*GPG_ERR_ENABLE_GETTEXT_MACROS*/ 46 | 47 | /* Force the use of the locale NAME or if NAME is NULL the one derived 48 | * from LANGID. This function must be used early and is not thread-safe. */ 49 | void gpgrt_w32_override_locale (const char *name, unsigned short langid); 50 | 51 | 52 | /* A simple iconv implementation w/o the need for an extra DLL. */ 53 | struct _gpgrt_w32_iconv_s; 54 | typedef struct _gpgrt_w32_iconv_s *gpgrt_w32_iconv_t; 55 | 56 | gpgrt_w32_iconv_t gpgrt_w32_iconv_open (const char *tocode, 57 | const char *fromcode); 58 | int gpgrt_w32_iconv_close (gpgrt_w32_iconv_t cd); 59 | size_t gpgrt_w32_iconv (gpgrt_w32_iconv_t cd, 60 | const char **inbuf, size_t *inbytesleft, 61 | char **outbuf, size_t *outbytesleft); 62 | 63 | #ifdef GPGRT_ENABLE_W32_ICONV_MACROS 64 | # define ICONV_CONST const 65 | # define iconv_t gpgrt_w32_iconv_t 66 | # define iconv_open(a,b) gpgrt_w32_iconv_open ((a), (b)) 67 | # define iconv_close(a) gpgrt_w32_iconv_close ((a)) 68 | # define iconv(a,b,c,d,e) gpgrt_w32_iconv ((a),(b),(c),(d),(e)) 69 | #endif /*GPGRT_ENABLE_W32_ICONV_MACROS*/ 70 | 71 | /* Release a wchar_t * buffer. */ 72 | void gpgrt_free_wchar (wchar_t *wstring); 73 | 74 | /* Convert an UTF-8 encoded file name to wchar. 75 | * Prepend a '\\?\' prefix if needed. */ 76 | wchar_t *gpgrt_fname_to_wchar (const char *fname); 77 | 78 | /* Convert an UTF8 string to a WCHAR string. Caller should use 79 | * gpgrt_free_wchar to release the result. 80 | * Returns NULL on error and sets ERRNO. */ 81 | wchar_t *gpgrt_utf8_to_wchar (const char *string); 82 | 83 | /* Convert a WCHAR string to UTF-8. Caller should use gpgrt_free to 84 | * release the result. Returns NULL on error and sets ERRNO. */ 85 | char *gpgrt_wchar_to_utf8 (const wchar_t *wstring); 86 | 87 | /* Query a string in the registry. */ 88 | char *gpgrt_w32_reg_query_string (const char *root, 89 | const char *dir, 90 | const char *name); 91 | 92 | /* Query a string in the registry using a unified key representation. */ 93 | char *gpgrt_w32_reg_get_string (const char *key); 94 | -------------------------------------------------------------------------------- /src/gpgrt.m4: -------------------------------------------------------------------------------- 1 | # gpgrt.m4 - autoconf macro to detect libgpgrt 2 | # Copyright (C) 2002, 2003, 2004, 2011, 2014, 2017, 2018 g10 Code GmbH 3 | # 4 | # This file is free software; as a special exception the author gives 5 | # unlimited permission to copy and/or distribute it, with or without 6 | # modifications, as long as this notice is preserved. 7 | # 8 | # This file is distributed in the hope that it will be useful, but 9 | # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the 10 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 | # SPDX-License-Identifier: FSFULLR 12 | # 13 | # Last-changed: 2018-11-13 14 | # Note: This is a kind of duplicate of gpg-error.m4 which uses the 15 | # future name of libgpg-error to prepare for a smooth migration in 16 | # some distant time. 17 | 18 | dnl AM_PATH_GPGRT([MINIMUM-VERSION, 19 | dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]]) 20 | dnl 21 | dnl Test for libgpgrt and define GPGRT_CFLAGS, GPGRT_LIBS, 22 | dnl GPGRT_MT_CFLAGS, and GPGRT_MT_LIBS. The _MT_ variants are 23 | dnl used for programs requiring real multi thread support. 24 | dnl 25 | AC_DEFUN([AM_PATH_GPGRT], 26 | [ AC_REQUIRE([AC_CANONICAL_HOST]) 27 | if test "$prefix" = NONE ; then 28 | prefix_option_expanded=/usr/local 29 | else 30 | prefix_option_expanded="$prefix" 31 | fi 32 | if test "$exec_prefix" = NONE ; then 33 | exec_prefix_option_expanded=$prefix_option_expanded 34 | else 35 | exec_prefix_option_expanded=$(prefix=$prefix_option_expanded eval echo $exec_prefix) 36 | fi 37 | libdir_option_expanded=$(prefix=$prefix_option_expanded exec_prefix=$exec_prefix_option_expanded eval echo $libdir) 38 | 39 | if test -f $libdir_option_expanded/pkgconfig/gpg-error.pc; then 40 | gpgrt_libdir=$libdir_option_expanded 41 | else 42 | if crt1_path=$(${CC:-cc} -print-file-name=crt1.o 2>/dev/null); then 43 | if possible_libdir=$(cd ${crt1_path%/*} && pwd 2>/dev/null); then 44 | if test -f $possible_libdir/pkgconfig/gpg-error.pc; then 45 | gpgrt_libdir=$possible_libdir 46 | fi 47 | fi 48 | fi 49 | fi 50 | 51 | if test -n "$gpgrt_libdir"; then 52 | AC_PATH_PROG(GPGRT_CONFIG, gpgrt-config, no) 53 | if test "$GPGRT_CONFIG" != "no"; then 54 | GPGRT_CONFIG="$GPGRT_CONFIG --libdir=$gpgrt_libdir" 55 | fi 56 | fi 57 | min_gpgrt_version=ifelse([$1], ,1.33,$1) 58 | AC_MSG_CHECKING(for GPG Runtime - version >= $min_gpgrt_version) 59 | ok=no 60 | if test x"$GPGRT_CONFIG" != x && test "$GPGRT_CONFIG" != "no" ; then 61 | req_major=`echo $min_gpgrt_version | \ 62 | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)/\1/'` 63 | req_minor=`echo $min_gpgrt_version | \ 64 | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)/\2/'` 65 | gpgrt_config_version=`$GPGRT_CONFIG --version` 66 | major=`echo $gpgrt_config_version | \ 67 | sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` 68 | minor=`echo $gpgrt_config_version | \ 69 | sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` 70 | if test "$major" -gt "$req_major"; then 71 | ok=yes 72 | else 73 | if test "$major" -eq "$req_major"; then 74 | if test "$minor" -ge "$req_minor"; then 75 | ok=yes 76 | fi 77 | fi 78 | fi 79 | fi 80 | if test $ok = yes; then 81 | GPGRT_CFLAGS=`$GPGRT_CONFIG --cflags` 82 | GPGRT_LIBS=`$GPGRT_CONFIG --libs` 83 | GPGRT_MT_CFLAGS=`$GPGRT_CONFIG --variable=mtcflags 2>/dev/null` 84 | GPGRT_MT_CFLAGS="$GPGRT_CFLAGS${GPGRT_CFLAGS:+ }$GPGRT_MT_CFLAGS" 85 | GPGRT_MT_LIBS=`$GPGRT_CONFIG --variable=mtlibs 2>/dev/null` 86 | GPGRT_MT_LIBS="$GPGRT_LIBS${GPGRT_LIBS:+ }$GPGRT_MT_LIBS" 87 | AC_MSG_RESULT([yes ($gpgrt_config_version)]) 88 | ifelse([$2], , :, [$2]) 89 | gpgrt_config_host=`$GPGRT_CONFIG --variable=host 2>/dev/null || echo none` 90 | if test x"$gpgrt_config_host" != xnone ; then 91 | if test x"$gpgrt_config_host" != x"$host" ; then 92 | AC_MSG_WARN([[ 93 | *** 94 | *** The config script "$GPGRT_CONFIG" is for $gpgrt_config_host 95 | *** and thus may not match the used host $host. 96 | ***]]) 97 | gpg_config_script_warn="$gpg_config_script_warn libgpgrt" 98 | fi 99 | fi 100 | else 101 | GPGRT_CFLAGS="" 102 | GPGRT_LIBS="" 103 | GPGRT_MT_CFLAGS="" 104 | GPGRT_MT_LIBS="" 105 | AC_MSG_RESULT(no) 106 | ifelse([$3], , :, [$3]) 107 | fi 108 | AC_SUBST(GPGRT_CFLAGS) 109 | AC_SUBST(GPGRT_LIBS) 110 | AC_SUBST(GPGRT_MT_CFLAGS) 111 | AC_SUBST(GPGRT_MT_LIBS) 112 | ]) 113 | -------------------------------------------------------------------------------- /tests/t-lock-single-posix.c: -------------------------------------------------------------------------------- 1 | /* t-lock-single-posix.c - Check the lock functions with single thread 2 | * Copyright (C) 2021 g10 Code GmbH 3 | * 4 | * This file is part of libgpg-error. 5 | * 6 | * libgpg-error is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public License 8 | * as published by the Free Software Foundation; either version 2.1 of 9 | * the License, or (at your option) any later version. 10 | * 11 | * libgpg-error is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this program; if not, see . 18 | */ 19 | 20 | #if HAVE_CONFIG_H 21 | # include 22 | #endif 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | #define PGM "t-lock-single" 32 | 33 | #include "t-common.h" 34 | 35 | GPGRT_LOCK_DEFINE (the_lock); 36 | 37 | static int locking_used; 38 | 39 | #ifdef USE_POSIX_THREADS_FROM_LIBC 40 | #include 41 | 42 | static void * 43 | thread_func (void *arg) 44 | { 45 | (void)arg; 46 | return NULL; 47 | } 48 | #endif 49 | 50 | static void 51 | run_test (void) 52 | { 53 | gpg_err_code_t rc; 54 | 55 | rc = gpgrt_lock_lock (&the_lock); 56 | if (rc) 57 | fail ("gpgrt_lock_lock failed at %d: %s", __LINE__, gpg_strerror (rc)); 58 | 59 | rc = gpgrt_lock_unlock (&the_lock); 60 | if (rc) 61 | fail ("gpgrt_lock_unlock failed at %d: %s", __LINE__,gpg_strerror (rc)); 62 | 63 | if (locking_used) 64 | /*It was incremented, even with single thread. */ 65 | fail ("Single thread situation is not correctly handled\n"); 66 | 67 | #ifdef USE_POSIX_THREADS_FROM_LIBC 68 | /* 69 | * With !USE_POSIX_THREADS_FROM_LIBC, it is determined at link time. 70 | * 71 | * With USE_POSIX_THREADS_FROM_LIBC, it is determined at runtime, 72 | * and the condition is changed when an application actually uses 73 | * thread. 74 | */ 75 | { 76 | pthread_t rthread; 77 | pthread_create (&rthread, NULL, thread_func, NULL); 78 | 79 | rc = gpgrt_lock_lock (&the_lock); 80 | if (rc) 81 | fail ("gpgrt_lock_lock failed at %d: %s", __LINE__, gpg_strerror (rc)); 82 | 83 | rc = gpgrt_lock_unlock (&the_lock); 84 | if (rc) 85 | fail ("gpgrt_lock_unlock failed at %d: %s", __LINE__,gpg_strerror (rc)); 86 | 87 | pthread_join (rthread, NULL); 88 | 89 | if (!locking_used) 90 | /*It was *NOT* incremented, even with multiple threads. */ 91 | fail ("Multiple threads situation is not correctly handled\n"); 92 | } 93 | #endif 94 | } 95 | 96 | 97 | static void 98 | syscall_clam_pre (void) 99 | { 100 | if (debug) 101 | show ("syscall pre called\n"); 102 | locking_used++; 103 | } 104 | 105 | static void 106 | syscall_clam_post (void) 107 | { 108 | if (debug) 109 | show ("syscall post called\n"); 110 | } 111 | 112 | int 113 | main (int argc, char **argv) 114 | { 115 | int last_argc = -1; 116 | int rc; 117 | 118 | if (argc) 119 | { 120 | argc--; argv++; 121 | } 122 | while (argc && last_argc != argc ) 123 | { 124 | last_argc = argc; 125 | if (!strcmp (*argv, "--help")) 126 | { 127 | puts ( 128 | "usage: ./t-lock-single [options]\n" 129 | "\n" 130 | "Options:\n" 131 | " --verbose Show what is going on\n" 132 | " --debug Flyswatter\n" 133 | ); 134 | exit (0); 135 | } 136 | if (!strcmp (*argv, "--verbose")) 137 | { 138 | verbose = 1; 139 | argc--; argv++; 140 | } 141 | else if (!strcmp (*argv, "--debug")) 142 | { 143 | verbose = debug = 1; 144 | argc--; argv++; 145 | } 146 | } 147 | 148 | if (!gpg_error_check_version (GPG_ERROR_VERSION)) 149 | { 150 | die ("gpg_error_check_version returned an error"); 151 | errorcount++; 152 | } 153 | 154 | gpgrt_set_syscall_clamp (syscall_clam_pre, syscall_clam_post); 155 | 156 | rc = gpgrt_lock_init (&the_lock); 157 | if (rc) 158 | fail ("gpgrt_lock_init failed at %d: %s", __LINE__, gpg_strerror (rc)); 159 | 160 | run_test (); 161 | 162 | gpgrt_lock_destroy (&the_lock); 163 | 164 | return errorcount ? 1 : 0; 165 | } 166 | --------------------------------------------------------------------------------