summaryrefslogtreecommitdiff
path: root/systemv/lp.c
diff options
context:
space:
mode:
authorDidier Raboud <odyx@debian.org>2012-10-25 20:57:13 +0200
committerDidier Raboud <odyx@debian.org>2012-10-25 20:57:13 +0200
commit49a2853988b074d087e82c51aec4f9fc052a057d (patch)
treec38ece96005bc33bd4e133fd0037f3428fdc039d /systemv/lp.c
parenta312f7e1ac68fb22275719f6208b670d9edd45b5 (diff)
downloadcups-49a2853988b074d087e82c51aec4f9fc052a057d.tar.gz
Imported Upstream version 1.5.0upstream/1.5.0
Diffstat (limited to 'systemv/lp.c')
-rw-r--r--systemv/lp.c127
1 files changed, 53 insertions, 74 deletions
diff --git a/systemv/lp.c b/systemv/lp.c
index 133a0845..af47132e 100644
--- a/systemv/lp.c
+++ b/systemv/lp.c
@@ -1,9 +1,9 @@
/*
- * "$Id: lp.c 8141 2008-11-18 00:42:34Z mike $"
+ * "$Id: lp.c 9636 2011-03-21 22:02:00Z mike $"
*
- * "lp" command for the Common UNIX Printing System (CUPS).
+ * "lp" command for CUPS.
*
- * Copyright 2007-2008 by Apple Inc.
+ * Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -23,12 +23,7 @@
* Include necessary headers...
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <cups/string.h>
-#include <cups/cups.h>
-#include <cups/i18n.h>
+#include <cups/cups-private.h>
/*
@@ -104,8 +99,7 @@ main(int argc, /* I - Number of command-line arguments */
#ifdef HAVE_SSL
cupsSetEncryption(HTTP_ENCRYPT_REQUIRED);
#else
- _cupsLangPrintf(stderr,
- _("%s: Sorry, no encryption support compiled in!\n"),
+ _cupsLangPrintf(stderr, _("%s: Sorry, no encryption support."),
argv[0]);
#endif /* HAVE_SSL */
break;
@@ -119,9 +113,8 @@ main(int argc, /* I - Number of command-line arguments */
if (i >= argc)
{
_cupsLangPrintf(stderr,
- _("%s: Error - expected username after "
- "\'-U\' option!\n"),
- argv[0]);
+ _("%s: Error - expected username after \"-U\" "
+ "option."), argv[0]);
return (1);
}
@@ -143,8 +136,7 @@ main(int argc, /* I - Number of command-line arguments */
{
_cupsLangPrintf(stderr,
_("%s: Error - expected destination after "
- "\'-d\' option!\n"),
- argv[0]);
+ "\"-d\" option."), argv[0]);
return (1);
}
@@ -157,7 +149,8 @@ main(int argc, /* I - Number of command-line arguments */
if ((dest = cupsGetNamedDest(NULL, printer, instance)) != NULL)
{
for (j = 0; j < dest->num_options; j ++)
- if (cupsGetOption(dest->options[j].name, num_options, options) == NULL)
+ if (cupsGetOption(dest->options[j].name, num_options,
+ options) == NULL)
num_options = cupsAddOption(dest->options[j].name,
dest->options[j].value,
num_options, &options);
@@ -172,14 +165,14 @@ main(int argc, /* I - Number of command-line arguments */
if (i >= argc)
{
_cupsLangPrintf(stderr,
- _("%s: Error - expected form after \'-f\' "
- "option!\n"),
+ _("%s: Error - expected form after \"-f\" "
+ "option."),
argv[0]);
return (1);
}
}
- _cupsLangPrintf(stderr, _("%s: Warning - form option ignored!\n"),
+ _cupsLangPrintf(stderr, _("%s: Warning - form option ignored."),
argv[0]);
break;
@@ -194,8 +187,7 @@ main(int argc, /* I - Number of command-line arguments */
{
_cupsLangPrintf(stderr,
_("%s: Error - expected hostname after "
- "\'-h\' option!\n"),
- argv[0]);
+ "\"-h\" option."), argv[0]);
return (1);
}
@@ -213,7 +205,7 @@ main(int argc, /* I - Number of command-line arguments */
if (i >= argc)
{
_cupsLangPrintf(stderr,
- _("%s: Expected job ID after \'-i\' option!\n"),
+ _("%s: Expected job ID after \"-i\" option."),
argv[0]);
return (1);
}
@@ -225,8 +217,7 @@ main(int argc, /* I - Number of command-line arguments */
{
_cupsLangPrintf(stderr,
_("%s: Error - cannot print files and alter "
- "jobs simultaneously!\n"),
- argv[0]);
+ "jobs simultaneously."), argv[0]);
return (1);
}
@@ -237,7 +228,7 @@ main(int argc, /* I - Number of command-line arguments */
if (job_id < 0)
{
- _cupsLangPrintf(stderr, _("%s: Error - bad job ID!\n"), argv[0]);
+ _cupsLangPrintf(stderr, _("%s: Error - bad job ID."), argv[0]);
break;
}
break;
@@ -271,8 +262,7 @@ main(int argc, /* I - Number of command-line arguments */
{
_cupsLangPrintf(stderr,
_("%s: Error - expected copies after "
- "\'-n\' option!\n"),
- argv[0]);
+ "\"-n\" option."), argv[0]);
return (1);
}
@@ -280,12 +270,14 @@ main(int argc, /* I - Number of command-line arguments */
}
sprintf(buffer, "%d", num_copies);
- num_options = cupsAddOption("copies", buffer, num_options, &options);
+ num_options = cupsAddOption("copies", buffer, num_options,
+ &options);
break;
case 'o' : /* Option */
if (argv[i][2] != '\0')
- num_options = cupsParseOptions(argv[i] + 2, num_options, &options);
+ num_options = cupsParseOptions(argv[i] + 2, num_options,
+ &options);
else
{
i ++;
@@ -293,9 +285,8 @@ main(int argc, /* I - Number of command-line arguments */
if (i >= argc)
{
_cupsLangPrintf(stderr,
- _("%s: Error - expected option string after "
- "\'-o\' option!\n"),
- argv[0]);
+ _("%s: Error - expected option=value after "
+ "\"-o\" option."), argv[0]);
return (1);
}
@@ -315,8 +306,7 @@ main(int argc, /* I - Number of command-line arguments */
{
_cupsLangPrintf(stderr,
_("%s: Error - expected priority after "
- "\'-%c\' option!\n"),
- argv[0], argv[i][1]);
+ "\"-%c\" option."), argv[0], argv[i][1]);
return (1);
}
@@ -338,13 +328,13 @@ main(int argc, /* I - Number of command-line arguments */
{
_cupsLangPrintf(stderr,
_("%s: Error - priority must be between 1 and "
- "100.\n"),
- argv[0]);
+ "100."), argv[0]);
return (1);
}
sprintf(buffer, "%d", priority);
- num_options = cupsAddOption("job-priority", buffer, num_options, &options);
+ num_options = cupsAddOption("job-priority", buffer, num_options,
+ &options);
break;
case 's' : /* Silent */
@@ -362,8 +352,7 @@ main(int argc, /* I - Number of command-line arguments */
{
_cupsLangPrintf(stderr,
_("%s: Error - expected title after "
- "\'-t\' option!\n"),
- argv[0]);
+ "\"-t\" option."), argv[0]);
return (1);
}
@@ -380,15 +369,13 @@ main(int argc, /* I - Number of command-line arguments */
{
_cupsLangPrintf(stderr,
_("%s: Error - expected mode list after "
- "\'-y\' option!\n"),
- argv[0]);
+ "\"-y\" option."), argv[0]);
return (1);
}
}
_cupsLangPrintf(stderr,
- _("%s: Warning - mode option ignored!\n"),
- argv[0]);
+ _("%s: Warning - mode option ignored."), argv[0]);
break;
case 'H' : /* Hold job */
@@ -402,8 +389,7 @@ main(int argc, /* I - Number of command-line arguments */
{
_cupsLangPrintf(stderr,
_("%s: Error - expected hold name after "
- "\'-H\' option!\n"),
- argv[0]);
+ "\"-H\" option."), argv[0]);
return (1);
}
@@ -429,9 +415,8 @@ main(int argc, /* I - Number of command-line arguments */
if (job_id < 1)
{
_cupsLangPrintf(stderr,
- _("%s: Need job ID (\'-i jobid\') before "
- "\'-H restart\'!\n"),
- argv[0]);
+ _("%s: Need job ID (\"-i jobid\") before "
+ "\"-H restart\"."), argv[0]);
return (1);
}
@@ -454,8 +439,7 @@ main(int argc, /* I - Number of command-line arguments */
{
_cupsLangPrintf(stderr,
_("%s: Error - expected page list after "
- "\'-P\' option!\n"),
- argv[0]);
+ "\"-P\" option."), argv[0]);
return (1);
}
@@ -475,14 +459,13 @@ main(int argc, /* I - Number of command-line arguments */
{
_cupsLangPrintf(stderr,
_("%s: Error - expected character set after "
- "\'-S\' option!\n"),
- argv[0]);
+ "\"-S\" option."), argv[0]);
return (1);
}
}
_cupsLangPrintf(stderr,
- _("%s: Warning - character set option ignored!\n"),
+ _("%s: Warning - character set option ignored."),
argv[0]);
break;
@@ -495,14 +478,13 @@ main(int argc, /* I - Number of command-line arguments */
{
_cupsLangPrintf(stderr,
_("%s: Error - expected content type after "
- "\'-T\' option!\n"),
- argv[0]);
+ "\"-T\" option."), argv[0]);
return (1);
}
}
_cupsLangPrintf(stderr,
- _("%s: Warning - content type option ignored!\n"),
+ _("%s: Warning - content type option ignored."),
argv[0]);
break;
@@ -511,7 +493,7 @@ main(int argc, /* I - Number of command-line arguments */
break;
default :
- _cupsLangPrintf(stderr, _("%s: Error - unknown option \'%c\'!\n"),
+ _cupsLangPrintf(stderr, _("%s: Error - unknown option \"%c\"."),
argv[0], argv[i][1]);
return (1);
}
@@ -521,8 +503,7 @@ main(int argc, /* I - Number of command-line arguments */
{
_cupsLangPrintf(stderr,
_("%s: Error - cannot print from stdin if files or a "
- "job ID are provided!\n"),
- argv[0]);
+ "job ID are provided."), argv[0]);
return (1);
}
@@ -536,7 +517,7 @@ main(int argc, /* I - Number of command-line arguments */
if (access(argv[i], R_OK) != 0)
{
- _cupsLangPrintf(stderr, _("%s: Error - unable to access \"%s\" - %s\n"),
+ _cupsLangPrintf(stderr, _("%s: Error - unable to access \"%s\" - %s"),
argv[0], argv[i], strerror(errno));
return (1);
}
@@ -553,7 +534,7 @@ main(int argc, /* I - Number of command-line arguments */
}
}
else
- _cupsLangPrintf(stderr, _("%s: Error - too many files - \"%s\"\n"),
+ _cupsLangPrintf(stderr, _("%s: Error - too many files - \"%s\"."),
argv[0], argv[i]);
/*
@@ -601,15 +582,14 @@ main(int argc, /* I - Number of command-line arguments */
if (printer && !cupsGetNamedDest(NULL, printer, NULL))
_cupsLangPrintf(stderr,
_("%s: Error - %s environment variable names "
- "non-existent destination \"%s\"!\n"),
- argv[0], val, printer);
+ "non-existent destination \"%s\"."), argv[0], val,
+ printer);
else if (cupsLastError() == IPP_NOT_FOUND)
_cupsLangPrintf(stderr,
- _("%s: Error - no default destination available.\n"),
+ _("%s: Error - no default destination available."),
argv[0]);
else
- _cupsLangPrintf(stderr,
- _("%s: Error - scheduler not responding!\n"),
+ _cupsLangPrintf(stderr, _("%s: Error - scheduler not responding."),
argv[0]);
return (1);
@@ -641,8 +621,7 @@ main(int argc, /* I - Number of command-line arguments */
if (status != HTTP_CONTINUE)
{
- _cupsLangPrintf(stderr,
- _("%s: Error - unable to queue from stdin - %s\n"),
+ _cupsLangPrintf(stderr, _("%s: Error - unable to queue from stdin - %s."),
argv[0], httpStatus(status));
return (1);
}
@@ -653,11 +632,11 @@ main(int argc, /* I - Number of command-line arguments */
if (job_id < 1)
{
- _cupsLangPrintf(stderr, "%s: %s\n", argv[0], cupsLastErrorString());
+ _cupsLangPrintf(stderr, "%s: %s", argv[0], cupsLastErrorString());
return (1);
}
else if (!silent)
- _cupsLangPrintf(stdout, _("request id is %s-%d (%d file(s))\n"),
+ _cupsLangPrintf(stdout, _("request id is %s-%d (%d file(s))"),
printer, job_id, num_files);
return (0);
@@ -690,7 +669,7 @@ restart_job(const char *command, /* I - Command name */
if (cupsLastError() > IPP_OK_CONFLICT)
{
- _cupsLangPrintf(stderr, "%s: %s\n", command, cupsLastErrorString());
+ _cupsLangPrintf(stderr, "%s: %s", command, cupsLastErrorString());
return (1);
}
@@ -731,7 +710,7 @@ set_job_attrs(const char *command, /* I - Command name */
if (cupsLastError() > IPP_OK_CONFLICT)
{
- _cupsLangPrintf(stderr, "%s: %s\n", command, cupsLastErrorString());
+ _cupsLangPrintf(stderr, "%s: %s", command, cupsLastErrorString());
return (1);
}
@@ -740,5 +719,5 @@ set_job_attrs(const char *command, /* I - Command name */
/*
- * End of "$Id: lp.c 8141 2008-11-18 00:42:34Z mike $".
+ * End of "$Id: lp.c 9636 2011-03-21 22:02:00Z mike $".
*/