int main(int argc, char * argv[]){ riff_result_t res; int argi = 1; VEC_INIT(skipv); VEC_INIT(readv); VEC_INIT(stopv); while(argc > argi) { if(0 == strcmp(argv[argi], "-h") || 0 == strcmp(argv[argi], "--help")) { printf( "USAGE: %s [FLAGS]\n" "Reads RIFF file from standard input\n" "FLAGS:\n" " -h (--help) Print this message\n" " -s (--skip) fourcc Skip chunk with this fourcc\n" " -r (--read) fourcc Read chunk with this fourcc\n" " -p (--stop) fourcc Stop on chunk with this fourcc\n" , argv[0]); return 0; } else if(0 == strcmp(argv[argi], "-s") || 0 == strcmp(argv[argi], "--skip")) { argi++; VEC_PUSH(skipv, FOURCC(argv[argi])); argi++; } else if(0 == strcmp(argv[argi], "-r") || 0 == strcmp(argv[argi], "--read")) { argi++; VEC_PUSH(readv, FOURCC(argv[argi])); argi++; } else if(0 == strcmp(argv[argi], "-p") || 0 == strcmp(argv[argi], "--stop")) { argi++; VEC_PUSH(stopv, FOURCC(argv[argi])); argi++; } } res = riff_readfile(stdin, chunk_cb, err_cb, NULL); printf("%d\n", res); return 0; }
void irc_chan_join(struct bot *bot, struct message *msg) { char *strptr; char *arg = strdup(msg->arg); char *host = strdup(msg->host); char *nick = strtok_r(arg, " ", &strptr); char *chan = strtok_r(NULL, " ", &strptr); VEC_PUSH(bot->channels, strdup(chan)); printf("[irc\tinfo] joined channel %s\n", chan); free(arg); free(host); }