]> git.ipfire.org Git - thirdparty/cups.git/blob - cgi-bin/testcgi.c
Full sweep of all Clang warnings, plus some bug fixes for incorrect memcpy usage.
[thirdparty/cups.git] / cgi-bin / testcgi.c
1 /*
2 * "$Id$"
3 *
4 * CGI test program for CUPS.
5 *
6 * Copyright 2007-2014 by Apple Inc.
7 * Copyright 1997-2005 by Easy Software Products.
8 *
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/".
14 */
15
16 /*
17 * Include necessary headers...
18 */
19
20 #include "cgi.h"
21
22
23 /*
24 * 'main()' - Test the CGI code.
25 */
26
27 int /* O - Exit status */
28 main(void)
29 {
30 /*
31 * Test file upload/multi-part submissions...
32 */
33
34 freopen("multipart.dat", "rb", stdin);
35
36 putenv("CONTENT_TYPE=multipart/form-data; "
37 "boundary=---------------------------1977426492562745908748943111");
38 putenv("REQUEST_METHOD=POST");
39
40 printf("cgiInitialize: ");
41 if (cgiInitialize())
42 {
43 const cgi_file_t *file; /* Upload file */
44
45 if ((file = cgiGetFile()) != NULL)
46 {
47 puts("PASS");
48 printf(" tempfile=\"%s\"\n", file->tempfile);
49 printf(" name=\"%s\"\n", file->name);
50 printf(" filename=\"%s\"\n", file->filename);
51 printf(" mimetype=\"%s\"\n", file->mimetype);
52 }
53 else
54 puts("FAIL (no file!)");
55 }
56 else
57 puts("FAIL (init)");
58
59 /*
60 * Return with no errors...
61 */
62
63 return (0);
64 }
65
66
67 /*
68 * End of "$Id$".
69 */