X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fcups.git;a=blobdiff_plain;f=scheduler%2Fcupsfilter.c;h=713a0f1cd36c31e520da0b7a6dd6a5405cec3cfb;hp=f69aa820f31ac741a2dcc7bcdb833dcb0c68017f;hb=db1f069b7f02a8e17a9e4abf8f182530b882c6c9;hpb=76cd9e37aaf496aab887d499f4917b60e91d6d25 diff --git a/scheduler/cupsfilter.c b/scheduler/cupsfilter.c index f69aa820f..713a0f1cd 100644 --- a/scheduler/cupsfilter.c +++ b/scheduler/cupsfilter.c @@ -1,5 +1,5 @@ /* - * "$Id: cupsfilter.c 6695 2007-07-19 21:59:30Z mike $" + * "$Id: cupsfilter.c 6816 2007-08-20 20:16:00Z mike $" * * CUPS filtering program for the Common UNIX Printing System (CUPS). * @@ -76,8 +76,9 @@ static int exec_filter(const char *filter, char **argv, char **envp, int infd, int outfd); static int exec_filters(cups_array_t *filters, const char *infile, const char *outfile, const char *ppdfile, - const char *user, const char *title, - int num_options, cups_option_t *options); + const char *printer, const char *user, + const char *title, int num_options, + cups_option_t *options); static int open_pipe(int *fds); static int read_cupsd_conf(const char *filename); static void set_string(char **s, const char *val); @@ -396,8 +397,9 @@ main(int argc, /* I - Number of command-line args */ * Do it! */ - status = exec_filters(filters, infile, outfile, ppdfile, user, title, - num_options, options); + status = exec_filters(filters, infile, outfile, ppdfile, + !strcmp(command, "convert") ? "tofile" : "cupsfilter", + user, title, num_options, options); /* * Remove files as needed, then exit... @@ -590,6 +592,7 @@ exec_filters(cups_array_t *filters, /* I - Array of filters to run */ const char *infile, /* I - File to filter */ const char *outfile, /* I - File to create */ const char *ppdfile, /* I - PPD file, if any */ + const char *printer, /* I - Printer name */ const char *user, /* I - Username */ const char *title, /* I - Job title */ int num_options, /* I - Number of filter options */ @@ -643,17 +646,24 @@ exec_filters(cups_array_t *filters, /* I - Array of filters to run */ snprintf(ppd, sizeof(ppd), "PPD=%s", temp); else #ifdef __APPLE__ + if (!access("/System/Library/Frameworks/ApplicationServices.framework/" + "Versions/A/Frameworks/PrintCore.framework/Versions/A/" + "Resources/English.lproj/Generic.ppd", 0)) strlcpy(ppd, "PPD=/System/Library/Frameworks/ApplicationServices.framework/" "Versions/A/Frameworks/PrintCore.framework/Versions/A/" "Resources/English.lproj/Generic.ppd", sizeof(ppd)); + else + strlcpy(ppd, "PPD=/System/Library/Frameworks/ApplicationServices.framework/" + "Versions/A/Frameworks/PrintCore.framework/Versions/A/" + "Resources/Generic.ppd", sizeof(ppd)); #else snprintf(ppd, sizeof(ppd), "PPD=%s/model/laserjet.ppd", DataDir); #endif /* __APPLE__ */ snprintf(rip_cache, sizeof(rip_cache), "RIP_CACHE=%s", RIPCache); snprintf(userenv, sizeof(userenv), "USER=%s", user); - argv[0] = "cupsfilter"; - argv[1] = "0"; + argv[0] = (char *)printer; + argv[1] = "1"; argv[2] = user; argv[3] = title; argv[4] = cupsGetOption("copies", num_options, options); @@ -982,5 +992,5 @@ usage(const char *command, /* I - Command name */ /* - * End of "$Id: cupsfilter.c 6695 2007-07-19 21:59:30Z mike $". + * End of "$Id: cupsfilter.c 6816 2007-08-20 20:16:00Z mike $". */