diff options
author | Jim Meyering <jim@meyering.net> | 2001-09-26 08:13:41 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2001-09-26 08:13:41 +0000 |
commit | de7d4fdb5ffbab637f673043917f22e84fbfb027 (patch) | |
tree | be98db425b338ab6fa0c2df9103bd15c5a582c57 | |
parent | ddbaad372efd1cb1e618ccb32c1d280cffd0782c (diff) | |
download | coreutils-de7d4fdb5ffbab637f673043917f22e84fbfb027.tar.xz |
*** empty log message ***
-rwxr-xr-x | lib/gen-uio | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/lib/gen-uio b/lib/gen-uio new file mode 100755 index 000000000..4d09c4c3d --- /dev/null +++ b/lib/gen-uio @@ -0,0 +1,46 @@ +#!/bin/sh + +tmp=gen-uio.$$ +trap 'status=$?; rm -f $tmp && exit $status' 0 +trap 'exit $?' 1 2 13 15 + +cat <<\EOF +#ifndef UNLOCKED_IO_H +# define UNLOCKED_IO_H 1 + +# if USE_UNLOCKED_IO + +/* These are wrappers for functions/macros from GNU libc. + The standard I/O functions are thread-safe. These *_unlocked ones + are more efficient but not thread-safe. That they're not thread-safe + is fine since all these applications are single threaded. */ + +EOF + +for f in $@; do + u=`echo $f|tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` + echo "# if HAVE_${u}_UNLOCKED" + echo "# undef $f" + case $f in + getchar) + params=;; + putchar | clearerr | feof | ferror | fflush | getc ) + params=x;; + putc | fputc | fputs ) + params=x,y;; + fgets ) + params=x,y,z;; + fread | fwrite ) + params=w,x,y,z;; + *) + echo $0: missing case for $f 2>&1; exit 1;; + esac + echo "# define $f($params) ${f}_unlocked ($params)" + echo '# endif' +done + +cat <<\EOF + +# endif /* USE_UNLOCKED_IO */ +#endif /* UNLOCKED_IO_H */ +EOF |