Annotation of 43BSDReno/contrib/isode-beta/others/quipu/uips/pod/sequence.c, revision 1.1

1.1     ! root        1: 
        !             2: #ifndef lint
        !             3: static char *rcsid = "$Header: /f/osi/others/quipu/uips/pod/RCS/sequence.c,v 7.0 90/06/12 13:15:51 mrose Exp $";
        !             4: #endif
        !             5: 
        !             6: /*
        !             7:  * $Header: /f/osi/others/quipu/uips/pod/RCS/sequence.c,v 7.0 90/06/12 13:15:51 mrose Exp $
        !             8:  */
        !             9: 
        !            10: /*
        !            11:  * $Log:       sequence.c,v $
        !            12:  * Revision 7.0  90/06/12  13:15:51  mrose
        !            13:  * *** empty log message ***
        !            14:  * 
        !            15:  * Revision 1.5  90/04/26  10:21:22  emsrdsm
        !            16:  * *** empty log message ***
        !            17:  * 
        !            18:  * Revision 1.4  90/04/25  13:47:31  emsrdsm
        !            19:  * i) lint'ed
        !            20:  * 
        !            21:  * Revision 1.3  90/04/20  10:28:27  emsrdsm
        !            22:  * (i) fixed form bug
        !            23:  * 
        !            24:  * Revision 1.2  90/04/18  18:48:29  emsrdsm
        !            25:  * i) added logging
        !            26:  * 
        !            27:  * Revision 1.1  90/04/10  16:44:54  emsrdsm
        !            28:  * Initial revision
        !            29:  * 
        !            30:  */
        !            31: 
        !            32: #include <malloc.h>
        !            33: #include <string.h>
        !            34: 
        !            35: #include "sequence.h"
        !            36: 
        !            37: add_seq (seq, str)
        !            38: D_seq *seq;
        !            39: char *str;
        !            40: {
        !            41: D_seq curr;
        !            42:       
        !            43:       if (*seq) {
        !            44:             for (curr = *seq; curr->next; curr = curr->next) {}
        !            45:            curr->next = (struct d_seq *) malloc (sizeof (struct d_seq));
        !            46:            curr = curr->next;
        !            47:            curr->strlen = strlen (str);
        !            48:            curr->dname = malloc ((curr->strlen)+5);
        !            49:            (void) strcpy(curr->dname, str);
        !            50:            curr->next = 0;
        !            51:       } else {
        !            52:            curr = (struct d_seq *) malloc (sizeof (struct d_seq));
        !            53:            curr->strlen = strlen (str);
        !            54:            curr->dname = malloc ((curr->strlen)+5);
        !            55:            (void) strcpy(curr->dname, str);
        !            56:            curr->next = 0;
        !            57:            *seq = curr;
        !            58:       }
        !            59: }
        !            60:                  
        !            61: char *     
        !            62: get_from_seq (seq_num, seq_ptr)
        !            63: int seq_num;
        !            64: D_seq seq_ptr;
        !            65: {
        !            66:       for (; seq_num > 1 && seq_ptr; seq_ptr = seq_ptr->next, seq_num--) {}
        !            67:       if (seq_ptr)
        !            68:             return seq_ptr->dname;
        !            69:       else
        !            70:            return 0;
        !            71: }
        !            72: 
        !            73: 
        !            74: free_seq (seq_ptr)
        !            75: D_seq seq_ptr;
        !            76: {
        !            77:        D_seq next_seq;
        !            78: 
        !            79:        while (seq_ptr) {
        !            80:                free((char *) (seq_ptr->dname));
        !            81:                next_seq = seq_ptr->next;
        !            82:                free((char *) seq_ptr);
        !            83:                seq_ptr = next_seq;
        !            84:        }
        !            85: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.