diff options
Diffstat (limited to 'unsupported/atari/gawkmisc.atr')
-rw-r--r-- | unsupported/atari/gawkmisc.atr | 177 |
1 files changed, 0 insertions, 177 deletions
diff --git a/unsupported/atari/gawkmisc.atr b/unsupported/atari/gawkmisc.atr deleted file mode 100644 index 35dcff80..00000000 --- a/unsupported/atari/gawkmisc.atr +++ /dev/null @@ -1,177 +0,0 @@ -/* - * gawkmisc.atr --- miscellaneous gawk routines that are OS specific. - */ - -/* - * Copyright (C) 1986, 1988, 1989, 1991-1996 the Free Software Foundation, Inc. - * - * This file is part of GAWK, the GNU implementation of the - * AWK Progamming Language. - * - * GAWK is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * GAWK is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include <string.h> - -char quote = '\''; -#ifndef DEFPATH -char *defpath = ".,c:\\lib\\awk,c:\\gnu\\lib\\awk"; -#else -char *defpath = DEFPATH; -#endif -char envsep = ','; - - -/* gawk_name --- pull out the "gawk" part from how the OS called us */ - -char * -gawk_name(filespec) -const char *filespec; -{ - char *p, *q; - - p = (char *)filespec; - - if ((q = strrchr(p, '\\')) != NULL) - p = q + 1; - if ((q = strrchr(p, '/')) != NULL) - p = q + 1; - if ((q = strchr(p, '.')) != NULL) - *q = '\0'; - strlwr(p); - - return (p == NULL ? (char *)filespec : (char *)p); -} - -/* os_arg_fixup --- fixup the command line */ - -void -os_arg_fixup(argcp, argvp) -int *argcp; -char ***argvp; -{ - /* no-op */ - return; -} - -/* os_devopen --- open special per-OS devices */ - -int -os_devopen(name, flag) -const char *name; -int flag; -{ - /* no-op */ - return INVALID_HANDLE; -} - -/* optimal_bufsize --- determine optimal buffer size */ - -size_t -optimal_bufsize(fd, stb) -int fd; -struct stat *stb; -{ - /* force all members to zero in case OS doesn't use all of them. */ - memset(stb, '\0', sizeof(struct stat)); - - /* The atari has the st_blksize structure, so we just use it. */ -#define DEFBLKSIZE (stb->st_blksize ? stb->st_blksize : BUFSIZ) - - /* - * On ST redirected stdin does not have a name attached - * (this could be hard to do to) and fstat would fail - */ - if (fd == 0) - return BUFSIZ; - if (fstat(fd, stb) == -1) - fatal("can't stat fd %d (%s)", fd, strerror(errno)); - if (S_ISREG(stb->st_mode) - && 0 < stb->st_size && stb->st_size < DEFBLKSIZE) /* small file */ - return stb->st_size; - return DEFBLKSIZE; -} - -/* ispath --- return true if path has directory components */ - -int -ispath(file) -const char *file; -{ - return (strchr(file, '/') != NULL || strchr(file, '\\') != NULL); -} - -/* isdirpunct --- return true if char is a directory separator */ - -int -isdirpunct(c) -int c; -{ - return (c == '/' || 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() -{ - return 0; -} - -/* 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; -} |