💾 Archived View for gemini.thededem.de › lc19 › src › src › url.c captured on 2024-07-08 at 23:38:31.
⬅️ Previous capture (2021-12-03)
-=-=-=-=-=-=-
/* Copyright 2020, 2021 Lukas Wedeking * * This file is part of LC19. * * LC19 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 * (at your option) any later version. * * LC19 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 LC19. If not, see <https://www.gnu.org/licenses/>. */ #define _XOPEN_SOURCE 500 #include "../include/url.h" #include<assert.h> #include<ctype.h> #include<string.h> #include<stdlib.h> #include<stdio.h> #include "../include/util.h" size_t url_char_is_gen_delim(const char *url, size_t offset, size_t max_length) { assert(url != NULL); assert(offset < max_length); if (url[offset] == ':' || url[offset] == '/' || url[offset] == '?' || url[offset] == '#' || url[offset] == '[' || url[offset] == ']' || url[offset] == '@') { return 1; } return 0; } size_t url_char_is_sub_delim(const char *url, size_t offset, size_t max_length) { assert(url != NULL); assert(offset < max_length); if (url[offset] == '!' || url[offset] == '