]>
git.ipfire.org Git - thirdparty/cups.git/blob - cups/testadmin.c
2 * "$Id: testadmin.c 5240 2006-03-07 21:55:29Z mike $"
4 * Admin function test program for the Common UNIX Printing System (CUPS).
6 * Copyright 2006 by Easy Software Products.
8 * These coded instructions, statements, and computer programs are the
9 * property of Easy Software Products and are protected by Federal
10 * copyright law. Distribution and use rights are outlined in the file
11 * "LICENSE.txt" which should have been included with this file. If this
12 * file is missing or damaged please contact Easy Software Products
15 * Attn: CUPS Licensing Information
16 * Easy Software Products
17 * 44141 Airport View Drive, Suite 204
18 * Hollywood, Maryland 20636 USA
20 * Voice: (301) 373-9600
21 * EMail: cups-info@cups.org
22 * WWW: http://www.cups.org
24 * This file is subject to the Apple OS-Developed Software exception.
28 * main() - Main entry.
29 * show_settings() - Show settings in the array...
33 * Include necessary headers...
36 #include "adminutil.h"
44 static void show_settings(int num_settings
, cups_option_t
*settings
);
48 * 'main()' - Main entry.
51 int /* O - Exit status */
52 main(int argc
, /* I - Number of command-line args */
53 char *argv
[]) /* I - Command-line arguments */
55 int i
, /* Looping var */
56 num_settings
; /* Number of settings */
57 cups_option_t
*settings
; /* Settings */
58 http_t
*http
; /* Connection to server */
62 * Connect to the server using the defaults...
65 http
= httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
68 * Set the current configuration if we have anything on the command-line...
73 for (i
= 1, num_settings
= 0; i
< argc
; i
++)
74 num_settings
= cupsParseOptions(argv
[i
], num_settings
, &settings
);
76 if (_cupsAdminSetServerSettings(http
, num_settings
, settings
))
78 puts("New server settings:");
79 cupsFreeOptions(num_settings
, settings
);
83 printf("Server settings not changed: %s\n", cupsLastErrorString());
88 puts("Current server settings:");
91 * Get the current configuration...
94 if (_cupsAdminGetServerSettings(http
, &num_settings
, &settings
))
96 show_settings(num_settings
, settings
);
97 cupsFreeOptions(num_settings
, settings
);
102 printf(" %s\n", cupsLastErrorString());
109 * 'show_settings()' - Show settings in the array...
114 int num_settings
, /* I - Number of settings */
115 cups_option_t
*settings
) /* I - Settings */
117 while (num_settings
> 0)
119 printf(" %s=%s\n", settings
->name
, settings
->value
);
128 * End of "$Id: testadmin.c 5240 2006-03-07 21:55:29Z mike $".