1 #include <stdbool.h>
2 
3 void debugLog(const char* msg);
4 
5 void fatalError(const char* message);
6 
7 int int_to_monkey_int(int i);
8 int int_to_vbr_int(int i);
9 int int_to_bitrate(int i, bool vbr);
10 int int_to_wavpack_bitrate(int i);
11 int int_to_musepack_bitrate(int i);
12 int int_to_musepack_int(int i);
13 
14 // substitute various items into a formatted string (similar to printf)
15 //
16 // format - the format of the filename
17 // tracknum - gets substituted for %N in format
18 // year - gets substituted for %Y in format
19 // artist - gets substituted for %A in format
20 // album - gets substituted for %L in format
21 // title - gets substituted for %T in format
22 //
23 // NOTE: caller must free the returned string!
24 char * parse_format(const char* format, int tracknum, const char* year, const char* artist,
25                     const char* album, const char* genre, const char* title);
26 
27 // construct a filename from various parts
28 //
29 // path - the path the file is placed in (don't include a trailing '/')
30 // dir - the parent directory of the file (don't include a trailing '/')
31 // file - the filename
32 // extension - the suffix of a file (don't include a leading '.')
33 //
34 // NOTE: caller must free the returned string!
35 // NOTE: any of the parameters may be NULL to be omitted
36 char * make_filename(const char * path, const char * dir, const char * file, const char * extension);
37 
38 void make_playlist(const char* pathAndName, FILE** file);
39 
40 // reads an entire line from a file and returns it
41 //
42 // NOTE: caller must free the returned string!
43 char * read_line(int fd);
44 
45 // reads an entire line from a file and turns it into a number
46 int read_line_num(int fd);
47 
48 int recursive_mkdir(char* pathAndName, mode_t mode);
49 
50 int recursive_parent_mkdir(char* pathAndName, mode_t mode);
51 
52 // searches $PATH for the named program
53 // returns 1 if found, 0 otherwise
54 int program_exists(const char * name);
55 
56 // removes leading and trailing whitespace as defined by isspace()
57 //
58 // str - the string to trim
59 void trim_whitespace(char * str);
60 
61 // removes all instances of bad characters from the string
62 //
63 // str - the string to trim
64 // bad - the sting containing all the characters to remove
65 void trim_chars(char * str, const char * bad);
66 
67 // LNR - It's possible that some files may end up on a MS file system,
68 // so it's best to disallow MS invalid chars as well. I also disallow
69 // period (dot) because it screws up my file name database software. YMMV
70 // 13may2013: removed '.' from the list, it's a valid character.
71 #define	BADCHARS	"/?*|><:\"\\"
72