]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | /* |
7e86f2f6 | 2 | * CGI test program for CUPS. |
ef416fc2 | 3 | * |
7e86f2f6 MS |
4 | * Copyright 2007-2014 by Apple Inc. |
5 | * Copyright 1997-2005 by Easy Software Products. | |
ef416fc2 | 6 | * |
7e86f2f6 MS |
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 | * file is missing or damaged, see the license at "http://www.cups.org/". | |
ef416fc2 | 12 | */ |
13 | ||
14 | /* | |
15 | * Include necessary headers... | |
16 | */ | |
17 | ||
18 | #include "cgi.h" | |
19 | ||
20 | ||
21 | /* | |
22 | * 'main()' - Test the CGI code. | |
23 | */ | |
24 | ||
25 | int /* O - Exit status */ | |
7e86f2f6 | 26 | main(void) |
ef416fc2 | 27 | { |
28 | /* | |
29 | * Test file upload/multi-part submissions... | |
30 | */ | |
31 | ||
32 | freopen("multipart.dat", "rb", stdin); | |
33 | ||
34 | putenv("CONTENT_TYPE=multipart/form-data; " | |
35 | "boundary=---------------------------1977426492562745908748943111"); | |
36 | putenv("REQUEST_METHOD=POST"); | |
37 | ||
38 | printf("cgiInitialize: "); | |
39 | if (cgiInitialize()) | |
40 | { | |
41 | const cgi_file_t *file; /* Upload file */ | |
42 | ||
43 | if ((file = cgiGetFile()) != NULL) | |
44 | { | |
45 | puts("PASS"); | |
46 | printf(" tempfile=\"%s\"\n", file->tempfile); | |
47 | printf(" name=\"%s\"\n", file->name); | |
48 | printf(" filename=\"%s\"\n", file->filename); | |
49 | printf(" mimetype=\"%s\"\n", file->mimetype); | |
50 | } | |
51 | else | |
52 | puts("FAIL (no file!)"); | |
53 | } | |
54 | else | |
55 | puts("FAIL (init)"); | |
321d8d57 | 56 | |
ef416fc2 | 57 | /* |
58 | * Return with no errors... | |
59 | */ | |
60 | ||
61 | return (0); | |
62 | } |