diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2010-07-16 14:55:10 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2010-07-16 14:55:10 +0300 |
commit | 00ef0423acd97cb964a2bae54c93a03a8ab50e5e (patch) | |
tree | 2864426773f537f912db1bd716c27b713c5f7dcf /missing_d | |
parent | 3ba50a15ebd976f7a88393e2e45dc14b6478b9a9 (diff) | |
download | egawk-00ef0423acd97cb964a2bae54c93a03a8ab50e5e.tar.gz egawk-00ef0423acd97cb964a2bae54c93a03a8ab50e5e.tar.bz2 egawk-00ef0423acd97cb964a2bae54c93a03a8ab50e5e.zip |
Move to 3.1.8.
Diffstat (limited to 'missing_d')
-rw-r--r-- | missing_d/ChangeLog | 23 | ||||
-rw-r--r-- | missing_d/snprintf.c | 5 | ||||
-rw-r--r-- | missing_d/snprintf.c.save | 136 | ||||
-rw-r--r-- | missing_d/usleep.c | 17 |
4 files changed, 45 insertions, 136 deletions
diff --git a/missing_d/ChangeLog b/missing_d/ChangeLog index 7322aa33..4197afd9 100644 --- a/missing_d/ChangeLog +++ b/missing_d/ChangeLog @@ -1,3 +1,26 @@ +Thu May 6 20:55:14 2010 Arnold D. Robbins <arnold@skeeve.com> + + * Release 3.1.8: Release tar file made. + +Fri Apr 30 11:38:49 2010 Arnold D. Robbins <arnold@skeeve.com> + + * snprintf.c: Add check to undef restrict and define as empty. + Allows !@#$%^&*() OSF/1 to compile and build. + +Mon Apr 26 19:48:07 2010 Arnold D. Robbins <arnold@skeeve.com> + + * snprintf.c (vsnprintf): Undo change of 21 April. vsnprintf + is needed for vprintf in that file. + +Wed Apr 21 23:32:51 2010 Arnold D. Robbins <arnold@skeeve.com> + + * snprintf.c (vsnprintf): Don't define if not STDARG_H. + Gawk doesn't use it. + +Fri Mar 19 09:19:17 2010 Arnold D. Robbins <arnold@skeeve.com> + + * usleep.c: New file. + Tue Jul 21 22:28:56 2009 Arnold D. Robbins <arnold@skeeve.com> * Release 3.1.7: Release tar file made. diff --git a/missing_d/snprintf.c b/missing_d/snprintf.c index df7f1da7..254a8e0b 100644 --- a/missing_d/snprintf.c +++ b/missing_d/snprintf.c @@ -109,6 +109,11 @@ safe_tmpfile (void) #error Neither mkstemp() nor tmpfile() is available on this platform. #endif +#if (__STDC_VERSION__ + 0) < 199901 +#undef restrict /* force it! */ +#define restrict +#endif + int vsnprintf (char *restrict buf, size_t len, const char *restrict fmt, va_list args) diff --git a/missing_d/snprintf.c.save b/missing_d/snprintf.c.save deleted file mode 100644 index 9f59e73e..00000000 --- a/missing_d/snprintf.c.save +++ /dev/null @@ -1,136 +0,0 @@ -/* - * snprintf.c - Implement snprintf and vsnprintf on platforms that need them. - */ - -/* - * Copyright (C) 2006 the Free Software Foundation, Inc. - * - * This file is part of GAWK, the GNU implementation of the - * AWK Programming 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 - */ - - -/* If using in a multi-threaded context, then SNPRINTF_REENTRANT must be - defined. But in that case, performance will be much worse, since a - temporary file is created and closed for each call to snprintf. */ - -#if defined(HAVE_MKSTEMP) -/* If mkstemp is available, use it instead of tmpfile(), since some older - implementations of tmpfile() were not secure. */ - -static FILE * -safe_tmpfile (void) -{ - static const char template[] = "/tmp/snprintfXXXXXX"; - FILE *f; - int fd; - char t[sizeof (template)]; - - strcpy (t, template); - if ((fd = mkstemp (t)) < 0) - return NULL; - unlink (t); - if ((f = fdopen (fd, "w+b")) == NULL) { - close (fd); - return NULL; - } - /* setvbuf(f,NULL,_IOFBF,4*BUFSIZ); */ - return f; -} - -#elif defined(HAVE_TMPFILE) -#define safe_tmpfile tmpfile -#else -#error Neither mkstemp() nor tmpfile() is available on this platform. -#endif - -int -vsnprintf (char *restrict buf, size_t len, - const char *restrict fmt, va_list args) -{ - int actual; - int nread; - size_t cnt = 0; -#ifndef SNPRINTF_REENTRANT - static -#endif - FILE *fp; - - if ((buf == NULL) || (len < 1)) - return -1; - - buf[0] = '\0'; /* in case the caller does not check the return code! */ - -#ifdef SNPRINTF_REENTRANT - if ((fp = safe_tmpfile ()) == NULL) - return -1; -#else - if ((fp == NULL) && ((fp = safe_tmpfile ()) == NULL)) - return -1; - rewind (fp); -#endif - actual = vfprintf (fp, fmt, args); - rewind (fp); - if (actual < 0) { -#ifdef SNPRINTF_REENTRANT - fclose (fp); -#endif - return -1; - } - else if ((size_t) actual < len) - len = actual; - else - --len; - while (cnt < len && (nread = fread (buf + cnt, 1, len - cnt, fp)) > 0) - cnt += nread; - buf[cnt] = '\0'; -#ifdef SNPRINTF_REENTRANT - fclose (fp); -#endif - if (cnt < len) - return -1; - - return actual; -} - -int -#if defined(HAVE_STDARG_H) && defined(__STDC__) && __STDC__ -snprintf (char *restrict buf, size_t len, const char *restrict fmt, ...) -#else -snprintf (va_alist) - va_dcl -#endif -{ - int rv; - va_list args; - -#if defined(HAVE_STDARG_H) && defined(__STDC__) && __STDC__ - va_start (args, fmt); -#else - char *buf; - size_t len; - char *fmt; - - va_start (args); - buf = va_arg (args, char *); - len = va_arg (args, size_t); - fmt = va_arg (args, char *); -#endif - rv = vsnprintf (buf, len, fmt, args); - va_end (args); - return rv; -} diff --git a/missing_d/usleep.c b/missing_d/usleep.c new file mode 100644 index 00000000..cb1c7abf --- /dev/null +++ b/missing_d/usleep.c @@ -0,0 +1,17 @@ +/* + * usleep - round microseconds up to an integral number of seconds. + * + * The real usleep() doesn't work this way; this is a hack for systems + * that don't have usleep(). + */ + +int +usleep(unsigned int usec) +{ + unsigned int seconds = usec / 1000000; + + /* Round up: */ + seconds += (usec % 1000000 > 0); /* 1 or 0 */ + + return sleep(seconds); +} |