home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / lan / who / whoall.c < prev    next >
Text File  |  1987-10-13  |  2KB  |  79 lines

  1. /********************************************************************
  2.     WHO.C
  3.        Alternate menu function for Novell Netware
  4.  
  5.        First code : 10/13/87
  6.  
  7. ********************************************************************/
  8.  
  9. #include <stdio.h>
  10. #include <dos.h>
  11.  
  12. union REGPACK r;
  13.  
  14. struct {
  15.   int    length ;
  16.   char    function;
  17.   char    station ;
  18. } req ;
  19.  
  20. struct {
  21.   int    length ;
  22.   char    uniqueid[4] ;
  23.   int    type ;
  24.   char    objectname[48] ;
  25.   char    year ;
  26.   char    month ;
  27.   char    day ;
  28.   char    hour ;
  29.   char    minute ;
  30.   char    logtime[3] ;
  31. } who ;
  32.  
  33. struct {
  34.   int    length ;
  35.   char    network[4] ;
  36.   char    host[6] ;
  37.   char    socket[2] ;
  38. } map ;
  39.  
  40.  
  41. main()
  42. {
  43.   int station,physical,mystation ;
  44.   char fg ;
  45.  
  46.   r.r_ds=_DS ;
  47.   r.r_es=_DS ;
  48.   r.r_ax=(0xdc00) ;
  49.   intr(0x21,&r) ;
  50.   mystation=(r.r_ax & 0xff) ;
  51.   printf("Station  Connect  User               DATE    TIME \n"
  52.          "-------  -------  ---------------  --------  -----\n") ;
  53.   for (station=1; station<=20; station++) {
  54.     r.r_si=(int)&req ;
  55.     r.r_di=(int)&who ;
  56.     r.r_ax= (0xe300) ;
  57.     who.length=sizeof(who) ;
  58.     req.length=sizeof(req) ;
  59.     req.function=22 ;
  60.     req.station=station ;
  61.     intr(0x21,&r) ;
  62.     r.r_si=(int)&req ;
  63.     r.r_di=(int)&map ;
  64.     r.r_ax=0xe300 ;
  65.     req.length=sizeof(req) ;
  66.     req.function=19 ;
  67.     req.station=station ;
  68.     map.length=sizeof(map) ;
  69.     intr(0x21,&r) ;
  70.     physical=map.host[5] ;
  71.     if (station==mystation) fg='*' ;
  72.     else fg=' ' ;
  73.     if (who.objectname[0]!=0)
  74.       printf("  %3i      %3i  %c %-15s  %02i/%02i/%02i  %02i:%02i\n",
  75.         station,physical,fg,who.objectname,who.month,who.day,who.year,
  76.         who.hour,who.minute) ;
  77.   }
  78. }
  79.