| 28 | */ |
| 29 | |
| 30 | int /* O - Exit status */ |
| 31 | main(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 |
nothing calls this directly
no test coverage detected