Integrate cctools-751 changes
[striptease.git] / libstuff / ofile_error.c
blob4827a5a1d3b711f81fa5bef3713a5e25997a36be
1 /*
2 * Copyright (c) 2003 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 #define __darwin_i386_exception_state i386_exception_state
24 #define __darwin_i386_float_state i386_float_state
25 #define __darwin_i386_thread_state i386_thread_state
27 #include <stdarg.h>
28 #include "stuff/ofile.h"
29 #include "stuff/print.h"
30 #include "stuff/errors.h"
32 __private_extern__
33 void
34 archive_error(
35 struct ofile *ofile,
36 const char *format, ...)
38 va_list ap;
40 va_start(ap, format);
41 if(ofile->file_type == OFILE_FAT){
42 print("%s: for architecture %s archive: %s ",
43 progname, ofile->arch_flag.name, ofile->file_name);
45 else{
46 print("%s: archive: %s ", progname, ofile->file_name);
48 vprint(format, ap);
49 print("\n");
50 va_end(ap);
51 errors++;
54 __private_extern__
55 void
56 archive_member_error(
57 struct ofile *ofile,
58 const char *format, ...)
60 va_list ap;
62 va_start(ap, format);
63 if(ofile->file_type == OFILE_FAT){
64 print("%s: for architecture %s archive member: %s(%.*s) ",
65 progname, ofile->arch_flag.name, ofile->file_name,
66 (int)ofile->member_name_size, ofile->member_name);
68 else{
69 print("%s: archive member: %s(%.*s) ", progname, ofile->file_name,
70 (int)ofile->member_name_size, ofile->member_name);
72 vprint(format, ap);
73 print("\n");
74 va_end(ap);
75 errors++;
78 #ifndef OTOOL
79 __private_extern__
80 void
81 Mach_O_error(
82 struct ofile *ofile,
83 const char *format, ...)
85 va_list ap;
87 va_start(ap, format);
88 if(ofile->file_type == OFILE_FAT){
89 if(ofile->arch_type == OFILE_ARCHIVE){
90 print("%s: for architecture %s object: %s(%.*s) ", progname,
91 ofile->arch_flag.name, ofile->file_name,
92 (int)ofile->member_name_size, ofile->member_name);
94 else{
95 print("%s: for architecture %s object: %s ", progname,
96 ofile->arch_flag.name, ofile->file_name);
99 else if(ofile->file_type == OFILE_ARCHIVE){
100 if(ofile->member_type == OFILE_FAT){
101 print("%s: for object: %s(%.*s) architecture %s ", progname,
102 ofile->file_name, (int)ofile->member_name_size,
103 ofile->arch_flag.name, ofile->member_name);
105 else{
106 print("%s: object: %s(%.*s) ", progname, ofile->file_name,
107 (int)ofile->member_name_size, ofile->member_name);
110 else{
111 print("%s: object: %s ", progname, ofile->file_name);
113 vprint(format, ap);
114 print("\n");
115 va_end(ap);
116 errors++;
118 #endif /* !defined(OTOOL) */