blob: 84e08a968b814b3b999ba3c4b08bc0007e5f6dbc [file] [log] [blame]
Talustus3019a912013-04-06 11:50:07 +02001/**
2 * fb2png Save screenshot into .png.
3 *
4 * Copyright (C) 2012 Kyan <kyan.ql.he@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20#include <stdio.h>
21#include <limits.h>
22#include <stdlib.h>
23#include "fb2png.h"
24
25#ifdef ANDROID
26 #define DEFAULT_SAVE_PATH "/data/local/fbdump.png"
27#else
28 #define DEFAULT_SAVE_PATH "fbdump.png"
29#endif
30
31int main(int argc, char *argv[])
32{
33 char fn[PATH_MAX];
34 int ret;
35
36 if (argc == 2 && argv[1][0] != '-') {
37 if (strlen(argv[1]) >= PATH_MAX) {
38 printf("Output path is too long!\n");
39 exit(-1);
40 }
41 sprintf(fn, "%s", argv[1]);
42 } else if (argc == 1) {
43 sprintf(fn, "%s", DEFAULT_SAVE_PATH);
44 } else {
45 //if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help"))
46 printf(
47 "Android Screenshooter - fb2png\n"
48 "Author: Kyan He <kyan.ql.he@gmail.com>\n"
49 "Modified by Phil3759 & McKael @xda\n"
50 "Base version 0.0.2 ---> v0.0.5 <2013>\n"
51 "Usage: fb2png [path/to/output.png]\n"
52 " The default output path is /data/local/fbdump.png\n"
53 );
54 exit(0);
55 }
56
57 if (0 == (ret = fb2png(fn)))
58 printf("Saved image to %s\n", fn);
59
60 exit(ret);
61}