Changeset 1321 for toilet


Ignore:
Timestamp:
Nov 10, 2006, 8:56:55 AM (13 years ago)
Author:
Sam Hocevar
Message:
  • Moved export stuff in export.c.
  • Bail out with an error if the requested export format is unsupported.
Location:
toilet/trunk/src
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • toilet/trunk/src/Makefile.am

    r1293 r1321  
    66        render.c render.h \
    77        filter.c filter.h \
     8        export.c export.h \
    89        term.c figlet.c
    910toilet_CFLAGS = `pkg-config --cflags cucul`
  • toilet/trunk/src/main.c

    r1319 r1321  
    3535#include "render.h"
    3636#include "filter.h"
     37#include "export.h"
    3738
    3839static void version(void);
     
    4041static void usage(void);
    4142#endif
    42 static int export_list(void);
    4343
    4444int main(int argc, char *argv[])
     
    139139            if(!strcmp(optarg, "list"))
    140140                return export_list();
    141             cx->export = optarg;
     141            if(export_set(cx, optarg) < 0)
     142                return -1;
    142143            break;
    143144        case 140: /* --irc */
    144             cx->export = "irc";
     145            export_set(cx, "irc");
    145146            break;
    146147        case 141: /* --html */
    147             cx->export = "html";
     148            export_set(cx, "html");
    148149            break;
    149150        case '?':
     
    261262#endif
    262263
    263 static int export_list(void)
    264 {
    265     char const * const * exports, * const * p;
    266 
    267     exports = cucul_get_export_list();
    268 
    269     printf("Available export formats:\n");
    270     for(p = exports; *p; p += 2)
    271         printf("\"%s\": %s\n", *p, *(p + 1));
    272 
    273     return 0;
    274 }
    275 
Note: See TracChangeset for help on using the changeset viewer.