*
* Filtering program for CUPS.
*
- * Copyright 2007-2011 by Apple Inc.
+ * Copyright 2007-2012 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
static int read_cupsd_conf(const char *filename);
static void set_string(char **s, const char *val);
static void sighandler(int sig);
-static void usage(const char *command, const char *opt)
- __attribute__((noreturn));
+static void usage(const char *opt) __attribute__((noreturn));
/*
if (i < argc && !infile)
infile = argv[i];
else
- usage(command, opt);
+ usage(opt);
break;
case 'a' : /* Specify option... */
if (i < argc)
num_options = cupsParseOptions(argv[i], num_options, &options);
else
- usage(command, opt);
+ usage(opt);
break;
case 'c' : /* Specify cupsd.conf file location... */
strlcpy(cupsdconf, argv[i], sizeof(cupsdconf));
}
else
- usage(command, opt);
+ usage(opt);
break;
case 'd' : /* Specify the real printer name */
if (i < argc)
printer = argv[i];
else
- usage(command, opt);
+ usage(opt);
break;
case 'D' : /* Delete input file after conversion */
if (i < argc && !infile)
infile = argv[i];
else
- usage(command, opt);
+ usage(opt);
break;
case 'i' : /* Specify source MIME type... */
if (i < argc)
{
if (sscanf(argv[i], "%15[^/]/%255s", super, type) != 2)
- usage(command, opt);
+ usage(opt);
srctype = argv[i];
}
else
- usage(command, opt);
+ usage(opt);
break;
case 'j' : /* Get job file or specify destination MIME type... */
infile = TempFile;
}
else
- usage(command, opt);
+ usage(opt);
break;
}
if (i < argc)
{
if (sscanf(argv[i], "%15[^/]/%255s", super, type) != 2)
- usage(command, opt);
+ usage(opt);
dsttype = argv[i];
}
else
- usage(command, opt);
+ usage(opt);
break;
case 'n' : /* Specify number of copies... */
num_options = cupsAddOption("copies", argv[i], num_options,
&options);
else
- usage(command, opt);
+ usage(opt);
break;
case 'o' : /* Specify option(s) or output filename */
if (!strcmp(command, "convert"))
{
if (outfile)
- usage(command, NULL);
+ usage(NULL);
else
outfile = argv[i];
}
&options);
}
else
- usage(command, opt);
+ usage(opt);
break;
case 'p' : /* Specify PPD file... */
if (i < argc)
ppdfile = argv[i];
else
- usage(command, opt);
+ usage(opt);
break;
case 't' : /* Specify title... */
if (i < argc)
title = argv[i];
else
- usage(command, opt);
+ usage(opt);
break;
case 'u' : /* Delete PPD file after conversion */
if (i < argc)
user = argv[i];
else
- usage(command, opt);
+ usage(opt);
break;
default : /* Something we don't understand... */
- usage(command, opt);
+ usage(opt);
break;
}
}
if (strcmp(command, "convert"))
infile = argv[i];
else
- {
- _cupsLangPuts(stderr,
- _("convert: Use the -f option to specify a file to "
- "convert."));
- usage(command, NULL);
- }
+ usage(NULL);
}
else
{
_cupsLangPuts(stderr,
_("cupsfilter: Only one filename can be specified."));
- usage(command, NULL);
+ usage(NULL);
}
if (!infile && !srctype)
- usage(command, NULL);
+ usage(NULL);
if (!title)
{
*/
static void
-usage(const char *command, /* I - Command name */
- const char *opt) /* I - Incorrect option, if any */
+usage(const char *opt) /* I - Incorrect option, if any */
{
if (opt)
- _cupsLangPrintf(stderr, _("%s: Unknown option \"%c\"."), command, *opt);
-
- if (!strcmp(command, "cupsfilter"))
- {
- _cupsLangPuts(stdout, _("Usage: cupsfilter [ options ] filename"));
- _cupsLangPuts(stdout, _("Options:"));
- _cupsLangPuts(stdout, _(" -D Remove the input file "
- "when finished."));
- _cupsLangPuts(stdout, _(" -P filename.ppd Set PPD file."));
- _cupsLangPuts(stdout, _(" -U username Set username for job."));
- _cupsLangPuts(stdout, _(" -c cupsd.conf Set cupsd.conf file to "
- "use."));
- _cupsLangPuts(stdout, _(" -d printer Use the named "
- "printer."));
- _cupsLangPuts(stdout, _(" -e Use every filter from "
- "the PPD file."));
- _cupsLangPuts(stdout, _(" -i mime/type Set input MIME type "
- "(otherwise auto-typed)."));
- _cupsLangPuts(stdout, _(" -j job-id[,N] Filter file N from the "
- "specified job (default is file 1)."));
- _cupsLangPuts(stdout, _(" -m mime/type Set output MIME type "
- "(otherwise application/pdf)."));
- _cupsLangPuts(stdout, _(" -n copies Set number of copies."));
- _cupsLangPuts(stdout, _(" -o name=value Set option(s)."));
- _cupsLangPuts(stdout, _(" -p filename.ppd Set PPD file."));
- _cupsLangPuts(stdout, _(" -t title Set title."));
- _cupsLangPuts(stdout, _(" -u Remove the PPD file "
- "when finished."));
- }
- else
- {
- _cupsLangPuts(stdout, _("Usage: convert [ options ]"));
- _cupsLangPuts(stdout, _("Options:"));
- _cupsLangPuts(stdout, _(" -D Remove the input file "
- "when finished."));
- _cupsLangPuts(stdout, _(" -J title Set title."));
- _cupsLangPuts(stdout, _(" -P filename.ppd Set PPD file."));
- _cupsLangPuts(stdout, _(" -U username Set username for job."));
- _cupsLangPuts(stdout, _(" -a 'name=value ...' Set option(s)."));
- _cupsLangPuts(stdout, _(" -c copies Set number of copies."));
- _cupsLangPuts(stdout, _(" -d printer Use the named "
- "printer."));
- _cupsLangPuts(stdout, _(" -e Use every filter from "
- "the PPD file."));
- _cupsLangPuts(stdout, _(" -f filename Set file to be "
- "converted (otherwise stdin)."));
- _cupsLangPuts(stdout, _(" -i mime/type Set input MIME type "
- "(otherwise auto-typed)."));
- _cupsLangPuts(stdout, _(" -j mime/type Set output MIME type "
- "(otherwise application/pdf)."));
- _cupsLangPuts(stdout, _(" -o filename Set file to be "
- "generated (otherwise stdout)."));
- _cupsLangPuts(stdout, _(" -u Remove the PPD file "
- "when finished."));
- }
+ _cupsLangPrintf(stderr, _("%s: Unknown option \"%c\"."), "cupsfilter",
+ *opt);
+
+ _cupsLangPuts(stdout, _("Usage: cupsfilter [ options ] filename"));
+ _cupsLangPuts(stdout, _("Options:"));
+ _cupsLangPuts(stdout, _(" -D Remove the input file "
+ "when finished."));
+ _cupsLangPuts(stdout, _(" -P filename.ppd Set PPD file."));
+ _cupsLangPuts(stdout, _(" -U username Specify username."));
+ _cupsLangPuts(stdout, _(" -c cupsd.conf Set cupsd.conf file to "
+ "use."));
+ _cupsLangPuts(stdout, _(" -d printer Use the named "
+ "printer."));
+ _cupsLangPuts(stdout, _(" -e Use every filter from "
+ "the PPD file."));
+ _cupsLangPuts(stdout, _(" -i mime/type Set input MIME type "
+ "(otherwise auto-typed)."));
+ _cupsLangPuts(stdout, _(" -j job-id[,N] Filter file N from the "
+ "specified job (default is file 1)."));
+ _cupsLangPuts(stdout, _(" -m mime/type Set output MIME type "
+ "(otherwise application/pdf)."));
+ _cupsLangPuts(stdout, _(" -n copies Set number of copies."));
+ _cupsLangPuts(stdout, _(" -o name=value Set option(s)."));
+ _cupsLangPuts(stdout, _(" -p filename.ppd Set PPD file."));
+ _cupsLangPuts(stdout, _(" -t title Set title."));
+ _cupsLangPuts(stdout, _(" -u Remove the PPD file "
+ "when finished."));
exit(1);
}