aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2014-10-15 11:40:12 +0300
committerArnold D. Robbins <arnold@skeeve.com>2014-10-15 11:40:12 +0300
commit74ee0dcab17240a1626b77ed998b07f0f6560a48 (patch)
tree4cb604dbf593ca99fd0956880b9155b9ef3a9933 /io.c
parentcb9faa8c276efc4e2b24378bdb941d007523fc22 (diff)
downloadegawk-74ee0dcab17240a1626b77ed998b07f0f6560a48.tar.gz
egawk-74ee0dcab17240a1626b77ed998b07f0f6560a48.tar.bz2
egawk-74ee0dcab17240a1626b77ed998b07f0f6560a48.zip
Sanitize handling of AWKPATH / AWKLIBPATH.
Diffstat (limited to 'io.c')
-rw-r--r--io.c45
1 files changed, 0 insertions, 45 deletions
diff --git a/io.c b/io.c
index 7154a710..32caadfb 100644
--- a/io.c
+++ b/io.c
@@ -2505,7 +2505,6 @@ do_getline(int into_variable, IOBUF *iop)
typedef struct {
const char *envname;
char **dfltp; /* pointer to address of default path */
- char try_cwd; /* always search current directory? */
char **awkpath; /* array containing library search paths */
int max_pathlen; /* length of the longest item in awkpath */
} path_info;
@@ -2513,13 +2512,11 @@ typedef struct {
static path_info pi_awkpath = {
/* envname */ "AWKPATH",
/* dfltp */ & defpath,
- /* try_cwd */ true,
};
static path_info pi_awklibpath = {
/* envname */ "AWKLIBPATH",
/* dfltp */ & deflibpath,
- /* try_cwd */ false,
};
/* init_awkpath --- split path(=$AWKPATH) into components */
@@ -2577,30 +2574,6 @@ init_awkpath(path_info *pi)
#undef INC_PATH
}
-/* get_cwd -- get current working directory */
-
-static char *
-get_cwd ()
-{
-#define BSIZE 100
- char *buf;
- size_t bsize = BSIZE;
-
- emalloc(buf, char *, bsize * sizeof(char), "get_cwd");
- while (true) {
- if (getcwd(buf, bsize) == buf)
- return buf;
- if (errno != ERANGE) {
- efree(buf);
- return NULL;
- }
- bsize *= 2;
- erealloc(buf, char *, bsize * sizeof(char), "get_cwd");
- }
-#undef BSIZE
-}
-
-
/* do_find_source --- search $AWKPATH for file, return NULL if not found */
static char *
@@ -2622,24 +2595,6 @@ do_find_source(const char *src, struct stat *stb, int *errcode, path_info *pi)
return NULL;
}
- /* try current directory before $AWKPATH search */
- if (pi->try_cwd && stat(src, stb) == 0) {
- path = get_cwd();
- if (path == NULL) {
- *errcode = errno;
- return NULL;
- }
- erealloc(path, char *, strlen(path) + strlen(src) + 2, "do_find_source");
-#ifdef VMS
- if (strcspn(path,">]:") == strlen(path))
- strcat(path, "/");
-#else
- strcat(path, "/");
-#endif
- strcat(path, src);
- return path;
- }
-
if (pi->awkpath == NULL)
init_awkpath(pi);