annotate src/itemlist.c @ 344:a79adfd728d1 noffle

[svn] added openbsd-inetd dependency option
author godisch
date Wed, 12 Mar 2003 08:45:38 +0000
parents 5eece4dfd945
children b540ecb6f218
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
281
5eece4dfd945 [svn] * src/log.c,src/log.h: Add Log_fatal() for reporting fatal errors
bears
parents: 197
diff changeset
4 $Id: itemlist.c 413 2002-12-27 21:48:25Z 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 )
281
5eece4dfd945 [svn] * src/log.c,src/log.h: Add Log_fatal() for reporting fatal errors
bears
parents: 197
diff changeset
42 Log_fatal( "Malloc of ItemList failed." );
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
43
45
32ba1198c6fa [svn] * Makefile.in, configure, configure.in, docs/Makefile.in, src/Makefile.in:
uh1763
parents: 43
diff changeset
44 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
45 if ( res->list == NULL )
281
5eece4dfd945 [svn] * src/log.c,src/log.h: Add Log_fatal() for reporting fatal errors
bears
parents: 197
diff changeset
46 Log_fatal( "Malloc of ItemList.list failed." );
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
47 strcpy( res->list, list );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
48
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
49 res->count = 0;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
50 res->next = res->list;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
51
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
52 /* 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
53 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
54 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
55 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
56
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
57 if ( inItem )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
58 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
59 if ( isSep )
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 p[ 0 ] = '\0';
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
62 inItem = FALSE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
63 res->count++;
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 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
66 else
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
67 {
72
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
68 if ( isSep )
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
69 p[ 0 ] = SEP_CHAR;
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
70 else
43
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
71 inItem = TRUE;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
72 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
73 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
74 if ( inItem )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
75 res->count++;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
76 p[ 1 ] = '\0';
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
77 return res;
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 /* Delete an item list. */
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
81 void
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
82 del_Itl( ItemList *self )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
83 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
84 if ( self == NULL )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
85 return;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
86 free( self->list );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
87 free( self );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
88 }
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 /* Get first item. */
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
91 const char *
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
92 Itl_first( ItemList *self)
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
93 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
94 self->next = self->list;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
95 return Itl_next( self );
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
96 }
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
97
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
98 /* 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
99 const char *
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
100 Itl_next( ItemList *self )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
101 {
72
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
102 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
103
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
104 if ( res[ 0 ] == '\0' )
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
105 return NULL;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
106
72
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
107 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
108 res++;
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' && res[ 1 ] == '\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 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
114 return 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
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
117 /* 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
118 size_t
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
119 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
120 {
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
121 return self->count;
2842f50feb55 [svn] * client.c, client.h, common.h, config.c, config.h, content.c, content.h,
uh1763
parents:
diff changeset
122 }
72
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
123
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
124 #if defined(ITEMLIST_TEST)
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
125
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
126 /* Test code borrowed from wildmat.c. Yep, still uses gets(). */
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
127 extern char *gets();
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
128
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
129 int
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
130 main()
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 Str line;
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
133 Str seps;
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
134 ItemList * itl;
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
135 int count;
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
136 const char *item;
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 printf( "Itemlist tester. Enter seperators, then strings to test.\n" );
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
139 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
140 printf( "exits the program.\n" );
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
141
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
142 for ( ; ; )
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( "\nEnter seperators: " );
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
145 (void) fflush( stdout );
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
146 if ( gets( seps ) == NULL || seps[0] == '\0' )
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
147 break;
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( "Enter line: " );
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( line ) == NULL )
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
153 exit( 0 );
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
154 if ( line[0] == '\0' )
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
155 break;
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
156 itl = new_Itl( line, seps );
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
157 printf( "%d items on list\n", Itl_count( itl ) );
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
158 count = 0;
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
159 for ( item = Itl_first( itl );
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
160 item != NULL;
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
161 item = Itl_next( itl ) )
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
162 printf( " Item %d is '%s'\n", ++count, item );
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
163 if ( count != Itl_count( itl ) )
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
164 printf( "*** Warning - counts don't match ***\n" );
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
165 del_Itl( itl );
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
166 }
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
167 }
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
168
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
169 exit(0);
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
170 /* NOTREACHED */
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
171 }
78e2ae741240 [svn] Fix stupid bug in Itl_next
bears
parents: 54
diff changeset
172 #endif /* defined(TEST) */