No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 
 
 

71 líneas
1.5 KiB

  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(__KERNEL__)
  16. # if defined(HAVE_INTTYPES_H)
  17. # include <inttypes.h>
  18. # endif
  19. # include <stdio.h>
  20. # include <stdlib.h>
  21. #endif
  22. #include "cucul.h"
  23. #include "caca.h"
  24. int main(int argc, char *argv[])
  25. {
  26. cucul_canvas_t *cv;
  27. cucul_buffer_t *b;
  28. caca_display_t *dp;
  29. if(argc < 2)
  30. {
  31. fprintf(stderr, "%s: missing argument (filename).\n", argv[0]);
  32. fprintf(stderr, "usage: %s <filename> [<format>]\n", argv[0]);
  33. return 1;
  34. }
  35. b = cucul_load_file(argv[1]);
  36. if(!b)
  37. {
  38. fprintf(stderr, "%s: could not open `%s'.\n", argv[0], argv[1]);
  39. return 1;
  40. }
  41. cv = cucul_import_canvas(b, argc >= 3 ? argv[2] : "");
  42. if(!cv)
  43. {
  44. fprintf(stderr, "%s: could not import `%s'.\n", argv[0], argv[1]);
  45. return 1;
  46. }
  47. cucul_free_buffer(b);
  48. dp = caca_create_display(cv);
  49. caca_refresh_display(dp);
  50. caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1);
  51. caca_free_display(dp);
  52. cucul_free_canvas(cv);
  53. return 0;
  54. }