home *** CD-ROM | disk | FTP | other *** search
/ Network Support Encyclopedia 96-1 / novell-nsepro-1996-1-cd2.iso / download / netware / rndcap.exe / RENDCAP.C next >
Text File  |  1995-03-03  |  4KB  |  114 lines

  1. /****************************************************************************
  2. **      DISCLAIMER  
  3. **  
  4. **   Novell, Inc. makes no representations or warranties with respect to
  5. **   any NetWare software, and specifically disclaims any express or
  6. **   implied warranties of merchantability, title, or fitness for a
  7. **   particular purpose.  
  8. **
  9. **   Distribution of any NetWare software is forbidden without the
  10. **   express written consent of Novell, Inc.  Further, Novell reserves
  11. **   the right to discontinue distribution of any NetWare software.
  12. **   
  13. **   Novell is not responsible for lost profits or revenue, loss of use
  14. **   of the software, loss of data, costs of re-creating lost data, the
  15. **   cost of any substitute equipment or program, or claims by any party
  16. **   other than you.  Novell strongly recommends a backup be made before
  17. **   any software is installed.   Technical support for this software
  18. **   may be provided at the discretion of Novell.
  19. ****************************************************************************
  20. **   File:  ENDCAP.C
  21. **
  22. **  Desc:   This program will do an end capture on a print job by checking the
  23. **          capture flags2 fileCaptureFlag and seeing if a file or queue is
  24. **          captured.  It will then end the capture according to the way the
  25. **          flag is set.
  26. **
  27. **   Programmers:
  28. **   Ini   Who               Firm
  29. **   ------------------------------------------------------------------
  30. **   ARM   A. Ray Maxwell    Novell Developer Support.
  31. **
  32. **   History:
  33. **
  34. **   ------------------------------------------------------------------
  35. **   02-15-95   ARM   First code.
  36. */
  37.  
  38. /****************************************************************************
  39. ** Include Headers, Macros & function Prototypes.
  40. */
  41.     /*-------------------------------------------------------------------
  42.     ** ANSI
  43.     */
  44.     #include <stdio.h>    /* getch()       */
  45.     #include <stdlib.h>   /* exit() atoi() */
  46.     #include <conio.h>    /* cputs()       */
  47.     #include <string.h>   /* strcpy()      */
  48.  
  49.     /*-------------------------------------------------------------------
  50.     ** Netware NWCALLS etc.
  51.     */
  52.     #include <nwcalls.h>
  53.  
  54. /***************************************************************************
  55. ** Program start
  56. */
  57. void main(int argc, char *argv[])
  58. {
  59.     NWCAPTURE_FLAGS1 f1;
  60.     NWCAPTURE_FLAGS2 f2;
  61.     NWCCODE ccode;
  62.     int lptPort;
  63.  
  64.     if(argc!=2){
  65.         printf("Usage: endcap <lpt port>\n");
  66.         printf("  lpt port = 1 to 3 on netx\n");
  67.         printf("             1 to 9 with VLM's set\n");
  68.         exit(-1);
  69.     }
  70.  
  71.     lptPort=atoi(argv[1]);                    /* set up the port */
  72.  
  73.     if(argc!=2 || lptPort>9 ){
  74.         printf("Usage: endcap <lpt port>\n");
  75.         printf("  lpt port = 1 to 3 on netx\n");
  76.         printf("             1 to 9 with VLM's set\n");
  77.         exit(-1);
  78.     }
  79.  
  80.     ccode = NWCallsInit(NULL, NULL);
  81.     if (ccode){
  82.         printf("NWCallsInit failed with ccode =%X\n",ccode);
  83.     }
  84.     ccode = NWGetCaptureStatus(lptPort);
  85.     if (ccode ==0x00FF){
  86.         ccode = NWGetCaptureFlags(
  87.                   /* port 1,2,3    > */ lptPort,
  88.                   /* captureflags1 < */ &f1,
  89.                   /* captureflags2 < */ &f2);
  90.  
  91.         if (ccode){
  92.             printf("NWGetCaptureFlags failed with ccode =%X\n",ccode);
  93.             exit(-1);
  94.         }
  95. /*--------------------------------------------------------------------
  96. ** Note: the NWCancelCapture is used to end a file capture.
  97. */
  98.         if(f2.fileCaptureFlag==0xFF){
  99.             ccode=NWCancelCapture(lptPort);
  100.             if (ccode){
  101.                 printf("NWCancelCapture failed with ccode=%X\n",ccode);
  102.                 exit(-1);
  103.             }
  104.         }
  105.         else{
  106.             ccode=NWEndCapture(lptPort);
  107.             if(ccode){
  108.                 printf("NWEndCapture fails %X\n",ccode);
  109.                 exit(-1);
  110.             }
  111.         }
  112.     }
  113. }
  114.