Main Page | Data Structures | File List | Globals

libppr/query.c File Reference

print query routines More...

#include "before_system.h"
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <errno.h>
#include <sys/time.h>
#include <time.h>
#include <sys/wait.h>
#include "gu.h"
#include "global_defines.h"
#include "interface.h"
#include "libppr_query.h"

Defines

#define STR(a)   #a

Functions

QUERY * query_new_byaddress (const char interface[], const char address[], const char options[])
 create a query object with interface and address

QUERY * query_new_byprinter (const char printer[])
 create a query object from an existing printer

void query_delete (struct QUERY *q)
 destroy a query object

void query_connect (struct QUERY *q, gu_boolean probe)
 connect to the printer

void query_puts (struct QUERY *q, const char s[])
 Send a line to the printer.

char * query_getline (struct QUERY *q, gu_boolean *is_stderr, int timeout)
 Get a line from the printer.

void query_disconnect (struct QUERY *q)
 Disconnect from the printer.

void query_sendquery (struct QUERY *q, const char *query_name, const char generic_query_name[], const char default_response[], const char pstext[])
 send a PostScript query

void query_endjob (struct QUERY *q)
 Finish the current query job without disconnecting.


Detailed Description

print query routines

This file contains routines for sending queries to printers.


Function Documentation

void query_disconnect struct QUERY *  q  ) 
 

Disconnect from the printer.

This function close any started query job, flushes the output buffer, and closes the pipe to the interface program's stdin.

char* query_getline struct QUERY *  q,
gu_boolean *  is_stderr,
int  timeout
 

Get a line from the printer.

Wait for a line from the printer. Strip the line termination and return a pointer to it. The line pointed to will be good until the next call to this function. The timeout value is the maximum number of seconds to wait for data from the printer.

void query_puts struct QUERY *  q,
const char  s[]
 

Send a line to the printer.

Actually this function doesn't transmit the line. It just adds it to the list of lines which will be sent as you call query_getline().

void query_sendquery struct QUERY *  q,
const char *  query_name,
const char  generic_query_name[],
const char  default_response[],
const char  pstext[]
 

send a PostScript query

query_name Name of query as defined in DSC spec, possibly NULL Defined values include: Feature File FontList Font Printer ProcSet If the parameter is NULL, then the query is a generic query.

generic_query_name Name of query not defined in DSC spec

default response Response which spoolers that don't understand the query should

pstext The PostScript code to be executed on the printer in order to produce the query response.


Generated on Fri Feb 20 15:17:53 2004 for PPR Libraries by doxygen 1.3.5