home *** CD-ROM | disk | FTP | other *** search
/ Black Box 4 / BlackBox.cdr / lan / queues.arj / QSERVER.C < prev    next >
Text File  |  1991-05-31  |  3KB  |  87 lines

  1. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  2.  *                                                                           *
  3.  *                                                                           *
  4.  Program : QSERVER.C
  5.  Author  : Christopher R. Ojeda
  6.  Date    : 05/20/91
  7.  Function: QSERVER services a queue.
  8.  Genesis : Turbo C 2.0
  9.            Compiled in Turbo C environment with defaults under DOS 3.3.
  10.  
  11.  This software is provided as is and carries no warranty
  12.  whatsoever.  Novell disclaims and excludes any and all implied
  13.  warranties of merchantability, title and fitness for a particular
  14.  purpose.  Novell does not warrant that the software will satisfy
  15.  your requirements or that the software is without defect or error
  16.  or that operation of the software will be uninterrupted.  You are
  17.  using the software at your risk.  The software is not a product
  18.  of Novell, Inc. or any of subsidiaries.
  19.  *                                                                           *
  20.  *                                                                           *
  21.  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  22.  
  23. #include <stdio.h>
  24. #include <nit.h>
  25. #include <niterror.h>
  26. #include <nitq.h>
  27.  
  28. #define OT_TEST_SERVER 0x8010
  29. #define OT_TEST_QUEUE  0x8020
  30. #define NO_CHARGE 0L
  31. #define IOERROR   -1
  32. char readBuf[20];
  33.  
  34. main()
  35. {
  36.     long queueID;
  37.     long charge = 0;
  38.     int  cCode, errno;
  39.     int  fileHandle;
  40.     int  readResult;
  41.     WORD conID;
  42.     WORD jobType = 0x0045;
  43.     WORD jobCount;
  44.     BYTE directoryHandle;
  45.     BYTE drive;
  46.     BYTE statFlag;
  47.     JobStruct job;
  48.     char fileServer[48], QServer[48];
  49.  
  50.     strcpy (QServer, "CHRIS_SERVER");
  51.    cCode = LoginToFileServer (QServer, OT_TEST_SERVER, "CHRISERVER");
  52.    if(cCode != 0) {
  53.       printf("\nError in LoginToFileServer.  Status = %d",cCode);
  54.       exit(1);
  55.    }
  56.    printf("\n%s successfully logged into server.", QServer);
  57.  
  58.     queueID=-1;
  59.     if (cCode = GetBinderyObjectID ("CHRIS_QUEUE",
  60.                                     OT_TEST_QUEUE,
  61.                                     &queueID)) {
  62.       printf ("\nError %d getting bindery object ID.", cCode);
  63.       exit (1);
  64.       }
  65.     if (cCode = AttachQueueServerToQueue (queueID))
  66.       printf ("\nError %d attaching queue server to queue.", cCode);
  67.     job.serverIDNumber = 0x00;
  68.     if (cCode = ServiceQueueJobAndOpenFile (queueID,
  69.                                             jobType,
  70.                                             &job,
  71.                                             &fileHandle))
  72.       printf ("\nError %d servicing queue job.", cCode);
  73.     readResult = read (fileHandle, readBuf, sizeof (readBuf));
  74.     if (readResult==IOERROR)
  75.       printf ("\nError %d occured on read.", errno);
  76.     else
  77.       printf ("\nIncoming!:%s.", readBuf);
  78.     if (cCode = FinishServicingQueueJobAndFile (queueID,
  79.                                                 job.jobNumber,
  80.                                                 NO_CHARGE,
  81.                                                 fileHandle))
  82.       printf ("\nError %d finishing servicing queue job and file.", cCode);
  83.     if (cCode = DetachQueueServerFromQueue (queueID))
  84.       printf ("\nError %d detaching queue server from queue.", cCode);
  85. }
  86.  
  87.