1/* Utility functions 2 * 3 * Project : minidlna 4 * Website : http://sourceforge.net/projects/minidlna/ 5 * Author : Justin Maggard 6 * 7 * MiniDLNA media server 8 * Copyright (C) 2008-2009 Justin Maggard 9 * 10 * This file is part of MiniDLNA. 11 * 12 * MiniDLNA is free software; you can redistribute it and/or modify 13 * it under the terms of the GNU General Public License version 2 as 14 * published by the Free Software Foundation. 15 * 16 * MiniDLNA is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details. 20 * 21 * You should have received a copy of the GNU General Public License 22 * along with MiniDLNA. If not, see <http://www.gnu.org/licenses/>. 23 */ 24#ifndef __UTILS_H__ 25#define __UTILS_H__ 26 27int 28strcatf(struct string_s *str, char *fmt, ...); 29 30void 31strncpyt(char *dst, const char *src, size_t len); 32 33int 34ends_with(const char * haystack, const char * needle); 35 36char * 37trim(char *str); 38 39char * 40strstrc(const char *s, const char *p, const char t); 41 42char * 43strcasestrc(const char *s, const char *p, const char t); 44 45char * 46modifyString(char * string, const char * before, const char * after, short like); 47 48char * 49escape_tag(const char *tag, int force_alloc); 50 51void 52strip_ext(char * name); 53 54int 55make_dir(char * path, mode_t mode); 56 57unsigned int 58DJBHash(const char *str, int len); 59 60int 61is_video(const char * file); 62 63int 64is_audio(const char * file); 65 66int 67is_image(const char * file); 68 69int 70is_playlist(const char * file); 71 72int 73is_album_art(const char * name); 74 75int 76resolve_unknown_type(const char * path, enum media_types dir_type); 77 78 79int is_disk_mounted(); 80 81#endif 82