]> git.saurik.com Git - apple/security.git/blob - SecuritySNACCRuntime/c-lib/src/print.c
Security-54.1.3.tar.gz
[apple/security.git] / SecuritySNACCRuntime / c-lib / src / print.c
1 /*
2 * Copyright (c) 2000-2001 Apple Computer, Inc. All Rights Reserved.
3 *
4 * The contents of this file constitute Original Code as defined in and are
5 * subject to the Apple Public Source License Version 1.2 (the 'License').
6 * You may not use this file except in compliance with the License. Please obtain
7 * a copy of the License at http://www.apple.com/publicsource and read it before
8 * using this file.
9 *
10 * This Original Code and all software distributed under the License are
11 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS
12 * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
13 * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14 * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the
15 * specific language governing rights and limitations under the License.
16 */
17
18
19 /*
20 * print.c - library routines for printing ASN.1 values.
21 *
22 * Copyright (C) 1992 Michael Sample and the University of British Columbia
23 *
24 * This library is free software; you can redistribute it and/or
25 * modify it provided that this copyright/license information is retained
26 * in original form.
27 *
28 * If you modify this file, you must clearly indicate your changes.
29 *
30 * This source code is distributed in the hope that it will be
31 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
32 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
33 *
34 * $Header: /cvs/Darwin/src/live/Security/SecuritySNACCRuntime/c-lib/src/print.c,v 1.1.1.1 2001/05/18 23:14:08 mb Exp $
35 * $Log: print.c,v $
36 * Revision 1.1.1.1 2001/05/18 23:14:08 mb
37 * Move from private repository to open source repository
38 *
39 * Revision 1.2 2001/05/05 00:59:25 rmurphy
40 * Adding darwin license headers
41 *
42 * Revision 1.1.1.1 1999/03/16 18:06:32 aram
43 * Originals from SMIME Free Library.
44 *
45 * Revision 1.3 1997/03/13 09:15:19 wan
46 * Improved dependency generation for stupid makedepends.
47 * Corrected PeekTag to peek into buffer only as far as necessary.
48 * Added installable error handler.
49 * Fixed small glitch in idl-code generator (Markku Savela <msa@msa.tte.vtt.fi>).
50 *
51 * Revision 1.2 1995/07/24 21:04:55 rj
52 * changed `_' to `-' in file names.
53 *
54 * Revision 1.1 1994/08/28 09:46:08 rj
55 * first check-in. for a list of changes to the snacc-1.1 distribution please refer to the ChangeLog.
56 *
57 */
58
59 #include "asn-config.h"
60 #include "print.h"
61
62 unsigned short int stdIndentG = 4;
63
64
65 void
66 Indent PARAMS ((f, i),
67 FILE *f _AND_
68 unsigned short int i)
69 {
70 for (; i > 0; i--)
71 fputc (' ', f); /* this may be slow */
72 }
73
74 void Asn1DefaultErrorHandler PARAMS ((str, severity),
75 char* str _AND_
76 int severity)
77 {
78 fprintf(stderr,"%s",str);
79 }
80
81 static Asn1ErrorHandler asn1CurrentErrorHandler = Asn1DefaultErrorHandler;
82
83 void
84 Asn1Error PARAMS ((str),
85 char* str)
86 {
87 (*asn1CurrentErrorHandler)(str,1);
88 }
89
90 void
91 Asn1Warning PARAMS ((str),
92 char* str)
93 {
94 (*asn1CurrentErrorHandler)(str,0);
95 }
96
97 Asn1ErrorHandler
98 Asn1InstallErrorHandler PARAMS ((handler),
99 Asn1ErrorHandler handler)
100 {
101 Asn1ErrorHandler former = asn1CurrentErrorHandler;
102 asn1CurrentErrorHandler = handler;
103 return former;
104 }
105