home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / snip9707.zip / PRINTQ.C < prev    next >
C/C++ Source or Header  |  1997-07-05  |  2KB  |  49 lines

  1. /* +++Date last modified: 05-Jul-1997 */
  2.  
  3. /* printq.c 12-22-91 Robert Mashlan, Public Domain
  4.  
  5.    A small program that utilizes the prnspool module,
  6.    which is an interface to the DOS program PRINT.COM
  7.  
  8. */
  9.  
  10. #include "prnspool.h"
  11. #include <stdio.h>
  12. #include <string.h>
  13.  
  14. int main(int argc, char **argv )
  15. {
  16.       char far *files;
  17.       int i;
  18.       int addfiles = 1;
  19.  
  20.       if (!printspool_installed())
  21.       {
  22.             printf("print.com not installed\n");
  23.             return 0;
  24.       }
  25.       for (i = 1; i < argc; i++)
  26.       {
  27.             if (stricmp(argv[i],"/T") == 0)
  28.                   printspool_cancel();    /* cancel all files in queue */
  29.             else if (stricmp(argv[i],"/C") == 0)
  30.                   addfiles = 0;           /* cancel all listed files */
  31.             else if (stricmp(argv[i],"/P") == 0)
  32.                   addfiles = 1;           /* add all listed files */
  33.             else
  34.             /* here the specified file should really have the full pathname */
  35.             {
  36.                   if (addfiles)
  37.                         printspool_submit(argv[i]);
  38.                   else  printspool_remove(argv[i]);
  39.                   if (printspool_errno)
  40.                         puts(printspool_errlist[printspool_errno]);
  41.             }
  42.       }
  43.       printf("files currently in queue:\n");
  44.       for (files = printspool_getqueue(); *files; files += 64)
  45.             printf("\t%Fs\n", files);
  46.       printspool_endhold();
  47.       return 0;
  48. }
  49.