1 /* t-syserror.c - System error specific regression test.
2 Copyright (C) 2006 g10 Code GmbH
4 This file is part of libgpg-error.
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.
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.
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
32 #include <gpg-error.h>
35 main (int argc, char *argv[])
41 fp = fopen ("/does-not-exist/110761/nowhere.foo", "r");
45 fp = fopen (" no this file does not exists foo 4711", "r");
49 fprintf (stderr, "unable to run test\n");
54 ec = gpg_err_code_from_syserror ();
55 if (ec != GPG_ERR_ENOENT)
57 fprintf (stderr, "fopen failed with bad code: %d\n", save_errno);
61 if (ec != gpg_err_code_from_errno (save_errno))
63 fprintf (stderr, "oops at %d\n",__LINE__);
69 ec = gpg_err_code_from_syserror ();
70 if (ec != GPG_ERR_MISSING_ERRNO)
72 fprintf (stderr, "oops at %d\n",__LINE__);
76 if ( gpg_err_code_from_errno (0) )
78 fprintf (stderr, "oops at %d\n",__LINE__);