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

  1. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  2.  *                                                                           *
  3.  *                                                                           *
  4.  Program : QCLIENT.C
  5.  Author  : Christopher R. Ojeda
  6.  Date    : 05/20/91
  7.  Function: QCLIENT submits jobs to 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 <string.h>
  25. #include <io.h>
  26. #include <nit.h>
  27. #include <niterror.h>
  28. #include <nitq.h>
  29.  
  30. #define INT21 0x21
  31. #define OT_TEST_SERVER   0x8010
  32. #define OT_TEST_QUEUE    0x8020
  33.  
  34. void main (void);
  35.  
  36. char writeBuf[14] = "This is a test" ;
  37. JobStruct job;
  38.  
  39. void main() {
  40.     int  cCode, NETQfileHandle, sizeWritten;
  41.     long queueID, serverID;
  42.  
  43.     if (cCode = GetBinderyObjectID ("CHRIS_QUEUE",
  44.                                     OT_TEST_QUEUE,
  45.                                     &queueID))
  46.       printf ("\nError %d getting bindery object ID.", cCode);
  47.     if (cCode = GetBinderyObjectID ("CHRIS_SERVER",
  48.                                     OT_TEST_SERVER,
  49.                                     &serverID))
  50.       printf ("\nError %d getting bindery object ID.", cCode);
  51.     job.targetServerIDNumber = serverID;
  52.     memset (job.targetExecutionTime, 0xFF, sizeof (job.targetExecutionTime));
  53.     job.jobType = 0x0045;
  54.     job.jobControlFlags = QF_AUTO_START;
  55.     if (cCode = CreateQueueJobAndFile (queueID,
  56.                                        &job,
  57.                                        &NETQfileHandle))
  58.       printf ("\nError %d creating queue job and file.", cCode);
  59.     sizeWritten = write (NETQfileHandle,
  60.                          writeBuf, sizeof (writeBuf));
  61.     if (sizeWritten != sizeof (writeBuf)) {
  62.       printf ("\nError writing data buffer.");
  63.       if (cCode = CloseFileAndAbortQueueJob (queueID,
  64.                                              job.jobNumber,
  65.                                              NETQfileHandle))
  66.         printf ("\nError %d closing and aborting queue job.", cCode);
  67.       }
  68.     else
  69.       if (cCode = CloseFileAndStartQueueJob (queueID,
  70.                                              job.jobNumber,
  71.                                              NETQfileHandle))
  72.         printf ("\nError %d closing and starting queue job.", cCode);
  73. }
  74.  
  75.