From bc70de7b3302d5a81515b901cae376b8b51d2004 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 16 Jul 2010 13:09:56 +0300 Subject: Move to gawk-3.1.0. --- posix/ChangeLog | 28 +++++++++++++++++++++++- posix/gawkmisc.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 91 insertions(+), 2 deletions(-) (limited to 'posix') diff --git a/posix/ChangeLog b/posix/ChangeLog index f0d1419c..359a635a 100644 --- a/posix/ChangeLog +++ b/posix/ChangeLog @@ -1,3 +1,29 @@ +Sun Jun 3 13:04:44 2001 Arnold D. Robbins + + * Release 3.1.0: Release tar file made. And there was + rejoicing. + +Sun Jan 28 15:50:02 2001 Eli Zaretskii + + * gawkmisc.c (os_restore_mode): New function. + +Sun Dec 3 16:53:37 2000 Arnold D. Robbins + + * gawkmisc.c (os_setbinmode): new function. + +Tue Nov 14 16:13:08 2000 Arnold D. Robbins + + * gawkmisc.c: Remove all includes. Done by ../gawkmisc.c. + +Tue Nov 7 14:09:14 2000 Arnold D. Robbins + + * gawkmisc.c (os_is_setuid): new function. + +Wed Jul 30 19:53:52 1997 Arnold D. Robbins + + * Close-on-exec changes: + gawkmisc.c: (os_close_on_exec, os_isdir): new functions. + Mon Aug 7 15:23:00 2000 Arnold D. Robbins * Release 3.0.6: Release tar file made. @@ -7,7 +33,7 @@ Sun Jun 25 15:08:19 2000 Arnold D. Robbins * Release 3.0.5: Release tar file made. Wed Jun 30 16:14:36 1999 Arnold D. Robbins - + * Release 3.0.4: Release tar file made. This time for sure. Thu May 15 12:49:08 1997 Arnold D. Robbins diff --git a/posix/gawkmisc.c b/posix/gawkmisc.c index 68bfb5dd..4f94683d 100644 --- a/posix/gawkmisc.c +++ b/posix/gawkmisc.c @@ -1,6 +1,6 @@ /* gawkmisc.c --- miscellanious gawk routines that are OS specific. - Copyright (C) 1986, 1988, 1989, 1991 - 96 the Free Software Foundation, Inc. + Copyright (C) 1986, 1988, 1989, 1991 - 98, 2001 the Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,6 +20,11 @@ char quote = '\''; char *defpath = DEFPATH; char envsep = ':'; +#ifndef INVALID_HANDLE +/* FIXME: is this value for INVALID_HANDLE correct? */ +#define INVALID_HANDLE -1 +#endif + /* gawk_name --- pull out the "gawk" part from how the OS called us */ char * @@ -106,3 +111,61 @@ int c; return (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; +{ + if (fcntl(fd, F_SETFD, 1) < 0) + warning(_("%s %s `%s': could not set close-on-exec: %s"), + what, dir, name, strerror(errno)); +} + +/* os_isdir --- is this an fd on a directory? */ + +#if ! defined(S_ISDIR) && defined(S_IFDIR) +#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +#endif + +int +os_isdir(fd) +int fd; +{ + struct stat sbuf; + + return (fstat(fd, &sbuf) == 0 && S_ISDIR(sbuf.st_mode)); +} + +/* os_is_setuid --- true if running setuid root */ + +int +os_is_setuid() +{ + long uid, euid; + + uid = getuid(); + euid = geteuid(); + + return (euid == 0 && euid != uid); +} + +/* os_setbinmode --- set binary mode on file */ + +int +os_setbinmode (fd, mode) +int fd, mode; +{ + return 0; +} + +/* os_restore_mode --- restore the original mode of the console device */ + +void +os_restore_mode (fd) +int fd; +{ + /* no-op */ + return; +} -- cgit v1.2.3