comparison usr/src/cmd/fmli/oh/obj_to_par.c @ 0:c9caec207d52 b86

Initial porting based on b86
author Koji Uno <koji.uno@sun.com>
date Tue, 02 Jun 2009 18:56:50 +0900
parents
children 1a15d5aaf794
comparison
equal deleted inserted replaced
-1:000000000000 0:c9caec207d52
1 /*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
23 /* All Rights Reserved */
24
25
26 /*
27 * Copyright (c) 1985 AT&T
28 * All Rights Reserved
29 */
30
31 #ident "@(#)obj_to_par.c 1.6 05/06/08 SMI" /* SVr4.0 1.5 */
32
33 #include <stdio.h>
34 #include <string.h>
35 #include <sys/types.h> /* EFT abs k16 */
36 #include "but.h"
37 #include "wish.h"
38 #include "typetab.h"
39 #include "ifuncdefs.h"
40 #include "partabdefs.h"
41 #include "optabdefs.h"
42
43 /* Obj_to_parts should be used instead of obj_to_opt in those executables
44 * that do not need access to the object operations table. It only
45 * reads the global flags and parts information for an object.
46 */
47
48 /* The No_operations flag is set to TRUE if the externally read object
49 * has not had its operations read.
50 */
51 bool No_operations;
52
53 struct opt_entry *
54 obj_to_parts(objtype)
55 char *objtype;
56 {
57 register int i;
58 FILE *fp;
59 extern struct opt_entry Partab[MAX_TYPES];
60 extern char *externoot();
61
62 for (i = 0; i < MAX_TYPES && Partab[i].objtype; i++) {
63 if (strcmp(objtype, Partab[i].objtype) == 0 )
64 return(Partab + i);
65 }
66
67 /* read in the external object table for this object, but
68 * only read in the parts information.
69 */
70
71 if ((fp = fopen(externoot(objtype), "r")) == NULL)
72 return(NULL);
73
74 if (read_parts(fp, objtype) == O_FAIL) {
75 #ifdef _DEBUG
76 _debug(stderr, "External Object not found\n");
77 #endif
78 fclose(fp);
79 return(NULL);
80 } else {
81 #ifdef _DEBUG
82 _debug(stderr, "External Object %s found\n", objtype);
83 #endif
84 No_operations = TRUE;
85 fclose(fp);
86 return(Partab + MAX_TYPES - 1);
87 }
88 }