obj_list_sort

From: James (roper@pa.mother.com)
Date: 06/27/95


I'm sorry about bringing up this subject again, but I just spent an hour 
digging threw the list archive on ftp.cs.jhu.edu and could not find what 
I was looking for. 

In the past, the subject about compacting thelist_obj_to_char command so 
it prints out 
[3] bread 
  instead of
bread
bread
bread.

Well, my users have demanded this. I remember this was a two step 
proccess. Step #1 was to sort the list. then you could compact the lines. 
Well, I'm having problems sorting the list. My code goes something like this

void sort_obj_list(struct obj_data *list)
{
   struct obj_data *obj1,*obj2,*obj3);

   for(obj1 = list;obj1;obj1 = obj1->next_obj)
      for(obj2 = list;obj2;obj2 = obj2->next_obj)
         if(strcmp(obj1->description,obj2->description))
         {
            obj3 = obj1;
            obj1 = obj2;
            obj2 = obj3;
         }
}

then I call this from obj_list_to_char.
Nothing seems to happen. No bugs, no sort, nothin.
Perhaps I should not code at 3AM!
I think what is going on is, I'm moving links around, but 
they have pointers, pointing to links, so i'm doing nothing by
moving the pointer around, but I'm not sure. It's bed time!



This archive was generated by hypermail 2b30 : 12/18/00 PST