|
|
1.1 ! root 1: /* qb_pullup.c - "pullup" a list of qbufs */ ! 2: ! 3: #ifndef lint ! 4: static char *rcsid = "$Header: /f/osi/psap/RCS/qb_pullup.c,v 7.0 89/11/23 22:13:31 mrose Rel $"; ! 5: #endif ! 6: ! 7: /* ! 8: * $Header: /f/osi/psap/RCS/qb_pullup.c,v 7.0 89/11/23 22:13:31 mrose Rel $ ! 9: * ! 10: * ! 11: * $Log: qb_pullup.c,v $ ! 12: * Revision 7.0 89/11/23 22:13:31 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: int qb_pullup (qb) ! 36: register struct qbuf *qb; ! 37: { ! 38: register int len; ! 39: register char *d; ! 40: register struct qbuf *p, ! 41: *qp, ! 42: *qpp; ! 43: ! 44: len = 0; ! 45: #ifdef notdef /* want null-termination... */ ! 46: if ((p = qb -> qb_forw) -> qb_forw == qb) ! 47: return OK; ! 48: #endif ! 49: for (p = qb -> qb_forw; p != qb; p = p -> qb_forw) ! 50: len += p -> qb_len; ! 51: ! 52: if ((p = (struct qbuf *) malloc ((unsigned) (sizeof *p + len + 1))) ! 53: == NULL) ! 54: return NOTOK; ! 55: d = p -> qb_data = p -> qb_base; ! 56: p -> qb_len = len; ! 57: ! 58: for (qp = qb -> qb_forw; qp != qb; qp = qpp) { ! 59: qpp = qp -> qb_forw; ! 60: ! 61: remque (qp); ! 62: ! 63: bcopy (qp -> qb_data, d, qp -> qb_len); ! 64: d += qp -> qb_len; ! 65: ! 66: free ((char *) qp); ! 67: } ! 68: *d = NULL; ! 69: ! 70: insque (p, qb); ! 71: ! 72: return OK; ! 73: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.