Contents page

Rules for Tools/sorteventlist()

    struct Event *sorteventlist(struct Event *list)

    `struct Event  *list'
          Linked list of Events.

     `sorteventlist()' sorts a list of Events in chronological order,
     returning a pointer to the top of the sorted list.  It sorts by
     the time field, the second field in the Event structure.

     You may use this routine to sort any linked list, as long as the
     list is linked by the first field in each structure and the second
     field is a four byte number (as is time) to sort by.

     `sorteventlist()' is very useful for processing linked lists of
     Events because it removes the drudgery of trying to keep
     everything in order while rearranging a list.  For example, to
     merge two linked lists, just concatonate the two lists, then send
     the result to `sorteventlist()' to put all of the Events in order.