Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

import.c 1.3 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. caca_display_t *dp;
  28. if(argc < 2)
  29. {
  30. fprintf(stderr, "%s: missing argument (filename).\n", argv[0]);
  31. fprintf(stderr, "usage: %s <filename> [<format>]\n", argv[0]);
  32. return 1;
  33. }
  34. cv = cucul_create_canvas(0, 0);
  35. if(cucul_import_file(cv, argv[1], argc >= 3 ? argv[2] : "") < 0)
  36. {
  37. fprintf(stderr, "%s: could not open `%s'.\n", argv[0], argv[1]);
  38. cucul_free_canvas(cv);
  39. return 1;
  40. }
  41. dp = caca_create_display(cv);
  42. caca_refresh_display(dp);
  43. caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1);
  44. caca_free_display(dp);
  45. cucul_free_canvas(cv);
  46. return 0;
  47. }