diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2013-06-11 18:44:10 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2013-06-11 18:44:10 +0300 |
commit | 612ea8d837f14a15a44c2d4941ff62c0ebf30461 (patch) | |
tree | 1770be5b52e131c0b2150c72a1f42c2301d17c51 /io.c | |
parent | 21c8b6d547b12942775d675ead2994992285c04c (diff) | |
download | egawk-612ea8d837f14a15a44c2d4941ff62c0ebf30461.tar.gz egawk-612ea8d837f14a15a44c2d4941ff62c0ebf30461.tar.bz2 egawk-612ea8d837f14a15a44c2d4941ff62c0ebf30461.zip |
Improve fix for debugger on Windows.
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -2731,11 +2731,18 @@ find_source(const char *src, struct stat *stb, int *errcode, int is_extlib) int srcopen(SRCFILE *s) { + int fd = INVALID_HANDLE; + if (s->stype == SRC_STDIN) - return fileno(stdin); - if (s->stype == SRC_FILE || s->stype == SRC_INC) - return devopen(s->fullpath, "r"); - return INVALID_HANDLE; + fd = fileno(stdin); + else if (s->stype == SRC_FILE || s->stype == SRC_INC) + fd = devopen(s->fullpath, "r"); + + /* set binary mode so that debugger byte offset calculations will be right */ + if (fd != INVALID_HANDLE) + os_setbinmode(fd, O_BINARY); + + return fd; } /* input parsers, mainly for use by extension functions */ |