home *** CD-ROM | disk | FTP | other *** search
/ PC-Online 1998 February / PCOnline_02_1998.iso / filesbbs / dos / cutil100.exe / USERLIST.MEX < prev    next >
Encoding:
Text File  |  1997-04-20  |  1.7 KB  |  87 lines

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Desc: Search userbase and return in RAform
  4. //
  5. // Copyright 1996 by Neil Staib
  6. //
  7. //////////////////////////////////////////////////////////////////////////////
  8.  
  9. #include <max.mh>
  10.  
  11. string ratioup(int: up) // Format ratio uploades
  12. {
  13.   if (up <= 9)
  14.       return "0" + itostr(up);
  15.   else
  16.       return itostr(up);
  17. }
  18.  
  19. string ratiodown(int: down) // Format ratio downloads
  20. {
  21.   if (down <= 9)
  22.       return "0" + itostr(down);
  23.   else
  24.       return itostr(down);
  25. }
  26.  
  27. string lastdate(string: lcdate) // Return Users Last Call or Pad right date format
  28. {
  29.   if (substr(lcdate, 3,1) <> "-")
  30.   {
  31.     return "         ";
  32.   }
  33.   else
  34.     return  substr(lcdate,1,9);
  35. }
  36.  
  37. void main()
  38. {
  39.   int: ok;
  40.   char: nonstop;
  41.   struct _usr: usr;
  42.  
  43.   reset_more(nonstop);
  44.  
  45.   print(AVATAR_CLS, COL_WHITE, "Name                          Location                LastOn     Calls Ratio\n");
  46.   print(strpad("", 79, '─'), '\n');
  47.  
  48. ok := userfindopen("", "",usr);
  49.  
  50. while (ok)
  51. {
  52.   if (usr.noulist <> 1)
  53.   {
  54.  
  55.    print(COL_LCYAN AVATAR_CLEOL,
  56.           strpad(usr.name,29,' '),
  57.           ' ',
  58.           COL_LGREEN,
  59.           strpad(usr.city,23,' '),
  60.           ' ',
  61.           COL_LBLUE,
  62.           lastdate(stamp_string(usr.ludate)),
  63.           "  ",
  64.           COL_YELLOW,
  65.           strpad(itostr(usr.times), 5, ' '),
  66.           " ",
  67.           COL_LRED,
  68.           ratioup(strtoi(ltostr(usr.nup))),
  69.           " :",
  70.           ratiodown(strtoi(ltostr(usr.ndown))),
  71.           '\n');
  72.     }
  73.  
  74.    if (do_more(nonstop, COL_LMAGENTA) = 0);
  75.    {
  76.      do_more(nonstop, COL_LMAGENTA);
  77.    }
  78.  
  79.   ok := userfindnext(usr);
  80.  }
  81.  
  82.   print(COL_LMAGENTA, "\n\nPress (Enter) to continue:");
  83.   getch();
  84.  
  85. }
  86.  
  87.