/
main.c
53 lines (43 loc) · 900 Bytes
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "fastphoto.h"
#include "cgi.h"
#include "resize.h"
static void
usage (void)
{
printf ("FastPhoto " VERSION "\n");
printf ("Usage: fastphoto infile outfile\n");
}
int
main (int argc, char * argv[])
{
int cgi = 0;
fastphoto_t params;
memset (¶ms, 0, sizeof (fastphoto_t));
if (cgi_init(¶ms)) {
cgi = 1;
content_type_jpeg ();
} else {
if (argc < 3) {
usage ();
exit (1);
}
params.infile = argv[1];
params.outfile = argv[2];
params.x = 0;
params.y = 0;
}
resize (¶ms);
if (cgi) {
/*
puts ("Content-Type: text/plain\n\n");
printf ("Infile: %s\n", params.infile);
printf ("Outfile: %s\n", params.outfile);
*/
cgi_send (¶ms);
}
return 0;
}