/* * This file is part of uIRC. (https://git.redxen.eu/caskd/uIRC) * Copyright (c) 2019-2021 Alex-David Denes * * uIRC is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * uIRC is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with uIRC. If not, see . */ #include "common.h" // expect() print_irc_message() #include "uirc.h" // uirc_* IRC_* #include // fprintf() #include // EXIT_* #include // strcmp() #define TRAILING "random stuff here" int main(void) { const char* str = "NOTICE 0 1 2 3 4 5 6 7 8 9 10 11 12 13 " TRAILING "\r\n"; IRC_Message* m = NULL; if ((m = uirc_tokenizer_message(str)) == NULL) { fprintf(stderr, "Failed to convert string to IRC_Message struct.\n"); return EXIT_FAILURE; } if (strcmp(m->args[IRC_MAXARGS - 1], TRAILING) != 0) { fprintf(stderr, "Trailing was parsed incorrectly, got %s instead of %s\n", m->args[IRC_MAXARGS - 1], TRAILING); return EXIT_FAILURE; } uirc_struct_free(m, IRC_STRUCT_MESSAGE); free(m); return EXIT_SUCCESS; }