~ubuntu-branches/ubuntu/raring/libcaca/raring

« back to all changes in this revision

Viewing changes to toilet-0.1/src/export.c

  • Committer: Bazaar Package Importer
  • Author(s): Sam Hocevar (Debian packages)
  • Date: 2007-10-13 20:10:44 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20071013201044-35yldy9w3xe7iy2j
Tags: 0.99.beta12.debian-3
* debian/control:
  + Build-depend on texlive instead of all the other texlive-* packages so
    that we have the proper fonts at build time (Closes: #445797).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *  TOIlet        The Other Implementation’s letters
3
 
 *  Copyright (c) 2006 Sam Hocevar <sam@zoy.org>
4
 
 *                All Rights Reserved
5
 
 *
6
 
 *  $Id: export.c 72 2006-11-10 07:56:55Z 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
 
/*
15
 
 * This file contains export functions.
16
 
 */
17
 
 
18
 
#include "config.h"
19
 
 
20
 
#if defined(HAVE_INTTYPES_H)
21
 
#   include <inttypes.h>
22
 
#endif
23
 
#include <string.h>
24
 
#include <stdio.h>
25
 
#include <stdlib.h>
26
 
#include <cucul.h>
27
 
 
28
 
#include "toilet.h"
29
 
#include "export.h"
30
 
 
31
 
int export_list(void)
32
 
{
33
 
    char const * const * exports, * const * p;
34
 
 
35
 
    printf("Available export formats:\n");
36
 
 
37
 
    exports = cucul_get_export_list();
38
 
    for(p = exports; *p; p += 2)
39
 
        printf("\"%s\": %s\n", *p, *(p + 1));
40
 
 
41
 
    return 0;
42
 
}
43
 
 
44
 
int export_set(context_t *cx, char const *format)
45
 
{
46
 
    char const * const * exports, * const * p;
47
 
 
48
 
    cx->export = format;
49
 
 
50
 
    exports = cucul_get_export_list();
51
 
    for(p = exports; *p; p += 2)
52
 
        if(!strcmp(*p, format))
53
 
            return 0;
54
 
 
55
 
    fprintf(stderr, "unknown export format `%s'\n", format);
56
 
    return -1;
57
 
}
58