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 54 55 56 57 58 59 60 61
|
/*
* import libcaca importers test program
* Copyright (c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org>
* All Rights Reserved
*
* $Id: import.c 1000 2006-11-08 17:26:57Z sam $
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the Do What The Fuck You Want To
* Public License, Version 2, as published by Sam Hocevar. See
* http://sam.zoy.org/wtfpl/COPYING for more details.
*/
#include "config.h"
#include "common.h"
#if !defined(__KERNEL__)
# if defined(HAVE_INTTYPES_H)
# include <inttypes.h>
# endif
# include <stdio.h>
# include <stdlib.h>
#endif
#include "cucul.h"
#include "caca.h"
int main(int argc, char *argv[])
{
cucul_canvas_t *cv;
caca_display_t *dp;
if(argc < 2)
{
fprintf(stderr, "%s: missing argument (filename).\n", argv[0]);
fprintf(stderr, "usage: %s <filename> [<format>]\n", argv[0]);
return 1;
}
cv = cucul_create_canvas(0, 0);
if(cucul_import_file(cv, argv[1], argc >= 3 ? argv[2] : "") < 0)
{
fprintf(stderr, "%s: could not open `%s'.\n", argv[0], argv[1]);
cucul_free_canvas(cv);
return 1;
}
dp = caca_create_display(cv);
caca_refresh_display(dp);
caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1);
caca_free_display(dp);
cucul_free_canvas(cv);
return 0;
}
|