|
|
1.1 ! root 1: /* str2qb.c - string to qbuf */ ! 2: ! 3: #ifndef lint ! 4: static char *rcsid = "$Header: /f/osi/psap/RCS/str2qb.c,v 7.2 90/04/18 08:51:02 mrose Exp $"; ! 5: #endif ! 6: ! 7: /* ! 8: * $Header: /f/osi/psap/RCS/str2qb.c,v 7.2 90/04/18 08:51:02 mrose Exp $ ! 9: * ! 10: * ! 11: * $Log: str2qb.c,v $ ! 12: * Revision 7.2 90/04/18 08:51:02 mrose ! 13: * touch-up ! 14: * ! 15: * Revision 7.1 90/02/19 13:09:48 mrose ! 16: * update ! 17: * ! 18: * Revision 7.0 89/11/23 22:13:49 mrose ! 19: * Release 6.0 ! 20: * ! 21: */ ! 22: ! 23: /* ! 24: * NOTICE ! 25: * ! 26: * Acquisition, use, and distribution of this module and related ! 27: * materials are subject to the restrictions of a license agreement. ! 28: * Consult the Preface in the User's Manual for the full terms of ! 29: * this agreement. ! 30: * ! 31: */ ! 32: ! 33: ! 34: /* LINTLIBRARY */ ! 35: ! 36: #include <stdio.h> ! 37: #include "psap.h" ! 38: ! 39: /* */ ! 40: ! 41: struct qbuf *str2qb (s, len, head) ! 42: char *s; ! 43: int len, ! 44: head; ! 45: { ! 46: register struct qbuf *qb, ! 47: *pb; ! 48: ! 49: if ((pb = (struct qbuf *) malloc ((unsigned) (sizeof *pb + len))) == NULL) ! 50: return NULL; ! 51: ! 52: if (head) { ! 53: if ((qb = (struct qbuf *) malloc (sizeof *qb)) == NULL) { ! 54: free ((char *) pb); ! 55: return NULL; ! 56: } ! 57: qb -> qb_forw = qb -> qb_back = qb; ! 58: qb -> qb_data = NULL, qb -> qb_len = len; ! 59: insque (pb, qb); ! 60: } ! 61: else { ! 62: pb -> qb_forw = pb -> qb_back = pb; ! 63: qb = pb; ! 64: } ! 65: ! 66: pb -> qb_data = pb -> qb_base; ! 67: if ((pb -> qb_len = len) > 0 && s) ! 68: bcopy (s, pb -> qb_data, len); ! 69: ! 70: return qb; ! 71: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.