summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bvr.h3
-rw-r--r--src/bvrcommands.c28
2 files changed, 21 insertions, 10 deletions
diff --git a/src/bvr.h b/src/bvr.h
index a2bfe00..55b27de 100644
--- a/src/bvr.h
+++ b/src/bvr.h
@@ -26,7 +26,8 @@ int bvr_bvrvar_first_time_set = 1;
#define BVR_VER_MINOR 1
#define BVR_VER_PATCH 0
-#define BVR_PATH_SEPARATOR ';'
+#define BVR_PATH_SEPARATOR ' '
#define BVR_INCLUDE_PATH_VAR_NAME "bvr_include_path"
+#define BVR_COMMAND_FILE_EXT ".bvr"
int bvr_compose_stream(FILE *, FILE *);
diff --git a/src/bvrcommands.c b/src/bvrcommands.c
index 747c757..aac4800 100644
--- a/src/bvrcommands.c
+++ b/src/bvrcommands.c
@@ -60,24 +60,34 @@ int bvr_handle_include(FILE * input, FILE * output) {
FILE * stream = fopen(item, "r");
char notgoodatnamingvariables[PATH_MAX];
char * path = bvr_var_get(BVR_INCLUDE_PATH_VAR_NAME);
- if(strcmp(path, BVR_UNDEFINED) == 0 && stream == NULL) {
- fprintf(output, "\nbVerbose include error. File %s not found. Path is undefined.\n", item);
- fprintf(stderr, "[bvrcommands.c] bvr_handle_include: File %s not found. Path is undefined.\n", item);
- return FAILURE;
+ if(stream == NULL) {
+ strcpy(notgoodatnamingvariables, item);
+ strcat(notgoodatnamingvariables, BVR_COMMAND_FILE_EXT);
+ stream = fopen(notgoodatnamingvariables, "r");
+ if(strcmp(path, BVR_UNDEFINED) == 0 && stream == NULL) {
+ fprintf(output, "\nbVerbose include error. File %s not found. Path is undefined.\n", item);
+ fprintf(stderr, "[bvrcommands.c] bvr_handle_include: File %s not found. Path is undefined.\n", item);
+ return FAILURE;
+ }
}
char * singlepath;
while(stream == NULL) {
singlepath = strrchr(path, BVR_PATH_SEPARATOR);
- strcpy(notgoodatnamingvariables, singlepath);
- strcat(notgoodatnamingvariables, item);
- stream = fopen(notgoodatnamingvariables, "r");
- if(strrchr(path, BVR_PATH_SEPARATOR) == NULL) {
- stream = fopen(notgoodatnamingvariables, "r");
+ if(singlepath == NULL) {
+ stream = fopen(path, "r"); // ob1 fuckery
if(stream == NULL) {
fprintf(output, "\nbVerbose include error. File %s not found.\n", item);
fprintf(stderr, "[bvrcommands.c] bvr_handle_include: File %s not found.\n", item);
return FAILURE;
}
+ break;
+ }
+ strcpy(notgoodatnamingvariables, singlepath);
+ strcat(notgoodatnamingvariables, item);
+ stream = fopen(notgoodatnamingvariables+1, "r"); // ob1 fuckery
+ if(stream == NULL) {
+ strcat(notgoodatnamingvariables, BVR_COMMAND_FILE_EXT);
+ stream = fopen(notgoodatnamingvariables+1, "r"); // ob1 fuckery
}
*singlepath = '\0';
}