Fix showpath / pwd bug
This commit is contained in:
parent
315244fc91
commit
66e00ef39d
@ -64,6 +64,7 @@
|
|||||||
#define MAX_SEARCH_BUFSIZE (MAX_SEARCH_LEN + 1)
|
#define MAX_SEARCH_BUFSIZE (MAX_SEARCH_LEN + 1)
|
||||||
// For files
|
// For files
|
||||||
#define MAX_FILENAME_LEN 1024
|
#define MAX_FILENAME_LEN 1024
|
||||||
|
#define MAXPATHLENGTH 8128
|
||||||
#define MAX_FILENAME_BUFSIZE (MAX_FILENAME_LEN + 1)
|
#define MAX_FILENAME_BUFSIZE (MAX_FILENAME_LEN + 1)
|
||||||
#define MAX_FILES 1024
|
#define MAX_FILES 1024
|
||||||
// Inset backquote buffers
|
// Inset backquote buffers
|
||||||
|
@ -27,7 +27,7 @@ char *process_line (char *line)
|
|||||||
char *strtok_save;
|
char *strtok_save;
|
||||||
char *tok_srch, *retbuf, *filebuf, *compbuf, *loopbuf;
|
char *tok_srch, *retbuf, *filebuf, *compbuf, *loopbuf;
|
||||||
//printf("%s", &line[strlen(line)-2]);
|
//printf("%s", &line[strlen(line)-2]);
|
||||||
static char dirpathbuf [MAX_STRING_BUFSIZE];
|
static char pathbuf[MAXPATHLENGTH+1];
|
||||||
|
|
||||||
tok_srch = strtok_r (line, "=\" ;", &strtok_save);
|
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)
|
else if (strncmp("showpath", tok_srch, 8) == 0 || strncmp("pwd", tok_srch, 3) == 0)
|
||||||
{
|
{
|
||||||
// Get current directory, if it errors, return NULL
|
// Get current directory, if it errors, return NULL
|
||||||
if (getcwd(retbuf, sizeof(dirpathbuf)) == NULL) {
|
if (getcwd(pathbuf, sizeof(pathbuf)) == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
// All good, return path
|
// All good, return path
|
||||||
return dirpathbuf;
|
return pathbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change directory
|
// Change directory
|
||||||
|
Loading…
x
Reference in New Issue
Block a user