diff --git a/src/inc/deps.h b/src/inc/deps.h index 24efcd4..3c449f6 100644 --- a/src/inc/deps.h +++ b/src/inc/deps.h @@ -64,6 +64,7 @@ #define MAX_SEARCH_BUFSIZE (MAX_SEARCH_LEN + 1) // For files #define MAX_FILENAME_LEN 1024 +#define MAXPATHLENGTH 8128 #define MAX_FILENAME_BUFSIZE (MAX_FILENAME_LEN + 1) #define MAX_FILES 1024 // Inset backquote buffers diff --git a/src/lexer.c b/src/lexer.c index d24b830..8b299d6 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -27,7 +27,7 @@ char *process_line (char *line) char *strtok_save; char *tok_srch, *retbuf, *filebuf, *compbuf, *loopbuf; //printf("%s", &line[strlen(line)-2]); - static char dirpathbuf [MAX_STRING_BUFSIZE]; + static char pathbuf[MAXPATHLENGTH+1]; tok_srch = strtok_r (line, "=\" ;", &strtok_save); @@ -389,11 +389,11 @@ char *process_line (char *line) else if (strncmp("showpath", tok_srch, 8) == 0 || strncmp("pwd", tok_srch, 3) == 0) { // Get current directory, if it errors, return NULL - if (getcwd(retbuf, sizeof(dirpathbuf)) == NULL) { + if (getcwd(pathbuf, sizeof(pathbuf)) == NULL) { return NULL; } // All good, return path - return dirpathbuf; + return pathbuf; } // Change directory diff --git a/test b/test new file mode 100644 index 0000000..36e44d5 --- /dev/null +++ b/test @@ -0,0 +1 @@ +testing data