summaryrefslogtreecommitdiffstats
path: root/src/bvrcommands.c
diff options
context:
space:
mode:
authorAnton L. Šijanec <anton@sijanec.eu>2020-05-05 21:22:27 +0200
committerAnton L. Šijanec <anton@sijanec.eu>2020-05-05 21:22:27 +0200
commite7d1afd46b66ffbdab0ef7989c6f0c0017d6e3d8 (patch)
treef0dbd04a59cdfaf956307ffe3077f705b13cbb98 /src/bvrcommands.c
parentforgot to increment version number, lol (diff)
downloadbverbose-e7d1afd46b66ffbdab0ef7989c6f0c0017d6e3d8.tar
bverbose-e7d1afd46b66ffbdab0ef7989c6f0c0017d6e3d8.tar.gz
bverbose-e7d1afd46b66ffbdab0ef7989c6f0c0017d6e3d8.tar.bz2
bverbose-e7d1afd46b66ffbdab0ef7989c6f0c0017d6e3d8.tar.lz
bverbose-e7d1afd46b66ffbdab0ef7989c6f0c0017d6e3d8.tar.xz
bverbose-e7d1afd46b66ffbdab0ef7989c6f0c0017d6e3d8.tar.zst
bverbose-e7d1afd46b66ffbdab0ef7989c6f0c0017d6e3d8.zip
Diffstat (limited to '')
-rw-r--r--src/bvrcommands.c28
1 files changed, 19 insertions, 9 deletions
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';
}