File:  [CSRG BSD Unix] / 43BSDReno / contrib / isode-beta / others / quipu / uips / pod / sequence.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 16:12:56 2018 UTC (8 years, 1 month ago) by root
Branches: MAIN, BSD
CVS tags: HEAD, BSD43reno
BSD 4.3reno


#ifndef lint
static char *rcsid = "$Header: /var/lib/cvsd/repos/CSRG/43BSDReno/contrib/isode-beta/others/quipu/uips/pod/sequence.c,v 1.1.1.1 2018/04/24 16:12:56 root Exp $";
#endif

/*
 * $Header: /var/lib/cvsd/repos/CSRG/43BSDReno/contrib/isode-beta/others/quipu/uips/pod/sequence.c,v 1.1.1.1 2018/04/24 16:12:56 root Exp $
 */

/*
 * $Log: sequence.c,v $
 * Revision 1.1.1.1  2018/04/24 16:12:56  root
 * BSD 4.3reno
 *
 * Revision 7.0  90/06/12  13:15:51  mrose
 * *** empty log message ***
 * 
 * Revision 1.5  90/04/26  10:21:22  emsrdsm
 * *** empty log message ***
 * 
 * Revision 1.4  90/04/25  13:47:31  emsrdsm
 * i) lint'ed
 * 
 * Revision 1.3  90/04/20  10:28:27  emsrdsm
 * (i) fixed form bug
 * 
 * Revision 1.2  90/04/18  18:48:29  emsrdsm
 * i) added logging
 * 
 * Revision 1.1  90/04/10  16:44:54  emsrdsm
 * Initial revision
 * 
 */

#include <malloc.h>
#include <string.h>

#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;

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

unix.superglobalmegacorp.com

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