|
|
1.1 root 1: /* pe2uvec.c - write a PE to a udvec */
2:
3: #ifndef lint
4: static char *rcsid = "$Header: /f/osi/psap/RCS/pe2uvec.c,v 7.0 89/11/23 22:12:59 mrose Rel $";
5: #endif
6:
7: /*
8: * $Header: /f/osi/psap/RCS/pe2uvec.c,v 7.0 89/11/23 22:12:59 mrose Rel $
9: *
10: *
11: * $Log: pe2uvec.c,v $
12: * Revision 7.0 89/11/23 22:12:59 mrose
13: * Release 6.0
14: *
15: */
16:
17: /*
18: * NOTICE
19: *
20: * Acquisition, use, and distribution of this module and related
21: * materials are subject to the restrictions of a license agreement.
22: * Consult the Preface in the User's Manual for the full terms of
23: * this agreement.
24: *
25: */
26:
27:
28: /* LINTLIBRARY */
29:
30: #include <stdio.h>
31: #include "psap.h"
32: #include "tailor.h"
33:
34: /* */
35:
36: int pe2uvec (pe, uv)
37: register PE pe;
38: struct udvec **uv;
39: {
40: int cc;
41: #ifdef DEBUG
42: int len;
43: #endif
44: register PS ps;
45:
46: *uv = NULL;
47:
48: if ((ps = ps_alloc (uvec_open)) == NULLPS)
49: return NOTOK;
50: cc = ps_get_abs (pe) - ps_get_plen (pe);
51: #ifdef DEBUG
52: len = ps -> ps_byteno;
53: #endif
54: if (uvec_setup (ps, cc) == NOTOK || pe2ps_aux (ps, pe, 0) == NOTOK) {
55: ps_free (ps);
56: return NOTOK;
57: }
58:
59: *uv = ps -> ps_head;
60: #ifdef DEBUG
61: len = ps -> ps_byteno - len;
62: #endif
63:
64: ps -> ps_head = NULL;
65: ps -> ps_extra = NULL;
66: ps_free (ps);
67:
68: #ifdef DEBUG
69: if (psap_log -> ll_events & LLOG_PDUS) {
70: register int i,
71: j,
72: k;
73: register struct udvec *vv;
74:
75: i = j = k = 0;
76: for (vv = *uv; vv -> uv_base; vv++, i++)
77: if (vv -> uv_inline)
78: j++, k += vv -> uv_len;
79:
80: LLOG (psap_log, LLOG_PDUS,
81: ("PE written in %d elements, %d inline (%d octet%s)",
82: i, j, k, k != 1 ? "s" : ""));
83: pe2text (psap_log, pe, 0, len);
84: }
85: #endif
86:
87: return OK;
88: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.