home *** CD-ROM | disk | FTP | other *** search
/ Network Support Encyclopedia 96-1 / novell-nsepro-1996-1-cd2.iso / download / netware / dax1.exe / CLIENT / INOUT / DOS / INOUT.C next >
Text File  |  1992-07-15  |  4KB  |  96 lines

  1. //   ╔════════════════════════════════════════════════════════════════════╗
  2. //   ║                                                                    ║
  3. //   ║ module:      inout.c                                               ║
  4. //   ║ abstract:    This module logs in and out of the DAX Engine.        ║
  5. //   ║                                                                    ║
  6. //   ║ environment: NetWare 3.x v3.11                                     ║
  7. //   ║              Network C for DOS v2.0                                ║
  8. //   ║              NetWare C Interface DOS v1.2                          ║
  9. //   ║                                                                    ║
  10. //   ║  This software is provided as is and carries no warranty           ║
  11. //   ║  whatsoever.  Novell disclaims and excludes any and all implied    ║
  12. //   ║  warranties of merchantability, title and fitness for a particular ║
  13. //   ║  purpose.  Novell does not warrant that the software will satisfy  ║
  14. //   ║  your requirements or that the software is without defect or error ║
  15. //   ║  or that operation of the software will be uninterrupted.  You are ║
  16. //   ║  using the software at your risk.  The software is not a product   ║
  17. //   ║  of Novell, Inc. or any of subsidiaries.                           ║
  18. //   ║                                                                    ║
  19. //   ╟────────────────────────────────────────────────────────────────────╢
  20. //   ║ maintenance history:                                               ║
  21. //   ║ level    date      pi   description                                ║
  22. //   ╟────────────────────────────────────────────────────────────────────╢
  23. //   ║  001   03/05/92    kl   initial release.                           ║
  24. //   ╚════════════════════════════════════════════════════════════════════╝
  25.  
  26. #include <stdio.h>
  27. #include <conio.h>
  28. #include <stdlib.h>
  29. #include <string.h>
  30.  
  31. #include "h/appl.h"
  32. #include "dap/dapapi.h"
  33.  
  34. #include <nxt.h>
  35.  
  36. static  DAPDATA *dd;
  37.  
  38. atexitproc()
  39. {
  40.         if( dd ){
  41.             DAPDeAllocateSession(dd);
  42.             DAPDeInitialize(dd);
  43.         }
  44. }
  45.  
  46. errorexit(int rc, char *msg)
  47. {
  48.     printf("\n\n\t%s. rc = %d\n\tERROR: %s\n",
  49.            msg,
  50.            rc,
  51.            DAPTranslateReturnCode(rc));
  52.     DAPDisplaySessionData(dd);
  53.     exit(1);
  54. }
  55.  
  56. #define DEFOUTER    1000
  57. #define DEFINNER    10
  58.  
  59. main(int argc, char *argv[])
  60. {
  61.         int     rc,x,y;
  62.         LONG    iter=0L;
  63.         LONG    outerlimit = DEFOUTER;
  64.         LONG    innerlimit = DEFINNER;
  65.  
  66.         if( argc == 3 ){
  67.             outerlimit = atoi(argv[1]);
  68.             innerlimit = atoi(argv[1]);
  69.         }
  70.         atexit(atexitproc);
  71.         for(x=0; !kbhit() && x < outerlimit; ++x){
  72.             for(y=1; !kbhit() && y < innerlimit; ++y){
  73.                 putch('i');
  74.                 if( (dd = DAPInitialize(SERVERNAME, SERVERTYPE)) == NULL ){
  75.                     errorexit(0,"Could not initialize DAP");
  76.                 }
  77.                 putch('a');
  78.                 if( (rc = DAPAllocateSession(dd)) != NULL ){
  79.                     errorexit(rc,"Allocate Session failed");
  80.                 }
  81.                 putch('d');
  82.                 printf("%04ld",*(long *)&(((int *)dd)[1]));
  83.                 if( (rc = DAPDeAllocateSession(dd)) != NULL ){
  84.                     errorexit(rc,"De Allocate Request failed");
  85.                 }
  86.                 putch('u');
  87.                 DAPDeInitialize(dd);
  88.                 printf("\r........\r");
  89.                 dd = NULL;
  90.                 ++iter;
  91.             }
  92.         }
  93.         printf("%ld total operations performed\n",iter*2);
  94.         return 0;
  95. }
  96.