/* _____ _ __ ___ _ |_ _|__| | __\ \ / (_)___(_) ___ _ __ | |/ _ \ |/ _ \ \ / /| / __| |/ _ \| '_ \ | | __/ | __/\ V / | \__ \ | (_) | | | | |_|\___|_|\___| \_/ |_|___/_|\___/|_| |_| */ #include #include #include #include "tga_outils.h" /*::------------------------------------------------------------------::*/ /*::------------------------------------------------------------------::*/ #define TV_GRINK 2 #define TV_GROK 4 #define TV_GRUUD 6 #define TV_GRIIIZ 8 #define TV_PIX0 10 #define TV_PIX1 11 #define TV_MINITEL 12 #define TV_OLD 20 #define TV_HISTORY 21 /* wtf ? */ #define TV_TRILIGNE 22 #define TV_PROTO 30 mot_clef mots_clef[] = { { "grink", TV_GRINK, "i", "colors are bipolars" }, { "grok", TV_GROK, "i", "..." }, { "gruud", TV_GRUUD, "i", "..." }, { "griiiz", TV_GRIIIZ, "i", "parameter must be 0" }, { "oldstyle", TV_OLD, "iii", "..." }, { "pix0", TV_PIX0, "iii", "func not finished" }, { "pix1", TV_PIX1, "iii", "func not finished" }, { "triligne", TV_TRILIGNE, "f", "flag : rand or modulo" }, { "cplus0", TV_PROTO, "i", "premier cplus" }, { "proto", TV_PROTO, "i", "prototype canal+" } }; /*::------------------------------------------------------------------::*/ void usage(int flag) { fprintf(stderr, "* tga_television v 0.0.24 [%s] %s\n", TGA_OUTILS_VERSION, TGA_OUTILS_COPYLEFT); fprintf(stderr, " compiled %s at %s\n", __DATE__, __TIME__); fprintf(stderr, "Usage:\n\ttga_television method [params]\n"); Image_print_version(0); if (flag) { liste_mots_clefs(mots_clef, 42); } exit(5); } /*::------------------------------------------------------------------::*/ int main(int argc, char *argv[]) { Image_Desc *src, *dst; int foo, mode; int par[NB_PARAMS], nb_int_par, value; int commande, nbargs; dump_command_line(argc, argv, 0); if (argc==2 && !strcmp(argv[1], "-?")) usage(0); if (argc==2 && !strcmp(argv[1], "list")) usage(1); if (argc < 4) usage(0); srand(getpid()); if ( (src=Image_TGA_alloc_load(argv[1])) == NULL ) { fprintf(stderr, "can't load image file '%s'\n", argv[1]); exit(1); } if ( (dst=Image_clone(src, 0))==NULL ) { fprintf(stderr, "can't clone %p, exiting...\n", src); exit(2); } /* * rechercher le mot clef dans la table */ mode = cherche_mot_clef(argv[2], mots_clef, &commande, &nbargs); if (mode < 0) { fprintf(stderr, "%s : mot-clef %s inconnu\n", argv[0], argv[2]); exit(5); } /* * decoder les arguments */ for (foo=0; foo