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

Function main

cups/testadmin.c:30–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28 */
29
30int /* O - Exit status */
31main(int argc, /* I - Number of command-line args */
32 char *argv[]) /* I - Command-line arguments */
33{
34 int i, /* Looping var */
35 num_settings; /* Number of settings */
36 cups_option_t *settings; /* Settings */
37 http_t *http; /* Connection to server */
38
39
40 /*
41 * Connect to the server using the defaults...
42 */
43
44 http = httpConnect2(cupsServer(), ippPort(), NULL, AF_UNSPEC,
45 cupsEncryption(), 1, 30000, NULL);
46
47 /*
48 * Set the current configuration if we have anything on the command-line...
49 */
50
51 if (argc > 1)
52 {
53 for (i = 1, num_settings = 0, settings = NULL; i < argc; i ++)
54 num_settings = cupsParseOptions(argv[i], num_settings, &settings);
55
56 if (cupsAdminSetServerSettings(http, num_settings, settings))
57 {
58 puts("New server settings:");
59 cupsFreeOptions(num_settings, settings);
60 }
61 else
62 {
63 printf("Server settings not changed: %s\n", cupsLastErrorString());
64 return (1);
65 }
66 }
67 else
68 puts("Current server settings:");
69
70 /*
71 * Get the current configuration...
72 */
73
74 if (cupsAdminGetServerSettings(http, &num_settings, &settings))
75 {
76 show_settings(num_settings, settings);
77 cupsFreeOptions(num_settings, settings);
78 return (0);
79 }
80 else
81 {
82 printf(" %s\n", cupsLastErrorString());
83 return (1);
84 }
85}
86
87

Callers

nothing calls this directly

Calls 10

httpConnect2Function · 0.85
cupsServerFunction · 0.85
ippPortFunction · 0.85
cupsEncryptionFunction · 0.85
cupsParseOptionsFunction · 0.85
cupsFreeOptionsFunction · 0.85
cupsLastErrorStringFunction · 0.85
show_settingsFunction · 0.85

Tested by

no test coverage detected