summaryrefslogtreecommitdiffstats
path: root/tools/globalcode/utility/util.h
blob: 33a6d84b753f137000df10ec75c21b0c6bee8515 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#ifndef _UTIL_H
#define _UTIL_H
/*-----------------------------------------------------------------------------
** Copyright (C) 2001 Radical Entertainment Ltd.  All rights reserved.
**
** util.h
**
** Description: A set of utilities for various things.
**
** Modification History:
**  + Created Aug 03, 2001 -- bkusy 
**---------------------------------------------------------------------------*/

/*----------------------------------------
** System Includes
**--------------------------------------*/

/*----------------------------------------
** Project Includes
**--------------------------------------*/

/*----------------------------------------
** Forward References
**--------------------------------------*/

#ifdef __cplusplus
extern "C" {
#endif

/*----------------------------------------
** Globals
**--------------------------------------*/
extern char* util_optarg;
extern int   util_optind;
extern int   util_opterr;
extern int   util_optopt;

/*----------------------------------------
** Macros
**--------------------------------------*/


/*----------------------------------------
** Functions
**--------------------------------------*/

extern int         util_basename( char* buffer, int size, const char* path );

extern void        util_changeFileExtension( char* buffer, const char* ext );

extern void        util_decomposeFilePath( const char* path, 
                                           char** dir, 
                                           char** name, 
                                           char** ext 
                                         );

extern int         util_dirname( char* buffer, int size, const char* path );

extern int         util_fileExists( const char* filename );

extern void        util_getopt_init();

extern int         util_getopt( int argc, char* const* argv, const char *opts );

extern const char* util_index( const char* s, int c );

extern void        util_posixFilePath( char* path );

extern void        util_replaceCharacters( char find, 
                                           char replace, 
                                           char* string 
                                         );

extern const char* util_reverseSpan( const char* string, const char* spanSet );

extern const char* util_rindex( const char* s, int c );

extern int         util_substitute( const char* find, 
                                    const char* replace,
                                    char* string,
                                    int stringSize,
                                    int firstOnly
                                   );
#ifdef __cplusplus
}
#endif

#endif