|
|
1.1 root 1: /* qb2str.c - qbuf to string */
2:
3: #ifndef lint
4: static char *rcsid = "$Header: /f/osi/psap/RCS/qb2str.c,v 7.0 89/11/23 22:13:30 mrose Rel $";
5: #endif
6:
7: /*
8: * $Header: /f/osi/psap/RCS/qb2str.c,v 7.0 89/11/23 22:13:30 mrose Rel $
9: *
10: *
11: * $Log: qb2str.c,v $
12: * Revision 7.0 89/11/23 22:13:30 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:
33: /* */
34:
35: char *qb2str (q)
36: register struct qbuf *q;
37: {
38: register int len;
39: register char *b,
40: *d;
41: register struct qbuf *p;
42:
43: len = 0;
44: for (p = q -> qb_forw; p != q; p = p -> qb_forw)
45: len += p -> qb_len;
46: q -> qb_len = len;
47:
48: if ((b = d = malloc ((unsigned) (len + 1))) == NULL)
49: return NULLCP;
50:
51: for (p = q -> qb_forw; p != q; p = p -> qb_forw) {
52: bcopy (p -> qb_data, d, p -> qb_len);
53: d += p -> qb_len;
54: }
55: *d = NULL;
56:
57: return b;
58: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.