int main(int argc, char *argv[])
{
    char fn[128];

    if (argc == 2) {
        //if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")) {
        if (argv[1][0] == '-') {
            printf(
                "Usage: fb2png [path/to/output.png]\n"
                "    The default output path is /data/local/fbdump.png\n"
                );
            exit(0);
        } else {
            sprintf(fn, "%s", argv[1]);
        }
    } else {
        sprintf(fn, "%s", DEFAULT_SAVE_PATH);
    }

    fb2png(fn);

    printf("Saved to %s\n", fn);

    exit(0);
}
int main(int argc, char *argv[])
{
    char fn[PATH_MAX];
    int ret;

    if (argc == 2 && argv[1][0] != '-') {
        if (strlen(argv[1]) >= PATH_MAX) {
            printf("Output path is too long!\n");
            exit(-1);
        }
        sprintf(fn, "%s", argv[1]);
    } else if (argc == 1) {
        sprintf(fn, "%s", DEFAULT_SAVE_PATH);
    } else {
        //if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help"))
        printf(
            "Android Screenshooter - fb2png\n"
            "Author: Kyan He <*****@*****.**>\n"
            "Modified by  Phil3759 & McKael @xda\n"
            "Base version 0.0.2 ---> v0.0.5  <2013>\n"
            "Usage: fb2png [path/to/output.png]\n"
            "    The default output path is /data/local/fbdump.png\n"
        );
        exit(0);
    }

    if (0 == (ret = fb2png(fn)))
        printf("Saved image to %s\n", fn);

    exit(ret);
}
int main(int argc, char *argv[])
{
    char fn[128];

    if (argc == 2) {
        if (argv[1][0] == '-') {
            printf("Usage: adb_screenshoot [path/to/output.png]\n"
                   "The default output path is %s\n", DEFAULT_SAVE_PATH);
            exit(0);
        } else {
            sprintf(fn, "%s", argv[1]);
        }
    } else {
        printf("Could not parse command line; using default path %s\n",
               DEFAULT_SAVE_PATH);
        sprintf(fn, "%s", DEFAULT_SAVE_PATH);
    }

    return fb2png(fn);
}
Esempio n. 4
0
int main(int argc, char **argv)
{
    char *path = NULL;
    int ret = 0;
    int i = 1;

    while (i < argc && path == NULL) {
        ret = parse_options(argv[i]);
        if (ret == 0)
            path = argv[i];
        else if (ret < 0)
            return print_usage();
        ++i;
    }

    // all options must come before path
    if (i != argc)
        return print_usage();

    if (path == NULL)
        path = DEFAULT_SAVE_PATH;

    if (strlen(path) >= PATH_MAX) {
        printf("Output path too long!\n");
        return -1;
    }

    print_version();
    printf("%s -buffer=%d%s %s\n",
            argv[0],
            user_set_buffers_num,
            user_set_buffers_num < 0 ? " (auto)" : "",
            path
    );

    ret = fb2png(path);
    if (!ret)
        printf("Image saved to %s\n", path);

    return ret;
}