|
Packit |
fc043f |
/* t-strerror.c - Regression test.
|
|
Packit |
fc043f |
Copyright (C) 2003 g10 Code GmbH
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
This file is part of libgpg-error.
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
libgpg-error is free software; you can redistribute it and/or
|
|
Packit |
fc043f |
modify it under the terms of the GNU Lesser General Public License
|
|
Packit |
fc043f |
as published by the Free Software Foundation; either version 2.1 of
|
|
Packit |
fc043f |
the License, or (at your option) any later version.
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
libgpg-error is distributed in the hope that it will be useful, but
|
|
Packit |
fc043f |
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
fc043f |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
fc043f |
Lesser General Public License for more details.
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
You should have received a copy of the GNU Lesser General Public
|
|
Packit |
fc043f |
License along with libgpgme-error; if not, write to the Free
|
|
Packit |
fc043f |
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
Packit |
fc043f |
02111-1307, USA. */
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
#if HAVE_CONFIG_H
|
|
Packit |
fc043f |
#include <config.h>
|
|
Packit |
fc043f |
#endif
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
#include <stdio.h>
|
|
Packit |
fc043f |
#if HAVE_STDLIB_H
|
|
Packit |
fc043f |
#include <stdlib.h>
|
|
Packit |
fc043f |
#endif
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
#include <gpg-error.h>
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
int
|
|
Packit |
fc043f |
main (int argc, char *argv[])
|
|
Packit |
fc043f |
{
|
|
Packit |
fc043f |
if (argc > 1)
|
|
Packit |
fc043f |
{
|
|
Packit |
fc043f |
int i = 1;
|
|
Packit |
fc043f |
while (i + 1 < argc)
|
|
Packit |
fc043f |
{
|
|
Packit |
fc043f |
gpg_error_t err = gpg_err_make (atoi (argv[i]), atoi (argv[i + 1]));
|
|
Packit |
fc043f |
printf ("%s: %s\n", gpg_strsource (err), gpg_strerror (err));
|
|
Packit |
fc043f |
i += 2;
|
|
Packit |
fc043f |
}
|
|
Packit |
fc043f |
}
|
|
Packit |
fc043f |
else
|
|
Packit |
fc043f |
{
|
|
Packit |
fc043f |
struct
|
|
Packit |
fc043f |
{
|
|
Packit |
fc043f |
gpg_err_source_t src;
|
|
Packit |
fc043f |
gpg_err_code_t code;
|
|
Packit |
fc043f |
} list[] = { { 0, 0 }, { 1, 201 }, { 2, 2 }, { 3, 102 },
|
|
Packit |
fc043f |
{ 4, 100 }, { 5, 99 }, { 6, 110 }, { 7, 7 }, { 8, 888 } };
|
|
Packit |
fc043f |
int i = 0;
|
|
Packit |
fc043f |
|
|
Packit |
fc043f |
while (i < sizeof (list) / sizeof (list[0]))
|
|
Packit |
fc043f |
{
|
|
Packit |
fc043f |
gpg_error_t err = gpg_err_make (list[i].src, list[i].code);
|
|
Packit |
fc043f |
printf ("%s: %s\n", gpg_strsource (err), gpg_strerror (err));
|
|
Packit |
fc043f |
i++;
|
|
Packit |
fc043f |
}
|
|
Packit |
fc043f |
}
|
|
Packit |
fc043f |
return 0;
|
|
Packit |
fc043f |
}
|