annotate src/itemlist.c @ 278:a0497ffac49b noffle

[svn] I'm not very good at automake. Redo with automake2.13.
author bears
date Sun, 10 Nov 2002 18:49:41 +0000
parents 24d4cd032da5
children 5eece4dfd945
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
1 /*
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
2 itemlist.c
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
3
197
24d4cd032da5 [svn] * AUTHORS,INSTALL,NEWS,README,TODO,docs/NOTES,src/client.c,src/protocol.c,
bears
parents: 72
diff changeset
4 $Id: itemlist.c 316 2001-10-31 11:44:53Z bears $
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
5 */
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
6
45
32ba1198c6fa [svn] * Makefile.in, configure, configure.in, docs/Makefile.in, src/Makefile.in:
uh1763
parents: 43
diff changeset
7 #if HAVE_CONFIG_H
32ba1198c6fa [svn] * Makefile.in, configure, configure.in, docs/Makefile.in, src/Makefile.in:
uh1763
parents: 43
diff changeset
8 #include <config.h>
32ba1198c6fa [svn] * Makefile.in, configure, configure.in, docs/Makefile.in, src/Makefile.in:
uh1763
parents: 43
diff changeset
9 #endif
32ba1198c6fa [svn] * Makefile.in, configure, configure.in, docs/Makefile.in, src/Makefile.in:
uh1763
parents: 43
diff changeset
10
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
11 #include <ctype.h>
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
12 #include <string.h>
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
13 #include <stdlib.h>
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
14 #include "common.h"
197
24d4cd032da5 [svn] * AUTHORS,INSTALL,NEWS,README,TODO,docs/NOTES,src/client.c,src/protocol.c,
bears
parents: 72
diff changeset
15 #include "itemlist.h"
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
16 #include "log.h"
54
125d79c9e586 [svn] * src/client.c, src/configfile.c, src/content.c, src/control.c,
uh1763
parents: 45
diff changeset
17 #include "portable.h"
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
18
72
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
19 #if defined(ITEMLIST_TEST)
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
20 #define Log_err printf
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
21 #endif
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
22
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
23 #define SEP_CHAR '\1' /* Replace all separators with this */
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
24
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
25 struct ItemList
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
26 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
27 char *list;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
28 char *next;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
29 size_t count;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
30 };
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
31
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
32 /* Make a new item list. */
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
33 ItemList *
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
34 new_Itl( const char *list, const char *separators )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
35 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
36 ItemList * res;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
37 char *p;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
38 Bool inItem;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
39
45
32ba1198c6fa [svn] * Makefile.in, configure, configure.in, docs/Makefile.in, src/Makefile.in:
uh1763
parents: 43
diff changeset
40 res = malloc( sizeof( ItemList ) );
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
41 if ( res == NULL )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
42 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
43 Log_err( "Malloc of ItemList failed." );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
44 exit( EXIT_FAILURE );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
45 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
46
45
32ba1198c6fa [svn] * Makefile.in, configure, configure.in, docs/Makefile.in, src/Makefile.in:
uh1763
parents: 43
diff changeset
47 res->list = malloc ( strlen(list) + 2 );
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
48 if ( res->list == NULL )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
49 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
50 Log_err( "Malloc of ItemList.list failed." );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
51 exit( EXIT_FAILURE );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
52 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
53 strcpy( res->list, list );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
54
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
55 res->count = 0;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
56 res->next = res->list;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
57
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
58 /* Separate items into strings and have final zero-length string. */
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
59 for( p = res->list, inItem = FALSE; *p != '\0'; p++ )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
60 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
61 Bool isSep = ( strchr( separators, p[ 0 ] ) != NULL );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
62
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
63 if ( inItem )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
64 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
65 if ( isSep )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
66 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
67 p[ 0 ] = '\0';
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
68 inItem = FALSE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
69 res->count++;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
70 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
71 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
72 else
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
73 {
72
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
74 if ( isSep )
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
75 p[ 0 ] = SEP_CHAR;
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
76 else
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
77 inItem = TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
78 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
79 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
80 if ( inItem )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
81 res->count++;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
82 p[ 1 ] = '\0';
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
83 return res;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
84 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
85
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
86 /* Delete an item list. */
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
87 void
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
88 del_Itl( ItemList *self )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
89 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
90 if ( self == NULL )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
91 return;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
92 free( self->list );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
93 free( self );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
94 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
95
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
96 /* Get first item. */
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
97 const char *
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
98 Itl_first( ItemList *self)
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
99 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
100 self->next = self->list;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
101 return Itl_next( self );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
102 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
103
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
104 /* Get next item or NULL. */
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
105 const char *
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
106 Itl_next( ItemList *self )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
107 {
72
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
108 char *res = self->next;
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
109
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
110 if ( res[ 0 ] == '\0' )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
111 return NULL;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
112
72
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
113 while ( res[ 0 ] == SEP_CHAR )
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
114 res++;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
115
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
116 if ( res[ 0 ] == '\0' && res[ 1 ] == '\0' )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
117 return NULL;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
118
72
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
119 self->next = res + strlen( res ) + 1;
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
120 return res;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
121 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
122
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
123 /* Get count of items in list. */
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
124 size_t
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
125 Itl_count( const ItemList *self )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
126 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
127 return self->count;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
128 }
72
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
129
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
130 #if defined(ITEMLIST_TEST)
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
131
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
132 /* Test code borrowed from wildmat.c. Yep, still uses gets(). */
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
133 extern char *gets();
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
134
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
135 int
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
136 main()
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
137 {
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
138 Str line;
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
139 Str seps;
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
140 ItemList * itl;
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
141 int count;
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
142 const char *item;
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
143
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
144 printf( "Itemlist tester. Enter seperators, then strings to test.\n" );
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
145 printf( "A blank line gets prompts for new seperators; blank separators\n" );
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
146 printf( "exits the program.\n" );
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
147
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
148 for ( ; ; )
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
149 {
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
150 printf( "\nEnter seperators: " );
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
151 (void) fflush( stdout );
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
152 if ( gets( seps ) == NULL || seps[0] == '\0' )
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
153 break;
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
154 for ( ; ; )
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
155 {
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
156 printf( "Enter line: " );
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
157 (void) fflush( stdout );
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
158 if ( gets( line ) == NULL )
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
159 exit( 0 );
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
160 if ( line[0] == '\0' )
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
161 break;
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
162 itl = new_Itl( line, seps );
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
163 printf( "%d items on list\n", Itl_count( itl ) );
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
164 count = 0;
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
165 for ( item = Itl_first( itl );
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
166 item != NULL;
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
167 item = Itl_next( itl ) )
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
168 printf( " Item %d is '%s'\n", ++count, item );
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
169 if ( count != Itl_count( itl ) )
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
170 printf( "*** Warning - counts don't match ***\n" );
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
171 del_Itl( itl );
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
172 }
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
173 }
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
174
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
175 exit(0);
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
176 /* NOTREACHED */
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
177 }
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
178 #endif /* defined(TEST) */