home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0010 - 0019 / ibm0010-0019 / ibm0010.tar / ibm0010 / CLIPB52.ZIP / HUFF.ZIP / WHO.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-05-23  |  1.9 KB  |  61 lines

  1. /*--------------------------------------------------------------------------*
  2.  ** CLIPnet Library ** copyright of DataSync Technologies - Lansing, Mi
  3.  *--------------------------------------------------------------------------*/
  4. #include "nandef.h"
  5. #include "extend.h"
  6. #include "extor.h"
  7.  
  8. #include <dos.h>
  9. #include <stdio.h>
  10. #include <ctype.h>
  11.  
  12. CLIPPER whoami()    /* Returns name of user connected to the calling station
  13.  
  14.                       Novell call: Connection Services
  15.                         NetWare API E3h(16h) "Get Connection Information"
  16.  
  17.                       Added Notes:
  18.                         required Request buffer size is .... 4 bytes
  19.                         required Reply buffer size is ...... 63 bytes
  20.  
  21. *---------------------------------------------------------------------------*/
  22. {
  23.     union REGS inreg,outreg;
  24.  
  25.     unsigned i,j;
  26.     struct SREGS seg;
  27.  
  28.     unsigned char *request = "    ";
  29.     unsigned char *reply = "                                                      ";
  30.  
  31.     /* Acquire local connect number from Novell */
  32.     inreg.h.ah = 0xDC;
  33.     intdos(&inreg,&outreg);
  34.  
  35.     inreg.h.ah = 0xE3;           /* Novell function number */
  36.  
  37.     /* point DS:SI at the request buffer */
  38.     seg.ds = FP_SEG(request);
  39.     inreg.x.si = FP_OFF(request);
  40.  
  41.     /* point ES:DI at the reply buffer */
  42.     seg.es = FP_SEG(reply);
  43.     inreg.x.di = FP_OFF(reply);
  44.  
  45.     request[0] = 2;                /* Length of send packet */
  46.     request[1] = 0;
  47.     request[2] = 0x16;             /* Novell get connection info code */
  48.     request[3] = outreg.h.al;     /* logical ID of station we're interested in */
  49.  
  50.     intdosx(&inreg,&outreg,&seg);     /* Software interrupt */
  51.  
  52.     /* Now retrieve user name from receive packet */
  53.     for(i =0; reply[8+i] != 0 && i < 48; i++)
  54.         reply[i] = reply[8+i];
  55.  
  56.     _retclen(reply,i);       /* Clipper return mechanism */
  57.  
  58. } /* EOF whoami */
  59. /*******************************/
  60.  
  61.