You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * import libcaca importers test program
  3. * Copyright (c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org>
  4. * All Rights Reserved
  5. *
  6. * $Id$
  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. #include "config.h"
  14. #include "common.h"
  15. #if defined(HAVE_INTTYPES_H)
  16. # include <inttypes.h>
  17. #endif
  18. #include <stdio.h>
  19. #include <stdlib.h>
  20. #include "cucul.h"
  21. #include "caca.h"
  22. int main(int argc, char *argv[])
  23. {
  24. cucul_canvas_t *cv;
  25. cucul_buffer_t *b;
  26. caca_display_t *dp;
  27. if(argc < 2)
  28. {
  29. fprintf(stderr, "%s: missing argument (filename).\n", argv[0]);
  30. return 1;
  31. }
  32. b = cucul_load_file(argv[1]);
  33. if(!b)
  34. {
  35. fprintf(stderr, "%s: could not open `%s'.\n", argv[0], argv[1]);
  36. return 1;
  37. }
  38. cv = cucul_import_canvas(b, "");
  39. if(!cv)
  40. {
  41. fprintf(stderr, "%s: could not import `%s'.\n", argv[0], argv[1]);
  42. return 1;
  43. }
  44. cucul_free_buffer(b);
  45. dp = caca_create_display(cv);
  46. caca_refresh_display(dp);
  47. caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1);
  48. caca_free_display(dp);
  49. cucul_free_canvas(cv);
  50. return 0;
  51. }