Print this page
4023 - Typo in file(1) manpage and various others
   1 '\" te
   2 .\" Copyright (c) 2007, Sun Microsystems, Inc.  All Rights Reserved.
   3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
   4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
   5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
   6 .TH PAPIJOBSUBMIT 3PAPI "Jan 17, 2007"
   7 .SH NAME
   8 papiJobSubmit, papiJobSubmitByReference, papiJobValidate, papiJobStreamOpen,
   9 papiJobStreamWrite, papiJobStreamClose, papiJobQuery, papiJobModify,
  10 papiJobMove, papiJobCancel, papiJobHold, papiJobRelease, papiJobRestart,
  11 papiJobPromote, papiJobGetAttributeList, papiJobGetPrinterName, papiJobGetId,
  12 papiJobGetJobTicket, papiJobFree, papiJobListFree \- job object manipulation
  13 .SH SYNOPSIS
  14 .LP
  15 .nf
  16 cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-lpapi\fR [ \fIlibrary\fR\&.\|.\|. ]
  17 #include <papi.h>
  18 
  19 \fBpapi_status_t\fR \fBpapiJobSubmit\fR(\fBpapi_service_t\fR \fIhandle\fR,
  20      \fBchar *\fR\fIprinter\fR, \fBpapi_attribute_t **\fR\fIjob_attributes\fR,
  21      \fBpapi_job_ticket_t *\fR\fIjob_ticket\fR, \fBchar **\fR\fIfiles\fR,
  22      \fBpapi_job_t *\fR\fIjob\fR);
  23 .fi
  24 
  25 .LP
  26 .nf


 407     papi_service_t svc = NULL;
 408     papi_job_t *jobs = NULL;
 409     char *svc_name = NULL;
 410     char *pname = "unknown";
 411     int c;
 412 
 413     while ((c = getopt(ac, av, "s:p:")) != EOF)
 414         switch (c) {
 415         case 's':
 416             svc_name = optarg;
 417             break;
 418         case 'p':
 419             pname = optarg;
 420             break;
 421         }
 422 
 423     status = papiServiceCreate(&svc, svc_name, NULL, NULL, authCB,
 424                             PAPI_ENCRYPT_NEVER, NULL);
 425 
 426     if (status != PAPI_OK) {
 427         printf("papiServiceCreate(%s): %s\n", svc_name ? svc_name :
 428                      "NULL", papiStatusString(status));
 429         papiServiceDestroy(svc);
 430         exit(1);
 431     }
 432 
 433     status = papiPrinterListJobs(svc, pname, NULL, 0, 0, &jobs);
 434     if (status != PAPI_OK) {
 435         printf("papiPrinterListJobs(%s): %s\n", pname,
 436                     papiStatusString(status));
 437         papiServiceDestroy(svc);
 438         exit(1);
 439     }
 440 
 441     if (jobs != NULL) {
 442         int i;
 443 
 444         for (i = 0; jobs[i] != NULL; i++) {
 445             papi_attribute_t **list = papiJobGetAttributeList(jobs[i]);
 446 
 447             if (list != NULL) {
 448                 char *name = "unknown";
 449                             int32_t id = 0;
 450                 char *buffer = NULL;
 451                 size_t size = 0;
 452 
 453                (void) papiAttributeListGetString(list, NULL,
 454                                     "printer-name", &name);
 455                (void) papiAttributeListGetInteger(list, NULL,
 456                                     "job-id", &id);
 457                 while (papiAttributeListToString(list, "\n\t", buffer,
 458                             size) != PAPI_OK)
 459                     buffer = realloc(buffer, size += BUFSIZ);
 460 
 461                 printf("%s-%d:\n\t%s\n", name, id, buffer);
 462                 free(buffer);
 463             }
 464         }
 465         papiJobListFree(jobs);
 466     }
 467 
 468     papiServiceDestroy(svc);
 469 
 470     exit(0);
 471 }
 472 .fi
 473 .in -2
 474 
 475 .LP
 476 \fBExample 2 \fRDump all job attributes.
 477 .sp
 478 .in +2
 479 .nf
 480 /*
 481  * program to dump a queued job's attributes using PAPI interfaces.


 531     int id = 0;
 532     int c;
 533 
 534     while ((c = getopt(ac, av, "s:p:j:")) != EOF)
 535         switch (c) {
 536         case 's':
 537             svc_name = optarg;
 538             break;
 539         case 'p':
 540             pname = optarg;
 541             break;
 542         case 'j':
 543             id = atoi(optarg);
 544             break;
 545         }
 546 
 547     status = papiServiceCreate(&svc, svc_name, NULL, NULL, authCB,
 548                             PAPI_ENCRYPT_NEVER, NULL);
 549 
 550     if (status != PAPI_OK) {
 551         printf("papiServiceCreate(%s): %s\n", svc_name ? svc_name :
 552                      "NULL", papiStatusString(status));
 553         papiServiceDestroy(svc);
 554         exit(1);
 555     }
 556 
 557     status = papiJobQuery(svc, pname, id, NULL, &job);
 558     if ((status == PAPI_OK) && (job != NULL)) {
 559         papi_attribute_t **list = papiJobGetAttributeList(job);
 560 
 561         if (list != NULL) {
 562             char *name = "unknown";
 563             int32_t id = 0;
 564             char *buffer = NULL;
 565             size_t size = 0;
 566 
 567             (void) papiAttributeListGetString(list, NULL,
 568                                     "printer-name", &name);
 569             (void) papiAttributeListGetInteger(list, NULL,
 570                                     "job-id", &id);
 571             while (papiAttributeListToString(list, "\n\t", buffer, size)
 572                             != PAPI_OK)
 573                 buffer = realloc(buffer, size += BUFSIZ);
 574 
 575             printf("%s-%d:\n\t%s\n", name, id, buffer);
 576             free(buffer);
 577         }
 578     } else
 579         printf("papiJobQuery(%s-%d): %s\n", pname, id,
 580                     papiStatusString(status));
 581 
 582     papiJobFree(job);
 583     papiServiceDestroy(svc);
 584 
 585     exit(0);
 586 }
 587 .fi
 588 .in -2
 589 
 590 .LP
 591 \fBExample 3 \fRSubmit a job (stream).
 592 .sp
 593 .in +2
 594 .nf
 595 /*
 596  * program to submit a job from standard input.
 597  */
 598 #include <stdio.h>
 599 #include <stdlib.h>


 647     char *pname = "unknown";
 648     int id = 0;
 649     int c;
 650     int rc;
 651     char buf[BUFSIZ];
 652 
 653     while ((c = getopt(ac, av, "s:p:")) != EOF)
 654         switch (c) {
 655         case 's':
 656             svc_name = optarg;
 657             break;
 658         case 'p':
 659             pname = optarg;
 660             break;
 661         }
 662 
 663     status = papiServiceCreate(&svc, svc_name, NULL, NULL, authCB,
 664                             PAPI_ENCRYPT_NEVER, NULL);
 665 
 666     if (status != PAPI_OK) {
 667         printf("papiServiceCreate(%s): %s\n", svc_name ? svc_name :
 668                     "NULL", papiStatusString(status));
 669         papiServiceDestroy(svc);
 670         exit(1);
 671     }
 672 
 673     papiAttributeListAddInteger(&attrs, PAPI_ATTR_EXCL, "copies", 1);
 674     papiAttributeListAddString(&attrs, PAPI_ATTR_EXCL,
 675                 "document-format", "application/octet-stream");
 676     papiAttributeListAddString(&attrs, PAPI_ATTR_EXCL,
 677                 "job-title", "Standard Input");
 678 
 679     status = papiJobStreamOpen(svc, pname, attrs, NULL, &stream);
 680     while ((status == PAPI_OK) && ((rc = read(0, buf,
 681                      sizeof (buf))) > 0))
 682             status = papiJobStreamWrite(svc, stream, buf, rc);
 683 
 684     if (status == PAPI_OK)
 685             status = papiJobStreamClose(svc, stream, &job);
 686 
 687 
 688     if ((status == PAPI_OK) && (job != NULL)) {
 689         papi_attribute_t **list = papiJobGetAttributeList(job);
 690 
 691         if (list != NULL) {
 692             char *name = "unknown";
 693             int32_t id = 0;
 694             char *buffer = NULL;
 695             size_t size = 0;
 696 
 697             (void) papiAttributeListGetString(list, NULL,
 698                                     "printer-name", &name);
 699             (void) papiAttributeListGetInteger(list, NULL,
 700                                     "job-id", &id);
 701             while (papiAttributeListToString(list, "\n\t", buffer, size)
 702                             != PAPI_OK)
 703                 buffer = realloc(buffer, size += BUFSIZ);
 704 
 705             printf("%s-%d:\n\t%s\n", name, id, buffer);
 706             free(buffer);
 707         }
 708     } else
 709         printf("papiJobStream*(%s-%d): %s\n", pname, id,
 710                     papiStatusString(status));
 711 
 712     papiJobFree(job);
 713     papiServiceDestroy(svc);
 714 
 715     exit(0);
 716 }
 717 .fi
 718 .in -2
 719 
 720 .SH ATTRIBUTES
 721 .sp
 722 .LP
 723 See \fBattributes\fR(5) for descriptions of the following attributes:
 724 .sp
 725 
 726 .sp
 727 .TS
 728 box;
 729 c | c
   1 '\" te
   2 .\" Copyright (c) 2007, Sun Microsystems, Inc.  All Rights Reserved.
   3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
   4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
   5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
   6 .TH PAPIJOBSUBMIT 3PAPI "Sep 10, 2013"
   7 .SH NAME
   8 papiJobSubmit, papiJobSubmitByReference, papiJobValidate, papiJobStreamOpen,
   9 papiJobStreamWrite, papiJobStreamClose, papiJobQuery, papiJobModify,
  10 papiJobMove, papiJobCancel, papiJobHold, papiJobRelease, papiJobRestart,
  11 papiJobPromote, papiJobGetAttributeList, papiJobGetPrinterName, papiJobGetId,
  12 papiJobGetJobTicket, papiJobFree, papiJobListFree \- job object manipulation
  13 .SH SYNOPSIS
  14 .LP
  15 .nf
  16 cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-lpapi\fR [ \fIlibrary\fR\&.\|.\|. ]
  17 #include <papi.h>
  18 
  19 \fBpapi_status_t\fR \fBpapiJobSubmit\fR(\fBpapi_service_t\fR \fIhandle\fR,
  20      \fBchar *\fR\fIprinter\fR, \fBpapi_attribute_t **\fR\fIjob_attributes\fR,
  21      \fBpapi_job_ticket_t *\fR\fIjob_ticket\fR, \fBchar **\fR\fIfiles\fR,
  22      \fBpapi_job_t *\fR\fIjob\fR);
  23 .fi
  24 
  25 .LP
  26 .nf


 407     papi_service_t svc = NULL;
 408     papi_job_t *jobs = NULL;
 409     char *svc_name = NULL;
 410     char *pname = "unknown";
 411     int c;
 412 
 413     while ((c = getopt(ac, av, "s:p:")) != EOF)
 414         switch (c) {
 415         case 's':
 416             svc_name = optarg;
 417             break;
 418         case 'p':
 419             pname = optarg;
 420             break;
 421         }
 422 
 423     status = papiServiceCreate(&svc, svc_name, NULL, NULL, authCB,
 424                             PAPI_ENCRYPT_NEVER, NULL);
 425 
 426     if (status != PAPI_OK) {
 427         printf("papiServiceCreate(%s): %s\en", svc_name ? svc_name :
 428                      "NULL", papiStatusString(status));
 429         papiServiceDestroy(svc);
 430         exit(1);
 431     }
 432 
 433     status = papiPrinterListJobs(svc, pname, NULL, 0, 0, &jobs);
 434     if (status != PAPI_OK) {
 435         printf("papiPrinterListJobs(%s): %s\en", pname,
 436                     papiStatusString(status));
 437         papiServiceDestroy(svc);
 438         exit(1);
 439     }
 440 
 441     if (jobs != NULL) {
 442         int i;
 443 
 444         for (i = 0; jobs[i] != NULL; i++) {
 445             papi_attribute_t **list = papiJobGetAttributeList(jobs[i]);
 446 
 447             if (list != NULL) {
 448                 char *name = "unknown";
 449                             int32_t id = 0;
 450                 char *buffer = NULL;
 451                 size_t size = 0;
 452 
 453                (void) papiAttributeListGetString(list, NULL,
 454                                     "printer-name", &name);
 455                (void) papiAttributeListGetInteger(list, NULL,
 456                                     "job-id", &id);
 457                 while (papiAttributeListToString(list, "\n\t", buffer,
 458                             size) != PAPI_OK)
 459                     buffer = realloc(buffer, size += BUFSIZ);
 460 
 461                 printf("%s-%d:\en\t%s\en", name, id, buffer);
 462                 free(buffer);
 463             }
 464         }
 465         papiJobListFree(jobs);
 466     }
 467 
 468     papiServiceDestroy(svc);
 469 
 470     exit(0);
 471 }
 472 .fi
 473 .in -2
 474 
 475 .LP
 476 \fBExample 2 \fRDump all job attributes.
 477 .sp
 478 .in +2
 479 .nf
 480 /*
 481  * program to dump a queued job's attributes using PAPI interfaces.


 531     int id = 0;
 532     int c;
 533 
 534     while ((c = getopt(ac, av, "s:p:j:")) != EOF)
 535         switch (c) {
 536         case 's':
 537             svc_name = optarg;
 538             break;
 539         case 'p':
 540             pname = optarg;
 541             break;
 542         case 'j':
 543             id = atoi(optarg);
 544             break;
 545         }
 546 
 547     status = papiServiceCreate(&svc, svc_name, NULL, NULL, authCB,
 548                             PAPI_ENCRYPT_NEVER, NULL);
 549 
 550     if (status != PAPI_OK) {
 551         printf("papiServiceCreate(%s): %s\en", svc_name ? svc_name :
 552                      "NULL", papiStatusString(status));
 553         papiServiceDestroy(svc);
 554         exit(1);
 555     }
 556 
 557     status = papiJobQuery(svc, pname, id, NULL, &job);
 558     if ((status == PAPI_OK) && (job != NULL)) {
 559         papi_attribute_t **list = papiJobGetAttributeList(job);
 560 
 561         if (list != NULL) {
 562             char *name = "unknown";
 563             int32_t id = 0;
 564             char *buffer = NULL;
 565             size_t size = 0;
 566 
 567             (void) papiAttributeListGetString(list, NULL,
 568                                     "printer-name", &name);
 569             (void) papiAttributeListGetInteger(list, NULL,
 570                                     "job-id", &id);
 571             while (papiAttributeListToString(list, "\en\et", buffer, size)
 572                             != PAPI_OK)
 573                 buffer = realloc(buffer, size += BUFSIZ);
 574 
 575             printf("%s-%d:\en\et%s\n", name, id, buffer);
 576             free(buffer);
 577         }
 578     } else
 579         printf("papiJobQuery(%s-%d): %s\en", pname, id,
 580                     papiStatusString(status));
 581 
 582     papiJobFree(job);
 583     papiServiceDestroy(svc);
 584 
 585     exit(0);
 586 }
 587 .fi
 588 .in -2
 589 
 590 .LP
 591 \fBExample 3 \fRSubmit a job (stream).
 592 .sp
 593 .in +2
 594 .nf
 595 /*
 596  * program to submit a job from standard input.
 597  */
 598 #include <stdio.h>
 599 #include <stdlib.h>


 647     char *pname = "unknown";
 648     int id = 0;
 649     int c;
 650     int rc;
 651     char buf[BUFSIZ];
 652 
 653     while ((c = getopt(ac, av, "s:p:")) != EOF)
 654         switch (c) {
 655         case 's':
 656             svc_name = optarg;
 657             break;
 658         case 'p':
 659             pname = optarg;
 660             break;
 661         }
 662 
 663     status = papiServiceCreate(&svc, svc_name, NULL, NULL, authCB,
 664                             PAPI_ENCRYPT_NEVER, NULL);
 665 
 666     if (status != PAPI_OK) {
 667         printf("papiServiceCreate(%s): %s\en", svc_name ? svc_name :
 668                     "NULL", papiStatusString(status));
 669         papiServiceDestroy(svc);
 670         exit(1);
 671     }
 672 
 673     papiAttributeListAddInteger(&attrs, PAPI_ATTR_EXCL, "copies", 1);
 674     papiAttributeListAddString(&attrs, PAPI_ATTR_EXCL,
 675                 "document-format", "application/octet-stream");
 676     papiAttributeListAddString(&attrs, PAPI_ATTR_EXCL,
 677                 "job-title", "Standard Input");
 678 
 679     status = papiJobStreamOpen(svc, pname, attrs, NULL, &stream);
 680     while ((status == PAPI_OK) && ((rc = read(0, buf,
 681                      sizeof (buf))) > 0))
 682             status = papiJobStreamWrite(svc, stream, buf, rc);
 683 
 684     if (status == PAPI_OK)
 685             status = papiJobStreamClose(svc, stream, &job);
 686 
 687 
 688     if ((status == PAPI_OK) && (job != NULL)) {
 689         papi_attribute_t **list = papiJobGetAttributeList(job);
 690 
 691         if (list != NULL) {
 692             char *name = "unknown";
 693             int32_t id = 0;
 694             char *buffer = NULL;
 695             size_t size = 0;
 696 
 697             (void) papiAttributeListGetString(list, NULL,
 698                                     "printer-name", &name);
 699             (void) papiAttributeListGetInteger(list, NULL,
 700                                     "job-id", &id);
 701             while (papiAttributeListToString(list, "\n\t", buffer, size)
 702                             != PAPI_OK)
 703                 buffer = realloc(buffer, size += BUFSIZ);
 704 
 705             printf("%s-%d:\en\t%s\en", name, id, buffer);
 706             free(buffer);
 707         }
 708     } else
 709         printf("papiJobStream*(%s-%d): %s\en", pname, id,
 710                     papiStatusString(status));
 711 
 712     papiJobFree(job);
 713     papiServiceDestroy(svc);
 714 
 715     exit(0);
 716 }
 717 .fi
 718 .in -2
 719 
 720 .SH ATTRIBUTES
 721 .sp
 722 .LP
 723 See \fBattributes\fR(5) for descriptions of the following attributes:
 724 .sp
 725 
 726 .sp
 727 .TS
 728 box;
 729 c | c