/*
* "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.
*/
/*
const char *make_model, const char *product,
const char *include_schemes,
const char *exclude_schemes);
+static void usage(void) _CUPS_NORETURN;
/*
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])
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 ++;
else
{
_cupsLangPuts(stderr, _("lpinfo: Expected scheme list after \"--include-schemes\"."));
- return (1);
+ usage();
}
}
else if (!strncmp(argv[i], "--include-schemes=", 18) && argv[i][18])
else
{
_cupsLangPuts(stderr, _("lpinfo: Expected language after \"--language\"."));
- return (1);
+ usage();
}
}
else if (!strncmp(argv[i], "--language=", 11) && argv[i][11])
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])
else
{
_cupsLangPuts(stderr, _("lpinfo: Expected product string after \"--product\"."));
- return (1);
+ usage();
}
}
else if (!strncmp(argv[i], "--product=", 10) && argv[i][10])
else
{
_cupsLangPuts(stderr, _("lpinfo: Expected timeout after \"--timeout\"."));
- return (1);
+ usage();
}
}
else if (!strncmp(argv[i], "--timeout=", 10) && argv[i][10])
if (i >= argc)
{
_cupsLangPuts(stderr, _("Error: need hostname after \"-h\" option."));
- return (1);
+ usage();
}
cupsSetServer(argv[i]);
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();
}
}
" 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");
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);
+}