[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Guide to Printers and Printing

Understanding Backend Routines in libqb

This article defines the set of library routines that the backend should use to communicate with the qdaemon process. These routines are in the /usr/lib/libqb.a library; they were designed to make the task of writing a backend as easy as possible. These backend routines are available using the ld or cc command-line option -lqb.

For information on using these routines with the backend, see "Understanding the Interaction between qdaemon and the Backend".

get_align() Returns TRUE or FALSE, telling whether an alignment form-feed is to be printed. A form-feed is printed only when the printer has been idle and is about to print a new job. The form-feed aligns the paper to top-of-form and is helpful if someone moved the paper while the printer was idle.
get_cmd_line() Returns a pointer to an array of characters containing the enq command line as invoked by the user. The string returned does not contain the name /usr/bin/enq, any of the file names specified, or any options that were sent to the backend using the enq -o option. For example, if the user enters the command line enq -Plp0 -Bgn -o -i15 filename, the get_cmd_line function returns the string -Plp0 -Bgn. This function is useful when the backend needs to know the command line options a user provided when the job was submitted.
get_copies() Returns the number of copies to be printed. Its return value is of type int.
get_device_name() Returns a pointer to an array of characters containing the device name.
get_feed() Returns the number of feed pages to be printed. Its return value is of type unsigned int. Feed pages are blank pages printed only when the printer has become idle. This makes it easier to tear off paper from the printer.
get_from() Returns an array of characters containing the name of the person who made the print request. The return value is of type char*.
get_header() Returns NEVER, ALWAYS, or GROUP (#include <IN/backend.h>). Its return value is of type unsigned int. A header is a page preceding a file that shows its title, date, its recipient, and other information.
get_job_number() Returns job number of current print. Its return value is of type int.
get_mail_only() Returns TRUE if the user specifies mail-only.
get_qdate() Returns a string showing the date that the request was queued. The return value is of type char*.
get_queue_name() Returns an array of characters containing the queue name.
get_title() Returns an array of characters containing the title of the job being printed. The return value is of type char*.
get_trailer() Returns NEVER, ALWAYS, or GROUP. Its return value is of type unsigned int. A trailer is a page following a file that gives the name of the user of the output.
get_to() Returns an array of characters containing the name of the person for whom the job is intended. The return value is of type char*.
get_was_idle() Returns TRUE if the printer was idle at job beginning (useful for paper feed: feed/no feed).

Returns the charge for printing the current job.

log_charge(charge) int charge;
                          Returns the charge for printing the current job.
log_init Initializes certain data common to the library routines.
log_pages(pages) Updates the status file with the number of pages printed.
log_percent(percent) Updates the status file with the percent of job completed.
log_progress(log_pages (int),log_percent(char))
                          Updates the status file with the number of pages printed and percent of job completed. This function uses log_pages and log_percent.
log_status(status) Changes the status of the job from RUNNING to WAITING and back again. The parameter is the new status.
put_header(fnaddr,width)
                         
 int (*fnaddr);
 int *width; Prints a header page with no following form-feed and returns the number of lines printed. The fnaddr and width parameters are optional. The fnaddr parameter defines the format subroutine used to display characters on the header page. The default is the putchar subroutine. The width parameter defines the width of the form. The default value for the width parameter is 80.
put_trailer(user,fnaddr,width)
                         
 char *user;
 int (*fnaddr);
 int *width Prints a trailer page for user with no following form-feed and returns the number of lines printed. The fnaddr and width parameters are optional. These parameters are identical to and take the same values as the fnaddr and width parameters for the put_header subroutine.
sysnot(user,host,message,pref)
                         
 char *user;
 char *host;
 char *message;
 unsigned int *pref;
                          Sends a message to the user if the backend cannot run a job. The value of the pref parameter indicates whether to mail the message to the user or to write the message on the user's terminal. The valid values defined in /usr/include/IN/backend.h file are:
DOMAIL
                          Mails the error message to the user.
DOWRITE Writes the message to the user's terminal if the user is logged on. If the user is not logged on, the message is mailed to the user.

[ Previous | Next | Contents | Glossary | Home | Search ]