|
|
1.1 ! root 1: #ifndef lint ! 2: static char *rcsid = "$Header: /f/osi/others/quipu/uips/sd/RCS/sequence.c,v 7.0 90/06/12 13:14:05 mrose Exp $"; ! 3: #endif ! 4: ! 5: /* ! 6: * $Header: /f/osi/others/quipu/uips/sd/RCS/sequence.c,v 7.0 90/06/12 13:14:05 mrose Exp $ ! 7: */ ! 8: ! 9: /* ! 10: * $Log: sequence.c,v $ ! 11: * Revision 7.0 90/06/12 13:14:05 mrose ! 12: * *** empty log message *** ! 13: * ! 14: * Revision 1.6 90/04/26 10:36:30 emsrdsm ! 15: * *** empty log message *** ! 16: * ! 17: * Revision 1.5 90/04/25 15:07:42 emsrdsm ! 18: * i) lint'ed ! 19: * ! 20: * Revision 1.4 90/04/20 17:57:56 emsrdsm ! 21: * i) no more freeing ! 22: * ! 23: * Revision 1.3 90/04/18 18:28:04 emsrdsm ! 24: * fixed i) does not move to leaves ! 25: * ii) added default mechanism described using "typeDefaults" file. ! 26: * iii) added 'sorting' to attribute display ! 27: * ! 28: * Revision 1.2 90/03/15 16:32:08 emsrdsm ! 29: * fixes i) Prints messages correctly on exit. ! 30: * ii) Added rfc822 to greybook mailbox conversion ! 31: * iii) Removed bug that caused crash if 'local_dit' undefined ! 32: * ! 33: * Revision 1.1 90/03/09 17:40:34 emsrdsm ! 34: * Initial revision ! 35: * ! 36: * Revision 1.1 90/03/09 13:37:16 emsrdsm ! 37: * Initial revision ! 38: * ! 39: */ ! 40: ! 41: /* This file contains code to implement the list storage facilities ! 42: * in the modified widget program (renamed SD 5/1/90). ! 43: */ ! 44: ! 45: /* This file was written by Damanjit Mahl @ Brunel University ! 46: * on 31st October 1989 as part of the modifications made to ! 47: * the Quipu X.500 widget interface written by Paul Sharpe ! 48: * at GEC Research, Hirst Research Centre. ! 49: */ ! 50: ! 51: /* ! 52: * NOTICE ! 53: * ! 54: * Acquisition, use, and distribution of this module and related ! 55: * materials are subject to the restrictions of a license agreement. ! 56: * Consult the Preface in the User's Manual for the full terms of ! 57: * this agreement. ! 58: * ! 59: */ ! 60: ! 61: #include "sequence.h" ! 62: ! 63: add_seq (seq, str) ! 64: D_seq *seq; ! 65: char *str; ! 66: { ! 67: D_seq curr; ! 68: ! 69: if (*seq) { ! 70: for (curr = *seq; curr->next; curr = curr->next) {} ! 71: curr->next = (struct d_seq *) malloc (sizeof (struct d_seq)); ! 72: curr = curr->next; ! 73: curr->strlen = strlen (str); ! 74: curr->dname = malloc ((curr->strlen)+5); ! 75: (void) strcpy(curr->dname, str); ! 76: curr->next = 0; ! 77: } else { ! 78: curr = (struct d_seq *) malloc (sizeof (struct d_seq)); ! 79: curr->strlen = strlen (str); ! 80: curr->dname = malloc ((curr->strlen)+5); ! 81: (void) strcpy(curr->dname, str); ! 82: curr->next = 0; ! 83: *seq = curr; ! 84: } ! 85: } ! 86: ! 87: char * ! 88: get_from_seq (seq_num, seq_ptr) ! 89: int seq_num; ! 90: D_seq seq_ptr; ! 91: { ! 92: for (; seq_num > 1 && seq_ptr; seq_ptr = seq_ptr->next, seq_num--) {} ! 93: if (seq_ptr) ! 94: return seq_ptr->dname; ! 95: else ! 96: return 0; ! 97: } ! 98: ! 99: ! 100: free_seq (seq_ptr) ! 101: D_seq seq_ptr; ! 102: { ! 103: D_seq next_seq; ! 104: ! 105: while (seq_ptr) { ! 106: free(seq_ptr->dname); ! 107: next_seq = seq_ptr->next; ! 108: free((char *) seq_ptr); ! 109: seq_ptr = next_seq; ! 110: } ! 111: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.