MCPcopy Create free account
hub / github.com/OpenPrinting/cups / main

Function main

berkeley/lpc.c:33–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31 */
32
33int
34main(int argc, /* I - Number of command-line arguments */
35 char *argv[]) /* I - Command-line arguments */
36{
37 http_t *http; /* Connection to server */
38 char line[1024], /* Input line from user */
39 *params; /* Pointer to parameters */
40
41
42 _cupsSetLocale(argv);
43
44 /*
45 * Connect to the scheduler...
46 */
47
48 http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
49
50 if (argc > 1)
51 {
52 /*
53 * Process a single command on the command-line...
54 */
55
56 do_command(http, argv[1], argv[2]);
57 }
58 else
59 {
60 /*
61 * Do the command prompt thing...
62 */
63
64 show_prompt(_("lpc> "));
65 while (fgets(line, sizeof(line), stdin) != NULL)
66 {
67 /*
68 * Strip trailing whitespace...
69 */
70
71 for (params = line + strlen(line) - 1; params >= line;)
72 if (!isspace(*params & 255))
73 break;
74 else
75 *params-- = '\0';
76
77 /*
78 * Strip leading whitespace...
79 */
80
81 for (params = line; isspace(*params & 255); params ++);
82
83 if (params > line)
84 _cups_strcpy(line, params);
85
86 if (!line[0])
87 {
88 /*
89 * Nothing left, just show a prompt...
90 */

Callers

nothing calls this directly

Calls 10

_cupsSetLocaleFunction · 0.85
httpConnectEncryptFunction · 0.85
cupsServerFunction · 0.85
ippPortFunction · 0.85
cupsEncryptionFunction · 0.85
show_promptFunction · 0.85
_cups_strcpyFunction · 0.85
compare_stringsFunction · 0.85
httpCloseFunction · 0.85
do_commandFunction · 0.70

Tested by

no test coverage detected