#include <signal.h>
#include <cups/cups.h>
-int /* O - Error status */
+int /* O - Error status */
universal(int inputfd, /* I - File descriptor input stream */
- int outputfd, /* I - File descriptor output stream */
- int inputseekable, /* I - Is input stream seekable? (unused) */
- filter_data_t *data, /* I - Job and printer data */
- void *parameters) /* I - Filter-specific parameters (outformat) */
+ int outputfd, /* I - File descriptor output stream */
+ int inputseekable, /* I - Is input stream seekable? */
+ filter_data_t *data, /* I - Job and printer data */
+ void *parameters) /* I - Filter-specific parameters
+ (input/output format) */
{
char *input;
char *output;
filter_out_format_t *outformat;
filter_filter_in_chain_t *filter , *next;
filter_input_output_format_t input_output_format;
+ filter_logfunc_t log = data->logfunc;
+ void *ld = data->logdata;
input_output_format = *(filter_input_output_format_t *)parameters;
input = input_output_format.input_format;
filter->function = imagetoraster;
filter->parameters = NULL;
filter->name = "imagetoraster";
- fprintf(stderr , "Adding %s to chain \n" , filter->name);
+ if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ "universal: Adding %s to chain", filter->name);
cupsArrayAdd(filter_chain , filter);
if(!strcmp(output , "image/pwg-raster")){
filter->parameters = outformat;
filter->name = "rastertopwg";
cupsArrayAdd(filter_chain , filter);
- fprintf(stderr , "Adding %s to chain \n" , filter->name);
+ if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ "universal: Adding %s to chain", filter->name);
}
else if(!strcmp(output , "application/PCLm")){
outformat = malloc(sizeof(filter_out_format_t));
filter->function = rastertopdf;
filter->parameters = outformat;
filter->name = "rastertopclm";
- fprintf(stderr , "Adding %s to chain \n" , filter->name);
+ if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ "universal: Adding %s to chain", filter->name);
cupsArrayAdd(filter_chain , filter);
}
else if(!strcmp(output , "image/urf")){
filter->parameters = outformat;
filter->name = "rastertopwg";
cupsArrayAdd(filter_chain , filter);
- fprintf(stderr , "Adding %s to chain \n" , filter->name);
+ if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ "universal: Adding %s to chain", filter->name);
}
}
else{
filter->function = imagetopdf;
filter->parameters = NULL;
filter->name = "imagetopdf";
- fprintf(stderr , "Adding %s to chain \n" , filter->name);
+ if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ "universal: Adding %s to chain", filter->name);
cupsArrayAdd(filter_chain , filter);
}
}
filter->function = ghostscript;
filter->parameters = outformat;
filter->name = "gstopdf";
- fprintf(stderr , "Adding %s to chain \n" , filter->name);
+ if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ "universal: Adding %s to chain", filter->name);
cupsArrayAdd(filter_chain , filter);
}
else if(!strcmp(input_super , "text") || (!strcmp(input_super , "application") && input_type[0] == 'x')){
filter->function = texttopdf;
filter->parameters = parameters;
filter->name = "texttopdf";
- fprintf(stderr , "Adding %s to chain \n" , filter->name);
+ if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ "universal: Adding %s to chain",
+ filter->name);
cupsArrayAdd(filter_chain , filter);
}
else if(!strcmp(input , "image/urf") || !strcmp(input , "image/pwg-raster") || !strcmp(input , "application/vnd.cups-raster")){
filter->function = rastertopdf;
filter->parameters = outformat;
filter->name = "rastertopdf";
- fprintf(stderr , "Adding %s to chain \n" , filter->name);
+ if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ "universal: Adding %s to chain", filter->name);
cupsArrayAdd(filter_chain , filter);
}
else if(!strcmp(input_type , "vnd.adobe-reader-postscript")){
filter->parameters = outformat;
filter->name = "pstoraster";
cupsArrayAdd(filter_chain , filter);
- fprintf(stderr , "Adding %s to chain \n" , filter->name);
+ if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ "universal: Adding %s to chain", filter->name);
if(strcmp(output_type , "urf") && strcmp(output_type , "pwg-raster") && strcmp(output_type , "vnd.cups-raster")){
outformat = malloc(sizeof(filter_out_format_t));
filter->function = rastertopdf;
filter->parameters = outformat;
filter->name = "rastertopdf";
- fprintf(stderr , "Adding %s to chain \n" , filter->name);
+ if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ "universal: Adding %s to chain", filter->name);
cupsArrayAdd(filter_chain , filter);
}
}
filter->function = pdftopdf;
filter->parameters = NULL;
filter->name = "pdftopdf";
- fprintf(stderr , "Adding %s to chain \n" , filter->name);
+ if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ "universal: Adding %s to chain", filter->name);
cupsArrayAdd(filter_chain , filter);
if(strcmp(output_type , "vnd.cups-pdf")){
filter->parameters = outformat;
filter->name = "pdftoraster";
cupsArrayAdd(filter_chain , filter);
- fprintf(stderr , "Adding %s to chain \n" , filter->name);
+ if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ "universal: Adding %s to chain",
+ filter->name);
if(!strcmp(output , "image/pwg-raster")){
outformat = malloc(sizeof(filter_out_format_t));
filter->parameters = outformat;
filter->name = "rastertopwg";
cupsArrayAdd(filter_chain , filter);
- fprintf(stderr , "Adding %s to chain \n" , filter->name);
+ if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ "universal: Adding %s to chain",
+ filter->name);
}
else if(!strcmp(output , "application/PCLm")){
outformat = malloc(sizeof(filter_out_format_t));
filter->function = rastertopdf;
filter->parameters = outformat;
filter->name = "rastertopclm";
- fprintf(stderr , "Adding %s to chain \n" , filter->name);
+ if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ "universal: Adding %s to chain",
+ filter->name);
cupsArrayAdd(filter_chain , filter);
}
else if(!strcmp(output , "image/urf")){
filter->parameters = outformat;
filter->name = "rastertopwg";
cupsArrayAdd(filter_chain , filter);
- fprintf(stderr , "Adding %s to chain \n" , filter->name);
+ if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ "universal: Adding %s to chain",
+ filter->name);
}
}
else if(!strcmp(output , "application/postscript") || !strcmp(output , "application/vnd.cups-postscript")){
filter->function = pdftops;
filter->parameters = NULL;
filter->name = "pdftops";
- fprintf(stderr , "Adding %s to chain \n" , filter->name);
+ if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
+ "universal: Adding %s to chain", filter->name);
cupsArrayAdd(filter_chain , filter);
}
}