summaryrefslogtreecommitdiff
path: root/systemv/lpinfo.c
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2018-12-06 14:17:23 -0500
committerMichael R Sweet <michael.r.sweet@gmail.com>2018-12-06 14:17:23 -0500
commit8e52928cfd69bbe91b9f610d62374009b37c2088 (patch)
tree226d8460be4b3946892ea02c51f3ace98d352d58 /systemv/lpinfo.c
parentdf4101bff6f03d551bf6ec81082f8878d2bcc85a (diff)
downloadcups-8e52928cfd69bbe91b9f610d62374009b37c2088.tar.gz
Add --help usage for all System V commands (Issue #5326)
Diffstat (limited to 'systemv/lpinfo.c')
-rw-r--r--systemv/lpinfo.c62
1 files changed, 48 insertions, 14 deletions
diff --git a/systemv/lpinfo.c b/systemv/lpinfo.c
index c52b04292..bb4db5967 100644
--- a/systemv/lpinfo.c
+++ b/systemv/lpinfo.c
@@ -1,10 +1,11 @@
/*
* "lpinfo" command for CUPS.
*
- * Copyright 2007-2017 by Apple Inc.
- * Copyright 1997-2006 by Easy Software Products.
+ * Copyright © 2007-2018 by Apple Inc.
+ * Copyright © 1997-2006 by Easy Software Products.
*
- * Licensed under Apache License v2.0. See the file "LICENSE" for more information.
+ * Licensed under Apache License v2.0. See the file "LICENSE" for more
+ * information.
*/
/*
@@ -32,6 +33,7 @@ static int show_models(int long_status,
const char *make_model, const char *product,
const char *include_schemes,
const char *exclude_schemes);
+static void usage(void) _CUPS_NORETURN;
/*
@@ -76,7 +78,7 @@ main(int argc, /* I - Number of command-line arguments */
else
{
_cupsLangPuts(stderr, _("lpinfo: Expected 1284 device ID string after \"--device-id\"."));
- return (1);
+ usage();
}
}
else if (!strncmp(argv[i], "--device-id=", 12) && argv[i][12])
@@ -92,13 +94,15 @@ main(int argc, /* I - Number of command-line arguments */
else
{
_cupsLangPuts(stderr, _("lpinfo: Expected scheme list after \"--exclude-schemes\"."));
- return (1);
+ usage();
}
}
else if (!strncmp(argv[i], "--exclude-schemes=", 18) && argv[i][18])
{
exclude_schemes = argv[i] + 18;
}
+ else if (!strcmp(argv[i], "--help"))
+ usage();
else if (!strcmp(argv[i], "--include-schemes"))
{
i ++;
@@ -108,7 +112,7 @@ main(int argc, /* I - Number of command-line arguments */
else
{
_cupsLangPuts(stderr, _("lpinfo: Expected scheme list after \"--include-schemes\"."));
- return (1);
+ usage();
}
}
else if (!strncmp(argv[i], "--include-schemes=", 18) && argv[i][18])
@@ -123,7 +127,7 @@ main(int argc, /* I - Number of command-line arguments */
else
{
_cupsLangPuts(stderr, _("lpinfo: Expected language after \"--language\"."));
- return (1);
+ usage();
}
}
else if (!strncmp(argv[i], "--language=", 11) && argv[i][11])
@@ -138,7 +142,7 @@ main(int argc, /* I - Number of command-line arguments */
else
{
_cupsLangPuts(stderr, _("lpinfo: Expected make and model after \"--make-and-model\"."));
- return (1);
+ usage();
}
}
else if (!strncmp(argv[i], "--make-and-model=", 17) && argv[i][17])
@@ -153,7 +157,7 @@ main(int argc, /* I - Number of command-line arguments */
else
{
_cupsLangPuts(stderr, _("lpinfo: Expected product string after \"--product\"."));
- return (1);
+ usage();
}
}
else if (!strncmp(argv[i], "--product=", 10) && argv[i][10])
@@ -168,7 +172,7 @@ main(int argc, /* I - Number of command-line arguments */
else
{
_cupsLangPuts(stderr, _("lpinfo: Expected timeout after \"--timeout\"."));
- return (1);
+ usage();
}
}
else if (!strncmp(argv[i], "--timeout=", 10) && argv[i][10])
@@ -202,7 +206,7 @@ main(int argc, /* I - Number of command-line arguments */
if (i >= argc)
{
_cupsLangPuts(stderr, _("Error: need hostname after \"-h\" option."));
- return (1);
+ usage();
}
cupsSetServer(argv[i]);
@@ -225,14 +229,14 @@ main(int argc, /* I - Number of command-line arguments */
default :
_cupsLangPrintf(stderr, _("%s: Unknown option \"%c\"."), argv[0], *opt);
- return (1);
+ usage();
}
}
}
else
{
_cupsLangPrintf(stderr, _("%s: Unknown argument \"%s\"."), argv[0], argv[i]);
- return (1);
+ usage();
}
}
@@ -464,7 +468,7 @@ show_models(
" natural_language = %s\n"
" make-and-model = %s\n"
" device-id = %s"),
- "everywhere", cupsLangDefault()->language, "IPP Everywhere", "CMD:PwgRaster");
+ "everywhere", cupsLangDefault()->language, "IPP Everywhere™", "CMD:PwgRaster");
}
else
_cupsLangPuts(stdout, "everywhere IPP Everywhere");
@@ -479,3 +483,33 @@ show_models(
return (0);
}
+
+
+/*
+ * 'usage()' - Show program usage and exit.
+ */
+
+static void
+usage(void)
+{
+ _cupsLangPuts(stdout, _("Usage: lpinfo [options] -m\n"
+ " lpinfo [options] -v"));
+ _cupsLangPuts(stdout, _("Options:"));
+ _cupsLangPuts(stdout, _("-E Encrypt the connection to the server"));
+ _cupsLangPuts(stdout, _("-h server[:port] Connect to the named server and port"));
+ _cupsLangPuts(stdout, _("-l Show verbose (long) output"));
+ _cupsLangPuts(stdout, _("-m Show models"));
+ _cupsLangPuts(stdout, _("-U username Specify the username to use for authentication"));
+ _cupsLangPuts(stdout, _("-v Show devices"));
+ _cupsLangPuts(stdout, _("--device-id device-id Show models matching the given IEEE 1284 device ID"));
+ _cupsLangPuts(stdout, _("--exclude-schemes scheme-list\n"
+ " Exclude the specified URI schemes"));
+ _cupsLangPuts(stdout, _("--include-schemes scheme-list\n"
+ " Include only the specified URI schemes"));
+ _cupsLangPuts(stdout, _("--language locale Show models matching the given locale"));
+ _cupsLangPuts(stdout, _("--make-and-model name Show models matching the given make and model name"));
+ _cupsLangPuts(stdout, _("--product name Show models matching the given PostScript product"));
+ _cupsLangPuts(stdout, _("--timeout seconds Specify the maximum number of seconds to discover devices"));
+
+ exit(1);
+}