DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T s

⟦26ceb404e⟧ TextFile

    Length: 1932 (0x78c)
    Types: TextFile
    Names: »sequence.c«

Derivation

└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
    └─⟦35176feda⟧ »EurOpenD22/isode/isode-6.tar.Z« 
        └─⟦de7628f85⟧ 
            └─⟦this⟧ »isode-6.0/others/quipu/uips/widget2/sequence.c« 

TextFile

/* This file contains code to implement the list storage facilities
 * in the modified widget program.
 */

/*    This file was written by Damanjit Mahl @ Brunel University
 *    on 31st October 1989 as part of the modifications made to
 *    the Quipu X.500 widget interface written by Paul Sharpe
 *    at GEC Research, Hirst Research Centre.
 */

/*
 *                                NOTICE
 *
 *    Acquisition, use, and distribution of this module and related
 *    materials are subject to the restrictions of a license agreement.
 *    Consult the Preface in the User's Manual for the full terms of
 *    this agreement.
 *
 */

#include "sequence.h"

add_seq (seq, str)
D_seq *seq;
char *str;
{
D_seq curr;
      
      if (*seq) {
            for (curr = *seq; curr->next; curr = curr->next) {}
	    curr->next = (struct d_seq *) malloc (sizeof (struct d_seq));
	    curr = curr->next;
	    curr->strlen = strlen (str);
	    curr->dname = malloc ((curr->strlen)+5);
	    (void) strcpy(curr->dname, str);
	    curr->next = 0;
      } else {
	    curr = (struct d_seq *) malloc (sizeof (struct d_seq));
	    curr->strlen = strlen (str);
	    curr->dname = malloc ((curr->strlen)+5);
	    (void) strcpy(curr->dname, str);
	    curr->next = 0;
	    *seq = curr;
      }
}
	          
char *	    
get_from_seq (seq_num, seq_ptr)
int seq_num;
D_seq seq_ptr;
{
      for (; seq_num > 1 && seq_ptr; seq_ptr = seq_ptr->next, seq_num--) {}
      if (seq_ptr)
            return seq_ptr->dname;
      else
	    return 0;
}


free_seq (seq_ptr)
D_seq seq_ptr;
{
D_seq next_seq;

      next_seq = seq_ptr;

      if (seq_ptr) {
            for (; seq_ptr; seq_ptr = seq_ptr->next)
                  free (seq_ptr->dname);
 
	    seq_ptr = next_seq;
	    for (seq_ptr = next_seq; next_seq->next; seq_ptr = next_seq) {
                  next_seq = seq_ptr->next;
		  free ((char *)seq_ptr);
	    }
	    free ((char *)next_seq);
      }
}