您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

58 行
1.3 KiB

  1. /*
  2. * TOIlet The Other Implementation’s letters
  3. * Copyright (c) 2006 Sam Hocevar <sam@hocevar.net>
  4. * All Rights Reserved
  5. *
  6. * This program is free software. It comes without any warranty, to
  7. * the extent permitted by applicable law. You can redistribute it
  8. * and/or modify it under the terms of the Do What The Fuck You Want
  9. * To Public License, Version 2, as published by Sam Hocevar. See
  10. * http://sam.zoy.org/wtfpl/COPYING for more details.
  11. */
  12. /*
  13. * This file contains export functions.
  14. */
  15. #include "config.h"
  16. #if defined(HAVE_INTTYPES_H)
  17. # include <inttypes.h>
  18. #endif
  19. #include <string.h>
  20. #include <stdio.h>
  21. #include <stdlib.h>
  22. #include <caca.h>
  23. #include "toilet.h"
  24. #include "export.h"
  25. int export_list(void)
  26. {
  27. char const * const * exports, * const * p;
  28. printf("Available export formats:\n");
  29. exports = caca_get_export_list();
  30. for(p = exports; *p; p += 2)
  31. printf("\"%s\": %s\n", *p, *(p + 1));
  32. return 0;
  33. }
  34. int export_set(context_t *cx, char const *format)
  35. {
  36. char const * const * exports, * const * p;
  37. cx->export = format;
  38. exports = caca_get_export_list();
  39. for(p = exports; *p; p += 2)
  40. if(!strcmp(*p, format))
  41. return 0;
  42. fprintf(stderr, "unknown export format `%s'\n", format);
  43. return -1;
  44. }