diff options
author | James Raynard <jraynard@FreeBSD.org> | 1997-10-14 18:17:11 +0000 |
---|---|---|
committer | James Raynard <jraynard@FreeBSD.org> | 1997-10-14 18:17:11 +0000 |
commit | 728510ce917f315d75e9fb50728222d8c278425a (patch) | |
tree | d84200da2f7f2d8f1321c265bc6ddd7ce15633f8 /contrib/awk/posix | |
download | src-728510ce917f315d75e9fb50728222d8c278425a.tar.gz src-728510ce917f315d75e9fb50728222d8c278425a.zip |
Virgin import of GNU awk 3.0.3vendor/misc-GNU/awk/3.0.3
Notes
Notes:
svn path=/vendor/awk/dist/; revision=30411
svn path=/vendor/awk/3.0.3/; revision=30413; tag=vendor/misc-GNU/awk/3.0.3
Diffstat (limited to 'contrib/awk/posix')
-rw-r--r-- | contrib/awk/posix/ChangeLog | 19 | ||||
-rw-r--r-- | contrib/awk/posix/gawkmisc.c | 108 |
2 files changed, 127 insertions, 0 deletions
diff --git a/contrib/awk/posix/ChangeLog b/contrib/awk/posix/ChangeLog new file mode 100644 index 000000000000..575baa1737b7 --- /dev/null +++ b/contrib/awk/posix/ChangeLog @@ -0,0 +1,19 @@ +Thu May 15 12:49:08 1997 Arnold D. Robbins <arnold@skeeve.atl.ga.us> + + * Release 3.0.3: Release tar file made. + +Fri Apr 18 07:55:47 1997 Arnold D. Robbins <arnold@skeeve.atl.ga.us> + + * BETA Release 3.0.34: Release tar file made. + +Wed Dec 25 11:25:22 1996 Arnold D. Robbins <arnold@skeeve.atl.ga.us> + + * Release 3.0.2: Release tar file made. + +Tue Dec 10 23:09:26 1996 Arnold D. Robbins <arnold@skeeve.atl.ga.us> + + * Release 3.0.1: Release tar file made. + +Wed Jan 10 22:58:55 1996 Arnold D. Robbins <arnold@skeeve.atl.ga.us> + + * ChangeLog created. diff --git a/contrib/awk/posix/gawkmisc.c b/contrib/awk/posix/gawkmisc.c new file mode 100644 index 000000000000..68bfb5ddb96b --- /dev/null +++ b/contrib/awk/posix/gawkmisc.c @@ -0,0 +1,108 @@ +/* gawkmisc.c --- miscellanious gawk routines that are OS specific. + + Copyright (C) 1986, 1988, 1989, 1991 - 96 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +char quote = '\''; +char *defpath = DEFPATH; +char envsep = ':'; + +/* gawk_name --- pull out the "gawk" part from how the OS called us */ + +char * +gawk_name(filespec) +const char *filespec; +{ + char *p; + + /* "path/name" -> "name" */ + p = strrchr(filespec, '/'); + return (p == NULL ? (char *) filespec : p + 1); +} + +/* 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 */ + +int +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)); + + /* + * System V.n, n < 4, doesn't have the file system block size in the + * stat structure. So we have to make some sort of reasonable + * guess. We use stdio's BUFSIZ, since that is what it was + * meant for in the first place. + */ +#ifdef HAVE_ST_BLKSIZE +#define DEFBLKSIZE (stb->st_blksize ? stb->st_blksize : BUFSIZ) +#else +#define DEFBLKSIZE BUFSIZ +#endif + + if (isatty(fd)) + return BUFSIZ; + if (fstat(fd, stb) == -1) + fatal("can't stat fd %d (%s)", fd, strerror(errno)); + if (lseek(fd, (off_t)0, 0) == -1) /* not a regular file */ + return DEFBLKSIZE; + if (stb->st_size > 0 && 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); +} + +/* isdirpunct --- return true if char is a directory separator */ + +int +isdirpunct(c) +int c; +{ + return (c == '/'); +} + |