*** empty log message ***
[gnutls.git] / src / asn1c.c
blob19f1d1fb45fd8fb9a879c879fc963a014156298b
1 /*
2 * Copyright (C) 2000,2001 Fabio Fiorina
4 * This file is part of GNUTLS.
6 * GNUTLS is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * GNUTLS 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 General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
22 /*****************************************************/
23 /* File: PkixTabExample.c */
24 /* Description: An example on how to use the */
25 /* 'asn1_parser_asn1_file_c' function. */
26 /*****************************************************/
28 #include <stdio.h>
29 #include <string.h>
30 #include "../lib/gnutls.h"
31 #include "../lib/x509_der.h"
33 int
34 main(int argc,char *argv[])
36 int result;
37 char* outfile;
39 if(argc<2||argc>3) {
40 fprintf(stderr, "Usage: %s: input.asn output.c\n", argv[0]);
41 exit(1);
44 if (argc==3) outfile=argv[2];
45 else outfile=NULL;
47 result=asn1_parser_asn1_file_c( argv[1], outfile);
49 if(result==ASN_SYNTAX_ERROR){
50 printf("PARSE ERROR\n");
51 return;
53 else if(result==ASN_IDENTIFIER_NOT_FOUND){
54 printf("IDENTIFIER NOT FOUND\n");
55 return;
57 else if(result==ASN_FILE_NOT_FOUND){
58 printf("FILE NOT FOUND\n");
59 return;
62 return;