as_find()

Updated: April 19, 2023

Synopsis:

unsigned as_find(unsigned start, ...);

Description:

The start parameter indicates where to start the search for the given item. For an initial call, it should be set to AS_NULL_OFF. If the item found isn't the one wanted, then the return value from the first as_find_item() is used as the start parameter of the second call. The search will pick up where it left off. This can be repeated as many times as required (the return value from the second call going into the start parameter of the third, etc). The item being searched is identified by a sequence of char * parameters following start. The sequence is terminated by a NULL. The last string before the NULL is the bottom-level itemname being searched for, the string in front of that is the name of the item that owns the bottom-level item, etc.

For example, this call finds the first occurrence of an item called “foobar”:

item_off = as_find_item(AS_NULL_OFF, "foobar", NULL);

The following call finds the first occurrence of an item called “foobar” that's owned by “sam”:

item_off = as_find_item(AS_NULL_OFF, "sam", "foobar", NULL);

If the requested item can't be found, AS_NULL_OFF is returned.

Returns:

>0
Success.