diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2011-01-24 22:27:34 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2011-01-24 22:27:34 +0200 |
commit | 35b49bd68a818ff9a1720e2e8ef05f723b15e531 (patch) | |
tree | bfed2e6912b3613e69f839d1773a9a349eecc103 /posix/gawkmisc.c | |
parent | 9312bdde1d936a6970a135b269c52d04d895b1a5 (diff) | |
download | egawk-35b49bd68a818ff9a1720e2e8ef05f723b15e531.tar.gz egawk-35b49bd68a818ff9a1720e2e8ef05f723b15e531.tar.bz2 egawk-35b49bd68a818ff9a1720e2e8ef05f723b15e531.zip |
Cygwin fixes from Corinna.
Diffstat (limited to 'posix/gawkmisc.c')
-rw-r--r-- | posix/gawkmisc.c | 63 |
1 files changed, 25 insertions, 38 deletions
diff --git a/posix/gawkmisc.c b/posix/gawkmisc.c index 6032fcdf..8388212f 100644 --- a/posix/gawkmisc.c +++ b/posix/gawkmisc.c @@ -16,6 +16,12 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#ifdef __CYGWIN__ +#include <stdio.h> +#include <sys/cygwin.h> +#include <io.h> +#endif + char quote = '\''; char *defpath = DEFPATH; char envsep = ':'; @@ -28,8 +34,7 @@ char envsep = ':'; /* gawk_name --- pull out the "gawk" part from how the OS called us */ char * -gawk_name(filespec) -const char *filespec; +gawk_name(const char *filespec) { char *p; @@ -41,9 +46,7 @@ const char *filespec; /* os_arg_fixup --- fixup the command line */ void -os_arg_fixup(argcp, argvp) -int *argcp; -char ***argvp; +os_arg_fixup(int *argcp, char ***argvp) { /* no-op */ return; @@ -52,9 +55,7 @@ char ***argvp; /* os_devopen --- open special per-OS devices */ int -os_devopen(name, flag) -const char *name; -int flag; +os_devopen(const char *name, int flag) { /* no-op */ return INVALID_HANDLE; @@ -85,9 +86,7 @@ int flag; */ size_t -optimal_bufsize(fd, stb) -int fd; -struct stat *stb; +optimal_bufsize(int fd, struct stat *stb) { char *val; static size_t env_val = 0; @@ -143,8 +142,7 @@ struct stat *stb; /* ispath --- return true if path has directory components */ int -ispath(file) -const char *file; +ispath(const char *file) { return (strchr(file, '/') != NULL); } @@ -152,8 +150,7 @@ const char *file; /* isdirpunct --- return true if char is a directory separator */ int -isdirpunct(c) -int c; +isdirpunct(int c) { return (c == '/'); } @@ -161,9 +158,7 @@ int c; /* os_close_on_exec --- set close on exec flag, print warning if fails */ void -os_close_on_exec(fd, name, what, dir) -int fd; -const char *name, *what, *dir; +os_close_on_exec(int fd, const char *name, const char *what, const char *dir) { int curflags = 0; @@ -199,8 +194,7 @@ const char *name, *what, *dir; #endif int -os_isdir(fd) -int fd; +os_isdir(int fd) { struct stat sbuf; @@ -223,8 +217,7 @@ os_is_setuid() /* os_setbinmode --- set binary mode on file */ int -os_setbinmode(fd, mode) -int fd, mode; +os_setbinmode(int fd, int mode) { #ifdef __CYGWIN__ setmode (fd, mode); @@ -235,8 +228,7 @@ int fd, mode; /* os_restore_mode --- restore the original mode of the console device */ void -os_restore_mode (fd) -int fd; +os_restore_mode(int fd) { /* no-op */ return; @@ -251,25 +243,20 @@ files_are_same(struct stat *f1, struct stat *f2) } #ifdef __CYGWIN__ -#include <stdio.h> -#include <sys/cygwin.h> - -extern int _fmode; void -cygwin_premain0 (int argc, char **argv, void *myself) +cygwin_premain0(int argc, char **argv, void *myself) { - static struct __cygwin_perfile pf[] = - { - {"", O_RDONLY | O_TEXT}, - /*{"", O_WRONLY | O_BINARY},*/ - {NULL, 0} - }; - cygwin_internal (CW_PERFILE, pf); + static struct __cygwin_perfile pf[] = { + { "", O_RDONLY | O_TEXT }, + /*{ "", O_WRONLY | O_BINARY },*/ + { NULL, 0 } + }; + cygwin_internal(CW_PERFILE, pf); } void -cygwin_premain2 (int argc, char **argv, void *myself) +cygwin_premain2(int argc, char **argv, void *myself) { - setmode (fileno (stdin), O_TEXT); + setmode(fileno (stdin), O_TEXT); } #endif |