source: libcaca/trunk/test/import.c @ 1308

Last change on this file since 1308 was 1308, checked in by Sam Hocevar, 14 years ago
  • Convert all programs and tests to the new import/export API.
  • Property svn:keywords set to Id
File size: 1.3 KB
Line 
1/*
2 *  import        libcaca importers test program
3 *  Copyright (c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org>
4 *                All Rights Reserved
5 *
6 *  $Id: import.c 1308 2006-11-08 17:26:57Z sam $
7 *
8 *  This program is free software; you can redistribute it and/or
9 *  modify it under the terms of the Do What The Fuck You Want To
10 *  Public License, Version 2, as published by Sam Hocevar. See
11 *  http://sam.zoy.org/wtfpl/COPYING for more details.
12 */
13
14#include "config.h"
15#include "common.h"
16
17
18#if !defined(__KERNEL__)
19#   if defined(HAVE_INTTYPES_H)
20#      include <inttypes.h>
21#   endif
22#   include <stdio.h>
23#   include <stdlib.h>
24#endif
25
26
27#include "cucul.h"
28#include "caca.h"
29
30int main(int argc, char *argv[])
31{
32    cucul_canvas_t *cv;
33    caca_display_t *dp;
34
35    if(argc < 2)
36    {
37        fprintf(stderr, "%s: missing argument (filename).\n", argv[0]);
38        fprintf(stderr, "usage: %s <filename> [<format>]\n", argv[0]);
39        return 1;
40    }
41
42    cv = cucul_create_canvas(0, 0);
43    if(cucul_import_file(cv, argv[1], argc >= 3 ? argv[2] : "") < 0)
44    {
45        fprintf(stderr, "%s: could not open `%s'.\n", argv[0], argv[1]);
46        cucul_free_canvas(cv);
47        return 1;
48    }
49
50    dp = caca_create_display(cv);
51
52    caca_refresh_display(dp);
53
54    caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1);
55
56    caca_free_display(dp);
57    cucul_free_canvas(cv);
58
59    return 0;
60}
61
Note: See TracBrowser for help on using the repository browser.