tag = NextTagItem(tagItemPtr);
D0 A0
struct TagItem *NextTagItem(struct TagItem **);
Iterates through a tag list, skipping and chaining as dictated by system tags. TAG_SKIP will cause it to skip the entry and a number of following tags as specified in ti_Data. TAG_IGNORE ignores that single entry, and TAG_MORE has a pointer to another array of tags (and terminates the current array!). TAG_DONE also terminates the current array. Each call returns either the next tagitem you should examine, or NULL when the end of the list has been reached.
Iterate(struct TagItem *tags);
{
struct TagItem *tstate;
struct TagItem *tag;
tstate = tags;
while (tag = NextTagItem(&tstate))
{
switch (tag->ti_Tag)
{
case TAG1: ...
case TAG2: ...
...
}
}
}
Do NOT use the value of *tagItemPtr, but rather use the pointer returned by NextTagItem().