1 /* aux.h */ 2 3 /* 4 * This file is part of CliFM 5 * 6 * Copyright (C) 2016-2021, L. Abramovich <johndoe.arch@outlook.com> 7 * All rights reserved. 8 9 * CliFM is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by 11 * the Free Software Foundation; either version 2 of the License, or 12 * (at your option) any later version. 13 * 14 * CliFM is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with this program; if not, write to the Free Software 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 22 * MA 02110-1301, USA. 23 */ 24 25 #ifndef AUX_H 26 #define AUX_H 27 28 #include <time.h> 29 30 /* Some memory wrapper functions */ 31 void *xrealloc(void *ptr, size_t size); 32 void *xcalloc(size_t nmemb, size_t size); 33 void *xnmalloc(size_t nmemb, size_t size); 34 35 char xgetchar(void); 36 /*int *get_hex_num(const char *str); */ 37 char *url_encode(char *str); 38 char *url_decode(char *str); 39 char from_hex(char c); 40 //char *from_octal(char *s); 41 int read_octal(char *str); 42 int get_link_ref(const char *link); 43 off_t dir_size(char *dir); 44 char *get_size_unit(off_t size); 45 char *get_cmd_path(const char *cmd); 46 int count_dir(const char *dir, int pop); 47 char *xitoa(int n); 48 int xatoi(const char *s); 49 FILE *open_fstream_r(char *name, int *fd); 50 FILE *open_fstream_w(char *name, int *fd); 51 void close_fstream(FILE *fp, int fd); 52 int xmkdir(char *dir, mode_t mode); 53 mode_t get_dt(const mode_t mode); 54 char *gen_date_suffix(struct tm tm); 55 int get_cursor_position(const int ifd, const int ofd); 56 //int get_term_bgcolor(const int ifd, const int ofd); 57 void rl_ring_bell(void); 58 59 #endif /* AUX_H */ 60