home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / OBJASM.ZIP / ORLNAMES.C < prev    next >
C/C++ Source or Header  |  1990-02-25  |  1KB  |  51 lines

  1. #include <stdio.h>
  2. #include <string.h>
  3. #include "o.h"
  4.  
  5. int name_compare( NAME_T *, NAME_T * );
  6. void name_insert( char * );
  7.  
  8. int name_compare( rec_1, rec_2 )
  9.     NAME_T  *rec_1;
  10.     NAME_T  *rec_2;
  11. {
  12.     if ( rec_1->index > rec_2->index ) {
  13.         return( LEFT );
  14.     } else {
  15.         if ( rec_1->index < rec_2->index ) {
  16.             return( RIGHT );
  17.         } else {
  18.             return( EQUAL );
  19.         }
  20.     }
  21. }
  22.  
  23. void name_insert( this_name )
  24.     char    *this_name;
  25. {
  26.     static  name_count = 0;
  27.     NAME_T  *name_rec;
  28.  
  29.     name_count++;
  30.     name_rec = (NAME_T *)o_malloc( sizeof(NAME_T) );
  31.     name_rec->index = name_count;
  32.     strcpy( name_rec->name, this_name );
  33.  
  34.     insert( (char *)name_rec, name_tree, name_compare );
  35.  
  36. }
  37.  
  38. void lnames( length )
  39.     unsigned int length;
  40. {
  41.     char    mod_name[41];
  42.     char    cksum;
  43.  
  44.     --length;
  45.     while( length ) {
  46.         length -= get_name( mod_name );
  47.         name_insert( mod_name );
  48.     }
  49.     cksum = get_byte();
  50. }
  51.