comparison util.h @ 876:540cc4a7d626

Fix Android build breakage
author Michael Pavone <pavone@retrodev.com>
date Mon, 09 Nov 2015 20:55:17 -0800
parents 54ffba3768d6
children 229c23b3ab73
comparison
equal deleted inserted replaced
875:54ffba3768d6 876:540cc4a7d626
9 } dir_entry; 9 } dir_entry;
10 10
11 //Utility functions 11 //Utility functions
12 12
13 //Allocates a new string containing the concatenation of first and second 13 //Allocates a new string containing the concatenation of first and second
14 char * alloc_concat(char * first, char * second); 14 char * alloc_concat(char const * first, char const * second);
15 //Allocates a new string containing the concatenation of the strings pointed to by parts 15 //Allocates a new string containing the concatenation of the strings pointed to by parts
16 char * alloc_concat_m(int num_parts, char ** parts); 16 char * alloc_concat_m(int num_parts, char const ** parts);
17 //Returns the size of a file using fseek and ftell 17 //Returns the size of a file using fseek and ftell
18 long file_size(FILE * f); 18 long file_size(FILE * f);
19 //Strips whitespace and non-printable characters from the beginning and end of a string 19 //Strips whitespace and non-printable characters from the beginning and end of a string
20 char * strip_ws(char * text); 20 char * strip_ws(char * text);
21 //Inserts a null after the first word, returns a pointer to the second word 21 //Inserts a null after the first word, returns a pointer to the second word
27 //Returns the directory the executable is in 27 //Returns the directory the executable is in
28 char * get_exe_dir(); 28 char * get_exe_dir();
29 //Returns the user's home directory 29 //Returns the user's home directory
30 char * get_home_dir(); 30 char * get_home_dir();
31 //Returns an appropriate path for storing config files 31 //Returns an appropriate path for storing config files
32 char *get_config_dir(); 32 char const *get_config_dir();
33 //Reads a file bundled with the executable 33 //Reads a file bundled with the executable
34 char *read_bundled_file(char *name, long *sizeret); 34 char *read_bundled_file(char *name, long *sizeret);
35 //Retunrs an array of normal files and directories residing in a directory 35 //Retunrs an array of normal files and directories residing in a directory
36 dir_entry *get_dir_list(char *path, size_t *numret); 36 dir_entry *get_dir_list(char *path, size_t *numret);
37 //Frees a dir list returned by get_dir_list 37 //Frees a dir list returned by get_dir_list