]>
git.ipfire.org Git - thirdparty/cups.git/blob - cups/testadmin.c
2 * "$Id: testadmin.c 7720 2008-07-11 22:46:21Z mike $"
4 * Admin function test program for CUPS.
6 * Copyright 2007-2010 by Apple Inc.
7 * Copyright 2006 by Easy Software Products.
9 * These coded instructions, statements, and computer programs are the
10 * property of Apple Inc. and are protected by Federal copyright
11 * law. Distribution and use rights are outlined in the file "LICENSE.txt"
12 * which should have been included with this file. If this file is
13 * file is missing or damaged, see the license at "http://www.cups.org/".
15 * This file is subject to the Apple OS-Developed Software exception.
19 * main() - Main entry.
20 * show_settings() - Show settings in the array...
24 * Include necessary headers...
27 #include "adminutil.h"
28 #include "string-private.h"
35 static void show_settings(int num_settings
, cups_option_t
*settings
);
39 * 'main()' - Main entry.
42 int /* O - Exit status */
43 main(int argc
, /* I - Number of command-line args */
44 char *argv
[]) /* I - Command-line arguments */
46 int i
, /* Looping var */
47 num_settings
; /* Number of settings */
48 cups_option_t
*settings
; /* Settings */
49 http_t
*http
; /* Connection to server */
53 * Connect to the server using the defaults...
56 http
= httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
59 * Set the current configuration if we have anything on the command-line...
64 for (i
= 1, num_settings
= 0, settings
= NULL
; i
< argc
; i
++)
65 num_settings
= cupsParseOptions(argv
[i
], num_settings
, &settings
);
67 if (cupsAdminSetServerSettings(http
, num_settings
, settings
))
69 puts("New server settings:");
70 cupsFreeOptions(num_settings
, settings
);
74 printf("Server settings not changed: %s\n", cupsLastErrorString());
79 puts("Current server settings:");
82 * Get the current configuration...
85 if (cupsAdminGetServerSettings(http
, &num_settings
, &settings
))
87 show_settings(num_settings
, settings
);
88 cupsFreeOptions(num_settings
, settings
);
93 printf(" %s\n", cupsLastErrorString());
100 * 'show_settings()' - Show settings in the array...
105 int num_settings
, /* I - Number of settings */
106 cups_option_t
*settings
) /* I - Settings */
108 while (num_settings
> 0)
110 printf(" %s=%s\n", settings
->name
, settings
->value
);
119 * End of "$Id: testadmin.c 7720 2008-07-11 22:46:21Z mike $".