]>
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 * Licensed under Apache License v2.0. See the file "LICENSE" for more information.
11 * Include necessary headers...
18 * 'main()' - Test the template code.
21 int /* O - Exit status */
22 main(int argc
, /* I - Number of command-line arguments */
23 char *argv
[]) /* I - Command-line arguments */
25 int i
; /* Looping var */
26 char *value
; /* Value in name=value */
27 FILE *out
; /* Where to send output */
31 * Don't buffer stdout or stderr so that the mixed output is sane...
38 * Loop through the command-line, assigning variables for any args with
44 for (i
= 1; i
< argc
; i
++)
46 if (!strcmp(argv
[i
], "-o"))
51 out
= fopen(argv
[i
], "w");
59 else if (!strcmp(argv
[i
], "-e"))
65 if (!freopen(argv
[i
], "w", stderr
))
72 else if (!strcmp(argv
[i
], "-q"))
73 freopen("/dev/null", "w", stderr
);
74 else if ((value
= strchr(argv
[i
], '=')) != NULL
)
77 cgiSetVariable(argv
[i
], value
);
80 cgiCopyTemplateFile(out
, argv
[i
]);
84 * Return with no errors...