|
|
1.1 root 1: /* $Header: /f/osi/others/quipu/uips/xd/RCS/sequence.c,v 7.0 90/06/12 13:10:52 mrose Exp $ */
2: #ifndef lint
3: static char *rcsid = "$Id: sequence.c,v 7.0 90/06/12 13:10:52 mrose Exp $";
4: #endif
5: /*
6: $Log: sequence.c,v $
7: * Revision 7.0 90/06/12 13:10:52 mrose
8: * *** empty log message ***
9: *
10: * Revision 1.5 90/04/26 10:22:46 emsrssn
11: * Installation fixed
12: *
13: *
14: * Revision 1.4 90/04/25 17:28:15 emsrssn
15: * Lint tidy up
16: *
17: *
18: * Revision 1.3 90/04/19 13:54:17 emsrssn
19: * keyboard accelerator now activates button highlight.
20: *
21: * search types available is dependent on current position
22: * to prevent unreasonable searches.
23: *
24: * the help popup changes automatically depending on the
25: * position of the cursor
26: *
27: * buttons remain a fixed size when the application is
28: * resized
29: *
30: * command line options are now handled properly
31: *
32: * logging added
33: *
34: * "reads" are now sorted to show mail address at top etc.
35: *
36: *
37: * Revision 1.2 90/03/09 15:57:34 emsrssn
38: * First public distribution
39: *
40: *
41: * Revision 1.1 90/03/08 13:18:41 emsrssn
42: * Initial revision
43: *
44: *
45: */
46:
47: /* This file contains code to implement the list storage facilities
48: * in the modified widget program (renamed SD 5/1/90).
49: */
50:
51: /* This file was written by Damanjit Mahl @ Brunel University
52: * on 31st October 1989 as part of the modifications made to
53: * the Quipu X.500 widget interface written by Paul Sharpe
54: * at GEC Research, Hirst Research Centre.
55: */
56:
57: /*
58: * NOTICE
59: *
60: * Acquisition, use, and distribution of this module and related
61: * materials are subject to the restrictions of a license agreement.
62: * Consult the Preface in the User's Manual for the full terms of
63: * this agreement.
64: *
65: */
66:
67: #include "sequence.h"
68:
69: add_seq (seq, str)
70: D_seq *seq;
71: char *str;
72: {
73: D_seq curr;
74:
75: if (*seq) {
76: for (curr = *seq; curr->next; curr = curr->next) {}
77: curr->next = (struct d_seq *) malloc (sizeof (struct d_seq));
78: curr = curr->next;
79: curr->strlen = strlen (str);
80: curr->dname = malloc ((curr->strlen)+5);
81: (void) strcpy(curr->dname, str);
82: curr->next = 0;
83: } else {
84: curr = (struct d_seq *) malloc (sizeof (struct d_seq));
85: curr->strlen = strlen (str);
86: curr->dname = malloc ((curr->strlen)+5);
87: (void) strcpy(curr->dname, str);
88: curr->next = 0;
89: *seq = curr;
90: }
91: }
92:
93: char *
94: get_from_seq (seq_num, seq_ptr)
95: int seq_num;
96: D_seq seq_ptr;
97: {
98: for (; seq_num > 1 && seq_ptr; seq_ptr = seq_ptr->next, seq_num--) {}
99: if (seq_ptr)
100: return seq_ptr->dname;
101: else
102: return 0;
103: }
104:
105:
106: free_seq (seq_ptr)
107: D_seq seq_ptr;
108: {
109: D_seq next_seq;
110:
111: while (seq_ptr) {
112: free(seq_ptr->dname);
113: next_seq = seq_ptr->next;
114: free((char *) seq_ptr);
115: seq_ptr = next_seq;
116: }
117: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.