home *** CD-ROM | disk | FTP | other *** search
/ Network Support Encyclopedia 96-1 / novell-nsepro-1996-1-cd2.iso / download / netware / dax1.exe / CLIENT / ADD / ADD.C
C/C++ Source or Header  |  1992-07-15  |  4KB  |  96 lines

  1. //   ╔════════════════════════════════════════════════════════════════════╗
  2. //   ║                                                                    ║
  3. //   ║ module:      add.c                                                 ║
  4. //   ║ abstract:    This module contains an example that illustrates the  ║
  5. //   ║              absolute minimum requirements for a client example    ║
  6. //   ║              which talks to the DAX Engine.                        ║
  7. //   ║                                                                    ║
  8. //   ║ environment: NetWare 3.x v3.11                                     ║
  9. //   ║              Network C for NLMs SDK                                ║
  10. //   ║              CLib v3.11                                            ║
  11. //   ║              Network C for DOS v2.0                                ║
  12. //   ║              NetWare C Interface DOS v1.2                          ║
  13. //   ║                                                                    ║
  14. //   ║  This software is provided as is and carries no warranty           ║
  15. //   ║  whatsoever.  Novell disclaims and excludes any and all implied    ║
  16. //   ║  warranties of merchantability, title and fitness for a particular ║
  17. //   ║  purpose.  Novell does not warrant that the software will satisfy  ║
  18. //   ║  your requirements or that the software is without defect or error ║
  19. //   ║  or that operation of the software will be uninterrupted.  You are ║
  20. //   ║  using the software at your risk.  The software is not a product   ║
  21. //   ║  of Novell, Inc. or any of subsidiaries.                           ║
  22. //   ║                                                                    ║
  23. //   ╟────────────────────────────────────────────────────────────────────╢
  24. //   ║ maintenance history:                                               ║
  25. //   ║ level    date      pi   description                                ║
  26. //   ╟────────────────────────────────────────────────────────────────────╢
  27. //   ║  001   07/15/92    kl   initial release.                           ║
  28. //   ╚════════════════════════════════════════════════════════════════════╝
  29.  
  30. #include <stdio.h>
  31. #include <conio.h>
  32. #include <stdlib.h>
  33. #include <string.h>
  34.  
  35. #if defined(WINCLNT)
  36.     #include <windows.h>
  37. #endif
  38.  
  39. #include "h/appl.h"
  40. #include "dap/dapapi.h"
  41.  
  42. static  DAPDATA *dd;
  43.  
  44. void atexitproc()
  45. {
  46.     if( dd ){
  47.         DAPDeAllocateSession(dd);
  48.         DAPDeInitialize(dd);
  49.     }
  50. }
  51.  
  52. main(int argc, char *argv[])
  53. {
  54.     int     rc;
  55.     long    x,y,z;
  56.  
  57.     if( argc == 3 ){
  58.         x = atol(argv[1]);
  59.         y = atol(argv[2]);
  60.     }
  61.     else{
  62.         printf("usage: ADD op1 op2\n");
  63.         exit(1);
  64.     }
  65.     atexit(atexitproc);
  66.     if( (dd = DAPInitialize(SERVERNAME, SERVERTYPE)) == NULL ){
  67.         printf("Could not initialize DAP\n");
  68.         exit(1);
  69.     }
  70.     printf("Initialized okay...\n");
  71.     if( (rc = DAPAllocateSession(dd)) != NULL ){
  72.         printf("Allocate session failed '%s'",DAPTranslateReturnCode(rc));
  73.         exit(1);
  74.     }
  75.     printf("Attached to server '%s'\n",SERVERNAME);
  76.     if( (rc = DAPAddOperands(dd,x,y,&z)) != NULL ){
  77.         if( DAP_CRITICAL_ERROR(rc) ){
  78.             printf("\n\n\t%s. rc = %d\n",
  79.                    DAPTranslateReturnCode(rc),rc);
  80.             DAPDisplaySessionData(dd);
  81.             exit(1);
  82.         }
  83.         else{
  84.             printf("\n%s\n",DAPTranslateReturnCode(rc));
  85.         }
  86.     }
  87.     printf("%ld + %ld = %ld\n",x,y,z);
  88.     if( (rc = DAPDeAllocateSession(dd)) != NULL ){
  89.         printf("\n\n\t%s. rc = %d\n",
  90.                DAPTranslateReturnCode(rc),rc);
  91.     }
  92.     DAPDeInitialize(dd);
  93.     dd = NULL;
  94.     return 0;
  95. }
  96.