]>
git.ipfire.org Git - thirdparty/cups.git/blob - cgi-bin/testtemplate.c
2 * CGI template test program for CUPS.
4 * Copyright 2007-2011 by Apple Inc.
5 * Copyright 2006 by Easy Software Products.
7 * These coded instructions, statements, and computer programs are the
8 * property of Apple Inc. and are protected by Federal copyright
9 * law. Distribution and use rights are outlined in the file "LICENSE.txt"
10 * which should have been included with this file. If this file is
11 * missing or damaged, see the license at "http://www.cups.org/".
15 * Include necessary headers...
22 * 'main()' - Test the template code.
25 int /* O - Exit status */
26 main(int argc
, /* I - Number of command-line arguments */
27 char *argv
[]) /* I - Command-line arguments */
29 int i
; /* Looping var */
30 char *value
; /* Value in name=value */
31 FILE *out
; /* Where to send output */
35 * Don't buffer stdout or stderr so that the mixed output is sane...
42 * Loop through the command-line, assigning variables for any args with
48 for (i
= 1; i
< argc
; i
++)
50 if (!strcmp(argv
[i
], "-o"))
55 out
= fopen(argv
[i
], "w");
63 else if (!strcmp(argv
[i
], "-e"))
69 if (!freopen(argv
[i
], "w", stderr
))
76 else if (!strcmp(argv
[i
], "-q"))
77 freopen("/dev/null", "w", stderr
);
78 else if ((value
= strchr(argv
[i
], '=')) != NULL
)
81 cgiSetVariable(argv
[i
], value
);
84 cgiCopyTemplateFile(out
, argv
[i
]);
88 * Return with no errors...