-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.c
More file actions
44 lines (34 loc) · 703 Bytes
/
main.c
File metadata and controls
44 lines (34 loc) · 703 Bytes
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
/*
* Includes
*/
#include "rb_global.h"
/*
* Global variables
*/
BOOLEAN REGEX_ENABLED = TRUE;
BOOLEAN CASE_INSENSITIVITY = TRUE;
/*
* Functions
*/
int main( int argc, char** argv )
{
char* filecont = (char*)NULL;
rb_register_std();
rb_add_native_function( "print", print, FALSE, "v+", RB_FUNC_AT_RUNTIME );
if( argc <= 1 )
{
fprintf( stderr, "%s: Missing filename!\n", *argv );
return EXIT_FAILURE;
}
if( !pfiletostr( &filecont, argv[1] ) )
{
fprintf( stderr, "%s: File not found: %s\n", *argv, argv[1] );
return EXIT_FAILURE;
}
if( !rb_comp_compile( argv[1], filecont ) )
{
fprintf( stderr, "--- Running program ---\n" );
rb_run( );
}
return EXIT_SUCCESS;
}