|
|
1.1 ! root 1: /* seq_add.c - add an element to a sequence */ ! 2: ! 3: #ifndef lint ! 4: static char *rcsid = "$Header: /f/osi/psap/RCS/seq_add.c,v 7.0 89/11/23 22:13:35 mrose Rel $"; ! 5: #endif ! 6: ! 7: /* ! 8: * $Header: /f/osi/psap/RCS/seq_add.c,v 7.0 89/11/23 22:13:35 mrose Rel $ ! 9: * ! 10: * ! 11: * $Log: seq_add.c,v $ ! 12: * Revision 7.0 89/11/23 22:13:35 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 seq_add (pe, r, i) ! 36: register PE pe, ! 37: r; ! 38: register int i; ! 39: { ! 40: register PE *p, ! 41: q; ! 42: ! 43: if (r == NULLPE) ! 44: return pe_seterr (pe, PE_ERR_NMEM, NOTOK); ! 45: ! 46: if (i < 0) ! 47: i = pe -> pe_cardinal; ! 48: for (p = &pe -> pe_cons; q = *p; p = &q -> pe_next) ! 49: if (q -> pe_offset == i) { ! 50: r -> pe_next = q -> pe_next; ! 51: pe_free (q); ! 52: break; ! 53: } ! 54: else ! 55: if (q -> pe_offset > i) { ! 56: r -> pe_next = q; ! 57: break; ! 58: } ! 59: ! 60: *p = r; ! 61: if ((r -> pe_offset = i) >= pe -> pe_cardinal) ! 62: pe -> pe_cardinal = i + 1; ! 63: ! 64: return OK; ! 65: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.