Integrate cctools-822 changes
[striptease.git] / libstuff / fatal_arch.c
blobf16c8a453098f59de4dc0040e6738040e0c4c54c
1 /*
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
23 #ifndef RLD
24 #include <stdio.h>
25 #include <stdlib.h>
26 #include <stdarg.h>
27 #include "stuff/breakout.h"
28 #include "stuff/errors.h"
31 * Print the warning message and the input file.
33 __private_extern__
34 void
35 warning_arch(
36 struct arch *arch,
37 struct member *member,
38 char *format,
39 ...)
41 va_list ap;
43 va_start(ap, format);
44 fprintf(stderr, "%s: ", progname);
45 vfprintf(stderr, format, ap);
46 va_end(ap);
47 if(member != NULL){
48 fprintf(stderr, "%s(%.*s)", arch->file_name,
49 (int)member->member_name_size, member->member_name);
51 else
52 fprintf(stderr, "%s", arch->file_name);
53 if(arch->fat_arch_name != NULL)
54 fprintf(stderr, " (for architecture %s)\n", arch->fat_arch_name);
55 else
56 fprintf(stderr, "\n");
57 va_end(ap);
61 * Print the error message the input file and increment the error count
63 __private_extern__
64 void
65 error_arch(
66 struct arch *arch,
67 struct member *member,
68 char *format,
69 ...)
71 va_list ap;
73 va_start(ap, format);
74 fprintf(stderr, "%s: ", progname);
75 vfprintf(stderr, format, ap);
76 va_end(ap);
77 if(member != NULL){
78 fprintf(stderr, "%s(%.*s)", arch->file_name,
79 (int)member->member_name_size, member->member_name);
81 else
82 fprintf(stderr, "%s", arch->file_name);
83 if(arch->fat_arch_name != NULL)
84 fprintf(stderr, " (for architecture %s)\n", arch->fat_arch_name);
85 else
86 fprintf(stderr, "\n");
87 va_end(ap);
88 errors++;
92 * Print the fatal error message the input file and exit non-zero.
94 __private_extern__
95 void
96 fatal_arch(
97 struct arch *arch,
98 struct member *member,
99 char *format,
100 ...)
102 va_list ap;
104 va_start(ap, format);
105 fprintf(stderr, "%s: ", progname);
106 vfprintf(stderr, format, ap);
107 va_end(ap);
108 if(member != NULL){
109 fprintf(stderr, "%s(%.*s)", arch->file_name,
110 (int)member->member_name_size, member->member_name);
112 else
113 fprintf(stderr, "%s", arch->file_name);
114 if(arch->fat_arch_name != NULL)
115 fprintf(stderr, " (for architecture %s)\n", arch->fat_arch_name);
116 else
117 fprintf(stderr, "\n");
118 va_end(ap);
119 exit(EXIT_FAILURE);
121 #endif /* !defined(RLD) */