forked from RandyGaul/cute_headers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
40 lines (33 loc) · 833 Bytes
/
main.c
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
#define _CRT_SECURE_NO_WARNINGS
#define TINYSID_IMPLEMENTATION
#include "../tinysid.h"
#define TINYFILES_IMPLEMENTATION
#include "../tinyfiles.h"
#include <string.h>
#include <stdlib.h>
char* strcatdup( const char* a, const char* b )
{
int len_a = strlen( a );
int len_b = strlen( b );
char* c = (char*)malloc( len_a + len_b + 1 );
memcpy( c, a, len_a );
memcpy( c + len_a, b, len_b + 1 );
return c;
}
void CB_DoPreprocess( tfFILE* file, void* udata )
{
(void)udata;
char* out = strcatdup( file->path, ".preprocessed" );
tsPreprocess( file->path, out );
free( out );
}
int main( int argc, const char** argv )
{
if ( argc != 2 )
{
printf( "Incorrect parameter usage. Should only pass the path to source directory.\n" );
return -1;
}
tfTraverse( argv[ 1 ], CB_DoPreprocess, 0 );
return 0;
}