Fix showpath / pwd bug

This commit is contained in:
Pentium44 2021-05-19 14:41:24 -07:00
parent 315244fc91
commit 66e00ef39d
3 changed files with 5 additions and 3 deletions

View File

@ -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

View File

@ -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

1
test Normal file
View File

@ -0,0 +1 @@
testing data