summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/ChangeLog-20072
-rw-r--r--lib/acl-errno-valid.c52
-rw-r--r--lib/acl-internal.h29
-rw-r--r--lib/acl.h9
-rw-r--r--lib/acl_entries.c2
-rw-r--r--lib/alignof.h4
-rw-r--r--lib/alloca.in.h2
-rw-r--r--lib/allocator.h2
-rw-r--r--lib/anytostr.c4
-rw-r--r--lib/areadlink-with-size.c2
-rw-r--r--lib/areadlink.c19
-rw-r--r--lib/areadlink.h2
-rw-r--r--lib/areadlinkat.c2
-rw-r--r--lib/argmatch.c2
-rw-r--r--lib/argmatch.h10
-rw-r--r--lib/argv-iter.c2
-rw-r--r--lib/argv-iter.h2
-rw-r--r--lib/arpa_inet.in.h2
-rw-r--r--lib/asnprintf.c2
-rw-r--r--lib/asprintf.c2
-rw-r--r--lib/at-func.c2
-rw-r--r--lib/at-func2.c2
-rw-r--r--lib/backupfile.c2
-rw-r--r--lib/backupfile.h2
-rw-r--r--lib/base64.c45
-rw-r--r--lib/base64.h2
-rw-r--r--lib/basename-lgpl.c2
-rw-r--r--lib/basename.c2
-rw-r--r--lib/binary-io.c3
-rw-r--r--lib/binary-io.h72
-rw-r--r--lib/bitrotate.h5
-rw-r--r--lib/btowc.c2
-rw-r--r--lib/buffer-lcm.c2
-rw-r--r--lib/c-ctype.c2
-rw-r--r--lib/c-ctype.h5
-rw-r--r--lib/c-strcase.h2
-rw-r--r--lib/c-strcasecmp.c2
-rw-r--r--lib/c-strcaseeq.h2
-rw-r--r--lib/c-strncasecmp.c2
-rw-r--r--lib/c-strtod.c2
-rw-r--r--lib/c-strtod.h2
-rw-r--r--lib/calloc.c2
-rw-r--r--lib/canon-host.c2
-rw-r--r--lib/canon-host.h2
-rw-r--r--lib/canonicalize.c2
-rw-r--r--lib/canonicalize.h2
-rw-r--r--lib/careadlinkat.c17
-rw-r--r--lib/careadlinkat.h11
-rw-r--r--lib/chdir-long.c2
-rw-r--r--lib/chdir-long.h2
-rw-r--r--lib/chown.c7
-rw-r--r--lib/cloexec.c2
-rw-r--r--lib/cloexec.h2
-rw-r--r--lib/close-stream.c2
-rw-r--r--lib/close.c2
-rw-r--r--lib/closedir.c2
-rw-r--r--lib/closein.c2
-rw-r--r--lib/closein.h2
-rw-r--r--lib/closeout.c2
-rw-r--r--lib/closeout.h2
-rw-r--r--lib/config.charset2
-rw-r--r--lib/config.hin340
-rw-r--r--lib/copy-acl.c565
-rw-r--r--lib/creat-safer.c2
-rw-r--r--lib/ctype.in.h2
-rw-r--r--lib/cycle-check.c2
-rw-r--r--lib/cycle-check.h2
-rw-r--r--lib/di-set.c2
-rw-r--r--lib/diacrit.c2
-rw-r--r--lib/diacrit.h2
-rw-r--r--lib/dirchownmod.c2
-rw-r--r--lib/dirent--.h2
-rw-r--r--lib/dirent-private.h2
-rw-r--r--lib/dirent-safer.h2
-rw-r--r--lib/dirent.in.h2
-rw-r--r--lib/dirfd.c2
-rw-r--r--lib/dirname-lgpl.c2
-rw-r--r--lib/dirname.c2
-rw-r--r--lib/dirname.h2
-rw-r--r--lib/dosname.h2
-rw-r--r--lib/dtotimespec.c32
-rw-r--r--lib/dup-safer-flag.c2
-rw-r--r--lib/dup-safer.c2
-rw-r--r--lib/dup.c2
-rw-r--r--lib/dup2.c6
-rw-r--r--lib/errno.in.h2
-rw-r--r--lib/error.c21
-rw-r--r--lib/error.h2
-rw-r--r--lib/euidaccess.c2
-rw-r--r--lib/exclude.c196
-rw-r--r--lib/exclude.h14
-rw-r--r--lib/exitfail.c2
-rw-r--r--lib/exitfail.h2
-rw-r--r--lib/faccessat.c2
-rw-r--r--lib/fadvise.c8
-rw-r--r--lib/fadvise.h6
-rw-r--r--lib/fatal-signal.c286
-rw-r--r--lib/fatal-signal.h76
-rw-r--r--lib/fchdir.c2
-rw-r--r--lib/fchmodat.c2
-rw-r--r--lib/fchownat.c2
-rw-r--r--lib/fclose.c2
-rw-r--r--lib/fcntl--.h2
-rw-r--r--lib/fcntl-safer.h2
-rw-r--r--lib/fcntl.c2
-rw-r--r--lib/fcntl.in.h18
-rw-r--r--lib/fd-hook.c2
-rw-r--r--lib/fd-hook.h2
-rw-r--r--lib/fd-reopen.c2
-rw-r--r--lib/fd-reopen.h2
-rw-r--r--lib/fd-safer-flag.c2
-rw-r--r--lib/fd-safer.c2
-rw-r--r--lib/fdatasync.c2
-rw-r--r--lib/fdopen.c2
-rw-r--r--lib/fdopendir.c2
-rw-r--r--lib/fdutimensat.c2
-rw-r--r--lib/fflush.c2
-rw-r--r--lib/file-has-acl.c15
-rw-r--r--lib/file-set.c2
-rw-r--r--lib/file-type.c64
-rw-r--r--lib/file-type.h2
-rw-r--r--lib/fileblocks.c2
-rw-r--r--lib/filemode.c2
-rw-r--r--lib/filemode.h2
-rw-r--r--lib/filename.h2
-rw-r--r--lib/filenamecat-lgpl.c2
-rw-r--r--lib/filenamecat.c2
-rw-r--r--lib/filenamecat.h2
-rw-r--r--lib/filevercmp.c2
-rw-r--r--lib/filevercmp.h2
-rw-r--r--lib/float+.h2
-rw-r--r--lib/float.c2
-rw-r--r--lib/float.in.h2
-rw-r--r--lib/fnmatch.c2
-rw-r--r--lib/fnmatch.in.h2
-rw-r--r--lib/fnmatch_loop.c6
-rw-r--r--lib/fopen-safer.c2
-rw-r--r--lib/fopen.c2
-rw-r--r--lib/fpending.c2
-rw-r--r--lib/fpending.h13
-rw-r--r--lib/fprintftime.h2
-rw-r--r--lib/fpucw.h2
-rw-r--r--lib/fpurge.c2
-rw-r--r--lib/freadahead.c2
-rw-r--r--lib/freadahead.h2
-rw-r--r--lib/freading.c2
-rw-r--r--lib/freading.h4
-rw-r--r--lib/freadptr.c2
-rw-r--r--lib/freadptr.h2
-rw-r--r--lib/freadseek.c2
-rw-r--r--lib/freadseek.h2
-rw-r--r--lib/freopen-safer.c2
-rw-r--r--lib/freopen.c2
-rw-r--r--lib/frexp.c2
-rw-r--r--lib/frexpl.c2
-rw-r--r--lib/fseek.c2
-rw-r--r--lib/fseeko.c12
-rw-r--r--lib/fseterr.c2
-rw-r--r--lib/fseterr.h2
-rw-r--r--lib/fstat.c2
-rw-r--r--lib/fstatat.c2
-rw-r--r--lib/fsusage.c7
-rw-r--r--lib/fsusage.h2
-rw-r--r--lib/fsync.c2
-rw-r--r--lib/ftell.c2
-rw-r--r--lib/ftello.c2
-rw-r--r--lib/ftoastr.c2
-rw-r--r--lib/ftoastr.h19
-rw-r--r--lib/ftruncate.c2
-rw-r--r--lib/fts-cycle.c2
-rw-r--r--lib/fts.c14
-rw-r--r--lib/fts_.h2
-rw-r--r--lib/full-read.c2
-rw-r--r--lib/full-read.h2
-rw-r--r--lib/full-write.c2
-rw-r--r--lib/full-write.h2
-rw-r--r--lib/futimens.c2
-rw-r--r--lib/gai_strerror.c2
-rw-r--r--lib/getaddrinfo.c6
-rw-r--r--lib/getcwd-lgpl.c3
-rw-r--r--lib/getcwd.c4
-rw-r--r--lib/getdelim.c6
-rw-r--r--lib/getdtablesize.c35
-rw-r--r--lib/getfilecon.c2
-rw-r--r--lib/getgroups.c19
-rw-r--r--lib/gethostname.c2
-rw-r--r--lib/gethrxtime.c2
-rw-r--r--lib/gethrxtime.h5
-rw-r--r--lib/getline.c2
-rw-r--r--lib/getloadavg.c2
-rw-r--r--lib/getlogin.c2
-rw-r--r--lib/getndelim2.c2
-rw-r--r--lib/getndelim2.h2
-rw-r--r--lib/getopt.c2
-rw-r--r--lib/getopt.in.h2
-rw-r--r--lib/getopt1.c2
-rw-r--r--lib/getopt_int.h2
-rw-r--r--lib/getpagesize.c2
-rw-r--r--lib/getpass.c2
-rw-r--r--lib/getpass.h2
-rw-r--r--lib/gettext.h2
-rw-r--r--lib/gettime.c2
-rw-r--r--lib/gettimeofday.c2
-rw-r--r--lib/getugroups.c2
-rw-r--r--lib/getugroups.h2
-rw-r--r--lib/getusershell.c2
-rw-r--r--lib/gl_openssl.h116
-rw-r--r--lib/glthread/lock.c2
-rw-r--r--lib/glthread/lock.h2
-rw-r--r--lib/glthread/threadlib.c2
-rw-r--r--lib/glthread/tls.c2
-rw-r--r--lib/glthread/tls.h2
-rw-r--r--lib/gnulib.mk283
-rw-r--r--lib/group-member.c2
-rw-r--r--lib/hard-locale.c2
-rw-r--r--lib/hard-locale.h2
-rw-r--r--lib/hash-pjw.c2
-rw-r--r--lib/hash-pjw.h2
-rw-r--r--lib/hash-triple.c2
-rw-r--r--lib/hash.c2
-rw-r--r--lib/hash.h2
-rw-r--r--lib/heap.c2
-rw-r--r--lib/heap.h2
-rw-r--r--lib/human.c2
-rw-r--r--lib/human.h2
-rw-r--r--lib/i-ring.c2
-rw-r--r--lib/i-ring.h2
-rw-r--r--lib/iconv.c2
-rw-r--r--lib/iconv.in.h2
-rw-r--r--lib/iconv_close.c2
-rw-r--r--lib/iconv_open.c2
-rw-r--r--lib/idcache.c2
-rw-r--r--lib/ignore-value.h25
-rw-r--r--lib/inet_ntop.c2
-rw-r--r--lib/ino-map.c2
-rw-r--r--lib/intprops.h5
-rw-r--r--lib/inttostr.h2
-rw-r--r--lib/inttypes.in.h18
-rw-r--r--lib/isapipe.c2
-rw-r--r--lib/isatty.c10
-rw-r--r--lib/isblank.c2
-rw-r--r--lib/isnan.c20
-rw-r--r--lib/isnand-nolibm.h2
-rw-r--r--lib/isnand.c2
-rw-r--r--lib/isnanf-nolibm.h2
-rw-r--r--lib/isnanf.c2
-rw-r--r--lib/isnanl-nolibm.h2
-rw-r--r--lib/isnanl.c2
-rw-r--r--lib/iswblank.c2
-rw-r--r--lib/itold.c2
-rw-r--r--lib/langinfo.in.h20
-rw-r--r--lib/lchown.c2
-rw-r--r--lib/linebuffer.c2
-rw-r--r--lib/linebuffer.h2
-rw-r--r--lib/link.c2
-rw-r--r--lib/linkat.c2
-rw-r--r--lib/localcharset.c9
-rw-r--r--lib/localcharset.h2
-rw-r--r--lib/locale.in.h2
-rw-r--r--lib/localeconv.c2
-rw-r--r--lib/long-options.c2
-rw-r--r--lib/long-options.h2
-rw-r--r--lib/lseek.c2
-rw-r--r--lib/lstat.c2
-rw-r--r--lib/malloc.c2
-rw-r--r--lib/malloca.c31
-rw-r--r--lib/malloca.h4
-rw-r--r--lib/math.in.h5
-rw-r--r--lib/mbchar.c2
-rw-r--r--lib/mbchar.h5
-rw-r--r--lib/mbiter.h5
-rw-r--r--lib/mbrlen.c2
-rw-r--r--lib/mbrtowc.c9
-rw-r--r--lib/mbsalign.c2
-rw-r--r--lib/mbsalign.h2
-rw-r--r--lib/mbscasecmp.c2
-rw-r--r--lib/mbsinit.c2
-rw-r--r--lib/mbslen.c2
-rw-r--r--lib/mbsrtowcs-impl.h2
-rw-r--r--lib/mbsrtowcs-state.c2
-rw-r--r--lib/mbsrtowcs.c2
-rw-r--r--lib/mbsstr.c10
-rw-r--r--lib/mbswidth.c2
-rw-r--r--lib/mbswidth.h2
-rw-r--r--lib/mbtowc-impl.h2
-rw-r--r--lib/mbtowc.c2
-rw-r--r--lib/mbuiter.h5
-rw-r--r--lib/md5.c9
-rw-r--r--lib/md5.h22
-rw-r--r--lib/memcasecmp.c2
-rw-r--r--lib/memcasecmp.h2
-rw-r--r--lib/memchr.c2
-rw-r--r--lib/memchr2.c23
-rw-r--r--lib/memchr2.h2
-rw-r--r--lib/memcmp2.c2
-rw-r--r--lib/memcmp2.h2
-rw-r--r--lib/memcoll.c2
-rw-r--r--lib/memcoll.h2
-rw-r--r--lib/mempcpy.c2
-rw-r--r--lib/memrchr.c2
-rw-r--r--lib/mgetgroups.c4
-rw-r--r--lib/mgetgroups.h2
-rw-r--r--lib/mkancesdirs.c2
-rw-r--r--lib/mkdir-p.c57
-rw-r--r--lib/mkdir-p.h2
-rw-r--r--lib/mkdir.c2
-rw-r--r--lib/mkfifo.c2
-rw-r--r--lib/mknod.c2
-rw-r--r--lib/mkstemp-safer.c2
-rw-r--r--lib/mkstemp.c2
-rw-r--r--lib/mktime.c6
-rw-r--r--lib/modechange.c6
-rw-r--r--lib/modechange.h2
-rw-r--r--lib/mountlist.c39
-rw-r--r--lib/mountlist.h3
-rw-r--r--lib/mpsort.c2
-rw-r--r--lib/msvc-inval.c8
-rw-r--r--lib/msvc-inval.h2
-rw-r--r--lib/msvc-nothrow.c2
-rw-r--r--lib/msvc-nothrow.h2
-rw-r--r--lib/nanosleep.c2
-rw-r--r--lib/netdb.in.h2
-rw-r--r--lib/netinet_in.in.h2
-rw-r--r--lib/nl_langinfo.c255
-rw-r--r--lib/nproc.c2
-rw-r--r--lib/nproc.h2
-rw-r--r--lib/obstack.c105
-rw-r--r--lib/obstack.h673
-rw-r--r--lib/open-safer.c2
-rw-r--r--lib/open.c2
-rw-r--r--lib/openat-die.c2
-rw-r--r--lib/openat-priv.h2
-rw-r--r--lib/openat-proc.c10
-rw-r--r--lib/openat-safer.c2
-rw-r--r--lib/openat.c2
-rw-r--r--lib/openat.h5
-rw-r--r--lib/opendir-safer.c2
-rw-r--r--lib/opendir.c2
-rw-r--r--lib/parse-datetime.c1004
-rw-r--r--lib/parse-datetime.h2
-rw-r--r--lib/parse-datetime.y11
-rw-r--r--lib/pathmax.h2
-rw-r--r--lib/physmem.c23
-rw-r--r--lib/physmem.h2
-rw-r--r--lib/pipe-safer.c2
-rw-r--r--lib/pipe.c50
-rw-r--r--lib/pipe.h2
-rw-r--r--lib/pipe2-safer.c52
-rw-r--r--lib/pipe2.c168
-rw-r--r--lib/posixtm.c2
-rw-r--r--lib/posixtm.h2
-rw-r--r--lib/posixver.c2
-rw-r--r--lib/printf-args.c2
-rw-r--r--lib/printf-args.h2
-rw-r--r--lib/printf-frexp.c2
-rw-r--r--lib/printf-frexp.h2
-rw-r--r--lib/printf-frexpl.c2
-rw-r--r--lib/printf-frexpl.h2
-rw-r--r--lib/printf-parse.c2
-rw-r--r--lib/printf-parse.h2
-rw-r--r--lib/priv-set.c2
-rw-r--r--lib/priv-set.h5
-rw-r--r--lib/progname.c2
-rw-r--r--lib/progname.h2
-rw-r--r--lib/propername.c2
-rw-r--r--lib/propername.h2
-rw-r--r--lib/pthread.in.h14
-rw-r--r--lib/putenv.c98
-rw-r--r--lib/qcopy-acl.c583
-rw-r--r--lib/qset-acl.c (renamed from lib/set-mode-acl.c)43
-rw-r--r--lib/quote.h2
-rw-r--r--lib/quotearg.c13
-rw-r--r--lib/quotearg.h2
-rw-r--r--lib/raise.c2
-rw-r--r--lib/rand-isaac.c26
-rw-r--r--lib/rand-isaac.h2
-rw-r--r--lib/randint.c2
-rw-r--r--lib/randint.h2
-rw-r--r--lib/randperm.c2
-rw-r--r--lib/randread.c12
-rw-r--r--lib/randread.h2
-rw-r--r--lib/rawmemchr.c136
-rw-r--r--lib/rawmemchr.valgrind12
-rw-r--r--lib/read-file.c2
-rw-r--r--lib/read-file.h2
-rw-r--r--lib/read.c2
-rw-r--r--lib/readdir.c2
-rw-r--r--lib/readlink.c2
-rw-r--r--lib/readlinkat.c2
-rw-r--r--lib/readtokens.c2
-rw-r--r--lib/readtokens.h2
-rw-r--r--lib/readtokens0.c2
-rw-r--r--lib/readtokens0.h2
-rw-r--r--lib/readutmp.c2
-rw-r--r--lib/readutmp.h2
-rw-r--r--lib/realloc.c2
-rw-r--r--lib/ref-add.sin2
-rw-r--r--lib/ref-del.sin2
-rw-r--r--lib/regcomp.c119
-rw-r--r--lib/regex.c3
-rw-r--r--lib/regex.h4
-rw-r--r--lib/regex_internal.c23
-rw-r--r--lib/regex_internal.h74
-rw-r--r--lib/regexec.c16
-rw-r--r--lib/remove.c2
-rw-r--r--lib/rename.c8
-rw-r--r--lib/rewinddir.c2
-rw-r--r--lib/rmdir.c2
-rw-r--r--lib/root-dev-ino.c2
-rw-r--r--lib/root-dev-ino.h2
-rw-r--r--lib/root-uid.h2
-rw-r--r--lib/rpmatch.c7
-rw-r--r--lib/safe-read.c2
-rw-r--r--lib/safe-read.h2
-rw-r--r--lib/safe-write.c2
-rw-r--r--lib/safe-write.h2
-rw-r--r--lib/same-inode.h2
-rw-r--r--lib/same.c2
-rw-r--r--lib/same.h2
-rw-r--r--lib/save-cwd.c2
-rw-r--r--lib/save-cwd.h2
-rw-r--r--lib/savedir.c160
-rw-r--r--lib/savedir.h20
-rw-r--r--lib/savewd.c2
-rw-r--r--lib/savewd.h5
-rw-r--r--lib/sched.in.h2
-rw-r--r--lib/se-context.in.h11
-rw-r--r--lib/se-selinux.in.h13
-rw-r--r--lib/secure_getenv.c41
-rw-r--r--lib/select.c38
-rw-r--r--lib/selinux-at.c3
-rw-r--r--lib/selinux-at.h2
-rw-r--r--lib/set-acl.c48
-rw-r--r--lib/setenv.c10
-rw-r--r--lib/settime.c2
-rw-r--r--lib/sha1.c9
-rw-r--r--lib/sha1.h23
-rw-r--r--lib/sha256.c9
-rw-r--r--lib/sha256.h32
-rw-r--r--lib/sha512.c9
-rw-r--r--lib/sha512.h33
-rw-r--r--lib/sig-handler.h5
-rw-r--r--lib/sig2str.c14
-rw-r--r--lib/sig2str.h10
-rw-r--r--lib/sigaction.c2
-rw-r--r--lib/siglist.h2
-rw-r--r--lib/signal.in.h16
-rw-r--r--lib/signbitd.c2
-rw-r--r--lib/signbitf.c2
-rw-r--r--lib/signbitl.c2
-rw-r--r--lib/sigprocmask.c2
-rw-r--r--lib/size_max.h2
-rw-r--r--lib/smack.h46
-rw-r--r--lib/snprintf.c2
-rw-r--r--lib/sockets.c2
-rw-r--r--lib/sockets.h2
-rw-r--r--lib/spawn-pipe.c452
-rw-r--r--lib/spawn-pipe.h147
-rw-r--r--lib/spawn.in.h881
-rw-r--r--lib/spawn_faction_addclose.c69
-rw-r--r--lib/spawn_faction_adddup2.c70
-rw-r--r--lib/spawn_faction_addopen.c73
-rw-r--r--lib/spawn_faction_destroy.c31
-rw-r--r--lib/spawn_faction_init.c56
-rw-r--r--lib/spawn_int.h62
-rw-r--r--lib/spawnattr_destroy.c28
-rw-r--r--lib/spawnattr_init.c33
-rw-r--r--lib/spawnattr_setflags.c45
-rw-r--r--lib/spawnattr_setsigmask.c33
-rw-r--r--lib/spawni.c374
-rw-r--r--lib/spawnp.c33
-rw-r--r--lib/stat-size.h2
-rw-r--r--lib/stat-time.h5
-rw-r--r--lib/stat.c2
-rw-r--r--lib/stdalign.in.h42
-rw-r--r--lib/stdarg.in.h2
-rw-r--r--lib/stdbool.in.h2
-rw-r--r--lib/stddef.in.h2
-rw-r--r--lib/stdint.in.h5
-rw-r--r--lib/stdio--.h2
-rw-r--r--lib/stdio-impl.h4
-rw-r--r--lib/stdio-safer.h2
-rw-r--r--lib/stdio.in.h25
-rw-r--r--lib/stdlib--.h2
-rw-r--r--lib/stdlib-safer.h2
-rw-r--r--lib/stdlib.in.h18
-rw-r--r--lib/stpcpy.c2
-rw-r--r--lib/stpncpy.c2
-rw-r--r--lib/str-kmp.h2
-rw-r--r--lib/str-two-way.h2
-rw-r--r--lib/strchrnul.c142
-rw-r--r--lib/strchrnul.valgrind12
-rw-r--r--lib/strdup.c2
-rw-r--r--lib/streq.h2
-rw-r--r--lib/strerror-override.c2
-rw-r--r--lib/strerror-override.h4
-rw-r--r--lib/strerror.c2
-rw-r--r--lib/strftime.c50
-rw-r--r--lib/strftime.h2
-rw-r--r--lib/striconv.c2
-rw-r--r--lib/striconv.h2
-rw-r--r--lib/string.in.h2
-rw-r--r--lib/strintcmp.c2
-rw-r--r--lib/stripslash.c2
-rw-r--r--lib/strncat.c2
-rw-r--r--lib/strndup.c2
-rw-r--r--lib/strnlen.c2
-rw-r--r--lib/strnlen1.c2
-rw-r--r--lib/strnlen1.h2
-rw-r--r--lib/strnumcmp-in.h2
-rw-r--r--lib/strnumcmp.c2
-rw-r--r--lib/strpbrk.c2
-rw-r--r--lib/strsignal.c2
-rw-r--r--lib/strstr.c2
-rw-r--r--lib/strtod.c24
-rw-r--r--lib/strtoimax.c33
-rw-r--r--lib/strtol.c2
-rw-r--r--lib/strtoll.c2
-rw-r--r--lib/strtoul.c2
-rw-r--r--lib/strtoull.c2
-rw-r--r--lib/symlink.c2
-rw-r--r--lib/sys_ioctl.in.h2
-rw-r--r--lib/sys_resource.in.h2
-rw-r--r--lib/sys_select.in.h18
-rw-r--r--lib/sys_socket.in.h5
-rw-r--r--lib/sys_stat.in.h2
-rw-r--r--lib/sys_time.in.h12
-rw-r--r--lib/sys_types.in.h4
-rw-r--r--lib/sys_uio.in.h2
-rw-r--r--lib/sys_utsname.in.h2
-rw-r--r--lib/sys_wait.in.h2
-rw-r--r--lib/tempname.c7
-rw-r--r--lib/tempname.h2
-rw-r--r--lib/termios.in.h2
-rw-r--r--lib/time.in.h46
-rw-r--r--lib/time_r.c2
-rw-r--r--lib/timespec.h22
-rw-r--r--lib/trim.c2
-rw-r--r--lib/trim.h2
-rw-r--r--lib/u64.h5
-rw-r--r--lib/uname.c2
-rw-r--r--lib/unicodeio.c2
-rw-r--r--lib/unicodeio.h2
-rw-r--r--lib/unistd--.h2
-rw-r--r--lib/unistd-safer.h2
-rw-r--r--lib/unistd.in.h38
-rw-r--r--lib/unistr.in.h2
-rw-r--r--lib/unistr/u8-mbtoucr.c2
-rw-r--r--lib/unistr/u8-uctomb-aux.c2
-rw-r--r--lib/unistr/u8-uctomb.c2
-rw-r--r--lib/unitypes.in.h2
-rw-r--r--lib/uniwidth.in.h2
-rw-r--r--lib/uniwidth/cjk.h2
-rw-r--r--lib/uniwidth/width.c2
-rw-r--r--lib/unlink.c2
-rw-r--r--lib/unlinkat.c2
-rw-r--r--lib/unlocked-io.h2
-rw-r--r--lib/unsetenv.c6
-rw-r--r--lib/userspec.c34
-rw-r--r--lib/utimecmp.c2
-rw-r--r--lib/utimecmp.h2
-rw-r--r--lib/utimens.c32
-rw-r--r--lib/utimens.h5
-rw-r--r--lib/utimensat.c24
-rw-r--r--lib/vasnprintf.c5
-rw-r--r--lib/vasnprintf.h2
-rw-r--r--lib/vasprintf.c2
-rw-r--r--lib/verify.h136
-rw-r--r--lib/verror.c2
-rw-r--r--lib/verror.h2
-rw-r--r--lib/version-etc-fsf.c2
-rw-r--r--lib/version-etc.c4
-rw-r--r--lib/version-etc.h2
-rw-r--r--lib/vfprintf.c2
-rw-r--r--lib/vprintf.c2
-rw-r--r--lib/w32sock.h2
-rw-r--r--lib/w32spawn.h222
-rw-r--r--lib/wait-process.c361
-rw-r--r--lib/wait-process.h74
-rw-r--r--lib/waitpid.c30
-rw-r--r--lib/wchar.in.h2
-rw-r--r--lib/wcrtomb.c2
-rw-r--r--lib/wcswidth-impl.h2
-rw-r--r--lib/wcswidth.c2
-rw-r--r--lib/wctype.in.h12
-rw-r--r--lib/wcwidth.c2
-rw-r--r--lib/write-any-file.c2
-rw-r--r--lib/write.c2
-rw-r--r--lib/xalloc-die.c2
-rw-r--r--lib/xalloc-oversized.h2
-rw-r--r--lib/xalloc.h20
-rw-r--r--lib/xasprintf.c2
-rw-r--r--lib/xfreopen.c4
-rw-r--r--lib/xfts.c2
-rw-r--r--lib/xgetcwd.c2
-rw-r--r--lib/xgetcwd.h2
-rw-r--r--lib/xgetgroups.c2
-rw-r--r--lib/xgethostname.c2
-rw-r--r--lib/xmalloc.c2
-rw-r--r--lib/xmemcoll.c2
-rw-r--r--lib/xnanosleep.c2
-rw-r--r--lib/xprintf.c2
-rw-r--r--lib/xprintf.h2
-rw-r--r--lib/xreadlink.c2
-rw-r--r--lib/xreadlink.h2
-rw-r--r--lib/xsize.h5
-rw-r--r--lib/xstriconv.c2
-rw-r--r--lib/xstriconv.h2
-rw-r--r--lib/xstrndup.c2
-rw-r--r--lib/xstrndup.h2
-rw-r--r--lib/xstrtod.c2
-rw-r--r--lib/xstrtod.h2
-rw-r--r--lib/xstrtol-error.c2
-rw-r--r--lib/xstrtol.c4
-rw-r--r--lib/xstrtol.h2
-rw-r--r--lib/xtime.h5
-rw-r--r--lib/xvasprintf.c2
-rw-r--r--lib/xvasprintf.h2
-rw-r--r--lib/yesno.c2
-rw-r--r--lib/yesno.h2
620 files changed, 4423 insertions, 7316 deletions
diff --git a/lib/ChangeLog-2007 b/lib/ChangeLog-2007
index b872b2a0..f9bd37ff 100644
--- a/lib/ChangeLog-2007
+++ b/lib/ChangeLog-2007
@@ -8746,7 +8746,7 @@
-----
- Copyright (C) 2000-2013 Free Software Foundation, Inc.
+ Copyright (C) 2000-2014 Free Software Foundation, Inc.
Copying and distribution of this file, with or without
modification, are permitted provided the copyright notice
diff --git a/lib/acl-errno-valid.c b/lib/acl-errno-valid.c
new file mode 100644
index 00000000..3287382e
--- /dev/null
+++ b/lib/acl-errno-valid.c
@@ -0,0 +1,52 @@
+/* Test whether ACLs are well supported on this system.
+
+ Copyright 2013-2014 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
+
+ Written by Paul Eggert. */
+
+#include <config.h>
+
+#include <acl.h>
+
+#include <errno.h>
+
+/* Return true if errno value ERRNUM indicates that ACLs are well
+ supported on this system. ERRNUM should be an errno value obtained
+ after an ACL-related system call fails. */
+bool
+acl_errno_valid (int errnum)
+{
+ /* Recognize some common errors such as from an NFS mount that does
+ not support ACLs, even when local drives do. */
+ switch (errnum)
+ {
+ case EBUSY: return false;
+ case EINVAL: return false;
+#if defined __APPLE__ && defined __MACH__
+ case ENOENT: return false;
+#endif
+ case ENOSYS: return false;
+
+#if defined ENOTSUP && ENOTSUP != EOPNOTSUPP
+# if ENOTSUP != ENOSYS /* Needed for the MS-Windows port of GNU Emacs. */
+ case ENOTSUP: return false;
+# endif
+#endif
+
+ case EOPNOTSUPP: return false;
+ default: return true;
+ }
+}
diff --git a/lib/acl-internal.h b/lib/acl-internal.h
index 37c6ebfd..b2380068 100644
--- a/lib/acl-internal.h
+++ b/lib/acl-internal.h
@@ -1,6 +1,6 @@
/* Internal implementation of access control lists.
- Copyright (C) 2002-2003, 2005-2013 Free Software Foundation, Inc.
+ Copyright (C) 2002-2003, 2005-2014 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
@@ -44,16 +44,7 @@ extern int acl (char *, int, int, struct acl *);
extern int aclsort (int, int, struct acl *);
#endif
-#include "error.h"
-#include "quote.h"
-
#include <errno.h>
-#ifndef ENOSYS
-# define ENOSYS (-1)
-#endif
-#ifndef ENOTSUP
-# define ENOTSUP (-1)
-#endif
#include <limits.h>
#ifndef MIN
@@ -69,19 +60,9 @@ extern int aclsort (int, int, struct acl *);
# define fchmod(fd, mode) (-1)
#endif
-/* Recognize some common errors such as from an NFS mount that does
- not support ACLs, even when local drives do. */
-#if defined __APPLE__ && defined __MACH__ /* Mac OS X */
-# define ACL_NOT_WELL_SUPPORTED(Err) \
- ((Err) == ENOTSUP || (Err) == ENOSYS || (Err) == EINVAL || (Err) == EBUSY || (Err) == ENOENT)
-#elif defined EOPNOTSUPP /* Tru64 NFS */
-# define ACL_NOT_WELL_SUPPORTED(Err) \
- ((Err) == ENOTSUP || (Err) == ENOSYS || (Err) == EINVAL || (Err) == EBUSY || (Err) == EOPNOTSUPP)
-#else
-# define ACL_NOT_WELL_SUPPORTED(Err) \
- ((Err) == ENOTSUP || (Err) == ENOSYS || (Err) == EINVAL || (Err) == EBUSY)
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
#endif
-
_GL_INLINE_HEADER_BEGIN
#ifndef ACL_INTERNAL_INLINE
# define ACL_INTERNAL_INLINE _GL_INLINE
@@ -193,14 +174,14 @@ extern int acl_access_nontrivial (acl_t);
/* Return 1 if the given ACL is non-trivial.
Return 0 if it is trivial, i.e. equivalent to a simple stat() mode. */
-extern int acl_nontrivial (int count, aclent_t *entries);
+extern int acl_nontrivial (int count, aclent_t *entries) _GL_ATTRIBUTE_PURE;
# ifdef ACE_GETACL /* Solaris 10 */
/* Test an ACL retrieved with ACE_GETACL.
Return 1 if the given ACL, consisting of COUNT entries, is non-trivial.
Return 0 if it is trivial, i.e. equivalent to a simple stat() mode. */
-extern int acl_ace_nontrivial (int count, ace_t *entries);
+extern int acl_ace_nontrivial (int count, ace_t *entries) _GL_ATTRIBUTE_PURE;
/* Definitions for when the built executable is executed on Solaris 10
(newer version) or Solaris 11. */
diff --git a/lib/acl.h b/lib/acl.h
index 9471f994..f67e350d 100644
--- a/lib/acl.h
+++ b/lib/acl.h
@@ -1,6 +1,6 @@
/* acl.c - access control lists
- Copyright (C) 2002, 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2008-2014 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
@@ -17,12 +17,19 @@
Written by Paul Eggert. */
+#ifndef _GL_ACL_H
+#define _GL_ACL_H 1
+
+#include <stdbool.h>
#include <sys/types.h>
#include <sys/stat.h>
+bool acl_errno_valid (int) _GL_ATTRIBUTE_CONST;
int file_has_acl (char const *, struct stat const *);
int qset_acl (char const *, int, mode_t);
int set_acl (char const *, int, mode_t);
int qcopy_acl (char const *, int, char const *, int, mode_t);
int copy_acl (char const *, int, char const *, int, mode_t);
int chmod_or_fchmod (char const *, int, mode_t);
+
+#endif
diff --git a/lib/acl_entries.c b/lib/acl_entries.c
index 7ca7b9d5..39d6b28f 100644
--- a/lib/acl_entries.c
+++ b/lib/acl_entries.c
@@ -1,6 +1,6 @@
/* Return the number of entries in an ACL.
- Copyright (C) 2002-2003, 2005-2013 Free Software Foundation, Inc.
+ Copyright (C) 2002-2003, 2005-2014 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
diff --git a/lib/alignof.h b/lib/alignof.h
index 013d5141..9d161dfb 100644
--- a/lib/alignof.h
+++ b/lib/alignof.h
@@ -1,5 +1,5 @@
/* Determine alignment of types.
- Copyright (C) 2003-2004, 2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2003-2004, 2006, 2009-2014 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
@@ -41,7 +41,7 @@
- when -malign-double is specified: alignof_slot(double) = 8.
Note: The result cannot be used as a value for an 'enum' constant,
due to bugs in HP-UX 10.20 cc and AIX 3.2.5 xlc. */
-#if defined __GNUC__
+#if defined __GNUC__ || defined __IBM__ALIGNOF__
# define alignof_type __alignof__
#else
# define alignof_type alignof_slot
diff --git a/lib/alloca.in.h b/lib/alloca.in.h
index 72d28ee3..5de9aaab 100644
--- a/lib/alloca.in.h
+++ b/lib/alloca.in.h
@@ -1,6 +1,6 @@
/* Memory allocation on the stack.
- Copyright (C) 1995, 1999, 2001-2004, 2006-2013 Free Software Foundation,
+ Copyright (C) 1995, 1999, 2001-2004, 2006-2014 Free Software Foundation,
Inc.
This program is free software; you can redistribute it and/or modify it
diff --git a/lib/allocator.h b/lib/allocator.h
index b71fbbbb..0904b321 100644
--- a/lib/allocator.h
+++ b/lib/allocator.h
@@ -1,6 +1,6 @@
/* Memory allocators such as malloc+free.
- Copyright (C) 2011-2013 Free Software Foundation, Inc.
+ Copyright (C) 2011-2014 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
diff --git a/lib/anytostr.c b/lib/anytostr.c
index 1d2fca49..011a31fa 100644
--- a/lib/anytostr.c
+++ b/lib/anytostr.c
@@ -1,6 +1,6 @@
/* anytostr.c -- convert integers to printable strings
- Copyright (C) 2001, 2006, 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2006, 2008-2014 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,8 @@
/* Tell gcc not to warn about the (i < 0) test, below. */
#if (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) || 4 < __GNUC__
# pragma GCC diagnostic ignored "-Wtype-limits"
+#elif defined __clang__
+# pragma clang diagnostic ignored "-Wtautological-compare"
#endif
#include <config.h>
diff --git a/lib/areadlink-with-size.c b/lib/areadlink-with-size.c
index 29e0ef7a..161d4743 100644
--- a/lib/areadlink-with-size.c
+++ b/lib/areadlink-with-size.c
@@ -1,7 +1,7 @@
/* readlink wrapper to return the link name in malloc'd storage.
Unlike xreadlink and xreadlink_with_size, don't ever call exit.
- Copyright (C) 2001, 2003-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2003-2007, 2009-2014 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
diff --git a/lib/areadlink.c b/lib/areadlink.c
index fe65cc67..b4b856c5 100644
--- a/lib/areadlink.c
+++ b/lib/areadlink.c
@@ -1,7 +1,7 @@
/* areadlink.c -- readlink wrapper to return the link name in malloc'd storage
Unlike xreadlink and xreadlink_with_size, don't ever call exit.
- Copyright (C) 2001, 2003-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2003-2007, 2009-2014 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
@@ -26,6 +26,23 @@
#include "careadlinkat.h"
+#include <stdlib.h>
+#include <unistd.h>
+
+/* Get the symbolic link value of FILENAME and put it into BUFFER, with
+ size BUFFER_SIZE. This function acts like readlink but has
+ readlinkat's signature. */
+static ssize_t
+careadlinkatcwd (int fd, char const *filename, char *buffer,
+ size_t buffer_size)
+{
+ /* FD must be AT_FDCWD here, otherwise the caller is using this
+ function in contexts it was not meant for. */
+ if (fd != AT_FDCWD)
+ abort ();
+ return readlink (filename, buffer, buffer_size);
+}
+
/* Call readlink to get the symbolic link value of FILENAME.
Return a pointer to that NUL-terminated string in malloc'd storage.
If readlink fails, return NULL and set errno.
diff --git a/lib/areadlink.h b/lib/areadlink.h
index 5870ce59..59abb37c 100644
--- a/lib/areadlink.h
+++ b/lib/areadlink.h
@@ -1,6 +1,6 @@
/* Read symbolic links without size limitation.
- Copyright (C) 2001, 2003-2004, 2007, 2009-2013 Free Software Foundation,
+ Copyright (C) 2001, 2003-2004, 2007, 2009-2014 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/areadlinkat.c b/lib/areadlinkat.c
index 7676831b..9e1a9597 100644
--- a/lib/areadlinkat.c
+++ b/lib/areadlinkat.c
@@ -1,7 +1,7 @@
/* areadlinkat.c -- readlinkat wrapper to return malloc'd link name
Unlike xreadlinkat, only call exit on failure to change directory.
- Copyright (C) 2001, 2003-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2003-2007, 2009-2014 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
diff --git a/lib/argmatch.c b/lib/argmatch.c
index 9125e2af..f56ab55f 100644
--- a/lib/argmatch.c
+++ b/lib/argmatch.c
@@ -1,6 +1,6 @@
/* argmatch.c -- find a match for a string in an array
- Copyright (C) 1990, 1998-1999, 2001-2007, 2009-2013 Free Software
+ Copyright (C) 1990, 1998-1999, 2001-2007, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/argmatch.h b/lib/argmatch.h
index 2e0275cf..09645db6 100644
--- a/lib/argmatch.h
+++ b/lib/argmatch.h
@@ -1,6 +1,6 @@
/* argmatch.h -- definitions and prototypes for argmatch.c
- Copyright (C) 1990, 1998-1999, 2001-2002, 2004-2005, 2009-2013 Free Software
+ Copyright (C) 1990, 1998-1999, 2001-2002, 2004-2005, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -26,6 +26,10 @@
# include "verify.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
# define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array))
/* Assert there are as many real arguments as there are values
@@ -100,4 +104,8 @@ char const *argmatch_to_argument (char const *value,
argmatch_to_argument (Value, Arglist, \
(char const *) (Vallist), sizeof *(Vallist))
+#ifdef __cplusplus
+}
+#endif
+
#endif /* ARGMATCH_H_ */
diff --git a/lib/argv-iter.c b/lib/argv-iter.c
index a17d8689..f0704a47 100644
--- a/lib/argv-iter.c
+++ b/lib/argv-iter.c
@@ -1,5 +1,5 @@
/* Iterate over arguments from argv or --files0-from=FILE
- Copyright (C) 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2008-2014 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
diff --git a/lib/argv-iter.h b/lib/argv-iter.h
index 82237f54..f2cf77d3 100644
--- a/lib/argv-iter.h
+++ b/lib/argv-iter.h
@@ -1,5 +1,5 @@
/* Iterate over arguments from argv or --files0-from=FILE
- Copyright (C) 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2008-2014 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
diff --git a/lib/arpa_inet.in.h b/lib/arpa_inet.in.h
index ba89e977..b8c2e18b 100644
--- a/lib/arpa_inet.in.h
+++ b/lib/arpa_inet.in.h
@@ -1,6 +1,6 @@
/* A GNU-like <arpa/inet.h>.
- Copyright (C) 2005-2006, 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2008-2014 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
diff --git a/lib/asnprintf.c b/lib/asnprintf.c
index 76e228d8..0c62197f 100644
--- a/lib/asnprintf.c
+++ b/lib/asnprintf.c
@@ -1,5 +1,5 @@
/* Formatted output to strings.
- Copyright (C) 1999, 2002, 2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2014 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
diff --git a/lib/asprintf.c b/lib/asprintf.c
index 713dae13..9a69ac48 100644
--- a/lib/asprintf.c
+++ b/lib/asprintf.c
@@ -1,5 +1,5 @@
/* Formatted output to strings.
- Copyright (C) 1999, 2002, 2006-2007, 2009-2013 Free Software Foundation,
+ Copyright (C) 1999, 2002, 2006-2007, 2009-2014 Free Software Foundation,
Inc.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/at-func.c b/lib/at-func.c
index 03c56788..c8ee073d 100644
--- a/lib/at-func.c
+++ b/lib/at-func.c
@@ -1,5 +1,5 @@
/* Define at-style functions like fstatat, unlinkat, fchownat, etc.
- Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2009-2014 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
diff --git a/lib/at-func2.c b/lib/at-func2.c
index bbbddc0b..b4d6067a 100644
--- a/lib/at-func2.c
+++ b/lib/at-func2.c
@@ -1,5 +1,5 @@
/* Define 2-FD at-style functions like linkat or renameat.
- Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2009-2014 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
diff --git a/lib/backupfile.c b/lib/backupfile.c
index 83e0649f..2ad030f8 100644
--- a/lib/backupfile.c
+++ b/lib/backupfile.c
@@ -1,6 +1,6 @@
/* backupfile.c -- make Emacs style backup file names
- Copyright (C) 1990-2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 1990-2006, 2009-2014 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
diff --git a/lib/backupfile.h b/lib/backupfile.h
index 43b51d42..e2034c77 100644
--- a/lib/backupfile.h
+++ b/lib/backupfile.h
@@ -1,6 +1,6 @@
/* backupfile.h -- declarations for making Emacs style backup file names
- Copyright (C) 1990-1992, 1997-1999, 2003-2004, 2009-2013 Free Software
+ Copyright (C) 1990-1992, 1997-1999, 2003-2004, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/base64.c b/lib/base64.c
index 8da969c0..c7f7ac58 100644
--- a/lib/base64.c
+++ b/lib/base64.c
@@ -1,5 +1,5 @@
/* base64.c -- Encode binary data using printable characters.
- Copyright (C) 1999-2001, 2004-2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 1999-2001, 2004-2006, 2009-2014 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
@@ -59,6 +59,27 @@ to_uchar (char ch)
return ch;
}
+static const char b64c[64] =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
+/* Base64 encode IN array of size INLEN into OUT array. OUT needs
+ to be of length >= BASE64_LENGTH(INLEN), and INLEN needs to be
+ a multiple of 3. */
+static void
+base64_encode_fast (const char *restrict in, size_t inlen, char *restrict out)
+{
+ while (inlen)
+ {
+ *out++ = b64c[to_uchar (in[0]) >> 2];
+ *out++ = b64c[((to_uchar (in[0]) << 4) + (to_uchar (in[1]) >> 4)) & 0x3f];
+ *out++ = b64c[((to_uchar (in[1]) << 2) + (to_uchar (in[2]) >> 6)) & 0x3f];
+ *out++ = b64c[to_uchar (in[2]) & 0x3f];
+
+ inlen -= 3;
+ in += 3;
+ }
+}
+
/* Base64 encode IN array of size INLEN into OUT array of size OUTLEN.
If OUTLEN is less than BASE64_LENGTH(INLEN), write as many bytes as
possible. If OUTLEN is larger than BASE64_LENGTH(INLEN), also zero
@@ -67,28 +88,38 @@ void
base64_encode (const char *restrict in, size_t inlen,
char *restrict out, size_t outlen)
{
- static const char b64str[64] =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+ /* Note this outlen constraint can be enforced at compile time.
+ I.E. that the output buffer is exactly large enough to hold
+ the encoded inlen bytes. The inlen constraints (of corresponding
+ to outlen, and being a multiple of 3) can change at runtime
+ at the end of input. However the common case when reading
+ large inputs is to have both constraints satisfied, so we depend
+ on both in base_encode_fast(). */
+ if (outlen % 4 == 0 && inlen == outlen / 4 * 3)
+ {
+ base64_encode_fast (in, inlen, out);
+ return;
+ }
while (inlen && outlen)
{
- *out++ = b64str[(to_uchar (in[0]) >> 2) & 0x3f];
+ *out++ = b64c[to_uchar (in[0]) >> 2];
if (!--outlen)
break;
- *out++ = b64str[((to_uchar (in[0]) << 4)
+ *out++ = b64c[((to_uchar (in[0]) << 4)
+ (--inlen ? to_uchar (in[1]) >> 4 : 0))
& 0x3f];
if (!--outlen)
break;
*out++ =
(inlen
- ? b64str[((to_uchar (in[1]) << 2)
+ ? b64c[((to_uchar (in[1]) << 2)
+ (--inlen ? to_uchar (in[2]) >> 6 : 0))
& 0x3f]
: '=');
if (!--outlen)
break;
- *out++ = inlen ? b64str[to_uchar (in[2]) & 0x3f] : '=';
+ *out++ = inlen ? b64c[to_uchar (in[2]) & 0x3f] : '=';
if (!--outlen)
break;
if (inlen)
diff --git a/lib/base64.h b/lib/base64.h
index 343150cb..f550cccf 100644
--- a/lib/base64.h
+++ b/lib/base64.h
@@ -1,5 +1,5 @@
/* base64.h -- Encode binary data using printable characters.
- Copyright (C) 2004-2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2004-2006, 2009-2014 Free Software Foundation, Inc.
Written by Simon Josefsson.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/basename-lgpl.c b/lib/basename-lgpl.c
index 9307e831..cec50e93 100644
--- a/lib/basename-lgpl.c
+++ b/lib/basename-lgpl.c
@@ -1,6 +1,6 @@
/* basename.c -- return the last element in a file name
- Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2013 Free Software
+ Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/basename.c b/lib/basename.c
index d73fd41a..67d9420a 100644
--- a/lib/basename.c
+++ b/lib/basename.c
@@ -1,6 +1,6 @@
/* basename.c -- return the last element in a file name
- Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2013 Free Software
+ Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/binary-io.c b/lib/binary-io.c
deleted file mode 100644
index 8bbdb44d..00000000
--- a/lib/binary-io.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <config.h>
-#define BINARY_IO_INLINE _GL_EXTERN_INLINE
-#include "binary-io.h"
diff --git a/lib/binary-io.h b/lib/binary-io.h
deleted file mode 100644
index 317fe3d3..00000000
--- a/lib/binary-io.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Binary mode I/O.
- Copyright (C) 2001, 2003, 2005, 2008-2013 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
-
-#ifndef _BINARY_H
-#define _BINARY_H
-
-/* For systems that distinguish between text and binary I/O.
- O_BINARY is guaranteed by the gnulib <fcntl.h>. */
-#include <fcntl.h>
-
-/* The MSVC7 <stdio.h> doesn't like to be included after '#define fileno ...',
- so we include it here first. */
-#include <stdio.h>
-
-_GL_INLINE_HEADER_BEGIN
-#ifndef BINARY_IO_INLINE
-# define BINARY_IO_INLINE _GL_INLINE
-#endif
-
-/* set_binary_mode (fd, mode)
- sets the binary/text I/O mode of file descriptor fd to the given mode
- (must be O_BINARY or O_TEXT) and returns the previous mode. */
-#if O_BINARY
-# if defined __EMX__ || defined __DJGPP__ || defined __CYGWIN__
-# include <io.h> /* declares setmode() */
-# define set_binary_mode setmode
-# else
-# define set_binary_mode _setmode
-# undef fileno
-# define fileno _fileno
-# endif
-#else
- /* On reasonable systems, binary I/O is the only choice. */
- /* Use a function rather than a macro, to avoid gcc warnings
- "warning: statement with no effect". */
-BINARY_IO_INLINE int
-set_binary_mode (int fd, int mode)
-{
- (void) fd;
- (void) mode;
- return O_BINARY;
-}
-#endif
-
-/* SET_BINARY (fd);
- changes the file descriptor fd to perform binary I/O. */
-#ifdef __DJGPP__
-# include <unistd.h> /* declares isatty() */
- /* Avoid putting stdin/stdout in binary mode if it is connected to
- the console, because that would make it impossible for the user
- to interrupt the program through Ctrl-C or Ctrl-Break. */
-# define SET_BINARY(fd) ((void) (!isatty (fd) ? (set_binary_mode (fd, O_BINARY), 0) : 0))
-#else
-# define SET_BINARY(fd) ((void) set_binary_mode (fd, O_BINARY))
-#endif
-
-_GL_INLINE_HEADER_END
-
-#endif /* _BINARY_H */
diff --git a/lib/bitrotate.h b/lib/bitrotate.h
index 9e10a45f..9ec0b47b 100644
--- a/lib/bitrotate.h
+++ b/lib/bitrotate.h
@@ -1,5 +1,5 @@
/* bitrotate.h - Rotate bits in integers
- Copyright (C) 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2008-2014 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
@@ -23,6 +23,9 @@
#include <stdint.h>
#include <sys/types.h>
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
_GL_INLINE_HEADER_BEGIN
#ifndef BITROTATE_INLINE
# define BITROTATE_INLINE _GL_INLINE
diff --git a/lib/btowc.c b/lib/btowc.c
index 6c7cbec9..b06ca2e4 100644
--- a/lib/btowc.c
+++ b/lib/btowc.c
@@ -1,5 +1,5 @@
/* Convert unibyte character to wide character.
- Copyright (C) 2008, 2010-2013 Free Software Foundation, Inc.
+ Copyright (C) 2008, 2010-2014 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2008.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/buffer-lcm.c b/lib/buffer-lcm.c
index 5843452a..d27e1564 100644
--- a/lib/buffer-lcm.c
+++ b/lib/buffer-lcm.c
@@ -1,6 +1,6 @@
/* buffer-lcm.c - compute a good buffer size for dealing with two files
- Copyright (C) 2002-2013 Free Software Foundation, Inc.
+ Copyright (C) 2002-2014 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
diff --git a/lib/c-ctype.c b/lib/c-ctype.c
index 752d2e32..48c64783 100644
--- a/lib/c-ctype.c
+++ b/lib/c-ctype.c
@@ -1,6 +1,6 @@
/* Character handling in C locale.
- Copyright 2000-2003, 2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright 2000-2003, 2006, 2009-2014 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
diff --git a/lib/c-ctype.h b/lib/c-ctype.h
index 3a66440a..b4652776 100644
--- a/lib/c-ctype.h
+++ b/lib/c-ctype.h
@@ -5,7 +5,7 @@
<ctype.h> functions' behaviour depends on the current locale set via
setlocale.
- Copyright (C) 2000-2003, 2006, 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2000-2003, 2006, 2008-2014 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
@@ -136,7 +136,8 @@ extern int c_tolower (int c) _GL_ATTRIBUTE_CONST;
extern int c_toupper (int c) _GL_ATTRIBUTE_CONST;
-#if defined __GNUC__ && defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ && !defined NO_C_CTYPE_MACROS
+#if (defined __GNUC__ && !defined __STRICT_ANSI__ && defined __OPTIMIZE__ \
+ && !defined __OPTIMIZE_SIZE__ && !defined NO_C_CTYPE_MACROS)
/* ASCII optimizations. */
diff --git a/lib/c-strcase.h b/lib/c-strcase.h
index 49e1bb03..8e660441 100644
--- a/lib/c-strcase.h
+++ b/lib/c-strcase.h
@@ -1,5 +1,5 @@
/* Case-insensitive string comparison functions in C locale.
- Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2013 Free Software
+ Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2014 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/c-strcasecmp.c b/lib/c-strcasecmp.c
index ef85f0e6..b9b26a4c 100644
--- a/lib/c-strcasecmp.c
+++ b/lib/c-strcasecmp.c
@@ -1,5 +1,5 @@
/* c-strcasecmp.c -- case insensitive string comparator in C locale
- Copyright (C) 1998-1999, 2005-2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 1998-1999, 2005-2006, 2009-2014 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
diff --git a/lib/c-strcaseeq.h b/lib/c-strcaseeq.h
index afdea26b..5139a30b 100644
--- a/lib/c-strcaseeq.h
+++ b/lib/c-strcaseeq.h
@@ -1,5 +1,5 @@
/* Optimized case-insensitive string comparison in C locale.
- Copyright (C) 2001-2002, 2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2001-2002, 2007, 2009-2014 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
diff --git a/lib/c-strncasecmp.c b/lib/c-strncasecmp.c
index 04404b00..972eb800 100644
--- a/lib/c-strncasecmp.c
+++ b/lib/c-strncasecmp.c
@@ -1,5 +1,5 @@
/* c-strncasecmp.c -- case insensitive string comparator in C locale
- Copyright (C) 1998-1999, 2005-2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 1998-1999, 2005-2006, 2009-2014 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
diff --git a/lib/c-strtod.c b/lib/c-strtod.c
index 2705a2b5..c1c771c5 100644
--- a/lib/c-strtod.c
+++ b/lib/c-strtod.c
@@ -1,6 +1,6 @@
/* Convert string to double, using the C locale.
- Copyright (C) 2003-2004, 2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2003-2004, 2006, 2009-2014 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
diff --git a/lib/c-strtod.h b/lib/c-strtod.h
index 140f3469..2460668b 100644
--- a/lib/c-strtod.h
+++ b/lib/c-strtod.h
@@ -1,6 +1,6 @@
/* Convert string to double, using the C locale.
- Copyright (C) 2003-2004, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2003-2004, 2009-2014 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
diff --git a/lib/calloc.c b/lib/calloc.c
index 475d0aea..6fbca8b9 100644
--- a/lib/calloc.c
+++ b/lib/calloc.c
@@ -1,6 +1,6 @@
/* calloc() function that is glibc compatible.
This wrapper function is required at least on Tru64 UNIX 5.1 and mingw.
- Copyright (C) 2004-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2004-2007, 2009-2014 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
diff --git a/lib/canon-host.c b/lib/canon-host.c
index d6106890..862a7010 100644
--- a/lib/canon-host.c
+++ b/lib/canon-host.c
@@ -1,6 +1,6 @@
/* Host name canonicalization
- Copyright (C) 2005-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005-2014 Free Software Foundation, Inc.
Written by Derek Price <derek@ximbiot.com>.
diff --git a/lib/canon-host.h b/lib/canon-host.h
index c26db6bf..5f564817 100644
--- a/lib/canon-host.h
+++ b/lib/canon-host.h
@@ -1,6 +1,6 @@
/* Host name canonicalization
- Copyright (C) 2005, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2009-2014 Free Software Foundation, Inc.
Written by Derek Price <derek@ximbiot.com>
diff --git a/lib/canonicalize.c b/lib/canonicalize.c
index 6a39a022..2b94ebc0 100644
--- a/lib/canonicalize.c
+++ b/lib/canonicalize.c
@@ -1,5 +1,5 @@
/* Return the canonical absolute name of a given file.
- Copyright (C) 1996-2013 Free Software Foundation, Inc.
+ Copyright (C) 1996-2014 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
diff --git a/lib/canonicalize.h b/lib/canonicalize.h
index 41ff311d..5fac1191 100644
--- a/lib/canonicalize.h
+++ b/lib/canonicalize.h
@@ -1,5 +1,5 @@
/* Return the canonical absolute name of a given file.
- Copyright (C) 1996-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 1996-2007, 2009-2014 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
diff --git a/lib/careadlinkat.c b/lib/careadlinkat.c
index 1a759be7..b36fea28 100644
--- a/lib/careadlinkat.c
+++ b/lib/careadlinkat.c
@@ -1,6 +1,6 @@
/* Read symbolic links into a buffer without size limitation, relative to fd.
- Copyright (C) 2001, 2003-2004, 2007, 2009-2013 Free Software Foundation,
+ Copyright (C) 2001, 2003-2004, 2007, 2009-2014 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
@@ -24,7 +24,6 @@
#include <errno.h>
#include <limits.h>
-#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -39,20 +38,6 @@
#include "allocator.h"
-/* Get the symbolic link value of FILENAME and put it into BUFFER, with
- size BUFFER_SIZE. This function acts like readlink but has
- readlinkat's signature. */
-ssize_t
-careadlinkatcwd (int fd, char const *filename, char *buffer,
- size_t buffer_size)
-{
- /* FD must be AT_FDCWD here, otherwise the caller is using this
- function in contexts for which it was not meant for. */
- if (fd != AT_FDCWD)
- abort ();
- return readlink (filename, buffer, buffer_size);
-}
-
/* Assuming the current directory is FD, get the symbolic link value
of FILENAME as a null-terminated string and put it into a buffer.
If FD is AT_FDCWD, FILENAME is interpreted relative to the current
diff --git a/lib/careadlinkat.h b/lib/careadlinkat.h
index 5cdb813f..704f8159 100644
--- a/lib/careadlinkat.h
+++ b/lib/careadlinkat.h
@@ -1,6 +1,6 @@
/* Read symbolic links into a buffer without size limitation, relative to fd.
- Copyright (C) 2011-2013 Free Software Foundation, Inc.
+ Copyright (C) 2011-2014 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
@@ -52,21 +52,16 @@ char *careadlinkat (int fd, char const *filename,
ssize_t (*preadlinkat) (int, char const *,
char *, size_t));
-/* Suitable values for careadlinkat's FD and PREADLINKAT arguments,
- when doing a plain readlink:
- Pass FD = AT_FDCWD and PREADLINKAT = careadlinkatcwd. */
+/* Suitable value for careadlinkat's FD argument. */
#if HAVE_READLINKAT
/* AT_FDCWD is declared in <fcntl.h>. */
#else
/* Define AT_FDCWD independently, so that the careadlinkat module does
- not depend on the fcntl-h module. The value does not matter, since
- careadlinkatcwd ignores it, but we might as well use the same value
+ not depend on the fcntl-h module. We might as well use the same value
as fcntl-h. */
# ifndef AT_FDCWD
# define AT_FDCWD (-3041965)
# endif
#endif
-ssize_t careadlinkatcwd (int fd, char const *filename,
- char *buffer, size_t buffer_size);
#endif /* _GL_CAREADLINKAT_H */
diff --git a/lib/chdir-long.c b/lib/chdir-long.c
index 9c018250..5b1b18fc 100644
--- a/lib/chdir-long.c
+++ b/lib/chdir-long.c
@@ -1,5 +1,5 @@
/* provide a chdir function that tries not to fail due to ENAMETOOLONG
- Copyright (C) 2004-2013 Free Software Foundation, Inc.
+ Copyright (C) 2004-2014 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
diff --git a/lib/chdir-long.h b/lib/chdir-long.h
index 26f7706a..4b5b9404 100644
--- a/lib/chdir-long.h
+++ b/lib/chdir-long.h
@@ -1,5 +1,5 @@
/* provide a chdir function that tries not to fail due to ENAMETOOLONG
- Copyright (C) 2004-2005, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2004-2005, 2009-2014 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
diff --git a/lib/chown.c b/lib/chown.c
index b2121985..691cebe4 100644
--- a/lib/chown.c
+++ b/lib/chown.c
@@ -1,7 +1,7 @@
/* provide consistent interface to chown for systems that don't interpret
an ID of -1 as meaning "don't change the corresponding ID".
- Copyright (C) 1997, 2004-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2004-2007, 2009-2014 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
@@ -45,11 +45,6 @@ chown (const char *file _GL_UNUSED, uid_t uid _GL_UNUSED,
/* Below we refer to the system's chown(). */
# undef chown
-/* The results of open() in this file are not used with fchdir,
- therefore save some unnecessary work in fchdir.c. */
-# undef open
-# undef close
-
/* Provide a more-closely POSIX-conforming version of chown on
systems with one or both of the following problems:
- chown doesn't treat an ID of -1 as meaning
diff --git a/lib/cloexec.c b/lib/cloexec.c
index e3e42d28..48a0c973 100644
--- a/lib/cloexec.c
+++ b/lib/cloexec.c
@@ -1,6 +1,6 @@
/* closexec.c - set or clear the close-on-exec descriptor flag
- Copyright (C) 1991, 2004-2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 1991, 2004-2006, 2009-2014 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
diff --git a/lib/cloexec.h b/lib/cloexec.h
index 0c5935ba..6c442dca 100644
--- a/lib/cloexec.h
+++ b/lib/cloexec.h
@@ -1,6 +1,6 @@
/* closexec.c - set or clear the close-on-exec descriptor flag
- Copyright (C) 2004, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2009-2014 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
diff --git a/lib/close-stream.c b/lib/close-stream.c
index d6a86928..87921d42 100644
--- a/lib/close-stream.c
+++ b/lib/close-stream.c
@@ -1,6 +1,6 @@
/* Close a stream, with nicer error checking than fclose's.
- Copyright (C) 1998-2002, 2004, 2006-2013 Free Software Foundation, Inc.
+ Copyright (C) 1998-2002, 2004, 2006-2014 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
diff --git a/lib/close.c b/lib/close.c
index f620e54b..d7dcb3f1 100644
--- a/lib/close.c
+++ b/lib/close.c
@@ -1,5 +1,5 @@
/* close replacement.
- Copyright (C) 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2008-2014 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
diff --git a/lib/closedir.c b/lib/closedir.c
index fa8e2106..940c6f9f 100644
--- a/lib/closedir.c
+++ b/lib/closedir.c
@@ -1,5 +1,5 @@
/* Stop reading the entries of a directory.
- Copyright (C) 2006-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006-2014 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
diff --git a/lib/closein.c b/lib/closein.c
index 20d5035e..5b2c9150 100644
--- a/lib/closein.c
+++ b/lib/closein.c
@@ -1,6 +1,6 @@
/* Close standard input, rewinding seekable stdin if necessary.
- Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2014 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
diff --git a/lib/closein.h b/lib/closein.h
index 84bbeefc..1c01156f 100644
--- a/lib/closein.h
+++ b/lib/closein.h
@@ -1,6 +1,6 @@
/* Close standard input, rewinding seekable stdin if necessary.
- Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2014 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
diff --git a/lib/closeout.c b/lib/closeout.c
index d4d3edca..674db787 100644
--- a/lib/closeout.c
+++ b/lib/closeout.c
@@ -1,6 +1,6 @@
/* Close standard output and standard error, exiting with a diagnostic on error.
- Copyright (C) 1998-2002, 2004, 2006, 2008-2013 Free Software Foundation,
+ Copyright (C) 1998-2002, 2004, 2006, 2008-2014 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/closeout.h b/lib/closeout.h
index 131fe864..28d80ea5 100644
--- a/lib/closeout.h
+++ b/lib/closeout.h
@@ -1,6 +1,6 @@
/* Close standard output and standard error.
- Copyright (C) 1998, 2000, 2003-2004, 2006, 2008-2013 Free Software
+ Copyright (C) 1998, 2000, 2003-2004, 2006, 2008-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/config.charset b/lib/config.charset
index a991419c..289bc44e 100644
--- a/lib/config.charset
+++ b/lib/config.charset
@@ -1,7 +1,7 @@
#! /bin/sh
# Output a system dependent table of character encoding aliases.
#
-# Copyright (C) 2000-2004, 2006-2013 Free Software Foundation, Inc.
+# Copyright (C) 2000-2004, 2006-2014 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
diff --git a/lib/config.hin b/lib/config.hin
index e59c4149..ce408318 100644
--- a/lib/config.hin
+++ b/lib/config.hin
@@ -41,12 +41,12 @@
/* Define to 1 if chown mishandles trailing slash. */
#undef CHOWN_TRAILING_SLASH_BUG
-/* Define to one of '_getb67', 'GETB67', 'getb67' for Cray-2 and Cray-YMP
- systems. This function is required for 'alloca.c' support on those systems.
+/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
+ systems. This function is required for `alloca.c' support on those systems.
*/
#undef CRAY_STACKSEG_END
-/* Define to 1 if using 'alloca.c'. */
+/* Define to 1 if using `alloca.c'. */
#undef C_ALLOCA
/* Define as the bit index in the word where to find bit 0 of the exponent of
@@ -143,6 +143,10 @@
/* Define to 1 if the system's ftello function has the Solaris bug. */
#undef FTELLO_BROKEN_AFTER_SWITCHING_FROM_READ_TO_WRITE
+/* Define to 1 if fflush is known to work on stdin as per POSIX.1-2008, 0 if
+ fflush is known to not work, -1 if unknown. */
+#undef FUNC_FFLUSH_STDIN
+
/* Define to 1 if mkdir mistakenly creates a directory given with a trailing
dot component. */
#undef FUNC_MKDIR_DOT_BUG
@@ -252,6 +256,10 @@
#undef GNULIB_GETCWD
/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
+ whether the gnulib module lock shall be considered present. */
+#undef GNULIB_LOCK
+
+/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
whether the gnulib module malloc-gnu shall be considered present. */
#undef GNULIB_MALLOC_GNU
@@ -263,14 +271,14 @@
whether the gnulib module openat-safer shall be considered present. */
#undef GNULIB_OPENAT_SAFER
-/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
- whether the gnulib module pipe2-safer shall be considered present. */
-#undef GNULIB_PIPE2_SAFER
-
/* enable some gnulib portability checks */
#undef GNULIB_PORTCHECK
/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
+ whether the gnulib module pthread shall be considered present. */
+#undef GNULIB_PTHREAD
+
+/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
whether the gnulib module realloc-gnu shall be considered present. */
#undef GNULIB_REALLOC_GNU
@@ -558,57 +566,12 @@
/* Define to 1 when the gnulib module pipe should be tested. */
#undef GNULIB_TEST_PIPE
-/* Define to 1 when the gnulib module pipe2 should be tested. */
-#undef GNULIB_TEST_PIPE2
-
-/* Define to 1 when the gnulib module posix_spawnattr_destroy should be
- tested. */
-#undef GNULIB_TEST_POSIX_SPAWNATTR_DESTROY
-
-/* Define to 1 when the gnulib module posix_spawnattr_init should be tested.
- */
-#undef GNULIB_TEST_POSIX_SPAWNATTR_INIT
-
-/* Define to 1 when the gnulib module posix_spawnattr_setflags should be
- tested. */
-#undef GNULIB_TEST_POSIX_SPAWNATTR_SETFLAGS
-
-/* Define to 1 when the gnulib module posix_spawnattr_setsigmask should be
- tested. */
-#undef GNULIB_TEST_POSIX_SPAWNATTR_SETSIGMASK
-
-/* Define to 1 when the gnulib module posix_spawnp should be tested. */
-#undef GNULIB_TEST_POSIX_SPAWNP
-
-/* Define to 1 when the gnulib module posix_spawn_file_actions_addclose should
- be tested. */
-#undef GNULIB_TEST_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE
-
-/* Define to 1 when the gnulib module posix_spawn_file_actions_adddup2 should
- be tested. */
-#undef GNULIB_TEST_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2
-
-/* Define to 1 when the gnulib module posix_spawn_file_actions_addopen should
- be tested. */
-#undef GNULIB_TEST_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN
-
-/* Define to 1 when the gnulib module posix_spawn_file_actions_destroy should
- be tested. */
-#undef GNULIB_TEST_POSIX_SPAWN_FILE_ACTIONS_DESTROY
-
-/* Define to 1 when the gnulib module posix_spawn_file_actions_init should be
- tested. */
-#undef GNULIB_TEST_POSIX_SPAWN_FILE_ACTIONS_INIT
-
/* Define to 1 when the gnulib module putenv should be tested. */
#undef GNULIB_TEST_PUTENV
/* Define to 1 when the gnulib module raise should be tested. */
#undef GNULIB_TEST_RAISE
-/* Define to 1 when the gnulib module rawmemchr should be tested. */
-#undef GNULIB_TEST_RAWMEMCHR
-
/* Define to 1 when the gnulib module read should be tested. */
#undef GNULIB_TEST_READ
@@ -639,6 +602,9 @@
/* Define to 1 when the gnulib module rpmatch should be tested. */
#undef GNULIB_TEST_RPMATCH
+/* Define to 1 when the gnulib module secure_getenv should be tested. */
+#undef GNULIB_TEST_SECURE_GETENV
+
/* Define to 1 when the gnulib module select should be tested. */
#undef GNULIB_TEST_SELECT
@@ -678,9 +644,6 @@
/* Define to 1 when the gnulib module stpncpy should be tested. */
#undef GNULIB_TEST_STPNCPY
-/* Define to 1 when the gnulib module strchrnul should be tested. */
-#undef GNULIB_TEST_STRCHRNUL
-
/* Define to 1 when the gnulib module strdup should be tested. */
#undef GNULIB_TEST_STRDUP
@@ -735,9 +698,6 @@
/* Define to 1 when the gnulib module unsetenv should be tested. */
#undef GNULIB_TEST_UNSETENV
-/* Define to 1 when the gnulib module usleep should be tested. */
-#undef GNULIB_TEST_USLEEP
-
/* Define to 1 when the gnulib module utimensat should be tested. */
#undef GNULIB_TEST_UTIMENSAT
@@ -750,9 +710,6 @@
/* Define to 1 when the gnulib module vprintf-posix should be tested. */
#undef GNULIB_TEST_VPRINTF_POSIX
-/* Define to 1 when the gnulib module waitpid should be tested. */
-#undef GNULIB_TEST_WAITPID
-
/* Define to 1 when the gnulib module wcrtomb should be tested. */
#undef GNULIB_TEST_WCRTOMB
@@ -861,9 +818,6 @@
/* Define to 1 if the ACL type ACL_TYPE_EXTENDED exists. */
#undef HAVE_ACL_TYPE_EXTENDED
-/* Define to 1 if you have the `alarm' function. */
-#undef HAVE_ALARM
-
/* Define to 1 if you have 'alloca' after including <alloca.h>, a header that
may be supplied by this distribution. */
#undef HAVE_ALLOCA
@@ -944,9 +898,6 @@
/* Define if you have compound literals. */
#undef HAVE_COMPOUND_LITERALS
-/* Define to 1 if you have the `confstr' function. */
-#undef HAVE_CONFSTR
-
/* Define if the copysignf function is declared in <math.h> and available in
libc. */
#undef HAVE_COPYSIGNF_IN_LIBC
@@ -1290,6 +1241,10 @@
don't. */
#undef HAVE_DECL_WCWIDTH
+/* Define to 1 if you have the declaration of `_putenv', and to 0 if you
+ don't. */
+#undef HAVE_DECL__PUTENV
+
/* Define to 1 if you have the declaration of `_snprintf', and to 0 if you
don't. */
#undef HAVE_DECL__SNPRINTF
@@ -1425,6 +1380,9 @@
/* Define to 1 if you have the `getacl' function. */
#undef HAVE_GETACL
+/* Define to 1 if you have the `getattrat' function. */
+#undef HAVE_GETATTRAT
+
/* Define to 1 if you have the `getdelim' function. */
#undef HAVE_GETDELIM
@@ -1497,6 +1455,9 @@
/* Define if you have GNU libgmp (or replacement) */
#undef HAVE_GMP
+/* Define to 1 if you have the <gmp.h> header file. */
+#undef HAVE_GMP_H
+
/* Define to 1 if you have the <grp.h> header file. */
#undef HAVE_GRP_H
@@ -1569,6 +1530,9 @@
/* Define if the isnan(long double) function is available in libc. */
#undef HAVE_ISNANL_IN_LIBC
+/* Define to 1 if you have the `issetugid' function. */
+#undef HAVE_ISSETUGID
+
/* Define to 1 if you have the `iswblank' function. */
#undef HAVE_ISWBLANK
@@ -1657,6 +1621,9 @@
to 0 otherwise. */
#undef HAVE_MALLOC_GNU
+/* Define to 1 if you have the <malloc.h> header file. */
+#undef HAVE_MALLOC_H
+
/* Define if the 'malloc' function is POSIX compliant. */
#undef HAVE_MALLOC_POSIX
@@ -1716,6 +1683,9 @@
/* Define to 1 if you have the <mntent.h> header file. */
#undef HAVE_MNTENT_H
+/* Define to 1 if you have the `mode_to_security_class' function. */
+#undef HAVE_MODE_TO_SECURITY_CLASS
+
/* Define to 1 if you have the `mprotect' function. */
#undef HAVE_MPROTECT
@@ -1765,6 +1735,18 @@
/* Define to 1 if you have the `opendir' function. */
#undef HAVE_OPENDIR
+/* Define to 1 if libcrypto is used for MD5. */
+#undef HAVE_OPENSSL_MD5
+
+/* Define to 1 if libcrypto is used for SHA1. */
+#undef HAVE_OPENSSL_SHA1
+
+/* Define to 1 if libcrypto is used for SHA256. */
+#undef HAVE_OPENSSL_SHA256
+
+/* Define to 1 if libcrypto is used for SHA512. */
+#undef HAVE_OPENSSL_SHA512
+
/* Define to 1 if you have the <OS.h> header file. */
#undef HAVE_OS_H
@@ -1781,21 +1763,9 @@
/* Define to 1 if you have the `pipe' function. */
#undef HAVE_PIPE
-/* Define to 1 if you have the `pipe2' function. */
-#undef HAVE_PIPE2
-
/* Define to 1 if you have the `posix_fadvise' function. */
#undef HAVE_POSIX_FADVISE
-/* Define to 1 if you have the `posix_spawn' function. */
-#undef HAVE_POSIX_SPAWN
-
-/* Define to 1 if the system has the type `posix_spawnattr_t'. */
-#undef HAVE_POSIX_SPAWNATTR_T
-
-/* Define to 1 if the system has the type `posix_spawn_file_actions_t'. */
-#undef HAVE_POSIX_SPAWN_FILE_ACTIONS_T
-
/* Define to 1 if you have the `prctl' function. */
#undef HAVE_PRCTL
@@ -1835,9 +1805,6 @@
/* Define to 1 if you have the `raise' function. */
#undef HAVE_RAISE
-/* Define to 1 if you have the `rawmemchr' function. */
-#undef HAVE_RAWMEMCHR
-
/* Define to 1 if you have the `readdir' function. */
#undef HAVE_READDIR
@@ -1884,15 +1851,12 @@
/* Define to 1 if you have the <sched.h> header file. */
#undef HAVE_SCHED_H
-/* Define to 1 if you have the `sched_setparam' function. */
-#undef HAVE_SCHED_SETPARAM
-
-/* Define to 1 if you have the `sched_setscheduler' function. */
-#undef HAVE_SCHED_SETSCHEDULER
-
/* Define to 1 if you have the <search.h> header file. */
#undef HAVE_SEARCH_H
+/* Define to 1 if you have the `secure_getenv' function. */
+#undef HAVE_SECURE_GETENV
+
/* Define to 1 if you have the <selinux/context.h> header file. */
#undef HAVE_SELINUX_CONTEXT_H
@@ -1902,15 +1866,12 @@
/* Define to 1 if you have the <selinux/selinux.h> header file. */
#undef HAVE_SELINUX_SELINUX_H
-/* Define to 1 if you have the `setegid' function. */
-#undef HAVE_SETEGID
+/* Define to 1 if you have the `setdtablesize' function. */
+#undef HAVE_SETDTABLESIZE
/* Define to 1 if you have the `setenv' function. */
#undef HAVE_SETENV
-/* Define to 1 if you have the `seteuid' function. */
-#undef HAVE_SETEUID
-
/* Define to 1 if you have the `setgroups' function. */
#undef HAVE_SETGROUPS
@@ -1956,12 +1917,12 @@
/* Define to 1 if the system has the type `sigset_t'. */
#undef HAVE_SIGSET_T
-/* Define to 1 if the system has the type `sig_atomic_t'. */
-#undef HAVE_SIG_ATOMIC_T
-
/* Define to 1 if you have the `sleep' function. */
#undef HAVE_SLEEP
+/* libsmack usability */
+#undef HAVE_SMACK
+
/* Define to 1 if you have the `snprintf' function. */
#undef HAVE_SNPRINTF
@@ -1970,9 +1931,6 @@
buffer had been large enough. */
#undef HAVE_SNPRINTF_RETVAL_C99
-/* Define to 1 if you have the <spawn.h> header file. */
-#undef HAVE_SPAWN_H
-
/* Define to 1 if you have the `statacl' function. */
#undef HAVE_STATACL
@@ -2001,9 +1959,6 @@
/* Define if you have the stpncpy() function and it works. */
#undef HAVE_STPNCPY
-/* Define to 1 if you have the `strchrnul' function. */
-#undef HAVE_STRCHRNUL
-
/* Define to 1 if you have the `strdup' function. */
#undef HAVE_STRDUP
@@ -2131,6 +2086,9 @@
/* Define to 1 if `st_blocks' is a member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_BLOCKS
+/* Define to 1 if `mem_unit' is a member of `struct sysinfo'. */
+#undef HAVE_STRUCT_SYSINFO_MEM_UNIT
+
/* Define to 1 if `tm_zone' is a member of `struct tm'. */
#undef HAVE_STRUCT_TM_TM_ZONE
@@ -2362,6 +2320,9 @@
/* Define to 1 if you have the `tsearch' function. */
#undef HAVE_TSEARCH
+/* Define to 1 if you have the `ttyname' function. */
+#undef HAVE_TTYNAME
+
/* Define to 1 if you don't have `tm_zone' but do have the external array
`tzname'. */
#undef HAVE_TZNAME
@@ -2387,9 +2348,6 @@
/* Define to 1 if you have the `uselocale' function. */
#undef HAVE_USELOCALE
-/* Define to 1 if you have the `usleep' function. */
-#undef HAVE_USLEEP
-
/* Define to 1 if you have the `utimensat' function. */
#undef HAVE_UTIMENSAT
@@ -2423,9 +2381,6 @@
/* Define to 1 if you have the <vfork.h> header file. */
#undef HAVE_VFORK_H
-/* Define to 1 if you have the `waitid' function. */
-#undef HAVE_WAITID
-
/* Define to 1 if you have the <wchar.h> header file. */
#undef HAVE_WCHAR_H
@@ -2435,9 +2390,6 @@
/* Define to 1 if you have the `wcrtomb' function. */
#undef HAVE_WCRTOMB
-/* Define to 1 if you have the `wcscoll' function. */
-#undef HAVE_WCSCOLL
-
/* Define to 1 if you have the `wcslen' function. */
#undef HAVE_WCSLEN
@@ -2484,10 +2436,6 @@
/* Define to 1 if O_NOFOLLOW works. */
#undef HAVE_WORKING_O_NOFOLLOW
-/* Define if you have the posix_spawn and posix_spawnp functions and they
- work. */
-#undef HAVE_WORKING_POSIX_SPAWN
-
/* Define if utimes works properly. */
#undef HAVE_WORKING_UTIMES
@@ -2519,9 +2467,6 @@
member named physmem. */
#undef HAVE__SYSTEM_CONFIGURATION
-/* Define to 1 if you have the `__fpending' function. */
-#undef HAVE___FPENDING
-
/* Define to 1 if you have the `__fpurge' function. */
#undef HAVE___FPURGE
@@ -2543,6 +2488,9 @@
/* Define to 1 if you have the `__fsetlocking' function. */
#undef HAVE___FSETLOCKING
+/* Define to 1 if you have the `__secure_getenv' function. */
+#undef HAVE___SECURE_GETENV
+
/* Define to 1 if you have the `__xpg_strerror_r' function. */
#undef HAVE___XPG_STRERROR_R
@@ -2605,6 +2553,10 @@
/* Define to a substitute value for mmap()'s MAP_ANONYMOUS flag. */
#undef MAP_ANONYMOUS
+/* Define if the mbrtowc function does not return (size_t) -2 for empty input.
+ */
+#undef MBRTOWC_EMPTY_INPUT_BUG
+
/* Define if the mbrtowc function has the NULL pwc argument bug. */
#undef MBRTOWC_NULL_ARG1_BUG
@@ -2727,9 +2679,6 @@
large precisions without arbitrary bounds. */
#undef NEED_PRINTF_UNBOUNDED_PRECISION
-/* Define to 1 if your C compiler doesn't accept -c and -o together. */
-#undef NO_MINUS_C_MINUS_O
-
/* Define to 1 if the nlist n_name member is a pointer */
#undef N_NAME_POINTER
@@ -2861,9 +2810,9 @@
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at runtime.
- STACK_DIRECTION > 0 => grows toward higher addresses
- STACK_DIRECTION < 0 => grows toward lower addresses
- STACK_DIRECTION = 0 => direction of growth unknown */
+ STACK_DIRECTION > 0 => grows toward higher addresses
+ STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown */
#undef STACK_DIRECTION
/* Define if the block counts reported by statfs may be truncated to 2GB and
@@ -2981,6 +2930,38 @@
made weak. */
#undef USE_SOLARIS_THREADS_WEAK
+/* Enable extensions on AIX 3, Interix. */
+#ifndef _ALL_SOURCE
+# undef _ALL_SOURCE
+#endif
+/* Enable general extensions on OS X. */
+#ifndef _DARWIN_C_SOURCE
+# undef _DARWIN_C_SOURCE
+#endif
+/* Enable GNU extensions on systems that have them. */
+#ifndef _GNU_SOURCE
+# undef _GNU_SOURCE
+#endif
+/* Enable threading extensions on Solaris. */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# undef _POSIX_PTHREAD_SEMANTICS
+#endif
+/* Enable extensions on HP NonStop. */
+#ifndef _TANDEM_SOURCE
+# undef _TANDEM_SOURCE
+#endif
+/* Enable X/Open extensions if necessary. HP-UX 11.11 defines
+ mbstate_t only if _XOPEN_SOURCE is defined to 500, regardless of
+ whether compiling with -Ae or -D_HPUX_SOURCE=1. */
+#ifndef _XOPEN_SOURCE
+# undef _XOPEN_SOURCE
+#endif
+/* Enable general extensions on Solaris. */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif
+
+
/* Define to 1 if you want getc etc. to use unlocked I/O if available.
Unlocked I/O can improve performance in unithreaded apps, but it is not
safe for multithreaded apps. */
@@ -3046,6 +3027,9 @@
/* Define to 1 if on MINIX. */
#undef _MINIX
+/* Define to 1 to make NetBSD features available. MINIX 3 needs this. */
+#undef _NETBSD_SOURCE
+
/* The _Noreturn keyword of C11. */
#if ! (defined _Noreturn \
|| (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__))
@@ -3071,6 +3055,9 @@
/* Define to 1 if you need to in order for 'stat' and other things to work. */
#undef _POSIX_SOURCE
+/* For thread-safety on OSF/1, Solaris. */
+#undef _REENTRANT
+
/* Define if you want <regex.h> to include <limits.h>, so that it consistently
overrides <limits.h>'s RE_DUP_MAX. */
#undef _REGEX_INCLUDE_LIMITS_H
@@ -3078,67 +3065,59 @@
/* Define if you want regoff_t to be at least as wide POSIX requires. */
#undef _REGEX_LARGE_OFFSETS
-/* Define to 500 only on HP-UX. */
-#undef _XOPEN_SOURCE
-
-/* Enable extensions on AIX 3, Interix. */
-#ifndef _ALL_SOURCE
-# undef _ALL_SOURCE
-#endif
-/* Enable general extensions on Mac OS X. */
-#ifndef _DARWIN_C_SOURCE
-# undef _DARWIN_C_SOURCE
-#endif
-/* Enable GNU extensions on systems that have them. */
-#ifndef _GNU_SOURCE
-# undef _GNU_SOURCE
-#endif
-/* Enable threading extensions on Solaris. */
-#ifndef _POSIX_PTHREAD_SEMANTICS
-# undef _POSIX_PTHREAD_SEMANTICS
-#endif
-/* Enable extensions on HP NonStop. */
-#ifndef _TANDEM_SOURCE
-# undef _TANDEM_SOURCE
-#endif
-/* Enable general extensions on Solaris. */
-#ifndef __EXTENSIONS__
-# undef __EXTENSIONS__
-#endif
-
+/* For thread-safety on AIX, FreeBSD. */
+#undef _THREAD_SAFE
/* Define to rpl_ if the getopt replacement functions and variables should be
used. */
#undef __GETOPT_PREFIX
-/* _GL_INLINE is a portable alternative to ISO C99 plain 'inline'.
- _GL_EXTERN_INLINE is a portable alternative to 'extern inline'.
- _GL_INLINE_HEADER_BEGIN contains useful stuff to put
- in an include file, before uses of _GL_INLINE.
- It suppresses GCC's bogus "no previous prototype for 'FOO'" diagnostic,
- when FOO is an inline function in the header; see
- <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113>.
- _GL_INLINE_HEADER_END contains useful stuff to put
- in the same include file, after uses of _GL_INLINE.
+/* Please see the Gnulib manual for how to use these macros.
- Suppress the use of extern inline on Apple's platforms,
- as Libc-825.25 (2012-09-19) is incompatible with it; see
+ Suppress extern inline with HP-UX cc, as it appears to be broken; see
+ <http://lists.gnu.org/archive/html/bug-texinfo/2013-02/msg00030.html>.
+
+ Suppress extern inline with Sun C in standards-conformance mode, as it
+ mishandles inline functions that call each other. E.g., for 'inline void f
+ (void) { } inline void g (void) { f (); }', c99 incorrectly complains
+ 'reference to static identifier "f" in extern inline function'.
+ This bug was observed with Sun C 5.12 SunOS_i386 2011/11/16.
+
+ Suppress the use of extern inline on problematic Apple configurations.
+ OS X 10.8 and earlier mishandle it; see, e.g.,
<http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>.
+ OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and
+ for clang but remains for g++; see <http://trac.macports.org/ticket/41033>.
Perhaps Apple will fix this some day. */
+#if (defined __APPLE__ \
+ && (defined __header_inline \
+ ? (defined __cplusplus && defined __GNUC_STDC_INLINE__ \
+ && ! defined __clang__) \
+ : ((! defined _DONT_USE_CTYPE_INLINE_ \
+ && (defined __GNUC__ || defined __cplusplus)) \
+ || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \
+ && defined __GNUC__ && ! defined __cplusplus))))
+# define _GL_EXTERN_INLINE_APPLE_BUG
+#endif
#if ((__GNUC__ \
? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \
- : 199901L <= __STDC_VERSION__) \
- && !defined __APPLE__)
+ : (199901L <= __STDC_VERSION__ \
+ && !defined __HP_cc \
+ && !(defined __SUNPRO_C && __STDC__))) \
+ && !defined _GL_EXTERN_INLINE_APPLE_BUG)
# define _GL_INLINE inline
# define _GL_EXTERN_INLINE extern inline
-#elif 2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __APPLE__
-# if __GNUC_GNU_INLINE__
+# define _GL_EXTERN_INLINE_IN_USE
+#elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \
+ && !defined _GL_EXTERN_INLINE_APPLE_BUG)
+# if defined __GNUC_GNU_INLINE__ && __GNUC_GNU_INLINE__
/* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */
# define _GL_INLINE extern inline __attribute__ ((__gnu_inline__))
# else
# define _GL_INLINE extern inline
# endif
# define _GL_EXTERN_INLINE extern
+# define _GL_EXTERN_INLINE_IN_USE
#else
# define _GL_INLINE static _GL_UNUSED
# define _GL_EXTERN_INLINE static _GL_UNUSED
@@ -3151,6 +3130,10 @@
# define _GL_INLINE_HEADER_CONST_PRAGMA \
_Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"")
# endif
+ /* Suppress GCC's bogus "no previous prototype for 'FOO'"
+ and "no previous declaration for 'FOO'" diagnostics,
+ when FOO is an inline function in the header; see
+ <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113>. */
# define _GL_INLINE_HEADER_BEGIN \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \
@@ -3181,9 +3164,6 @@
/* A replacement for va_copy, if needed. */
#define gl_va_copy(a,b) ((a) = (b))
-/* Define to rpl_gmtime if the replacement function should be used. */
-#undef gmtime
-
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
@@ -3212,9 +3192,6 @@
/* Define to 1 if the compiler is checking for lint. */
#undef lint
-/* Define to rpl_localtime if the replacement function should be used. */
-#undef localtime
-
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef major_t
@@ -3302,10 +3279,6 @@
# define __restrict__
#endif
-/* Define as an integer type suitable for memory locations that can be
- accessed atomically even in the presence of asynchronous signals. */
-#undef sig_atomic_t
-
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t
@@ -3333,6 +3306,16 @@
is a misnomer outside of parameter lists. */
#define _UNUSED_PARAMETER_ _GL_UNUSED
+/* gcc supports the "unused" attribute on possibly unused labels, and
+ g++ has since version 4.5. Note to support C++ as well as C,
+ _GL_UNUSED_LABEL should be used with a trailing ; */
+#if !defined __cplusplus || __GNUC__ > 4 \
+ || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
+# define _GL_UNUSED_LABEL _GL_UNUSED
+#else
+# define _GL_UNUSED_LABEL
+#endif
+
/* The __pure__ attribute was added in gcc 2.96. */
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
@@ -3348,9 +3331,6 @@
#endif
-/* Define to an unsigned 32-bit type if <sys/types.h> lacks this type. */
-#undef useconds_t
-
/* Define as a macro for copying va_list variables. */
#undef va_copy
diff --git a/lib/copy-acl.c b/lib/copy-acl.c
index 58ff54ae..eebb359b 100644
--- a/lib/copy-acl.c
+++ b/lib/copy-acl.c
@@ -1,6 +1,6 @@
/* copy-acl.c - copy access control list from one file to another file
- Copyright (C) 2002-2003, 2005-2013 Free Software Foundation, Inc.
+ Copyright (C) 2002-2003, 2005-2014 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
@@ -21,8 +21,10 @@
#include "acl.h"
-#include "acl-internal.h"
+#include <errno.h>
+#include "quote.h"
+#include "error.h"
#include "gettext.h"
#define _(msgid) gettext (msgid)
@@ -34,565 +36,6 @@
If access control lists are not available, fchmod the target file to
MODE. Also sets the non-permission bits of the destination file
(S_ISUID, S_ISGID, S_ISVTX) to those from MODE if any are set.
- Return 0 if successful.
- Return -2 and set errno for an error relating to the source file.
- Return -1 and set errno for an error relating to the destination file. */
-
-int
-qcopy_acl (const char *src_name, int source_desc, const char *dst_name,
- int dest_desc, mode_t mode)
-{
-#if USE_ACL && HAVE_ACL_GET_FILE
- /* POSIX 1003.1e (draft 17 -- abandoned) specific version. */
- /* Linux, FreeBSD, Mac OS X, IRIX, Tru64 */
-# if !HAVE_ACL_TYPE_EXTENDED
- /* Linux, FreeBSD, IRIX, Tru64 */
-
- acl_t acl;
- int ret;
-
- if (HAVE_ACL_GET_FD && source_desc != -1)
- acl = acl_get_fd (source_desc);
- else
- acl = acl_get_file (src_name, ACL_TYPE_ACCESS);
- if (acl == NULL)
- {
- if (ACL_NOT_WELL_SUPPORTED (errno))
- return qset_acl (dst_name, dest_desc, mode);
- else
- return -2;
- }
-
- if (HAVE_ACL_SET_FD && dest_desc != -1)
- ret = acl_set_fd (dest_desc, acl);
- else
- ret = acl_set_file (dst_name, ACL_TYPE_ACCESS, acl);
- if (ret != 0)
- {
- int saved_errno = errno;
-
- if (ACL_NOT_WELL_SUPPORTED (errno) && !acl_access_nontrivial (acl))
- {
- acl_free (acl);
- return chmod_or_fchmod (dst_name, dest_desc, mode);
- }
- else
- {
- acl_free (acl);
- chmod_or_fchmod (dst_name, dest_desc, mode);
- errno = saved_errno;
- return -1;
- }
- }
- else
- acl_free (acl);
-
- if (!MODE_INSIDE_ACL || (mode & (S_ISUID | S_ISGID | S_ISVTX)))
- {
- /* We did not call chmod so far, and either the mode and the ACL are
- separate or special bits are to be set which don't fit into ACLs. */
-
- if (chmod_or_fchmod (dst_name, dest_desc, mode) != 0)
- return -1;
- }
-
- if (S_ISDIR (mode))
- {
- acl = acl_get_file (src_name, ACL_TYPE_DEFAULT);
- if (acl == NULL)
- return -2;
-
- if (acl_set_file (dst_name, ACL_TYPE_DEFAULT, acl))
- {
- int saved_errno = errno;
-
- acl_free (acl);
- errno = saved_errno;
- return -1;
- }
- else
- acl_free (acl);
- }
- return 0;
-
-# else /* HAVE_ACL_TYPE_EXTENDED */
- /* Mac OS X */
-
- /* On Mac OS X, acl_get_file (name, ACL_TYPE_ACCESS)
- and acl_get_file (name, ACL_TYPE_DEFAULT)
- always return NULL / EINVAL. You have to use
- acl_get_file (name, ACL_TYPE_EXTENDED)
- or acl_get_fd (open (name, ...))
- to retrieve an ACL.
- On the other hand,
- acl_set_file (name, ACL_TYPE_ACCESS, acl)
- and acl_set_file (name, ACL_TYPE_DEFAULT, acl)
- have the same effect as
- acl_set_file (name, ACL_TYPE_EXTENDED, acl):
- Each of these calls sets the file's ACL. */
-
- acl_t acl;
- int ret;
-
- if (HAVE_ACL_GET_FD && source_desc != -1)
- acl = acl_get_fd (source_desc);
- else
- acl = acl_get_file (src_name, ACL_TYPE_EXTENDED);
- if (acl == NULL)
- {
- if (ACL_NOT_WELL_SUPPORTED (errno))
- return qset_acl (dst_name, dest_desc, mode);
- else
- return -2;
- }
-
- if (HAVE_ACL_SET_FD && dest_desc != -1)
- ret = acl_set_fd (dest_desc, acl);
- else
- ret = acl_set_file (dst_name, ACL_TYPE_EXTENDED, acl);
- if (ret != 0)
- {
- int saved_errno = errno;
-
- if (ACL_NOT_WELL_SUPPORTED (errno) && !acl_extended_nontrivial (acl))
- {
- acl_free (acl);
- return chmod_or_fchmod (dst_name, dest_desc, mode);
- }
- else
- {
- acl_free (acl);
- chmod_or_fchmod (dst_name, dest_desc, mode);
- errno = saved_errno;
- return -1;
- }
- }
- else
- acl_free (acl);
-
- /* Since !MODE_INSIDE_ACL, we have to call chmod explicitly. */
- return chmod_or_fchmod (dst_name, dest_desc, mode);
-
-# endif
-
-#elif USE_ACL && defined GETACL /* Solaris, Cygwin, not HP-UX */
-
- /* Solaris 2.5 through Solaris 10, Cygwin, and contemporaneous versions
- of Unixware. The acl() call returns the access and default ACL both
- at once. */
-# ifdef ACE_GETACL
- int ace_count;
- ace_t *ace_entries;
-# endif
- int count;
- aclent_t *entries;
- int did_chmod;
- int saved_errno;
- int ret;
-
-# ifdef ACE_GETACL
- /* Solaris also has a different variant of ACLs, used in ZFS and NFSv4
- file systems (whereas the other ones are used in UFS file systems).
- There is an API
- pathconf (name, _PC_ACL_ENABLED)
- fpathconf (desc, _PC_ACL_ENABLED)
- that allows to determine which of the two kinds of ACLs is supported
- for the given file. But some file systems may implement this call
- incorrectly, so better not use it.
- When fetching the source ACL, we simply fetch both ACL types.
- When setting the destination ACL, we try either ACL types, assuming
- that the kernel will translate the ACL from one form to the other.
- (See in <http://docs.sun.com/app/docs/doc/819-2241/6n4huc7ia?l=en&a=view>
- the description of ENOTSUP.) */
- for (;;)
- {
- ace_count = (source_desc != -1
- ? facl (source_desc, ACE_GETACLCNT, 0, NULL)
- : acl (src_name, ACE_GETACLCNT, 0, NULL));
-
- if (ace_count < 0)
- {
- if (errno == ENOSYS || errno == EINVAL)
- {
- ace_count = 0;
- ace_entries = NULL;
- break;
- }
- else
- return -2;
- }
-
- if (ace_count == 0)
- {
- ace_entries = NULL;
- break;
- }
-
- ace_entries = (ace_t *) malloc (ace_count * sizeof (ace_t));
- if (ace_entries == NULL)
- {
- errno = ENOMEM;
- return -2;
- }
-
- ret = (source_desc != -1
- ? facl (source_desc, ACE_GETACL, ace_count, ace_entries)
- : acl (src_name, ACE_GETACL, ace_count, ace_entries));
- if (ret < 0)
- {
- free (ace_entries);
- if (errno == ENOSYS || errno == EINVAL)
- {
- ace_count = 0;
- ace_entries = NULL;
- break;
- }
- else
- return -2;
- }
- if (ret == ace_count)
- break;
- /* Huh? The number of ACL entries changed since the last call.
- Repeat. */
- }
-# endif
-
- for (;;)
- {
- count = (source_desc != -1
- ? facl (source_desc, GETACLCNT, 0, NULL)
- : acl (src_name, GETACLCNT, 0, NULL));
-
- if (count < 0)
- {
- if (errno == ENOSYS || errno == ENOTSUP || errno == EOPNOTSUPP)
- {
- count = 0;
- entries = NULL;
- break;
- }
- else
- return -2;
- }
-
- if (count == 0)
- {
- entries = NULL;
- break;
- }
-
- entries = (aclent_t *) malloc (count * sizeof (aclent_t));
- if (entries == NULL)
- {
- errno = ENOMEM;
- return -2;
- }
-
- if ((source_desc != -1
- ? facl (source_desc, GETACL, count, entries)
- : acl (src_name, GETACL, count, entries))
- == count)
- break;
- /* Huh? The number of ACL entries changed since the last call.
- Repeat. */
- }
-
- /* Is there an ACL of either kind? */
-# ifdef ACE_GETACL
- if (ace_count == 0)
-# endif
- if (count == 0)
- return qset_acl (dst_name, dest_desc, mode);
-
- did_chmod = 0; /* set to 1 once the mode bits in 0777 have been set */
- saved_errno = 0; /* the first non-ignorable error code */
-
- if (!MODE_INSIDE_ACL)
- {
- /* On Cygwin, it is necessary to call chmod before acl, because
- chmod can change the contents of the ACL (in ways that don't
- change the allowed accesses, but still visible). */
- if (chmod_or_fchmod (dst_name, dest_desc, mode) != 0)
- saved_errno = errno;
- did_chmod = 1;
- }
-
- /* If both ace_entries and entries are available, try SETACL before
- ACE_SETACL, because SETACL cannot fail with ENOTSUP whereas ACE_SETACL
- can. */
-
- if (count > 0)
- {
- ret = (dest_desc != -1
- ? facl (dest_desc, SETACL, count, entries)
- : acl (dst_name, SETACL, count, entries));
- if (ret < 0 && saved_errno == 0)
- {
- saved_errno = errno;
- if ((errno == ENOSYS || errno == EOPNOTSUPP || errno == EINVAL)
- && !acl_nontrivial (count, entries))
- saved_errno = 0;
- }
- else
- did_chmod = 1;
- }
- free (entries);
-
-# ifdef ACE_GETACL
- if (ace_count > 0)
- {
- ret = (dest_desc != -1
- ? facl (dest_desc, ACE_SETACL, ace_count, ace_entries)
- : acl (dst_name, ACE_SETACL, ace_count, ace_entries));
- if (ret < 0 && saved_errno == 0)
- {
- saved_errno = errno;
- if ((errno == ENOSYS || errno == EINVAL || errno == ENOTSUP)
- && !acl_ace_nontrivial (ace_count, ace_entries))
- saved_errno = 0;
- }
- }
- free (ace_entries);
-# endif
-
- if (MODE_INSIDE_ACL
- && did_chmod <= ((mode & (S_ISUID | S_ISGID | S_ISVTX)) ? 1 : 0))
- {
- /* We did not call chmod so far, and either the mode and the ACL are
- separate or special bits are to be set which don't fit into ACLs. */
-
- if (chmod_or_fchmod (dst_name, dest_desc, mode) != 0)
- {
- if (saved_errno == 0)
- saved_errno = errno;
- }
- }
-
- if (saved_errno)
- {
- errno = saved_errno;
- return -1;
- }
- return 0;
-
-#elif USE_ACL && HAVE_GETACL /* HP-UX */
-
- struct acl_entry entries[NACLENTRIES];
- int count;
-# if HAVE_ACLV_H
- struct acl aclv_entries[NACLVENTRIES];
- int aclv_count;
-# endif
- int did_chmod;
- int saved_errno;
- int ret;
-
- count = (source_desc != -1
- ? fgetacl (source_desc, NACLENTRIES, entries)
- : getacl (src_name, NACLENTRIES, entries));
-
- if (count < 0)
- {
- if (errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTSUP)
- count = 0;
- else
- return -2;
- }
- else if (count > 0)
- {
- if (count > NACLENTRIES)
- /* If NACLENTRIES cannot be trusted, use dynamic memory allocation. */
- abort ();
- }
-
-# if HAVE_ACLV_H
- aclv_count = acl ((char *) src_name, ACL_GET, NACLVENTRIES, aclv_entries);
-
- if (aclv_count < 0)
- {
- if (errno == ENOSYS || errno == EOPNOTSUPP || errno == EINVAL)
- count = 0;
- else
- return -2;
- }
- else if (aclv_count > 0)
- {
- if (aclv_count > NACLVENTRIES)
- /* If NACLVENTRIES cannot be trusted, use dynamic memory allocation. */
- abort ();
- }
-# endif
-
- if (count == 0)
-# if HAVE_ACLV_H
- if (aclv_count == 0)
-# endif
- return qset_acl (dst_name, dest_desc, mode);
-
- did_chmod = 0; /* set to 1 once the mode bits in 0777 have been set */
- saved_errno = 0; /* the first non-ignorable error code */
-
- if (count > 0)
- {
- ret = (dest_desc != -1
- ? fsetacl (dest_desc, count, entries)
- : setacl (dst_name, count, entries));
- if (ret < 0 && saved_errno == 0)
- {
- saved_errno = errno;
- if (errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTSUP)
- {
- struct stat source_statbuf;
-
- if ((source_desc != -1
- ? fstat (source_desc, &source_statbuf)
- : stat (src_name, &source_statbuf)) == 0)
- {
- if (!acl_nontrivial (count, entries, &source_statbuf))
- saved_errno = 0;
- }
- else
- saved_errno = errno;
- }
- }
- else
- did_chmod = 1;
- }
-
-# if HAVE_ACLV_H
- if (aclv_count > 0)
- {
- ret = acl ((char *) dst_name, ACL_SET, aclv_count, aclv_entries);
- if (ret < 0 && saved_errno == 0)
- {
- saved_errno = errno;
- if (errno == ENOSYS || errno == EOPNOTSUPP || errno == EINVAL)
- {
- if (!aclv_nontrivial (aclv_count, aclv_entries))
- saved_errno = 0;
- }
- }
- else
- did_chmod = 1;
- }
-# endif
-
- if (did_chmod <= ((mode & (S_ISUID | S_ISGID | S_ISVTX)) ? 1 : 0))
- {
- /* We did not call chmod so far, and special bits are to be set which
- don't fit into ACLs. */
-
- if (chmod_or_fchmod (dst_name, dest_desc, mode) != 0)
- {
- if (saved_errno == 0)
- saved_errno = errno;
- }
- }
-
- if (saved_errno)
- {
- errno = saved_errno;
- return -1;
- }
- return 0;
-
-#elif USE_ACL && HAVE_ACLX_GET && 0 /* AIX */
-
- /* TODO */
-
-#elif USE_ACL && HAVE_STATACL /* older AIX */
-
- union { struct acl a; char room[4096]; } u;
- int ret;
-
- if ((source_desc != -1
- ? fstatacl (source_desc, STX_NORMAL, &u.a, sizeof (u))
- : statacl (src_name, STX_NORMAL, &u.a, sizeof (u)))
- < 0)
- return -2;
-
- ret = (dest_desc != -1
- ? fchacl (dest_desc, &u.a, u.a.acl_len)
- : chacl (dst_name, &u.a, u.a.acl_len));
- if (ret < 0)
- {
- int saved_errno = errno;
-
- chmod_or_fchmod (dst_name, dest_desc, mode);
- errno = saved_errno;
- return -1;
- }
-
- /* No need to call chmod_or_fchmod at this point, since the mode bits
- S_ISUID, S_ISGID, S_ISVTX are also stored in the ACL. */
-
- return 0;
-
-#elif USE_ACL && HAVE_ACLSORT /* NonStop Kernel */
-
- struct acl entries[NACLENTRIES];
- int count;
- int ret;
-
- count = acl ((char *) src_name, ACL_GET, NACLENTRIES, entries);
-
- if (count < 0)
- {
- if (0)
- count = 0;
- else
- return -2;
- }
- else if (count > 0)
- {
- if (count > NACLENTRIES)
- /* If NACLENTRIES cannot be trusted, use dynamic memory allocation. */
- abort ();
- }
-
- if (count == 0)
- return qset_acl (dst_name, dest_desc, mode);
-
- ret = acl ((char *) dst_name, ACL_SET, count, entries);
- if (ret < 0)
- {
- int saved_errno = errno;
-
- if (0)
- {
- if (!acl_nontrivial (count, entries))
- return chmod_or_fchmod (dst_name, dest_desc, mode);
- }
-
- chmod_or_fchmod (dst_name, dest_desc, mode);
- errno = saved_errno;
- return -1;
- }
-
- if (mode & (S_ISUID | S_ISGID | S_ISVTX))
- {
- /* We did not call chmod so far, and either the mode and the ACL are
- separate or special bits are to be set which don't fit into ACLs. */
-
- return chmod_or_fchmod (dst_name, dest_desc, mode);
- }
- return 0;
-
-#else
-
- return qset_acl (dst_name, dest_desc, mode);
-
-#endif
-}
-
-
-/* Copy access control lists from one file to another. If SOURCE_DESC is
- a valid file descriptor, use file descriptor operations, else use
- filename based operations on SRC_NAME. Likewise for DEST_DESC and
- DST_NAME.
- If access control lists are not available, fchmod the target file to
- MODE. Also sets the non-permission bits of the destination file
- (S_ISUID, S_ISGID, S_ISVTX) to those from MODE if any are set.
Return 0 if successful, otherwise output a diagnostic and return a
negative error code. */
diff --git a/lib/creat-safer.c b/lib/creat-safer.c
index 93f794dd..984857b8 100644
--- a/lib/creat-safer.c
+++ b/lib/creat-safer.c
@@ -1,6 +1,6 @@
/* Invoke creat, but avoid some glitches.
- Copyright (C) 2005-2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2009-2014 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
diff --git a/lib/ctype.in.h b/lib/ctype.in.h
index 21eeac61..6d292d85 100644
--- a/lib/ctype.in.h
+++ b/lib/ctype.in.h
@@ -1,6 +1,6 @@
/* A substitute for ISO C99 <ctype.h>, for platforms on which it is incomplete.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 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
diff --git a/lib/cycle-check.c b/lib/cycle-check.c
index d475225c..f7b3d078 100644
--- a/lib/cycle-check.c
+++ b/lib/cycle-check.c
@@ -1,6 +1,6 @@
/* help detect directory cycles efficiently
- Copyright (C) 2003-2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2003-2006, 2009-2014 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
diff --git a/lib/cycle-check.h b/lib/cycle-check.h
index 46a1a442..7649606a 100644
--- a/lib/cycle-check.h
+++ b/lib/cycle-check.h
@@ -1,6 +1,6 @@
/* help detect directory cycles efficiently
- Copyright (C) 2003-2004, 2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2003-2004, 2006, 2009-2014 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
diff --git a/lib/di-set.c b/lib/di-set.c
index b757d49e..fa21d2dd 100644
--- a/lib/di-set.c
+++ b/lib/di-set.c
@@ -1,6 +1,6 @@
/* Set operations for device-inode pairs stored in a space-efficient manner.
- Copyright 2009-2013 Free Software Foundation, Inc.
+ Copyright 2009-2014 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
diff --git a/lib/diacrit.c b/lib/diacrit.c
index 8b7672b1..f3b6c1dd 100644
--- a/lib/diacrit.c
+++ b/lib/diacrit.c
@@ -1,6 +1,6 @@
/* Diacritics processing for a few character codes.
- Copyright (C) 1990-1993, 2000, 2006, 2009-2013 Free Software Foundation,
+ Copyright (C) 1990-1993, 2000, 2006, 2009-2014 Free Software Foundation,
Inc.
François Pinard <pinard@iro.umontreal.ca>, 1988.
diff --git a/lib/diacrit.h b/lib/diacrit.h
index 995514a2..3002c434 100644
--- a/lib/diacrit.h
+++ b/lib/diacrit.h
@@ -1,5 +1,5 @@
/* Diacritics processing for a few character codes.
- Copyright (C) 1990-1993, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 1990-1993, 2009-2014 Free Software Foundation, Inc.
François Pinard <pinard@iro.umontreal.ca>, 1988.
All this file is a temporary hack, waiting for locales in GNU.
diff --git a/lib/dirchownmod.c b/lib/dirchownmod.c
index 2de182bc..45cb2d2d 100644
--- a/lib/dirchownmod.c
+++ b/lib/dirchownmod.c
@@ -1,6 +1,6 @@
/* Change the ownership and mode bits of a directory.
- Copyright (C) 2006-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006-2014 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
diff --git a/lib/dirent--.h b/lib/dirent--.h
index 91067363..d7c51bac 100644
--- a/lib/dirent--.h
+++ b/lib/dirent--.h
@@ -1,6 +1,6 @@
/* Like dirent.h, but redefine some names to avoid glitches.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 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
diff --git a/lib/dirent-private.h b/lib/dirent-private.h
index 441071ca..83531a16 100644
--- a/lib/dirent-private.h
+++ b/lib/dirent-private.h
@@ -1,5 +1,5 @@
/* Private details of the DIR type.
- Copyright (C) 2011-2013 Free Software Foundation, Inc.
+ Copyright (C) 2011-2014 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
diff --git a/lib/dirent-safer.h b/lib/dirent-safer.h
index 853ea5dd..8cc75d8d 100644
--- a/lib/dirent-safer.h
+++ b/lib/dirent-safer.h
@@ -1,6 +1,6 @@
/* Invoke dirent-like functions, but avoid some glitches.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 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
diff --git a/lib/dirent.in.h b/lib/dirent.in.h
index fad3797b..4822d6b2 100644
--- a/lib/dirent.in.h
+++ b/lib/dirent.in.h
@@ -1,5 +1,5 @@
/* A GNU-like <dirent.h>.
- Copyright (C) 2006-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006-2014 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
diff --git a/lib/dirfd.c b/lib/dirfd.c
index 8272e132..4d37928c 100644
--- a/lib/dirfd.c
+++ b/lib/dirfd.c
@@ -1,6 +1,6 @@
/* dirfd.c -- return the file descriptor associated with an open DIR*
- Copyright (C) 2001, 2006, 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2006, 2008-2014 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
diff --git a/lib/dirname-lgpl.c b/lib/dirname-lgpl.c
index 82f66301..d4a69730 100644
--- a/lib/dirname-lgpl.c
+++ b/lib/dirname-lgpl.c
@@ -1,6 +1,6 @@
/* dirname.c -- return all but the last element in a file name
- Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2013 Free Software
+ Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/dirname.c b/lib/dirname.c
index 1fb65888..94f1a36a 100644
--- a/lib/dirname.c
+++ b/lib/dirname.c
@@ -1,6 +1,6 @@
/* dirname.c -- return all but the last element in a file name
- Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2013 Free Software
+ Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/dirname.h b/lib/dirname.h
index 4ad03120..a1b70093 100644
--- a/lib/dirname.h
+++ b/lib/dirname.h
@@ -1,6 +1,6 @@
/* Take file names apart into directory and base names.
- Copyright (C) 1998, 2001, 2003-2006, 2009-2013 Free Software Foundation,
+ Copyright (C) 1998, 2001, 2003-2006, 2009-2014 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/dosname.h b/lib/dosname.h
index ba63ce4b..b92adfac 100644
--- a/lib/dosname.h
+++ b/lib/dosname.h
@@ -1,6 +1,6 @@
/* File names on MS-DOS/Windows systems.
- Copyright (C) 2000-2001, 2004-2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2000-2001, 2004-2006, 2009-2014 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
diff --git a/lib/dtotimespec.c b/lib/dtotimespec.c
index ecce2e5b..57a0cee2 100644
--- a/lib/dtotimespec.c
+++ b/lib/dtotimespec.c
@@ -1,6 +1,6 @@
/* Convert double to timespec.
- Copyright (C) 2011-2013 Free Software Foundation, Inc.
+ Copyright (C) 2011-2014 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
@@ -29,41 +29,31 @@
struct timespec
dtotimespec (double sec)
{
- enum { BILLION = 1000 * 1000 * 1000 };
double min_representable = TYPE_MINIMUM (time_t);
double max_representable =
- ((TYPE_MAXIMUM (time_t) * (double) BILLION + (BILLION - 1))
- / BILLION);
- struct timespec r;
+ ((TYPE_MAXIMUM (time_t) * (double) TIMESPEC_RESOLUTION
+ + (TIMESPEC_RESOLUTION - 1))
+ / TIMESPEC_RESOLUTION);
if (! (min_representable < sec))
- {
- r.tv_sec = TYPE_MINIMUM (time_t);
- r.tv_nsec = 0;
- }
+ return make_timespec (TYPE_MINIMUM (time_t), 0);
else if (! (sec < max_representable))
- {
- r.tv_sec = TYPE_MAXIMUM (time_t);
- r.tv_nsec = BILLION - 1;
- }
+ return make_timespec (TYPE_MAXIMUM (time_t), TIMESPEC_RESOLUTION - 1);
else
{
time_t s = sec;
- double frac = BILLION * (sec - s);
+ double frac = TIMESPEC_RESOLUTION * (sec - s);
long ns = frac;
ns += ns < frac;
- s += ns / BILLION;
- ns %= BILLION;
+ s += ns / TIMESPEC_RESOLUTION;
+ ns %= TIMESPEC_RESOLUTION;
if (ns < 0)
{
s--;
- ns += BILLION;
+ ns += TIMESPEC_RESOLUTION;
}
- r.tv_sec = s;
- r.tv_nsec = ns;
+ return make_timespec (s, ns);
}
-
- return r;
}
diff --git a/lib/dup-safer-flag.c b/lib/dup-safer-flag.c
index 8a09821d..2d860fbc 100644
--- a/lib/dup-safer-flag.c
+++ b/lib/dup-safer-flag.c
@@ -1,7 +1,7 @@
/* Duplicate a file descriptor result, avoiding clobbering
STD{IN,OUT,ERR}_FILENO, with specific flags.
- Copyright (C) 2001, 2004-2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2004-2006, 2009-2014 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
diff --git a/lib/dup-safer.c b/lib/dup-safer.c
index c2031078..8df3cdab 100644
--- a/lib/dup-safer.c
+++ b/lib/dup-safer.c
@@ -1,6 +1,6 @@
/* Invoke dup, but avoid some glitches.
- Copyright (C) 2001, 2004-2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2004-2006, 2009-2014 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
diff --git a/lib/dup.c b/lib/dup.c
index 564d93ce..c813df62 100644
--- a/lib/dup.c
+++ b/lib/dup.c
@@ -1,6 +1,6 @@
/* Duplicate an open file descriptor.
- Copyright (C) 2011-2013 Free Software Foundation, Inc.
+ Copyright (C) 2011-2014 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
diff --git a/lib/dup2.c b/lib/dup2.c
index 9219eb38..7de68054 100644
--- a/lib/dup2.c
+++ b/lib/dup2.c
@@ -1,6 +1,6 @@
/* Duplicate an open file descriptor to a specified file descriptor.
- Copyright (C) 1999, 2004-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2004-2007, 2009-2014 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
@@ -96,7 +96,11 @@ rpl_dup2 (int fd, int desired_fd)
/* On Linux kernels 2.6.26-2.6.29, dup2 (fd, fd) returns -EBADF.
On Cygwin 1.5.x, dup2 (1, 1) returns 0.
On Cygwin 1.7.17, dup2 (1, -1) dumps core.
+ On Cygwin 1.7.25, dup2 (1, 256) can dump core.
On Haiku, dup2 (fd, fd) mistakenly clears FD_CLOEXEC. */
+# if HAVE_SETDTABLESIZE
+ setdtablesize (desired_fd + 1);
+# endif
if (desired_fd < 0)
fd = desired_fd;
if (fd == desired_fd)
diff --git a/lib/errno.in.h b/lib/errno.in.h
index 49b35464..832afc8f 100644
--- a/lib/errno.in.h
+++ b/lib/errno.in.h
@@ -1,6 +1,6 @@
/* A POSIX-like <errno.h>.
- Copyright (C) 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2008-2014 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
diff --git a/lib/error.c b/lib/error.c
index 865b2934..7b99cd73 100644
--- a/lib/error.c
+++ b/lib/error.c
@@ -1,5 +1,5 @@
/* Error handler for noninteractive utilities
- Copyright (C) 1990-1998, 2000-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 1990-1998, 2000-2007, 2009-2014 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software: you can redistribute it and/or modify
@@ -39,6 +39,9 @@
# include <stdint.h>
# include <wchar.h>
# define mbsrtowcs __mbsrtowcs
+# define USE_UNLOCKED_IO 0
+# define _GL_ATTRIBUTE_FORMAT_PRINTF(a, b)
+# define _GL_ARG_NONNULL(a)
#endif
#if USE_UNLOCKED_IO
@@ -77,9 +80,9 @@ extern void __error_at_line (int status, int errnum, const char *file_name,
# define error_at_line __error_at_line
# include <libio/iolibio.h>
-# define fflush(s) INTUSE(_IO_fflush) (s)
+# define fflush(s) _IO_fflush (s)
# undef putc
-# define putc(c, fp) INTUSE(_IO_putc) (c, fp)
+# define putc(c, fp) _IO_putc (c, fp)
# include <bits/libc-lock.h>
@@ -171,7 +174,7 @@ print_errno_message (int errnum)
#if defined HAVE_STRERROR_R || _LIBC
char errbuf[1024];
-# if STRERROR_R_CHAR_P || _LIBC
+# if _LIBC || STRERROR_R_CHAR_P
s = __strerror_r (errnum, errbuf, sizeof errbuf);
# else
if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0)
@@ -195,13 +198,12 @@ print_errno_message (int errnum)
#endif
}
-static void
+static void _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0) _GL_ARG_NONNULL ((3))
error_tail (int status, int errnum, const char *message, va_list args)
{
#if _LIBC
if (_IO_fwide (stderr, 0) > 0)
{
-# define ALLOCA_LIMIT 2000
size_t len = strlen (message) + 1;
wchar_t *wmessage = NULL;
mbstate_t st;
@@ -237,7 +239,7 @@ error_tail (int status, int errnum, const char *message, va_list args)
if (res != len)
break;
- if (__builtin_expect (len >= SIZE_MAX / 2, 0))
+ if (__builtin_expect (len >= SIZE_MAX / sizeof (wchar_t) / 2, 0))
{
/* This really should not happen if everything is fine. */
res = (size_t) -1;
@@ -342,7 +344,10 @@ error_at_line (int status, int errnum, const char *file_name,
if (old_line_number == line_number
&& (file_name == old_file_name
- || strcmp (old_file_name, file_name) == 0))
+ || (old_file_name != NULL
+ && file_name != NULL
+ && strcmp (old_file_name, file_name) == 0)))
+
/* Simply return and print nothing. */
return;
diff --git a/lib/error.h b/lib/error.h
index afcb0e10..4aaafb36 100644
--- a/lib/error.h
+++ b/lib/error.h
@@ -1,5 +1,5 @@
/* Declaration for error-reporting function
- Copyright (C) 1995-1997, 2003, 2006, 2008-2013 Free Software Foundation,
+ Copyright (C) 1995-1997, 2003, 2006, 2008-2014 Free Software Foundation,
Inc.
This file is part of the GNU C Library.
diff --git a/lib/euidaccess.c b/lib/euidaccess.c
index f73438e6..363e6fe2 100644
--- a/lib/euidaccess.c
+++ b/lib/euidaccess.c
@@ -1,6 +1,6 @@
/* euidaccess -- check if effective user id can access file
- Copyright (C) 1990-1991, 1995, 1998, 2000, 2003-2006, 2008-2013 Free
+ Copyright (C) 1990-1991, 1995, 1998, 2000, 2003-2006, 2008-2014 Free
Software Foundation, Inc.
This file is part of the GNU C Library.
diff --git a/lib/exclude.c b/lib/exclude.c
index a7dd9b36..14b59b70 100644
--- a/lib/exclude.c
+++ b/lib/exclude.c
@@ -1,6 +1,6 @@
/* exclude.c -- exclude file names
- Copyright (C) 1992-1994, 1997, 1999-2007, 2009-2013 Free Software
+ Copyright (C) 1992-1994, 1997, 1999-2007, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -32,6 +32,7 @@
#include <stdlib.h>
#include <string.h>
#include <wctype.h>
+#include <regex.h>
#include "exclude.h"
#include "hash.h"
@@ -39,6 +40,7 @@
#include "fnmatch.h"
#include "xalloc.h"
#include "verify.h"
+#include "filename.h"
#if USE_UNLOCKED_IO
# include "unlocked-io.h"
@@ -73,8 +75,12 @@ verify (((EXCLUDE_ANCHORED | EXCLUDE_INCLUDE | EXCLUDE_WILDCARDS)
struct patopts
{
- char const *pattern;
int options;
+ union
+ {
+ char const *pattern;
+ regex_t re;
+ } v;
};
/* An array of pattern-options pairs. */
@@ -104,13 +110,33 @@ struct exclude_segment
} v;
};
+struct pattern_buffer
+ {
+ struct pattern_buffer *next;
+ char *base;
+ };
+
/* The exclude structure keeps a singly-linked list of exclude segments,
maintained in reverse order. */
struct exclude
{
struct exclude_segment *head;
+ struct pattern_buffer *patbuf;
};
+/* Register BUF in the pattern buffer list of EX. ADD_FUNC (see
+ add_exclude_file and add_exclude_fp below) can use this function
+ if it modifies the pattern, to ensure the allocated memory will be
+ properly reclaimed upon calling free_exclude. */
+void
+exclude_add_pattern_buffer (struct exclude *ex, char *buf)
+{
+ struct pattern_buffer *pbuf = xmalloc (sizeof *pbuf);
+ pbuf->base = buf;
+ pbuf->next = ex->patbuf;
+ ex->patbuf = pbuf;
+}
+
/* Return true if STR has or may have wildcards, when matched with OPTIONS.
Return false if STR definitely does not have wildcards. */
bool
@@ -120,8 +146,20 @@ fnmatch_pattern_has_wildcards (const char *str, int options)
{
switch (*str++)
{
+ case '.':
+ case '{':
+ case '}':
+ case '(':
+ case ')':
+ if (options & EXCLUDE_REGEX)
+ return true;
+ break;
+
case '\\':
- str += ! (options & FNM_NOESCAPE) && *str;
+ if (options & EXCLUDE_REGEX)
+ continue;
+ else
+ str += ! (options & FNM_NOESCAPE) && *str;
break;
case '+': case '@': case '!':
@@ -243,9 +281,16 @@ new_exclude_segment (struct exclude *ex, enum exclude_type type, int options)
static void
free_exclude_segment (struct exclude_segment *seg)
{
+ size_t i;
+
switch (seg->type)
{
case exclude_pattern:
+ for (i = 0; i < seg->v.pat.exclude_count; i++)
+ {
+ if (seg->v.pat.exclude[i].options & EXCLUDE_REGEX)
+ regfree (&seg->v.pat.exclude[i].v.re);
+ }
free (seg->v.pat.exclude);
break;
@@ -261,12 +306,23 @@ void
free_exclude (struct exclude *ex)
{
struct exclude_segment *seg;
+ struct pattern_buffer *pbuf;
+
for (seg = ex->head; seg; )
{
struct exclude_segment *next = seg->next;
free_exclude_segment (seg);
seg = next;
}
+
+ for (pbuf = ex->patbuf; pbuf; )
+ {
+ struct pattern_buffer *next = pbuf->next;
+ free (pbuf->base);
+ free (pbuf);
+ pbuf = next;
+ }
+
free (ex);
}
@@ -331,11 +387,21 @@ exclude_fnmatch (char const *pattern, char const *f, int options)
if (! (options & EXCLUDE_ANCHORED))
for (p = f; *p && ! matched; p++)
if (*p == '/' && p[1] != '/')
- matched = ((*matcher) (pattern, p + 1, options) == 0);
+ matched = ((*matcher) (pattern, p + 1, options) == 0);
return matched;
}
+bool
+exclude_patopts (struct patopts const *opts, char const *f)
+{
+ int options = opts->options;
+
+ return (options & EXCLUDE_REGEX)
+ ? regexec (&opts->v.re, f, 0, NULL, 0) == 0
+ : exclude_fnmatch (opts->v.pattern, f, options);
+}
+
/* Return true if the exclude_pattern segment SEG matches F. */
static bool
@@ -347,9 +413,7 @@ file_pattern_matches (struct exclude_segment const *seg, char const *f)
for (i = 0; i < exclude_count; i++)
{
- char const *pattern = exclude[i].pattern;
- int options = exclude[i].options;
- if (exclude_fnmatch (pattern, f, options))
+ if (exclude_patopts (exclude + i, f))
return true;
}
return false;
@@ -454,17 +518,17 @@ void
add_exclude (struct exclude *ex, char const *pattern, int options)
{
struct exclude_segment *seg;
+ struct exclude_pattern *pat;
+ struct patopts *patopts;
- if ((options & EXCLUDE_WILDCARDS)
+ if ((options & (EXCLUDE_REGEX|EXCLUDE_WILDCARDS))
&& fnmatch_pattern_has_wildcards (pattern, options))
{
- struct exclude_pattern *pat;
- struct patopts *patopts;
-
if (! (ex->head && ex->head->type == exclude_pattern
- && ((ex->head->options & EXCLUDE_INCLUDE)
- == (options & EXCLUDE_INCLUDE))))
- new_exclude_segment (ex, exclude_pattern, options);
+ && ((ex->head->options & EXCLUDE_INCLUDE)
+ == (options & EXCLUDE_INCLUDE))))
+ new_exclude_segment (ex, exclude_pattern, options);
+
seg = ex->head;
pat = &seg->v.pat;
@@ -472,8 +536,51 @@ add_exclude (struct exclude *ex, char const *pattern, int options)
pat->exclude = x2nrealloc (pat->exclude, &pat->exclude_alloc,
sizeof *pat->exclude);
patopts = &pat->exclude[pat->exclude_count++];
- patopts->pattern = pattern;
+
patopts->options = options;
+ if (options & EXCLUDE_REGEX)
+ {
+ int rc;
+ int cflags = REG_NOSUB|REG_EXTENDED|
+ ((options & FNM_CASEFOLD) ? REG_ICASE : 0);
+
+ if (options & FNM_LEADING_DIR)
+ {
+ char *tmp;
+ size_t len = strlen (pattern);
+
+ while (len > 0 && ISSLASH (pattern[len-1]))
+ --len;
+
+ if (len == 0)
+ rc = 1;
+ else
+ {
+ tmp = xmalloc (len + 7);
+ memcpy (tmp, pattern, len);
+ strcpy (tmp + len, "(/.*)?");
+ rc = regcomp (&patopts->v.re, tmp, cflags);
+ free (tmp);
+ }
+ }
+ else
+ rc = regcomp (&patopts->v.re, pattern, cflags);
+
+ if (rc)
+ {
+ pat->exclude_count--;
+ return;
+ }
+ }
+ else
+ {
+ if (options & EXCLUDE_ALLOC)
+ {
+ pattern = xstrdup (pattern);
+ exclude_add_pattern_buffer (ex, (char*) pattern);
+ }
+ patopts->v.pattern = pattern;
+ }
}
else
{
@@ -498,45 +605,39 @@ add_exclude (struct exclude *ex, char const *pattern, int options)
/* Use ADD_FUNC to append to EX the patterns in FILE_NAME, each with
OPTIONS. LINE_END terminates each pattern in the file. If
LINE_END is a space character, ignore trailing spaces and empty
- lines in FILE. Return -1 on failure, 0 on success. */
+ lines in FP. Return -1 on failure, 0 on success. */
int
-add_exclude_file (void (*add_func) (struct exclude *, char const *, int),
- struct exclude *ex, char const *file_name, int options,
- char line_end)
+add_exclude_fp (void (*add_func) (struct exclude *, char const *, int, void *),
+ struct exclude *ex, FILE *fp, int options,
+ char line_end,
+ void *data)
{
- bool use_stdin = file_name[0] == '-' && !file_name[1];
- FILE *in;
char *buf = NULL;
char *p;
- char const *pattern;
+ char *pattern;
char const *lim;
size_t buf_alloc = 0;
size_t buf_count = 0;
int c;
int e = 0;
- if (use_stdin)
- in = stdin;
- else if (! (in = fopen (file_name, "r")))
- return -1;
-
- while ((c = getc (in)) != EOF)
+ while ((c = getc (fp)) != EOF)
{
if (buf_count == buf_alloc)
buf = x2realloc (buf, &buf_alloc);
buf[buf_count++] = c;
}
- if (ferror (in))
- e = errno;
-
- if (!use_stdin && fclose (in) != 0)
+ if (ferror (fp))
e = errno;
buf = xrealloc (buf, buf_count + 1);
buf[buf_count] = line_end;
lim = buf + buf_count + ! (buf_count == 0 || buf[buf_count - 1] == line_end);
+
+ exclude_add_pattern_buffer (ex, buf);
+
pattern = buf;
for (p = buf; p < lim; p++)
@@ -554,7 +655,7 @@ add_exclude_file (void (*add_func) (struct exclude *, char const *, int),
}
*pattern_end = '\0';
- (*add_func) (ex, pattern, options);
+ (*add_func) (ex, pattern, options, data);
next_pattern:
pattern = p + 1;
@@ -563,3 +664,32 @@ add_exclude_file (void (*add_func) (struct exclude *, char const *, int),
errno = e;
return e ? -1 : 0;
}
+
+static void
+call_addfn (struct exclude *ex, char const *pattern, int options, void *data)
+{
+ void (**addfnptr) (struct exclude *, char const *, int) = data;
+ (*addfnptr) (ex, pattern, options);
+}
+
+int
+add_exclude_file (void (*add_func) (struct exclude *, char const *, int),
+ struct exclude *ex, char const *file_name, int options,
+ char line_end)
+{
+ bool use_stdin = file_name[0] == '-' && !file_name[1];
+ FILE *in;
+ int rc = 0;
+
+ if (use_stdin)
+ in = stdin;
+ else if (! (in = fopen (file_name, "r")))
+ return -1;
+
+ rc = add_exclude_fp (call_addfn, ex, in, options, line_end, &add_func);
+
+ if (!use_stdin && fclose (in) != 0)
+ rc = -1;
+
+ return rc;
+}
diff --git a/lib/exclude.h b/lib/exclude.h
index f76b1539..95552186 100644
--- a/lib/exclude.h
+++ b/lib/exclude.h
@@ -1,6 +1,6 @@
/* exclude.h -- declarations for excluding file names
- Copyright (C) 1992-1994, 1997, 1999, 2001-2003, 2005-2006, 2009-2013 Free
+ Copyright (C) 1992-1994, 1997, 1999, 2001-2003, 2005-2006, 2009-2014 Free
Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -20,6 +20,7 @@
#define _GL_EXCLUDE_H 1
#include <stdbool.h>
+#include <stdio.h>
/* Written by Paul Eggert <eggert@twinsun.com>
and Sergey Poznyakoff <gray@gnu.org> */
@@ -37,6 +38,12 @@
option, these characters are ordinary and fnmatch is not used. */
#define EXCLUDE_WILDCARDS (1 << 28)
+/* Patterns are POSIX extended regular expressions */
+#define EXCLUDE_REGEX (1 << 27)
+
+/* Allocate storage for the pattern */
+#define EXCLUDE_ALLOC (1 << 26)
+
struct exclude;
bool fnmatch_pattern_has_wildcards (const char *, int) _GL_ATTRIBUTE_PURE;
@@ -46,7 +53,10 @@ void free_exclude (struct exclude *);
void add_exclude (struct exclude *, char const *, int);
int add_exclude_file (void (*) (struct exclude *, char const *, int),
struct exclude *, char const *, int, char);
+int add_exclude_fp (void (*) (struct exclude *, char const *, int, void *),
+ struct exclude *, FILE *, int, char, void *);
bool excluded_file_name (struct exclude const *, char const *);
-bool exclude_fnmatch (char const *pattern, char const *f, int options);
+void exclude_add_pattern_buffer (struct exclude *ex, char *buf);
+bool exclude_fnmatch (char const *, char const *, int);
#endif /* _GL_EXCLUDE_H */
diff --git a/lib/exitfail.c b/lib/exitfail.c
index b0b4ebe4..609afc5a 100644
--- a/lib/exitfail.c
+++ b/lib/exitfail.c
@@ -1,6 +1,6 @@
/* Failure exit status
- Copyright (C) 2002-2003, 2005-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2002-2003, 2005-2007, 2009-2014 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
diff --git a/lib/exitfail.h b/lib/exitfail.h
index e54333bd..66807d51 100644
--- a/lib/exitfail.h
+++ b/lib/exitfail.h
@@ -1,6 +1,6 @@
/* Failure exit status
- Copyright (C) 2002, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2009-2014 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
diff --git a/lib/faccessat.c b/lib/faccessat.c
index f3c3f673..44a38ae6 100644
--- a/lib/faccessat.c
+++ b/lib/faccessat.c
@@ -1,5 +1,5 @@
/* Check the access rights of a file relative to an open directory.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 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
diff --git a/lib/fadvise.c b/lib/fadvise.c
index 8d3af995..a4bc96f4 100644
--- a/lib/fadvise.c
+++ b/lib/fadvise.c
@@ -1,5 +1,5 @@
/* Declare an access pattern hint for files.
- Copyright (C) 2010-2013 Free Software Foundation, Inc.
+ Copyright (C) 2010-2014 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
@@ -14,6 +14,12 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+/* Without this pragma, gcc suggests that (given !HAVE_POSIX_FADVISE)
+ the fdadvise function might be a candidate for attribute 'const'. */
+#if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__
+# pragma GCC diagnostic ignored "-Wsuggest-attribute=const"
+#endif
+
#include <config.h>
#include "fadvise.h"
diff --git a/lib/fadvise.h b/lib/fadvise.h
index cd5046b3..11ecd8f0 100644
--- a/lib/fadvise.h
+++ b/lib/fadvise.h
@@ -1,5 +1,5 @@
/* Declare an access pattern hint for files.
- Copyright (C) 2010-2013 Free Software Foundation, Inc.
+ Copyright (C) 2010-2014 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
@@ -48,7 +48,7 @@ typedef enum {
FADVISE_NOREUSE = POSIX_FADV_NOREUSE,
FADVISE_DONTNEED = POSIX_FADV_DONTNEED,
FADVISE_WILLNEED = POSIX_FADV_WILLNEED,
- FADVISE_RANDOM = POSIX_FADV_RANDOM,
+ FADVISE_RANDOM = POSIX_FADV_RANDOM
} fadvice_t;
#else
typedef enum {
@@ -57,7 +57,7 @@ typedef enum {
FADVISE_NOREUSE,
FADVISE_DONTNEED,
FADVISE_WILLNEED,
- FADVISE_RANDOM,
+ FADVISE_RANDOM
} fadvice_t;
#endif
diff --git a/lib/fatal-signal.c b/lib/fatal-signal.c
deleted file mode 100644
index 8f7cb8ea..00000000
--- a/lib/fatal-signal.c
+++ /dev/null
@@ -1,286 +0,0 @@
-/* Emergency actions in case of a fatal signal.
- Copyright (C) 2003-2004, 2006-2013 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2003.
-
- 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
-
-
-#include <config.h>
-
-/* Specification. */
-#include "fatal-signal.h"
-
-#include <stdbool.h>
-#include <stdlib.h>
-#include <signal.h>
-#include <unistd.h>
-
-#include "sig-handler.h"
-#include "xalloc.h"
-
-#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
-
-/* ========================================================================= */
-
-
-/* The list of fatal signals.
- These are those signals whose default action is to terminate the process
- without a core dump, except
- SIGKILL - because it cannot be caught,
- SIGALRM SIGUSR1 SIGUSR2 SIGPOLL SIGIO SIGLOST - because applications
- often use them for their own purpose,
- SIGPROF SIGVTALRM - because they are used for profiling,
- SIGSTKFLT - because it is more similar to SIGFPE, SIGSEGV, SIGBUS,
- SIGSYS - because it is more similar to SIGABRT, SIGSEGV,
- SIGPWR - because it of too special use,
- SIGRTMIN...SIGRTMAX - because they are reserved for application use.
- plus
- SIGXCPU, SIGXFSZ - because they are quite similar to SIGTERM. */
-
-static int fatal_signals[] =
- {
- /* ISO C 99 signals. */
-#ifdef SIGINT
- SIGINT,
-#endif
-#ifdef SIGTERM
- SIGTERM,
-#endif
- /* POSIX:2001 signals. */
-#ifdef SIGHUP
- SIGHUP,
-#endif
-#ifdef SIGPIPE
- SIGPIPE,
-#endif
- /* BSD signals. */
-#ifdef SIGXCPU
- SIGXCPU,
-#endif
-#ifdef SIGXFSZ
- SIGXFSZ,
-#endif
- /* Native Windows signals. */
-#ifdef SIGBREAK
- SIGBREAK,
-#endif
- 0
- };
-
-#define num_fatal_signals (SIZEOF (fatal_signals) - 1)
-
-/* Eliminate signals whose signal handler is SIG_IGN. */
-
-static void
-init_fatal_signals (void)
-{
- static bool fatal_signals_initialized = false;
- if (!fatal_signals_initialized)
- {
- size_t i;
-
- for (i = 0; i < num_fatal_signals; i++)
- {
- struct sigaction action;
-
- if (sigaction (fatal_signals[i], NULL, &action) >= 0
- && get_handler (&action) == SIG_IGN)
- fatal_signals[i] = -1;
- }
-
- fatal_signals_initialized = true;
- }
-}
-
-
-/* ========================================================================= */
-
-
-typedef void (*action_t) (void);
-
-/* Type of an entry in the actions array.
- The 'action' field is accessed from within the fatal_signal_handler(),
- therefore we mark it as 'volatile'. */
-typedef struct
-{
- volatile action_t action;
-}
-actions_entry_t;
-
-/* The registered cleanup actions. */
-static actions_entry_t static_actions[32];
-static actions_entry_t * volatile actions = static_actions;
-static sig_atomic_t volatile actions_count = 0;
-static size_t actions_allocated = SIZEOF (static_actions);
-
-
-/* The saved signal handlers.
- Size 32 would not be sufficient: On HP-UX, SIGXCPU = 33, SIGXFSZ = 34. */
-static struct sigaction saved_sigactions[64];
-
-
-/* Uninstall the handlers. */
-static void
-uninstall_handlers (void)
-{
- size_t i;
-
- for (i = 0; i < num_fatal_signals; i++)
- if (fatal_signals[i] >= 0)
- {
- int sig = fatal_signals[i];
- if (saved_sigactions[sig].sa_handler == SIG_IGN)
- saved_sigactions[sig].sa_handler = SIG_DFL;
- sigaction (sig, &saved_sigactions[sig], NULL);
- }
-}
-
-
-/* The signal handler. It gets called asynchronously. */
-static void
-fatal_signal_handler (int sig)
-{
- for (;;)
- {
- /* Get the last registered cleanup action, in a reentrant way. */
- action_t action;
- size_t n = actions_count;
- if (n == 0)
- break;
- n--;
- actions_count = n;
- action = actions[n].action;
- /* Execute the action. */
- action ();
- }
-
- /* Now execute the signal's default action.
- If the signal being delivered was blocked, the re-raised signal would be
- delivered when this handler returns. But the way we install this handler,
- no signal is blocked, and the re-raised signal is delivered already
- during raise(). */
- uninstall_handlers ();
- raise (sig);
-}
-
-
-/* Install the handlers. */
-static void
-install_handlers (void)
-{
- size_t i;
- struct sigaction action;
-
- action.sa_handler = &fatal_signal_handler;
- /* If we get a fatal signal while executing fatal_signal_handler, enter
- fatal_signal_handler recursively, since it is reentrant. Hence no
- SA_RESETHAND. */
- action.sa_flags = SA_NODEFER;
- sigemptyset (&action.sa_mask);
- for (i = 0; i < num_fatal_signals; i++)
- if (fatal_signals[i] >= 0)
- {
- int sig = fatal_signals[i];
-
- if (!(sig < sizeof (saved_sigactions) / sizeof (saved_sigactions[0])))
- abort ();
- sigaction (sig, &action, &saved_sigactions[sig]);
- }
-}
-
-
-/* Register a cleanup function to be executed when a catchable fatal signal
- occurs. */
-void
-at_fatal_signal (action_t action)
-{
- static bool cleanup_initialized = false;
- if (!cleanup_initialized)
- {
- init_fatal_signals ();
- install_handlers ();
- cleanup_initialized = true;
- }
-
- if (actions_count == actions_allocated)
- {
- /* Extend the actions array. Note that we cannot use xrealloc(),
- because then the cleanup() function could access an already
- deallocated array. */
- actions_entry_t *old_actions = actions;
- size_t old_actions_allocated = actions_allocated;
- size_t new_actions_allocated = 2 * actions_allocated;
- actions_entry_t *new_actions =
- XNMALLOC (new_actions_allocated, actions_entry_t);
- size_t k;
-
- /* Don't use memcpy() here, because memcpy takes non-volatile arguments
- and is therefore not guaranteed to complete all memory stores before
- the next statement. */
- for (k = 0; k < old_actions_allocated; k++)
- new_actions[k] = old_actions[k];
- actions = new_actions;
- actions_allocated = new_actions_allocated;
- /* Now we can free the old actions array. */
- if (old_actions != static_actions)
- free (old_actions);
- }
- /* The two uses of 'volatile' in the types above (and ISO C 99 section
- 5.1.2.3.(5)) ensure that we increment the actions_count only after
- the new action has been written to the memory location
- actions[actions_count]. */
- actions[actions_count].action = action;
- actions_count++;
-}
-
-
-/* ========================================================================= */
-
-
-static sigset_t fatal_signal_set;
-
-static void
-init_fatal_signal_set (void)
-{
- static bool fatal_signal_set_initialized = false;
- if (!fatal_signal_set_initialized)
- {
- size_t i;
-
- init_fatal_signals ();
-
- sigemptyset (&fatal_signal_set);
- for (i = 0; i < num_fatal_signals; i++)
- if (fatal_signals[i] >= 0)
- sigaddset (&fatal_signal_set, fatal_signals[i]);
-
- fatal_signal_set_initialized = true;
- }
-}
-
-/* Temporarily delay the catchable fatal signals. */
-void
-block_fatal_signals (void)
-{
- init_fatal_signal_set ();
- sigprocmask (SIG_BLOCK, &fatal_signal_set, NULL);
-}
-
-/* Stop delaying the catchable fatal signals. */
-void
-unblock_fatal_signals (void)
-{
- init_fatal_signal_set ();
- sigprocmask (SIG_UNBLOCK, &fatal_signal_set, NULL);
-}
diff --git a/lib/fatal-signal.h b/lib/fatal-signal.h
deleted file mode 100644
index f5df78a0..00000000
--- a/lib/fatal-signal.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* Emergency actions in case of a fatal signal.
- Copyright (C) 2003-2004, 2009-2013 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2003.
-
- 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* It is often useful to do some cleanup action when a usually fatal signal
- terminates the process, like removing a temporary file or killing a
- subprocess that may be stuck waiting for a device, pipe or network input.
- Such signals are SIGHUP, SIGINT, SIGPIPE, SIGTERM, and possibly others.
- The limitation of this facility is that it cannot work for SIGKILL.
-
- Signals with a SIG_IGN handler are considered to be non-fatal. The
- functions in this file assume that when a SIG_IGN handler is installed
- for a signal, it was installed before any functions in this file were
- called and it stays so for the whole lifetime of the process. */
-
-/* Register a cleanup function to be executed when a catchable fatal signal
- occurs.
-
- Restrictions for the cleanup function:
- - The cleanup function can do all kinds of system calls.
- - It can also access application dependent memory locations and data
- structures provided they are in a consistent state. One way to ensure
- this is through block_fatal_signals()/unblock_fatal_signals(), see
- below. Another - more tricky - way to ensure this is the careful use
- of 'volatile'.
- However,
- - malloc() and similarly complex facilities are not safe to be called
- because they are not guaranteed to be in a consistent state.
- - Also, the cleanup function must not block the catchable fatal signals
- and leave them blocked upon return.
-
- The cleanup function is executed asynchronously. It is unspecified
- whether during its execution the catchable fatal signals are blocked
- or not. */
-extern void at_fatal_signal (void (*function) (void));
-
-
-/* Sometimes it is necessary to block the usually fatal signals while the
- data structures being accessed by the cleanup action are being built or
- reorganized. This is the case, for example, when a temporary file or
- directory is created through mkstemp() or mkdtemp(), because these
- functions create the temporary file or directory _before_ returning its
- name to the application. */
-
-/* Temporarily delay the catchable fatal signals.
- The signals will be blocked (= delayed) until the next call to
- unblock_fatal_signals(). If the signals are already blocked, a further
- call to block_fatal_signals() has no effect. */
-extern void block_fatal_signals (void);
-
-/* Stop delaying the catchable fatal signals. */
-extern void unblock_fatal_signals (void);
-
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/lib/fchdir.c b/lib/fchdir.c
index 36a8e358..5d713773 100644
--- a/lib/fchdir.c
+++ b/lib/fchdir.c
@@ -1,5 +1,5 @@
/* fchdir replacement.
- Copyright (C) 2006-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006-2014 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
diff --git a/lib/fchmodat.c b/lib/fchmodat.c
index 34e956cc..8b0bbb32 100644
--- a/lib/fchmodat.c
+++ b/lib/fchmodat.c
@@ -1,5 +1,5 @@
/* Change the protections of file relative to an open directory.
- Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2009-2014 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
diff --git a/lib/fchownat.c b/lib/fchownat.c
index 3e355792..65ced30b 100644
--- a/lib/fchownat.c
+++ b/lib/fchownat.c
@@ -4,7 +4,7 @@
when the buggy fchownat-with-AT_SYMLINK_NOFOLLOW operates on a symlink, it
mistakenly affects the symlink referent, rather than the symlink itself.
- Copyright (C) 2006-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006-2007, 2009-2014 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
diff --git a/lib/fclose.c b/lib/fclose.c
index 90ed653a..d238ab18 100644
--- a/lib/fclose.c
+++ b/lib/fclose.c
@@ -1,5 +1,5 @@
/* fclose replacement.
- Copyright (C) 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2008-2014 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
diff --git a/lib/fcntl--.h b/lib/fcntl--.h
index 3fcd5fec..37be26c3 100644
--- a/lib/fcntl--.h
+++ b/lib/fcntl--.h
@@ -1,6 +1,6 @@
/* Like fcntl.h, but redefine some names to avoid glitches.
- Copyright (C) 2005, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2009-2014 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
diff --git a/lib/fcntl-safer.h b/lib/fcntl-safer.h
index a98a6330..73b7ad78 100644
--- a/lib/fcntl-safer.h
+++ b/lib/fcntl-safer.h
@@ -1,6 +1,6 @@
/* Invoke fcntl-like functions, but avoid some glitches.
- Copyright (C) 2005, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2009-2014 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
diff --git a/lib/fcntl.c b/lib/fcntl.c
index 735fa66f..54f74860 100644
--- a/lib/fcntl.c
+++ b/lib/fcntl.c
@@ -1,6 +1,6 @@
/* Provide file descriptor control.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 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
diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h
index 1e45a65a..e23b4b2b 100644
--- a/lib/fcntl.in.h
+++ b/lib/fcntl.in.h
@@ -1,6 +1,6 @@
/* Like <fcntl.h>, but with non-working flags defined to 0.
- Copyright (C) 2006-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006-2014 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
@@ -186,6 +186,22 @@ _GL_WARN_ON_USE (openat, "openat is not portable - "
/* Fix up the O_* macros. */
+/* AIX 7.1 with XL C 12.1 defines O_CLOEXEC, O_NOFOLLOW, and O_TTY_INIT
+ to values outside 'int' range, so omit these misdefinitions.
+ But avoid namespace pollution on non-AIX systems. */
+#ifdef _AIX
+# include <limits.h>
+# if defined O_CLOEXEC && ! (INT_MIN <= O_CLOEXEC && O_CLOEXEC <= INT_MAX)
+# undef O_CLOEXEC
+# endif
+# if defined O_NOFOLLOW && ! (INT_MIN <= O_NOFOLLOW && O_NOFOLLOW <= INT_MAX)
+# undef O_NOFOLLOW
+# endif
+# if defined O_TTY_INIT && ! (INT_MIN <= O_TTY_INIT && O_TTY_INIT <= INT_MAX)
+# undef O_TTY_INIT
+# endif
+#endif
+
#if !defined O_DIRECT && defined O_DIRECTIO
/* Tru64 spells it 'O_DIRECTIO'. */
# define O_DIRECT O_DIRECTIO
diff --git a/lib/fd-hook.c b/lib/fd-hook.c
index e158a52a..0171cc60 100644
--- a/lib/fd-hook.c
+++ b/lib/fd-hook.c
@@ -1,5 +1,5 @@
/* Hook for making making file descriptor functions close(), ioctl() extensible.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2009.
This program is free software: you can redistribute it and/or modify it
diff --git a/lib/fd-hook.h b/lib/fd-hook.h
index d15b5771..1aa264eb 100644
--- a/lib/fd-hook.h
+++ b/lib/fd-hook.h
@@ -1,5 +1,5 @@
/* Hook for making making file descriptor functions close(), ioctl() extensible.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 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
diff --git a/lib/fd-reopen.c b/lib/fd-reopen.c
index d18827c5..1fba807b 100644
--- a/lib/fd-reopen.c
+++ b/lib/fd-reopen.c
@@ -1,6 +1,6 @@
/* Invoke open, but return either a desired file descriptor or -1.
- Copyright (C) 2005-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005-2014 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
diff --git a/lib/fd-reopen.h b/lib/fd-reopen.h
index 28db198e..7245a32d 100644
--- a/lib/fd-reopen.h
+++ b/lib/fd-reopen.h
@@ -1,6 +1,6 @@
/* Invoke open, but return either a desired file descriptor or -1.
- Copyright (C) 2005-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005-2014 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
diff --git a/lib/fd-safer-flag.c b/lib/fd-safer-flag.c
index 8bc14bda..17011000 100644
--- a/lib/fd-safer-flag.c
+++ b/lib/fd-safer-flag.c
@@ -1,7 +1,7 @@
/* Adjust a file descriptor result so that it avoids clobbering
STD{IN,OUT,ERR}_FILENO, with specific flags.
- Copyright (C) 2005-2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2009-2014 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
diff --git a/lib/fd-safer.c b/lib/fd-safer.c
index 8ded8886..148f735d 100644
--- a/lib/fd-safer.c
+++ b/lib/fd-safer.c
@@ -1,6 +1,6 @@
/* Return a safer copy of a file descriptor.
- Copyright (C) 2005-2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2009-2014 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
diff --git a/lib/fdatasync.c b/lib/fdatasync.c
index 8f9bf15a..688543f8 100644
--- a/lib/fdatasync.c
+++ b/lib/fdatasync.c
@@ -1,6 +1,6 @@
/* Emulate fdatasync on platforms that lack it.
- Copyright (C) 2011-2013 Free Software Foundation, Inc.
+ Copyright (C) 2011-2014 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
diff --git a/lib/fdopen.c b/lib/fdopen.c
index c717f713..eded1a67 100644
--- a/lib/fdopen.c
+++ b/lib/fdopen.c
@@ -1,5 +1,5 @@
/* Open a stream with a given file descriptor.
- Copyright (C) 2011-2013 Free Software Foundation, Inc.
+ Copyright (C) 2011-2014 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
diff --git a/lib/fdopendir.c b/lib/fdopendir.c
index 63e06b92..b6c94a09 100644
--- a/lib/fdopendir.c
+++ b/lib/fdopendir.c
@@ -1,5 +1,5 @@
/* provide a replacement fdopendir function
- Copyright (C) 2004-2013 Free Software Foundation, Inc.
+ Copyright (C) 2004-2014 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
diff --git a/lib/fdutimensat.c b/lib/fdutimensat.c
index 63c79e9e..fafa0a4d 100644
--- a/lib/fdutimensat.c
+++ b/lib/fdutimensat.c
@@ -1,6 +1,6 @@
/* Set file access and modification times.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 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
diff --git a/lib/fflush.c b/lib/fflush.c
index 8ac5dea3..dc9fbcd4 100644
--- a/lib/fflush.c
+++ b/lib/fflush.c
@@ -1,5 +1,5 @@
/* fflush.c -- allow flushing input streams
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007-2014 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
diff --git a/lib/file-has-acl.c b/lib/file-has-acl.c
index 2fedcc63..5104a41e 100644
--- a/lib/file-has-acl.c
+++ b/lib/file-has-acl.c
@@ -1,6 +1,6 @@
/* Test whether a file has a nontrivial access control list.
- Copyright (C) 2002-2003, 2005-2013 Free Software Foundation, Inc.
+ Copyright (C) 2002-2003, 2005-2014 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
@@ -75,8 +75,7 @@ acl_access_nontrivial (acl_t acl)
}
return got_one;
-# else /* IRIX, Tru64 */
-# if HAVE_ACL_TO_SHORT_TEXT /* IRIX */
+# elif HAVE_ACL_TO_SHORT_TEXT /* IRIX */
/* Don't use acl_get_entry: it is undocumented. */
int count = acl->acl_cnt;
@@ -93,8 +92,7 @@ acl_access_nontrivial (acl_t acl)
}
return 0;
-# endif
-# if HAVE_ACL_FREE_TEXT /* Tru64 */
+# elif HAVE_ACL_FREE_TEXT /* Tru64 */
/* Don't use acl_get_entry: it takes only one argument and does not work. */
int count = acl->acl_num;
@@ -117,7 +115,10 @@ acl_access_nontrivial (acl_t acl)
}
return 0;
-# endif
+# else
+
+ errno = ENOSYS;
+ return -1;
# endif
}
@@ -553,7 +554,7 @@ file_has_acl (char const *name, struct stat const *sb)
# endif
}
if (ret < 0)
- return ACL_NOT_WELL_SUPPORTED (errno) ? 0 : -1;
+ return - acl_errno_valid (errno);
return ret;
# elif HAVE_FACL && defined GETACL /* Solaris, Cygwin, not HP-UX */
diff --git a/lib/file-set.c b/lib/file-set.c
index 4103e67f..c3130d98 100644
--- a/lib/file-set.c
+++ b/lib/file-set.c
@@ -1,5 +1,5 @@
/* Specialized functions to manipulate a set of files.
- Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2014 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
diff --git a/lib/file-type.c b/lib/file-type.c
index 0d542692..bf3026f3 100644
--- a/lib/file-type.c
+++ b/lib/file-type.c
@@ -1,6 +1,6 @@
/* Return a string describing the type of a file.
- Copyright (C) 1993-1994, 2001-2002, 2004-2006, 2009-2013 Free Software
+ Copyright (C) 1993-1994, 2001-2002, 2004-2006, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -34,26 +34,19 @@ file_type (struct stat const *st)
To keep diagnostics grammatical in English, the returned string
must start with a consonant. */
+ /* Do these three first, as they're the most common. */
+
if (S_ISREG (st->st_mode))
return st->st_size == 0 ? _("regular empty file") : _("regular file");
if (S_ISDIR (st->st_mode))
return _("directory");
- if (S_ISBLK (st->st_mode))
- return _("block special file");
-
- if (S_ISCHR (st->st_mode))
- return _("character special file");
-
- if (S_ISFIFO (st->st_mode))
- return _("fifo");
-
if (S_ISLNK (st->st_mode))
return _("symbolic link");
- if (S_ISSOCK (st->st_mode))
- return _("socket");
+ /* Do the S_TYPEIS* macros next, as they may be implemented in terms
+ of S_ISNAM, and we want the more-specialized interpretation. */
if (S_TYPEISMQ (st))
return _("message queue");
@@ -67,5 +60,52 @@ file_type (struct stat const *st)
if (S_TYPEISTMO (st))
return _("typed memory object");
+ /* The remaining are in alphabetical order. */
+
+ if (S_ISBLK (st->st_mode))
+ return _("block special file");
+
+ if (S_ISCHR (st->st_mode))
+ return _("character special file");
+
+ if (S_ISCTG (st->st_mode))
+ return _("contiguous data");
+
+ if (S_ISFIFO (st->st_mode))
+ return _("fifo");
+
+ if (S_ISDOOR (st->st_mode))
+ return _("door");
+
+ if (S_ISMPB (st->st_mode))
+ return _("multiplexed block special file");
+
+ if (S_ISMPC (st->st_mode))
+ return _("multiplexed character special file");
+
+ if (S_ISMPX (st->st_mode))
+ return _("multiplexed file");
+
+ if (S_ISNAM (st->st_mode))
+ return _("named file");
+
+ if (S_ISNWK (st->st_mode))
+ return _("network special file");
+
+ if (S_ISOFD (st->st_mode))
+ return _("migrated file with data");
+
+ if (S_ISOFL (st->st_mode))
+ return _("migrated file without data");
+
+ if (S_ISPORT (st->st_mode))
+ return _("port");
+
+ if (S_ISSOCK (st->st_mode))
+ return _("socket");
+
+ if (S_ISWHT (st->st_mode))
+ return _("whiteout");
+
return _("weird file");
}
diff --git a/lib/file-type.h b/lib/file-type.h
index 9c6ac264..ff99a9d7 100644
--- a/lib/file-type.h
+++ b/lib/file-type.h
@@ -1,6 +1,6 @@
/* Return a string describing the type of a file.
- Copyright (C) 1993-1994, 2001-2002, 2004-2005, 2009-2013 Free Software
+ Copyright (C) 1993-1994, 2001-2002, 2004-2005, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/fileblocks.c b/lib/fileblocks.c
index 53c66803..6de113b2 100644
--- a/lib/fileblocks.c
+++ b/lib/fileblocks.c
@@ -1,6 +1,6 @@
/* Convert file size to number of blocks on System V-like machines.
- Copyright (C) 1990, 1997-1999, 2004-2006, 2009-2013 Free Software
+ Copyright (C) 1990, 1997-1999, 2004-2006, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/filemode.c b/lib/filemode.c
index 9e8735a5..3e2f8c03 100644
--- a/lib/filemode.c
+++ b/lib/filemode.c
@@ -1,6 +1,6 @@
/* filemode.c -- make a string describing file modes
- Copyright (C) 1985, 1990, 1993, 1998-2000, 2004, 2006, 2009-2013 Free
+ Copyright (C) 1985, 1990, 1993, 1998-2000, 2004, 2006, 2009-2014 Free
Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/filemode.h b/lib/filemode.h
index a235cb0c..c51e6a3a 100644
--- a/lib/filemode.h
+++ b/lib/filemode.h
@@ -1,6 +1,6 @@
/* Make a string describing file modes.
- Copyright (C) 1998-1999, 2003, 2006, 2009-2013 Free Software Foundation,
+ Copyright (C) 1998-1999, 2003, 2006, 2009-2014 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/filename.h b/lib/filename.h
index b82a0ac3..96dbaaa7 100644
--- a/lib/filename.h
+++ b/lib/filename.h
@@ -1,5 +1,5 @@
/* Basic filename support macros.
- Copyright (C) 2001-2004, 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2001-2004, 2007-2014 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
diff --git a/lib/filenamecat-lgpl.c b/lib/filenamecat-lgpl.c
index 60c4988b..e817f97c 100644
--- a/lib/filenamecat-lgpl.c
+++ b/lib/filenamecat-lgpl.c
@@ -1,6 +1,6 @@
/* Concatenate two arbitrary file names.
- Copyright (C) 1996-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 1996-2007, 2009-2014 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
diff --git a/lib/filenamecat.c b/lib/filenamecat.c
index 8809b571..64c27f20 100644
--- a/lib/filenamecat.c
+++ b/lib/filenamecat.c
@@ -1,6 +1,6 @@
/* Concatenate two arbitrary file names.
- Copyright (C) 1996-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 1996-2007, 2009-2014 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
diff --git a/lib/filenamecat.h b/lib/filenamecat.h
index 1476e14c..b33dce84 100644
--- a/lib/filenamecat.h
+++ b/lib/filenamecat.h
@@ -1,6 +1,6 @@
/* Concatenate two arbitrary file names.
- Copyright (C) 1996-1997, 2003, 2005, 2007, 2009-2013 Free Software
+ Copyright (C) 1996-1997, 2003, 2005, 2007, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/filevercmp.c b/lib/filevercmp.c
index 7dcff8f9..f09205ac 100644
--- a/lib/filevercmp.c
+++ b/lib/filevercmp.c
@@ -1,7 +1,7 @@
/*
Copyright (C) 1995 Ian Jackson <iwj10@cus.cam.ac.uk>
Copyright (C) 2001 Anthony Towns <aj@azure.humbug.org.au>
- Copyright (C) 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2008-2014 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
diff --git a/lib/filevercmp.h b/lib/filevercmp.h
index 34f73ab8..72785cd6 100644
--- a/lib/filevercmp.h
+++ b/lib/filevercmp.h
@@ -1,7 +1,7 @@
/*
Copyright (C) 1995 Ian Jackson <iwj10@cus.cam.ac.uk>
Copyright (C) 2001 Anthony Towns <aj@azure.humbug.org.au>
- Copyright (C) 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2008-2014 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
diff --git a/lib/float+.h b/lib/float+.h
index 32fb790b..5ff15110 100644
--- a/lib/float+.h
+++ b/lib/float+.h
@@ -1,5 +1,5 @@
/* Supplemental information about the floating-point formats.
- Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2007.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/float.c b/lib/float.c
index 366945fa..b7c321dd 100644
--- a/lib/float.c
+++ b/lib/float.c
@@ -1,5 +1,5 @@
/* Auxiliary definitions for <float.h>.
- Copyright (C) 2011-2013 Free Software Foundation, Inc.
+ Copyright (C) 2011-2014 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2011.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/float.in.h b/lib/float.in.h
index 84e1950f..db809f8f 100644
--- a/lib/float.in.h
+++ b/lib/float.in.h
@@ -1,6 +1,6 @@
/* A correct <float.h>.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007-2014 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
diff --git a/lib/fnmatch.c b/lib/fnmatch.c
index 6a09e1a9..4246d822 100644
--- a/lib/fnmatch.c
+++ b/lib/fnmatch.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1993, 1996-2007, 2009-2013 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1993, 1996-2007, 2009-2014 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
diff --git a/lib/fnmatch.in.h b/lib/fnmatch.in.h
index d39ce2f1..d4cea656 100644
--- a/lib/fnmatch.in.h
+++ b/lib/fnmatch.in.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1993, 1996-1999, 2001-2003, 2005, 2007, 2009-2013 Free
+/* Copyright (C) 1991-1993, 1996-1999, 2001-2003, 2005, 2007, 2009-2014 Free
Software Foundation, Inc.
This file is part of the GNU C Library.
diff --git a/lib/fnmatch_loop.c b/lib/fnmatch_loop.c
index f57cd63f..4c6000fa 100644
--- a/lib/fnmatch_loop.c
+++ b/lib/fnmatch_loop.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1993, 1996-2006, 2009-2013 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1993, 1996-2006, 2009-2014 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software; you can redistribute it and/or modify
@@ -227,6 +227,8 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
c = *p++;
for (;;)
{
+ bool is_range = false;
+
if (!(flags & FNM_NOESCAPE) && c == L_('\\'))
{
if (*p == L_('\0'))
@@ -420,8 +422,6 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
}
else
{
- bool is_range = false;
-
#ifdef _LIBC
bool is_seqval = false;
diff --git a/lib/fopen-safer.c b/lib/fopen-safer.c
index 917920d9..3c9e286a 100644
--- a/lib/fopen-safer.c
+++ b/lib/fopen-safer.c
@@ -1,6 +1,6 @@
/* Invoke fopen, but avoid some glitches.
- Copyright (C) 2001, 2004-2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2004-2006, 2009-2014 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
diff --git a/lib/fopen.c b/lib/fopen.c
index f9d6763d..8fead5a8 100644
--- a/lib/fopen.c
+++ b/lib/fopen.c
@@ -1,5 +1,5 @@
/* Open a stream to a file.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007-2014 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
diff --git a/lib/fpending.c b/lib/fpending.c
index e917f4f1..31aba1ad 100644
--- a/lib/fpending.c
+++ b/lib/fpending.c
@@ -1,5 +1,5 @@
/* fpending.c -- return the number of pending output bytes on a stream
- Copyright (C) 2000, 2004, 2006-2007, 2009-2013 Free Software Foundation,
+ Copyright (C) 2000, 2004, 2006-2007, 2009-2014 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/fpending.h b/lib/fpending.h
index bf40d373..dd607fe2 100644
--- a/lib/fpending.h
+++ b/lib/fpending.h
@@ -1,6 +1,6 @@
/* Declare __fpending.
- Copyright (C) 2000, 2003, 2005-2006, 2009-2013 Free Software Foundation,
+ Copyright (C) 2000, 2003, 2005-2006, 2009-2014 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
@@ -20,11 +20,10 @@
#include <stddef.h>
#include <stdio.h>
+#if HAVE_STDIO_EXT_H
+# include <stdio_ext.h>
+#endif
-#if HAVE_DECL___FPENDING
-# if HAVE_STDIO_EXT_H
-# include <stdio_ext.h>
-# endif
-#else
-size_t __fpending (FILE *);
+#if !HAVE_DECL___FPENDING
+size_t __fpending (FILE *) _GL_ATTRIBUTE_PURE;
#endif
diff --git a/lib/fprintftime.h b/lib/fprintftime.h
index 56b7c4a1..9b367cd6 100644
--- a/lib/fprintftime.h
+++ b/lib/fprintftime.h
@@ -1,6 +1,6 @@
/* Generate time strings directly to the output. */
-/* Copyright (C) 2005, 2009-2013 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2009-2014 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
diff --git a/lib/fpucw.h b/lib/fpucw.h
index 0b7f5284..9170c27f 100644
--- a/lib/fpucw.h
+++ b/lib/fpucw.h
@@ -1,5 +1,5 @@
/* Manipulating the FPU control word.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007-2014 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2007.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/fpurge.c b/lib/fpurge.c
index e00187dd..54a27225 100644
--- a/lib/fpurge.c
+++ b/lib/fpurge.c
@@ -1,5 +1,5 @@
/* Flushing buffers of a FILE stream.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007-2014 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
diff --git a/lib/freadahead.c b/lib/freadahead.c
index f2dae46b..01b08108 100644
--- a/lib/freadahead.c
+++ b/lib/freadahead.c
@@ -1,5 +1,5 @@
/* Retrieve information about a FILE stream.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007-2014 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
diff --git a/lib/freadahead.h b/lib/freadahead.h
index c691f89c..85c16b99 100644
--- a/lib/freadahead.h
+++ b/lib/freadahead.h
@@ -1,5 +1,5 @@
/* Retrieve information about a FILE stream.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007-2014 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
diff --git a/lib/freading.c b/lib/freading.c
index 8012a7a3..dee43256 100644
--- a/lib/freading.c
+++ b/lib/freading.c
@@ -1,5 +1,5 @@
/* Retrieve information about a FILE stream.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007-2014 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
diff --git a/lib/freading.h b/lib/freading.h
index 88ea789e..3d1c7b2c 100644
--- a/lib/freading.h
+++ b/lib/freading.h
@@ -1,5 +1,5 @@
/* Retrieve information about a FILE stream.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007-2014 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
@@ -44,7 +44,7 @@
extern "C" {
# endif
-extern bool freading (FILE *stream);
+extern bool freading (FILE *stream) _GL_ATTRIBUTE_PURE;
# ifdef __cplusplus
}
diff --git a/lib/freadptr.c b/lib/freadptr.c
index 9f11f965..26c66ede 100644
--- a/lib/freadptr.c
+++ b/lib/freadptr.c
@@ -1,5 +1,5 @@
/* Retrieve information about a FILE stream.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007-2014 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
diff --git a/lib/freadptr.h b/lib/freadptr.h
index 785ec99b..45fb93fd 100644
--- a/lib/freadptr.h
+++ b/lib/freadptr.h
@@ -1,5 +1,5 @@
/* Retrieve information about a FILE stream.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007-2014 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
diff --git a/lib/freadseek.c b/lib/freadseek.c
index ea28d878..5301794b 100644
--- a/lib/freadseek.c
+++ b/lib/freadseek.c
@@ -1,5 +1,5 @@
/* Skipping input from a FILE stream.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007-2014 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
diff --git a/lib/freadseek.h b/lib/freadseek.h
index 8e6a5a38..84ce3508 100644
--- a/lib/freadseek.h
+++ b/lib/freadseek.h
@@ -1,5 +1,5 @@
/* Skipping input from a FILE stream.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007-2014 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
diff --git a/lib/freopen-safer.c b/lib/freopen-safer.c
index 9fe403bd..714dc1df 100644
--- a/lib/freopen-safer.c
+++ b/lib/freopen-safer.c
@@ -1,6 +1,6 @@
/* Invoke freopen, but avoid some glitches.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 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
diff --git a/lib/freopen.c b/lib/freopen.c
index b5812611..384eba64 100644
--- a/lib/freopen.c
+++ b/lib/freopen.c
@@ -1,5 +1,5 @@
/* Open a stream to a file.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007-2014 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
diff --git a/lib/frexp.c b/lib/frexp.c
index d847fa38..17ddcef8 100644
--- a/lib/frexp.c
+++ b/lib/frexp.c
@@ -1,5 +1,5 @@
/* Split a double into fraction and mantissa.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007-2014 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
diff --git a/lib/frexpl.c b/lib/frexpl.c
index 5ec2780e..78e1c704 100644
--- a/lib/frexpl.c
+++ b/lib/frexpl.c
@@ -1,5 +1,5 @@
/* Split a 'long double' into fraction and mantissa.
- Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2014 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
diff --git a/lib/fseek.c b/lib/fseek.c
index 4708287c..f778145c 100644
--- a/lib/fseek.c
+++ b/lib/fseek.c
@@ -1,5 +1,5 @@
/* An fseek() function that, together with fflush(), is POSIX compliant.
- Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2014 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
diff --git a/lib/fseeko.c b/lib/fseeko.c
index 42cd6428..e56ad0bc 100644
--- a/lib/fseeko.c
+++ b/lib/fseeko.c
@@ -1,5 +1,5 @@
/* An fseeko() function that, together with fflush(), is POSIX compliant.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007-2014 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
@@ -19,7 +19,7 @@
/* Specification. */
#include <stdio.h>
-/* Get off_t and lseek. */
+/* Get off_t, lseek, _POSIX_VERSION. */
#include <unistd.h>
#include "stdio-impl.h"
@@ -99,8 +99,14 @@ fseeko (FILE *fp, off_t offset, int whence)
#elif defined EPLAN9 /* Plan9 */
if (fp->rp == fp->buf
&& fp->wp == fp->buf)
+#elif FUNC_FFLUSH_STDIN < 0 && 200809 <= _POSIX_VERSION
+ /* Cross-compiling to some other system advertising conformance to
+ POSIX.1-2008 or later. Assume fseeko and fflush work as advertised.
+ If this assumption is incorrect, please report the bug to
+ bug-gnulib. */
+ if (0)
#else
- #error "Please port gnulib fseeko.c to your platform! Look at the code in fpurge.c, then report this to bug-gnulib."
+ #error "Please port gnulib fseeko.c to your platform! Look at the code in fseeko.c, then report this to bug-gnulib."
#endif
{
/* We get here when an fflush() call immediately preceded this one (or
diff --git a/lib/fseterr.c b/lib/fseterr.c
index 0fca65f5..1e212e42 100644
--- a/lib/fseterr.c
+++ b/lib/fseterr.c
@@ -1,5 +1,5 @@
/* Set the error indicator of a stream.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007-2014 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
diff --git a/lib/fseterr.h b/lib/fseterr.h
index 630fa864..81672fb9 100644
--- a/lib/fseterr.h
+++ b/lib/fseterr.h
@@ -1,5 +1,5 @@
/* Set the error indicator of a stream.
- Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2014 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
diff --git a/lib/fstat.c b/lib/fstat.c
index dc802f50..ffcda9f5 100644
--- a/lib/fstat.c
+++ b/lib/fstat.c
@@ -1,5 +1,5 @@
/* fstat() replacement.
- Copyright (C) 2011-2013 Free Software Foundation, Inc.
+ Copyright (C) 2011-2014 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
diff --git a/lib/fstatat.c b/lib/fstatat.c
index 845c171f..44e32668 100644
--- a/lib/fstatat.c
+++ b/lib/fstatat.c
@@ -1,6 +1,6 @@
/* Work around an fstatat bug on Solaris 9.
- Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2009-2014 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
diff --git a/lib/fsusage.c b/lib/fsusage.c
index 0657555f..5bfc9cd0 100644
--- a/lib/fsusage.c
+++ b/lib/fsusage.c
@@ -1,6 +1,6 @@
/* fsusage.c -- return space usage of mounted file systems
- Copyright (C) 1991-1992, 1996, 1998-1999, 2002-2006, 2009-2013 Free Software
+ Copyright (C) 1991-1992, 1996, 1998-1999, 2002-2006, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -55,11 +55,6 @@
# include "full-read.h"
#endif
-/* The results of open() in this file are not used with fchdir,
- therefore save some unnecessary work in fchdir.c. */
-#undef open
-#undef close
-
/* Many space usage primitives use all 1 bits to denote a value that is
not applicable or unknown. Propagate this information by returning
a uintmax_t value that is all 1 bits if X is all 1 bits, even if X
diff --git a/lib/fsusage.h b/lib/fsusage.h
index 7810fc01..c1ce2811 100644
--- a/lib/fsusage.h
+++ b/lib/fsusage.h
@@ -1,6 +1,6 @@
/* fsusage.h -- declarations for file system space usage info
- Copyright (C) 1991-1992, 1997, 2003-2006, 2009-2013 Free Software
+ Copyright (C) 1991-1992, 1997, 2003-2006, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/fsync.c b/lib/fsync.c
index 8a1a9750..b09a8e64 100644
--- a/lib/fsync.c
+++ b/lib/fsync.c
@@ -7,7 +7,7 @@
Written by Richard W.M. Jones <rjones.at.redhat.com>
- Copyright (C) 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2008-2014 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
diff --git a/lib/ftell.c b/lib/ftell.c
index 4ad13c9f..d5cbccd7 100644
--- a/lib/ftell.c
+++ b/lib/ftell.c
@@ -1,5 +1,5 @@
/* An ftell() function that works around platform bugs.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007-2014 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
diff --git a/lib/ftello.c b/lib/ftello.c
index 3a2a0f20..ee4f7dc0 100644
--- a/lib/ftello.c
+++ b/lib/ftello.c
@@ -1,5 +1,5 @@
/* An ftello() function that works around platform bugs.
- Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2014 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
diff --git a/lib/ftoastr.c b/lib/ftoastr.c
index 518074f8..7780d008 100644
--- a/lib/ftoastr.c
+++ b/lib/ftoastr.c
@@ -1,6 +1,6 @@
/* floating point to accurate string
- Copyright (C) 2010-2013 Free Software Foundation, Inc.
+ Copyright (C) 2010-2014 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
diff --git a/lib/ftoastr.h b/lib/ftoastr.h
index 5aa0930d..26cad736 100644
--- a/lib/ftoastr.h
+++ b/lib/ftoastr.h
@@ -1,6 +1,6 @@
/* floating point to accurate string
- Copyright (C) 2010-2013 Free Software Foundation, Inc.
+ Copyright (C) 2010-2014 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
@@ -72,12 +72,13 @@ enum
/* _GL_FLT_PREC_BOUND is an upper bound on the precision needed to
represent a float value without losing information. Likewise for
- _GL_DBL_PREC_BOUND and double, and _GL_LDBL_PREC_BOUND and long double. */
+ _GL_DBL_PREC_BOUND and double, and _GL_LDBL_PREC_BOUND and long double.
+ These are macros, not enums, to work around a bug in IBM xlc 12.1. */
#if FLT_RADIX == 10 /* decimal floating point */
- enum { _GL_FLT_PREC_BOUND = FLT_MANT_DIG };
- enum { _GL_DBL_PREC_BOUND = DBL_MANT_DIG };
- enum { _GL_LDBL_PREC_BOUND = LDBL_MANT_DIG };
+# define _GL_FLT_PREC_BOUND FLT_MANT_DIG
+# define _GL_DBL_PREC_BOUND DBL_MANT_DIG
+# define _GL_LDBL_PREC_BOUND LDBL_MANT_DIG
#else
/* An upper bound on the number of bits needed to represent a single
@@ -95,13 +96,13 @@ enum
DIG digits. For why the "+ 1" is needed, see "Binary to Decimal
Conversion" in David Goldberg's paper "What Every Computer
Scientist Should Know About Floating-Point Arithmetic"
- <http://docs.sun.com/source/806-3568/ncg_goldberg.html>. */
+ <http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html>. */
# define _GL_FLOAT_PREC_BOUND(dig) \
(INT_BITS_STRLEN_BOUND ((dig) * _GL_FLOAT_DIG_BITS_BOUND) + 1)
- enum { _GL_FLT_PREC_BOUND = _GL_FLOAT_PREC_BOUND ( FLT_MANT_DIG) };
- enum { _GL_DBL_PREC_BOUND = _GL_FLOAT_PREC_BOUND ( DBL_MANT_DIG) };
- enum { _GL_LDBL_PREC_BOUND = _GL_FLOAT_PREC_BOUND (LDBL_MANT_DIG) };
+# define _GL_FLT_PREC_BOUND _GL_FLOAT_PREC_BOUND ( FLT_MANT_DIG)
+# define _GL_DBL_PREC_BOUND _GL_FLOAT_PREC_BOUND ( DBL_MANT_DIG)
+# define _GL_LDBL_PREC_BOUND _GL_FLOAT_PREC_BOUND (LDBL_MANT_DIG)
#endif
diff --git a/lib/ftruncate.c b/lib/ftruncate.c
index db7f7ddf..d7a5f203 100644
--- a/lib/ftruncate.c
+++ b/lib/ftruncate.c
@@ -1,5 +1,5 @@
/* ftruncate emulations for native Windows.
- Copyright (C) 1992-2013 Free Software Foundation, Inc.
+ Copyright (C) 1992-2014 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
diff --git a/lib/fts-cycle.c b/lib/fts-cycle.c
index b07266a7..95da56e2 100644
--- a/lib/fts-cycle.c
+++ b/lib/fts-cycle.c
@@ -1,6 +1,6 @@
/* Detect cycles in file tree walks.
- Copyright (C) 2003-2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2003-2006, 2009-2014 Free Software Foundation, Inc.
Written by Jim Meyering.
diff --git a/lib/fts.c b/lib/fts.c
index 74968b36..500e92c6 100644
--- a/lib/fts.c
+++ b/lib/fts.c
@@ -1,6 +1,6 @@
/* Traverse a file hierarchy.
- Copyright (C) 2004-2013 Free Software Foundation, Inc.
+ Copyright (C) 2004-2014 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
@@ -1447,19 +1447,21 @@ fts_build (register FTS *sp, int type)
nitems = 0;
while (cur->fts_dirp) {
bool is_dir;
+ size_t d_namelen;
struct dirent *dp = readdir(cur->fts_dirp);
if (dp == NULL)
break;
if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name))
continue;
- if ((p = fts_alloc (sp, dp->d_name,
- _D_EXACT_NAMLEN (dp))) == NULL)
+ d_namelen = _D_EXACT_NAMLEN (dp);
+ p = fts_alloc (sp, dp->d_name, d_namelen);
+ if (!p)
goto mem1;
- if (_D_EXACT_NAMLEN (dp) >= maxlen) {
+ if (d_namelen >= maxlen) {
/* include space for NUL */
oldaddr = sp->fts_path;
- if (! fts_palloc(sp, _D_EXACT_NAMLEN (dp) + len + 1)) {
+ if (! fts_palloc(sp, d_namelen + len + 1)) {
/*
* No more memory. Save
* errno, free up the current structure and the
@@ -1483,7 +1485,7 @@ mem1: saved_errno = errno;
maxlen = sp->fts_pathlen - len;
}
- new_len = len + _D_EXACT_NAMLEN (dp);
+ new_len = len + d_namelen;
if (new_len < len) {
/*
* In the unlikely event that we would end up
diff --git a/lib/fts_.h b/lib/fts_.h
index e217c73f..63d4b742 100644
--- a/lib/fts_.h
+++ b/lib/fts_.h
@@ -1,6 +1,6 @@
/* Traverse a file hierarchy.
- Copyright (C) 2004-2013 Free Software Foundation, Inc.
+ Copyright (C) 2004-2014 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
diff --git a/lib/full-read.c b/lib/full-read.c
index a0dc82c2..31b600bb 100644
--- a/lib/full-read.c
+++ b/lib/full-read.c
@@ -1,5 +1,5 @@
/* An interface to read that retries after partial reads and interrupts.
- Copyright (C) 2002-2003, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2002-2003, 2009-2014 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
diff --git a/lib/full-read.h b/lib/full-read.h
index 66c8c5c1..5eadd158 100644
--- a/lib/full-read.h
+++ b/lib/full-read.h
@@ -1,6 +1,6 @@
/* An interface to read() that reads all it is asked to read.
- Copyright (C) 2002, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2009-2014 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
diff --git a/lib/full-write.c b/lib/full-write.c
index beb5bf95..b8036772 100644
--- a/lib/full-write.c
+++ b/lib/full-write.c
@@ -1,6 +1,6 @@
/* An interface to read and write that retries (if necessary) until complete.
- Copyright (C) 1993-1994, 1997-2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 1993-1994, 1997-2006, 2009-2014 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
diff --git a/lib/full-write.h b/lib/full-write.h
index 67462b14..589f6e1b 100644
--- a/lib/full-write.h
+++ b/lib/full-write.h
@@ -1,6 +1,6 @@
/* An interface to write() that writes all it is asked to write.
- Copyright (C) 2002-2003, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2002-2003, 2009-2014 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
diff --git a/lib/futimens.c b/lib/futimens.c
index 4ea05f70..96c0b73e 100644
--- a/lib/futimens.c
+++ b/lib/futimens.c
@@ -1,5 +1,5 @@
/* Set the access and modification time of an open fd.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 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
diff --git a/lib/gai_strerror.c b/lib/gai_strerror.c
index 1e371d27..9c393880 100644
--- a/lib/gai_strerror.c
+++ b/lib/gai_strerror.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 2001-2002, 2004-2006, 2008-2013 Free Software
+/* Copyright (C) 1997, 2001-2002, 2004-2006, 2008-2014 Free Software
Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Philip Blundell <pjb27@cam.ac.uk>, 1997.
diff --git a/lib/getaddrinfo.c b/lib/getaddrinfo.c
index 4d4d4c55..eef7a0c4 100644
--- a/lib/getaddrinfo.c
+++ b/lib/getaddrinfo.c
@@ -1,5 +1,5 @@
/* Get address information (partial implementation).
- Copyright (C) 1997, 2001-2002, 2004-2013 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2001-2002, 2004-2014 Free Software Foundation, Inc.
Contributed by Simon Josefsson <simon@josefsson.org>.
This program is free software; you can redistribute it and/or modify
@@ -15,12 +15,12 @@
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>. */
-#include <config.h>
-
/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
optimizes away the sa == NULL test below. */
#define _GL_ARG_NONNULL(params)
+#include <config.h>
+
#include <netdb.h>
#if HAVE_NETINET_IN_H
diff --git a/lib/getcwd-lgpl.c b/lib/getcwd-lgpl.c
index d550f35c..044c0000 100644
--- a/lib/getcwd-lgpl.c
+++ b/lib/getcwd-lgpl.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011-2013 Free Software Foundation, Inc.
+/* Copyright (C) 2011-2014 Free Software Foundation, Inc.
This file is part of gnulib.
This program is free software: you can redistribute it and/or modify
@@ -20,6 +20,7 @@
#include <unistd.h>
#include <errno.h>
+#include <stdlib.h>
#include <string.h>
#if GNULIB_GETCWD
diff --git a/lib/getcwd.c b/lib/getcwd.c
index 4b781389..1a013f47 100644
--- a/lib/getcwd.c
+++ b/lib/getcwd.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1999, 2004-2013 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1999, 2004-2014 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software: you can redistribute it and/or modify
@@ -135,7 +135,7 @@ __getcwd (char *buf, size_t size)
size_t allocated = size;
size_t used;
-#if HAVE_RAW_DECL_GETCWD && HAVE_MINIMALLY_WORKING_GETCWD
+#if HAVE_MINIMALLY_WORKING_GETCWD
/* If AT_FDCWD is not defined, the algorithm below is O(N**2) and
this is much slower than the system getcwd (at least on
GNU/Linux). So trust the system getcwd's results unless they
diff --git a/lib/getdelim.c b/lib/getdelim.c
index 966bf764..e5714baf 100644
--- a/lib/getdelim.c
+++ b/lib/getdelim.c
@@ -1,5 +1,5 @@
/* getdelim.c --- Implementation of replacement getdelim function.
- Copyright (C) 1994, 1996-1998, 2001, 2003, 2005-2013 Free Software
+ Copyright (C) 1994, 1996-1998, 2001, 2003, 2005-2014 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or
@@ -17,12 +17,12 @@
/* Ported from glibc by Simon Josefsson. */
-#include <config.h>
-
/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
optimizes away the lineptr == NULL || n == NULL || fp == NULL tests below. */
#define _GL_ARG_NONNULL(params)
+#include <config.h>
+
#include <stdio.h>
#include <limits.h>
diff --git a/lib/getdtablesize.c b/lib/getdtablesize.c
index 9947405a..946738cd 100644
--- a/lib/getdtablesize.c
+++ b/lib/getdtablesize.c
@@ -1,5 +1,5 @@
/* getdtablesize() function for platforms that don't have it.
- Copyright (C) 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2008-2014 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2008.
This program is free software: you can redistribute it and/or modify
@@ -22,11 +22,11 @@
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-#include <stdio.h>
+# include <stdio.h>
-#include "msvc-inval.h"
+# include "msvc-inval.h"
-#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
+# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
static int
_setmaxstdio_nothrow (int newmax)
{
@@ -44,10 +44,11 @@ _setmaxstdio_nothrow (int newmax)
return result;
}
-# define _setmaxstdio _setmaxstdio_nothrow
-#endif
+# define _setmaxstdio _setmaxstdio_nothrow
+# endif
-/* Cache for the previous getdtablesize () result. */
+/* Cache for the previous getdtablesize () result. Safe to cache because
+ Windows also lacks setrlimit. */
static int dtablesize;
int
@@ -83,4 +84,24 @@ getdtablesize (void)
return dtablesize;
}
+#elif HAVE_GETDTABLESIZE
+
+# include <sys/resource.h>
+# undef getdtablesize
+
+int
+rpl_getdtablesize(void)
+{
+ /* To date, this replacement is only compiled for Cygwin 1.7.25,
+ which auto-increased the RLIMIT_NOFILE soft limit until it
+ hits the compile-time constant hard limit of 3200. Although
+ that version of cygwin supported a child process inheriting
+ a smaller soft limit, the smaller limit is not enforced, so
+ we might as well just report the hard limit. */
+ struct rlimit lim;
+ if (!getrlimit (RLIMIT_NOFILE, &lim) && lim.rlim_max != RLIM_INFINITY)
+ return lim.rlim_max;
+ return getdtablesize ();
+}
+
#endif
diff --git a/lib/getfilecon.c b/lib/getfilecon.c
index 29e16ec9..2aa489e5 100644
--- a/lib/getfilecon.c
+++ b/lib/getfilecon.c
@@ -1,5 +1,5 @@
/* wrap getfilecon, lgetfilecon, and fgetfilecon
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 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
diff --git a/lib/getgroups.c b/lib/getgroups.c
index 9856adc1..91a340f3 100644
--- a/lib/getgroups.c
+++ b/lib/getgroups.c
@@ -1,6 +1,6 @@
/* provide consistent interface to getgroups for systems that don't allow N==0
- Copyright (C) 1996, 1999, 2003, 2006-2013 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1999, 2003, 2006-2014 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
@@ -43,6 +43,21 @@ getgroups (int n _GL_UNUSED, GETGROUPS_T *groups _GL_UNUSED)
# define GETGROUPS_ZERO_BUG 0
# endif
+/* On OS X 10.6 and later, use the usual getgroups, not the one
+ supplied when _DARWIN_C_SOURCE is defined. _DARWIN_C_SOURCE is
+ normally defined, since it means "conform to POSIX, but add
+ non-POSIX extensions even if that violates the POSIX namespace
+ rules", which is what we normally want. But with getgroups there
+ is an inconsistency, and _DARWIN_C_SOURCE means "change getgroups()
+ so that it no longer works right". The BUGS section of compat(5)
+ says that the behavior is dubious if you compile different sections
+ of a program with different _DARWIN_C_SOURCE settings, so fix only
+ the offending symbol. */
+# ifdef __APPLE__
+int posix_getgroups (int, gid_t []) __asm ("_getgroups");
+# define getgroups posix_getgroups
+# endif
+
/* On at least Ultrix 4.3 and NextStep 3.2, getgroups (0, NULL) always
fails. On other systems, it returns the number of supplemental
groups for the process. This function handles that special case
@@ -86,7 +101,7 @@ rpl_getgroups (int n, gid_t *group)
}
saved_errno = errno;
free (gbuf);
- errno == saved_errno;
+ errno = saved_errno;
return result;
}
diff --git a/lib/gethostname.c b/lib/gethostname.c
index 22015732..785fd715 100644
--- a/lib/gethostname.c
+++ b/lib/gethostname.c
@@ -1,6 +1,6 @@
/* gethostname emulation for SysV and POSIX.1.
- Copyright (C) 1992, 2003, 2006, 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 1992, 2003, 2006, 2008-2014 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
diff --git a/lib/gethrxtime.c b/lib/gethrxtime.c
index 10d2ab98..788ef56e 100644
--- a/lib/gethrxtime.c
+++ b/lib/gethrxtime.c
@@ -1,6 +1,6 @@
/* gethrxtime -- get high resolution real time
- Copyright (C) 2005-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005-2007, 2009-2014 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
diff --git a/lib/gethrxtime.h b/lib/gethrxtime.h
index 10df6712..87dcdcf8 100644
--- a/lib/gethrxtime.h
+++ b/lib/gethrxtime.h
@@ -1,6 +1,6 @@
/* gethrxtime -- get high resolution real time
- Copyright (C) 2005, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2009-2014 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
@@ -22,6 +22,9 @@
#include "xtime.h"
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
_GL_INLINE_HEADER_BEGIN
#ifndef GETHRXTIME_INLINE
# define GETHRXTIME_INLINE _GL_INLINE
diff --git a/lib/getline.c b/lib/getline.c
index 1aa07b9c..5282e80f 100644
--- a/lib/getline.c
+++ b/lib/getline.c
@@ -1,5 +1,5 @@
/* getline.c --- Implementation of replacement getline function.
- Copyright (C) 2005-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005-2007, 2009-2014 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
diff --git a/lib/getloadavg.c b/lib/getloadavg.c
index 6e228191..cdba5259 100644
--- a/lib/getloadavg.c
+++ b/lib/getloadavg.c
@@ -1,6 +1,6 @@
/* Get the system load averages.
- Copyright (C) 1985-1989, 1991-1995, 1997, 1999-2000, 2003-2013 Free Software
+ Copyright (C) 1985-1989, 1991-1995, 1997, 1999-2000, 2003-2014 Free Software
Foundation, Inc.
NOTE: The canonical source of this file is maintained with gnulib.
diff --git a/lib/getlogin.c b/lib/getlogin.c
index c02b0b9c..3737d36c 100644
--- a/lib/getlogin.c
+++ b/lib/getlogin.c
@@ -1,6 +1,6 @@
/* Provide a working getlogin for systems which lack it.
- Copyright (C) 2010-2013 Free Software Foundation, Inc.
+ Copyright (C) 2010-2014 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
diff --git a/lib/getndelim2.c b/lib/getndelim2.c
index a5e8a666..d19e55c8 100644
--- a/lib/getndelim2.c
+++ b/lib/getndelim2.c
@@ -1,7 +1,7 @@
/* getndelim2 - Read a line from a stream, stopping at one of 2 delimiters,
with bounded memory allocation.
- Copyright (C) 1993, 1996-1998, 2000, 2003-2004, 2006, 2008-2013 Free
+ Copyright (C) 1993, 1996-1998, 2000, 2003-2004, 2006, 2008-2014 Free
Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/getndelim2.h b/lib/getndelim2.h
index 774fc90c..badf7836 100644
--- a/lib/getndelim2.h
+++ b/lib/getndelim2.h
@@ -1,7 +1,7 @@
/* getndelim2 - Read a line from a stream, stopping at one of 2 delimiters,
with bounded memory allocation.
- Copyright (C) 2003-2004, 2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2003-2004, 2006, 2009-2014 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
diff --git a/lib/getopt.c b/lib/getopt.c
index ef0f4cee..7d950af1 100644
--- a/lib/getopt.c
+++ b/lib/getopt.c
@@ -2,7 +2,7 @@
NOTE: getopt is part of the C library, so if you don't know what
"Keep this file name-space clean" means, talk to drepper@gnu.org
before changing it!
- Copyright (C) 1987-1996, 1998-2004, 2006, 2008-2013 Free Software
+ Copyright (C) 1987-1996, 1998-2004, 2006, 2008-2014 Free Software
Foundation, Inc.
This file is part of the GNU C Library.
diff --git a/lib/getopt.in.h b/lib/getopt.in.h
index d9c7d814..7ab99fb8 100644
--- a/lib/getopt.in.h
+++ b/lib/getopt.in.h
@@ -1,5 +1,5 @@
/* Declarations for getopt.
- Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2013 Free Software
+ Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2014 Free Software
Foundation, Inc.
This file is part of the GNU C Library.
diff --git a/lib/getopt1.c b/lib/getopt1.c
index 55a6b4ea..a184865e 100644
--- a/lib/getopt1.c
+++ b/lib/getopt1.c
@@ -1,5 +1,5 @@
/* getopt_long and getopt_long_only entry points for GNU getopt.
- Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2013 Free Software
+ Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2014 Free Software
Foundation, Inc.
This file is part of the GNU C Library.
diff --git a/lib/getopt_int.h b/lib/getopt_int.h
index a6e4b9ea..24ed672e 100644
--- a/lib/getopt_int.h
+++ b/lib/getopt_int.h
@@ -1,5 +1,5 @@
/* Internal declarations for getopt.
- Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2013 Free Software
+ Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2014 Free Software
Foundation, Inc.
This file is part of the GNU C Library.
diff --git a/lib/getpagesize.c b/lib/getpagesize.c
index 274c591a..86e12710 100644
--- a/lib/getpagesize.c
+++ b/lib/getpagesize.c
@@ -1,6 +1,6 @@
/* getpagesize emulation for systems where it cannot be done in a C macro.
- Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2014 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
diff --git a/lib/getpass.c b/lib/getpass.c
index 3c9c4d8a..1fee36ba 100644
--- a/lib/getpass.c
+++ b/lib/getpass.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-2001, 2003-2007, 2009-2013 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2001, 2003-2007, 2009-2014 Free Software Foundation, Inc.
This file is part of the GNU C Library.
diff --git a/lib/getpass.h b/lib/getpass.h
index 9b59abb1..1e03cbd7 100644
--- a/lib/getpass.h
+++ b/lib/getpass.h
@@ -1,5 +1,5 @@
/* getpass.h -- Read a password of arbitrary length from /dev/tty or stdin.
- Copyright (C) 2004, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2009-2014 Free Software Foundation, Inc.
Contributed by Simon Josefsson <jas@extundo.com>, 2004.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/gettext.h b/lib/gettext.h
index d0215715..c7d6fd34 100644
--- a/lib/gettext.h
+++ b/lib/gettext.h
@@ -1,5 +1,5 @@
/* Convenience header for conditional use of GNU <libintl.h>.
- Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2013 Free Software
+ Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2014 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/gettime.c b/lib/gettime.c
index 0a642dd2..1b4ca8d2 100644
--- a/lib/gettime.c
+++ b/lib/gettime.c
@@ -1,6 +1,6 @@
/* gettime -- get the system clock
- Copyright (C) 2002, 2004-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004-2007, 2009-2014 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
diff --git a/lib/gettimeofday.c b/lib/gettimeofday.c
index ad65c6da..8b2058e8 100644
--- a/lib/gettimeofday.c
+++ b/lib/gettimeofday.c
@@ -1,6 +1,6 @@
/* Provide gettimeofday for systems that don't have it or for which it's broken.
- Copyright (C) 2001-2003, 2005-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2001-2003, 2005-2007, 2009-2014 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
diff --git a/lib/getugroups.c b/lib/getugroups.c
index 725f0246..d6634baf 100644
--- a/lib/getugroups.c
+++ b/lib/getugroups.c
@@ -1,6 +1,6 @@
/* getugroups.c -- return a list of the groups a user is in
- Copyright (C) 1990-1991, 1998-2000, 2003-2013 Free Software Foundation, Inc.
+ Copyright (C) 1990-1991, 1998-2000, 2003-2014 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
diff --git a/lib/getugroups.h b/lib/getugroups.h
index 90cc55fe..4a5a5e86 100644
--- a/lib/getugroups.h
+++ b/lib/getugroups.h
@@ -1,5 +1,5 @@
/* Get a list of group IDs associated with a specified user ID.
- Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2014 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
diff --git a/lib/getusershell.c b/lib/getusershell.c
index f938dcaa..ba5c5484 100644
--- a/lib/getusershell.c
+++ b/lib/getusershell.c
@@ -1,6 +1,6 @@
/* getusershell.c -- Return names of valid user shells.
- Copyright (C) 1991, 1997, 2000-2001, 2003-2006, 2008-2013 Free Software
+ Copyright (C) 1991, 1997, 2000-2001, 2003-2006, 2008-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/gl_openssl.h b/lib/gl_openssl.h
new file mode 100644
index 00000000..24144215
--- /dev/null
+++ b/lib/gl_openssl.h
@@ -0,0 +1,116 @@
+/* gl_openssl.h -- wrap openssl crypto hash routines in gnulib interface
+
+ Copyright (C) 2013-2014 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
+
+/* Written by Pádraig Brady */
+
+#ifndef GL_OPENSSL_NAME
+# error "Please define GL_OPENSSL_NAME to 1,5,256 etc."
+#endif
+
+#ifndef _GL_INLINE_HEADER_BEGIN
+# error "Please include config.h first."
+#endif
+_GL_INLINE_HEADER_BEGIN
+#ifndef GL_OPENSSL_INLINE
+# define GL_OPENSSL_INLINE _GL_INLINE
+#endif
+
+/* Concatenate two preprocessor tokens. */
+#define _GLCRYPTO_CONCAT_(prefix, suffix) prefix##suffix
+#define _GLCRYPTO_CONCAT(prefix, suffix) _GLCRYPTO_CONCAT_ (prefix, suffix)
+
+#if GL_OPENSSL_NAME == 5
+# define OPENSSL_ALG md5
+#else
+# define OPENSSL_ALG _GLCRYPTO_CONCAT (sha, GL_OPENSSL_NAME)
+#endif
+
+/* Context type mappings. */
+#if BASE_OPENSSL_TYPE != GL_OPENSSL_NAME
+# undef BASE_OPENSSL_TYPE
+# if GL_OPENSSL_NAME == 224
+# define BASE_OPENSSL_TYPE 256
+# elif GL_OPENSSL_NAME == 384
+# define BASE_OPENSSL_TYPE 512
+# endif
+# define md5_CTX MD5_CTX
+# define sha1_CTX SHA_CTX
+# define sha224_CTX SHA256_CTX
+# define sha224_ctx sha256_ctx
+# define sha256_CTX SHA256_CTX
+# define sha384_CTX SHA512_CTX
+# define sha384_ctx sha512_ctx
+# define sha512_CTX SHA512_CTX
+# undef _gl_CTX
+# undef _gl_ctx
+# define _gl_CTX _GLCRYPTO_CONCAT (OPENSSL_ALG, _CTX) /* openssl type. */
+# define _gl_ctx _GLCRYPTO_CONCAT (OPENSSL_ALG, _ctx) /* gnulib type. */
+
+struct _gl_ctx { _gl_CTX CTX; };
+#endif
+
+/* Function name mappings. */
+#define md5_prefix MD5
+#define sha1_prefix SHA1
+#define sha224_prefix SHA224
+#define sha256_prefix SHA256
+#define sha384_prefix SHA384
+#define sha512_prefix SHA512
+#define _GLCRYPTO_PREFIX _GLCRYPTO_CONCAT (OPENSSL_ALG, _prefix)
+#define OPENSSL_FN(suffix) _GLCRYPTO_CONCAT (_GLCRYPTO_PREFIX, suffix)
+#define GL_CRYPTO_FN(suffix) _GLCRYPTO_CONCAT (OPENSSL_ALG, suffix)
+
+GL_OPENSSL_INLINE void
+GL_CRYPTO_FN (_init_ctx) (struct _gl_ctx *ctx)
+{ (void) OPENSSL_FN (_Init) ((_gl_CTX *) ctx); }
+
+/* These were never exposed by gnulib. */
+#if ! (GL_OPENSSL_NAME == 224 || GL_OPENSSL_NAME == 384)
+GL_OPENSSL_INLINE void
+GL_CRYPTO_FN (_process_bytes) (const void *buf, size_t len, struct _gl_ctx *ctx)
+{ OPENSSL_FN (_Update) ((_gl_CTX *) ctx, buf, len); }
+
+GL_OPENSSL_INLINE void
+GL_CRYPTO_FN (_process_block) (const void *buf, size_t len, struct _gl_ctx *ctx)
+{ GL_CRYPTO_FN (_process_bytes) (buf, len, ctx); }
+#endif
+
+GL_OPENSSL_INLINE void *
+GL_CRYPTO_FN (_finish_ctx) (struct _gl_ctx *ctx, void *res)
+{ OPENSSL_FN (_Final) ((unsigned char *) res, (_gl_CTX *) ctx); return res; }
+
+GL_OPENSSL_INLINE void *
+GL_CRYPTO_FN (_buffer) (const char *buf, size_t len, void *res)
+{ return OPENSSL_FN () ((const unsigned char *) buf, len, (unsigned char *) res); }
+
+GL_OPENSSL_INLINE void *
+GL_CRYPTO_FN (_read_ctx) (const struct _gl_ctx *ctx, void *res)
+{
+ /* Assume any unprocessed bytes in ctx are not to be ignored. */
+ _gl_CTX tmp_ctx = *(_gl_CTX *) ctx;
+ OPENSSL_FN (_Final) ((unsigned char *) res, &tmp_ctx);
+ return res;
+}
+
+/* Undef so we can include multiple times. */
+#undef GL_CRYPTO_FN
+#undef OPENSSL_FN
+#undef _GLCRYPTO_PREFIX
+#undef OPENSSL_ALG
+#undef GL_OPENSSL_NAME
+
+_GL_INLINE_HEADER_END
diff --git a/lib/glthread/lock.c b/lib/glthread/lock.c
index f62aa301..33c15a0d 100644
--- a/lib/glthread/lock.c
+++ b/lib/glthread/lock.c
@@ -1,5 +1,5 @@
/* Locking in multithreaded situations.
- Copyright (C) 2005-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005-2014 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
diff --git a/lib/glthread/lock.h b/lib/glthread/lock.h
index d20bbdef..36096c4b 100644
--- a/lib/glthread/lock.h
+++ b/lib/glthread/lock.h
@@ -1,5 +1,5 @@
/* Locking in multithreaded situations.
- Copyright (C) 2005-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005-2014 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
diff --git a/lib/glthread/threadlib.c b/lib/glthread/threadlib.c
index b4476573..26870de2 100644
--- a/lib/glthread/threadlib.c
+++ b/lib/glthread/threadlib.c
@@ -1,5 +1,5 @@
/* Multithreading primitives.
- Copyright (C) 2005-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005-2014 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
diff --git a/lib/glthread/tls.c b/lib/glthread/tls.c
index bcd285c2..971c72ab 100644
--- a/lib/glthread/tls.c
+++ b/lib/glthread/tls.c
@@ -1,5 +1,5 @@
/* Thread-local storage in multithreaded situations.
- Copyright (C) 2005-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005-2014 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
diff --git a/lib/glthread/tls.h b/lib/glthread/tls.h
index 2afe0b43..c0a56e49 100644
--- a/lib/glthread/tls.h
+++ b/lib/glthread/tls.h
@@ -1,5 +1,5 @@
/* Thread-local storage in multithreaded situations.
- Copyright (C) 2005, 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2007-2014 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
diff --git a/lib/gnulib.mk b/lib/gnulib.mk
index 6d6a0d72..e1d74db7 100644
--- a/lib/gnulib.mk
+++ b/lib/gnulib.mk
@@ -1,6 +1,6 @@
## DO NOT EDIT! GENERATED AUTOMATICALLY!
## Process this file with automake to produce Makefile.in.
-# Copyright (C) 2002-2013 Free Software Foundation, Inc.
+# Copyright (C) 2002-2014 Free Software Foundation, Inc.
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@
# the same distribution terms as the rest of that program.
#
# Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl --lib=libcoreutils --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=gnulib-tests --aux-dir=build-aux --with-tests --avoid=canonicalize-lgpl --avoid=dummy --makefile-name=gnulib.mk --no-conditional-dependencies --no-libtool --macro-prefix=gl acl alignof alloca announce-gen areadlink-with-size argmatch argv-iter assert autobuild backupfile base64 buffer-lcm c-strcase c-strtod c-strtold calloc-gnu canon-host canonicalize chown cloexec closein closeout config-h configmake crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 cycle-check d-ino d-type di-set diacrit dirfd dirname do-release-commit-and-tag dtoastr dup2 environ error euidaccess exclude exitfail faccessat fadvise fchdir fchmodat fchownat fclose fcntl fcntl-safer fd-reopen fdatasync fdl fdopen fdutimensat file-type fileblocks filemode filenamecat filevercmp fnmatch-gnu fopen-safer fprintftime freopen freopen-safer fseeko fstatat fsusage fsync ftello ftoastr ftruncate fts full-read full-write getgroups gethrxtime getline getloadavg getlogin getndelim2 getopt-gnu getpagesize getpass-gnu gettext-h gettime gettimeofday getugroups getusershell git-version-gen gitlog-to-changelog gnu-make gnu-web-doc-update gnumakefile gnupload group-member hard-locale hash hash-pjw heap host-os human idcache ignore-value inttostr inttypes isapipe isatty isblank largefile lchmod lchown ldtoastr lib-ignore linebuffer link link-follow linkat long-options lstat maintainer-makefile malloc-gnu manywarnings mbrlen mbrtowc mbsalign mbswidth memcasecmp memchr memcmp2 mempcpy memrchr mgetgroups mkancesdirs mkdir mkdir-p mkfifo mknod mkstemp mktime modechange mountlist mpsort netinet_in non-recursive-gnulib-prefix-hack nproc obstack parse-datetime pathmax perl physmem pipe posix-shell posixtm posixver priv-set progname propername pthread putenv quote quotearg randint randperm read-file readlink readtokens readtokens0 readutmp realloc-gnu regex remove rename rmdir root-dev-ino rpmatch safe-read same save-cwd savedir savewd selinux-at settime sig2str sigaction ssize_t stat-macros stat-size stat-time statat stdbool stdlib-safer stpcpy stpncpy strdup-posix strftime strncat strnumcmp strpbrk strsignal strtod strtoimax strtoumax symlink sys_ioctl sys_resource sys_stat sys_wait termios timer-time timespec tzset uname unicodeio unistd-safer unlink-busy unlinkat unlocked-io unsetenv update-copyright uptime useless-if-before-free userspec utimecmp utimens vasprintf-posix vc-list-files verify verror version-etc-fsf wcswidth wcwidth winsz-ioctl winsz-termios write-any-file xalloc xfreopen xfts xgetcwd xgetgroups xgethostname xmemcoll xnanosleep xprintf xprintf-posix xreadlink xstrtod xstrtoimax xstrtol xstrtold xstrtoumax yesno
+# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl --lib=libcoreutils --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=gnulib-tests --aux-dir=build-aux --with-tests --avoid=canonicalize-lgpl --avoid=dummy --makefile-name=gnulib.mk --no-conditional-dependencies --no-libtool --macro-prefix=gl acl alignof alloca announce-gen areadlink-with-size argmatch argv-iter assert autobuild backupfile base64 buffer-lcm c-strcase c-strtod c-strtold calloc-gnu canon-host canonicalize chown cloexec closein closeout config-h configmake crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 cycle-check d-ino d-type di-set diacrit dirfd dirname do-release-commit-and-tag dtoastr dup2 environ error euidaccess exclude exitfail faccessat fadvise fchdir fchmodat fchownat fclose fcntl fcntl-safer fd-reopen fdatasync fdl fdopen fdutimensat file-type fileblocks filemode filenamecat filevercmp fnmatch-gnu fopen-safer fprintftime freopen freopen-safer fseeko fstatat fsusage fsync ftello ftoastr ftruncate fts full-read full-write getgroups gethrxtime getline getloadavg getlogin getndelim2 getopt-gnu getpagesize getpass-gnu gettext-h gettime gettimeofday getugroups getusershell git-version-gen gitlog-to-changelog gnu-make gnu-web-doc-update gnumakefile gnupload group-member hard-locale hash hash-pjw heap host-os human idcache ignore-value inttostr inttypes isapipe isatty isblank largefile lchmod lchown ldtoastr lib-ignore linebuffer link link-follow linkat long-options lstat maintainer-makefile malloc-gnu manywarnings mbrlen mbrtowc mbsalign mbswidth memcasecmp memchr memcmp2 mempcpy memrchr mgetgroups mkancesdirs mkdir mkdir-p mkfifo mknod mkstemp mktime modechange mountlist mpsort netinet_in non-recursive-gnulib-prefix-hack nproc obstack parse-datetime pathmax perl physmem pipe-posix posix-shell posixtm posixver priv-set progname propername pthread putenv quote quotearg randint randperm read-file readlink readtokens readtokens0 readutmp realloc-gnu regex remove rename rmdir root-dev-ino rpmatch safe-read same save-cwd savedir savewd selinux-at settime sig2str sigaction smack ssize_t stat-macros stat-size stat-time statat stdbool stdlib-safer stpcpy stpncpy strdup-posix strftime strncat strnumcmp strpbrk strsignal strtod strtoimax strtoumax symlink sys_ioctl sys_resource sys_stat sys_wait termios timer-time timespec tzset uname unicodeio unistd-safer unlink-busy unlinkat unlocked-io unsetenv update-copyright uptime useless-if-before-free userspec utimecmp utimens vasprintf-posix vc-list-files verify verror version-etc-fsf wcswidth wcwidth winsz-ioctl winsz-termios write-any-file xalloc xfreopen xfts xgetcwd xgetgroups xgethostname xmemcoll xnanosleep xprintf xprintf-posix xreadlink xstrtod xstrtoimax xstrtol xstrtold xstrtoumax yesno
MOSTLYCLEANFILES += lib/core lib/*.stackdump
@@ -33,13 +33,18 @@ lib_libcoreutils_a_LIBADD = $(gl_LIBOBJS)
lib_libcoreutils_a_DEPENDENCIES = $(gl_LIBOBJS)
EXTRA_lib_libcoreutils_a_SOURCES =
-## begin gnulib module acl
+## begin gnulib module absolute-header
-lib_libcoreutils_a_SOURCES += lib/set-mode-acl.c lib/copy-acl.c lib/file-has-acl.c
+# Use this preprocessor expression to decide whether #include_next works.
+# Do not rely on a 'configure'-time test for this, since the expression
+# might appear in an installed header, which is used by some other compiler.
+HAVE_INCLUDE_NEXT = lib/(__GNUC__ lib/|| lib/60000000 lib/<= lib/__DECC_VER)
-EXTRA_DIST += lib/acl-internal.h lib/acl.h lib/acl_entries.c
+## end gnulib module absolute-header
-EXTRA_lib_libcoreutils_a_SOURCES += lib/acl_entries.c
+## begin gnulib module acl
+
+lib_libcoreutils_a_SOURCES += lib/copy-acl.c lib/set-acl.c
## end gnulib module acl
@@ -198,12 +203,6 @@ lib_libcoreutils_a_SOURCES += lib/base64.h lib/base64.c
## end gnulib module base64
-## begin gnulib module binary-io
-
-lib_libcoreutils_a_SOURCES += lib/binary-io.h lib/binary-io.c
-
-## end gnulib module binary-io
-
## begin gnulib module bitrotate
lib_libcoreutils_a_SOURCES += lib/bitrotate.h lib/bitrotate.c
@@ -375,7 +374,7 @@ EXTRA_DIST += lib/closeout.h
## begin gnulib module configmake
# Listed in the same order as the GNU makefile conventions, and
-# provided by autoconf 2.59c+.
+# provided by autoconf 2.59c+ or 2.70.
# The Automake-defined pkg* macros are appended, in the order
# listed in the Automake 1.10a+ documentation.
lib/configmake.h: Makefile
@@ -391,6 +390,7 @@ lib/configmake.h: Makefile
echo '#define SYSCONFDIR "$(sysconfdir)"'; \
echo '#define SHAREDSTATEDIR "$(sharedstatedir)"'; \
echo '#define LOCALSTATEDIR "$(localstatedir)"'; \
+ echo '#define RUNSTATEDIR "$(runstatedir)"'; \
echo '#define INCLUDEDIR "$(includedir)"'; \
echo '#define OLDINCLUDEDIR "$(oldincludedir)"'; \
echo '#define DOCDIR "$(docdir)"'; \
@@ -420,7 +420,7 @@ CLEANFILES += lib/configmake.h lib/configmake.h-t
lib_libcoreutils_a_SOURCES += lib/md5.c
-EXTRA_DIST += lib/md5.h
+EXTRA_DIST += lib/gl_openssl.h lib/md5.h
## end gnulib module crypto/md5
@@ -428,7 +428,7 @@ EXTRA_DIST += lib/md5.h
lib_libcoreutils_a_SOURCES += lib/sha1.c
-EXTRA_DIST += lib/sha1.h
+EXTRA_DIST += lib/gl_openssl.h lib/sha1.h
## end gnulib module crypto/sha1
@@ -436,7 +436,7 @@ EXTRA_DIST += lib/sha1.h
lib_libcoreutils_a_SOURCES += lib/sha256.c
-EXTRA_DIST += lib/sha256.h
+EXTRA_DIST += lib/gl_openssl.h lib/sha256.h
## end gnulib module crypto/sha256
@@ -444,7 +444,7 @@ EXTRA_DIST += lib/sha256.h
lib_libcoreutils_a_SOURCES += lib/sha512.c
-EXTRA_DIST += lib/sha512.h
+EXTRA_DIST += lib/gl_openssl.h lib/sha512.h
## end gnulib module crypto/sha512
@@ -716,12 +716,6 @@ lib_libcoreutils_a_SOURCES += lib/fadvise.c lib/fadvise.h
## end gnulib module fadvise
-## begin gnulib module fatal-signal
-
-lib_libcoreutils_a_SOURCES += lib/fatal-signal.h lib/fatal-signal.c
-
-## end gnulib module fatal-signal
-
## begin gnulib module fchdir
@@ -1711,6 +1705,7 @@ lib/inttypes.h: lib/inttypes.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(W
-e 's/@''HAVE_DECL_STRTOIMAX''@/$(HAVE_DECL_STRTOIMAX)/g' \
-e 's/@''HAVE_DECL_STRTOUMAX''@/$(HAVE_DECL_STRTOUMAX)/g' \
-e 's/@''REPLACE_STRTOIMAX''@/$(REPLACE_STRTOIMAX)/g' \
+ -e 's/@''REPLACE_STRTOUMAX''@/$(REPLACE_STRTOUMAX)/g' \
-e 's/@''INT32_MAX_LT_INTMAX_MAX''@/$(INT32_MAX_LT_INTMAX_MAX)/g' \
-e 's/@''INT64_MAX_EQ_LONG_MAX''@/$(INT64_MAX_EQ_LONG_MAX)/g' \
-e 's/@''UINT32_MAX_LT_UINTMAX_MAX''@/$(UINT32_MAX_LT_UINTMAX_MAX)/g' \
@@ -2793,24 +2788,14 @@ EXTRA_DIST += lib/physmem.h
## end gnulib module physmem
-## begin gnulib module pipe
-
-
-EXTRA_DIST += lib/pipe.h
-
-## end gnulib module pipe
-
-## begin gnulib module pipe2
-
-lib_libcoreutils_a_SOURCES += lib/pipe2.c
+## begin gnulib module pipe-posix
-## end gnulib module pipe2
-## begin gnulib module pipe2-safer
+EXTRA_DIST += lib/pipe.c
-lib_libcoreutils_a_SOURCES += lib/pipe2-safer.c
+EXTRA_lib_libcoreutils_a_SOURCES += lib/pipe.c
-## end gnulib module pipe2-safer
+## end gnulib module pipe-posix
## begin gnulib module posix-shell
@@ -2827,105 +2812,6 @@ lib_libcoreutils_a_SOURCES += lib/pipe2-safer.c
## end gnulib module posix-shell
-## begin gnulib module posix_spawn-internal
-
-
-EXTRA_DIST += lib/spawn_int.h lib/spawni.c
-
-EXTRA_lib_libcoreutils_a_SOURCES += lib/spawni.c
-
-## end gnulib module posix_spawn-internal
-
-## begin gnulib module posix_spawn_file_actions_addclose
-
-
-EXTRA_DIST += lib/spawn_faction_addclose.c lib/spawn_int.h
-
-EXTRA_lib_libcoreutils_a_SOURCES += lib/spawn_faction_addclose.c
-
-## end gnulib module posix_spawn_file_actions_addclose
-
-## begin gnulib module posix_spawn_file_actions_adddup2
-
-
-EXTRA_DIST += lib/spawn_faction_adddup2.c lib/spawn_int.h
-
-EXTRA_lib_libcoreutils_a_SOURCES += lib/spawn_faction_adddup2.c
-
-## end gnulib module posix_spawn_file_actions_adddup2
-
-## begin gnulib module posix_spawn_file_actions_addopen
-
-
-EXTRA_DIST += lib/spawn_faction_addopen.c lib/spawn_int.h
-
-EXTRA_lib_libcoreutils_a_SOURCES += lib/spawn_faction_addopen.c
-
-## end gnulib module posix_spawn_file_actions_addopen
-
-## begin gnulib module posix_spawn_file_actions_destroy
-
-
-EXTRA_DIST += lib/spawn_faction_destroy.c
-
-EXTRA_lib_libcoreutils_a_SOURCES += lib/spawn_faction_destroy.c
-
-## end gnulib module posix_spawn_file_actions_destroy
-
-## begin gnulib module posix_spawn_file_actions_init
-
-
-EXTRA_DIST += lib/spawn_faction_init.c lib/spawn_int.h
-
-EXTRA_lib_libcoreutils_a_SOURCES += lib/spawn_faction_init.c
-
-## end gnulib module posix_spawn_file_actions_init
-
-## begin gnulib module posix_spawnattr_destroy
-
-
-EXTRA_DIST += lib/spawnattr_destroy.c
-
-EXTRA_lib_libcoreutils_a_SOURCES += lib/spawnattr_destroy.c
-
-## end gnulib module posix_spawnattr_destroy
-
-## begin gnulib module posix_spawnattr_init
-
-
-EXTRA_DIST += lib/spawnattr_init.c
-
-EXTRA_lib_libcoreutils_a_SOURCES += lib/spawnattr_init.c
-
-## end gnulib module posix_spawnattr_init
-
-## begin gnulib module posix_spawnattr_setflags
-
-
-EXTRA_DIST += lib/spawnattr_setflags.c
-
-EXTRA_lib_libcoreutils_a_SOURCES += lib/spawnattr_setflags.c
-
-## end gnulib module posix_spawnattr_setflags
-
-## begin gnulib module posix_spawnattr_setsigmask
-
-
-EXTRA_DIST += lib/spawnattr_setsigmask.c
-
-EXTRA_lib_libcoreutils_a_SOURCES += lib/spawnattr_setsigmask.c
-
-## end gnulib module posix_spawnattr_setsigmask
-
-## begin gnulib module posix_spawnp
-
-
-EXTRA_DIST += lib/spawnp.c
-
-EXTRA_lib_libcoreutils_a_SOURCES += lib/spawnp.c
-
-## end gnulib module posix_spawnp
-
## begin gnulib module posixtm
lib_libcoreutils_a_SOURCES += lib/posixtm.c
@@ -3022,6 +2908,16 @@ EXTRA_lib_libcoreutils_a_SOURCES += lib/putenv.c
## end gnulib module putenv
+## begin gnulib module qacl
+
+lib_libcoreutils_a_SOURCES += lib/acl-errno-valid.c lib/file-has-acl.c lib/qcopy-acl.c lib/qset-acl.c
+
+EXTRA_DIST += lib/acl-internal.h lib/acl.h lib/acl_entries.c
+
+EXTRA_lib_libcoreutils_a_SOURCES += lib/acl_entries.c
+
+## end gnulib module qacl
+
## begin gnulib module quote
@@ -3064,15 +2960,6 @@ lib_libcoreutils_a_SOURCES += lib/randread.c lib/randread.h lib/rand-isaac.c lib
## end gnulib module randread
-## begin gnulib module rawmemchr
-
-
-EXTRA_DIST += lib/rawmemchr.c lib/rawmemchr.valgrind
-
-EXTRA_lib_libcoreutils_a_SOURCES += lib/rawmemchr.c
-
-## end gnulib module rawmemchr
-
## begin gnulib module read
@@ -3310,6 +3197,15 @@ EXTRA_DIST += lib/sched.in.h
## end gnulib module sched
+## begin gnulib module secure_getenv
+
+
+EXTRA_DIST += lib/secure_getenv.c
+
+EXTRA_lib_libcoreutils_a_SOURCES += lib/secure_getenv.c
+
+## end gnulib module secure_getenv
+
## begin gnulib module select
@@ -3473,6 +3369,12 @@ lib_libcoreutils_a_SOURCES += lib/size_max.h
## end gnulib module size_max
+## begin gnulib module smack
+
+lib_libcoreutils_a_SOURCES += lib/smack.h
+
+## end gnulib module smack
+
## begin gnulib module snippet/_Noreturn
# Because this Makefile snippet defines a variable used by other
@@ -3596,67 +3498,6 @@ EXTRA_DIST += lib/w32sock.h
## end gnulib module sockets
-## begin gnulib module spawn
-
-BUILT_SOURCES += lib/spawn.h
-
-# We need the following in order to create a replacement for <spawn.h> when
-# the system doesn't have one.
-lib/spawn.h: lib/spawn.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
- $(AM_V_GEN)rm -f $@-t $@ && \
- { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- sed -e 's|@''GUARD_PREFIX''@|GL|g' \
- -e 's|@''HAVE_SPAWN_H''@|$(HAVE_SPAWN_H)|g' \
- -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
- -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
- -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
- -e 's|@''NEXT_SPAWN_H''@|$(NEXT_SPAWN_H)|g' \
- -e 's/@''GNULIB_POSIX_SPAWN''@/$(GNULIB_POSIX_SPAWN)/g' \
- -e 's/@''GNULIB_POSIX_SPAWNP''@/$(GNULIB_POSIX_SPAWNP)/g' \
- -e 's/@''GNULIB_POSIX_SPAWN_FILE_ACTIONS_INIT''@/$(GNULIB_POSIX_SPAWN_FILE_ACTIONS_INIT)/g' \
- -e 's/@''GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE''@/$(GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE)/g' \
- -e 's/@''GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2''@/$(GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2)/g' \
- -e 's/@''GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN''@/$(GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN)/g' \
- -e 's/@''GNULIB_POSIX_SPAWN_FILE_ACTIONS_DESTROY''@/$(GNULIB_POSIX_SPAWN_FILE_ACTIONS_DESTROY)/g' \
- -e 's/@''GNULIB_POSIX_SPAWNATTR_INIT''@/$(GNULIB_POSIX_SPAWNATTR_INIT)/g' \
- -e 's/@''GNULIB_POSIX_SPAWNATTR_GETFLAGS''@/$(GNULIB_POSIX_SPAWNATTR_GETFLAGS)/g' \
- -e 's/@''GNULIB_POSIX_SPAWNATTR_SETFLAGS''@/$(GNULIB_POSIX_SPAWNATTR_SETFLAGS)/g' \
- -e 's/@''GNULIB_POSIX_SPAWNATTR_GETPGROUP''@/$(GNULIB_POSIX_SPAWNATTR_GETPGROUP)/g' \
- -e 's/@''GNULIB_POSIX_SPAWNATTR_SETPGROUP''@/$(GNULIB_POSIX_SPAWNATTR_SETPGROUP)/g' \
- -e 's/@''GNULIB_POSIX_SPAWNATTR_GETSCHEDPARAM''@/$(GNULIB_POSIX_SPAWNATTR_GETSCHEDPARAM)/g' \
- -e 's/@''GNULIB_POSIX_SPAWNATTR_SETSCHEDPARAM''@/$(GNULIB_POSIX_SPAWNATTR_SETSCHEDPARAM)/g' \
- -e 's/@''GNULIB_POSIX_SPAWNATTR_GETSCHEDPOLICY''@/$(GNULIB_POSIX_SPAWNATTR_GETSCHEDPOLICY)/g' \
- -e 's/@''GNULIB_POSIX_SPAWNATTR_SETSCHEDPOLICY''@/$(GNULIB_POSIX_SPAWNATTR_SETSCHEDPOLICY)/g' \
- -e 's/@''GNULIB_POSIX_SPAWNATTR_GETSIGDEFAULT''@/$(GNULIB_POSIX_SPAWNATTR_GETSIGDEFAULT)/g' \
- -e 's/@''GNULIB_POSIX_SPAWNATTR_SETSIGDEFAULT''@/$(GNULIB_POSIX_SPAWNATTR_SETSIGDEFAULT)/g' \
- -e 's/@''GNULIB_POSIX_SPAWNATTR_GETSIGMASK''@/$(GNULIB_POSIX_SPAWNATTR_GETSIGMASK)/g' \
- -e 's/@''GNULIB_POSIX_SPAWNATTR_SETSIGMASK''@/$(GNULIB_POSIX_SPAWNATTR_SETSIGMASK)/g' \
- -e 's/@''GNULIB_POSIX_SPAWNATTR_DESTROY''@/$(GNULIB_POSIX_SPAWNATTR_DESTROY)/g' \
- -e 's|@''HAVE_POSIX_SPAWN''@|$(HAVE_POSIX_SPAWN)|g' \
- -e 's|@''HAVE_POSIX_SPAWNATTR_T''@|$(HAVE_POSIX_SPAWNATTR_T)|g' \
- -e 's|@''HAVE_POSIX_SPAWN_FILE_ACTIONS_T''@|$(HAVE_POSIX_SPAWN_FILE_ACTIONS_T)|g' \
- -e 's|@''REPLACE_POSIX_SPAWN''@|$(REPLACE_POSIX_SPAWN)|g' \
- -e 's|@''REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE''@|$(REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE)|g' \
- -e 's|@''REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2''@|$(REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2)|g' \
- -e 's|@''REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN''@|$(REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN)|g' \
- -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
- -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
- -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
- < $(top_srcdir)/lib/spawn.in.h; \
- } > $@-t && \
- mv $@-t $@
-MOSTLYCLEANFILES += lib/spawn.h lib/spawn.h-t
-
-EXTRA_DIST += lib/spawn.in.h
-
-## end gnulib module spawn
-
-## begin gnulib module spawn-pipe
-
-lib_libcoreutils_a_SOURCES += lib/spawn-pipe.h lib/spawn-pipe.c lib/w32spawn.h
-
-## end gnulib module spawn-pipe
-
## begin gnulib module stat
@@ -4014,6 +3855,7 @@ lib/stdlib.h: lib/stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
-e 's/@''GNULIB_REALLOC_POSIX''@/$(GNULIB_REALLOC_POSIX)/g' \
-e 's/@''GNULIB_REALPATH''@/$(GNULIB_REALPATH)/g' \
-e 's/@''GNULIB_RPMATCH''@/$(GNULIB_RPMATCH)/g' \
+ -e 's/@''GNULIB_SECURE_GETENV''@/$(GNULIB_SECURE_GETENV)/g' \
-e 's/@''GNULIB_SETENV''@/$(GNULIB_SETENV)/g' \
-e 's/@''GNULIB_STRTOD''@/$(GNULIB_STRTOD)/g' \
-e 's/@''GNULIB_STRTOLL''@/$(GNULIB_STRTOLL)/g' \
@@ -4042,6 +3884,7 @@ lib/stdlib.h: lib/stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
-e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \
-e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \
-e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \
+ -e 's|@''HAVE_SECURE_GETENV''@|$(HAVE_SECURE_GETENV)|g' \
-e 's|@''HAVE_DECL_SETENV''@|$(HAVE_DECL_SETENV)|g' \
-e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \
-e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \
@@ -4103,15 +3946,6 @@ EXTRA_lib_libcoreutils_a_SOURCES += lib/stpncpy.c
## end gnulib module stpncpy
-## begin gnulib module strchrnul
-
-
-EXTRA_DIST += lib/strchrnul.c lib/strchrnul.valgrind
-
-EXTRA_lib_libcoreutils_a_SOURCES += lib/strchrnul.c
-
-## end gnulib module strchrnul
-
## begin gnulib module strdup-posix
@@ -4797,6 +4631,7 @@ lib/time.h: lib/time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_TIME_H''@|$(NEXT_TIME_H)|g' \
+ -e 's/@''GNULIB_GETTIMEOFDAY''@/$(GNULIB_GETTIMEOFDAY)/g' \
-e 's/@''GNULIB_MKTIME''@/$(GNULIB_MKTIME)/g' \
-e 's/@''GNULIB_NANOSLEEP''@/$(GNULIB_NANOSLEEP)/g' \
-e 's/@''GNULIB_STRPTIME''@/$(GNULIB_STRPTIME)/g' \
@@ -4806,6 +4641,8 @@ lib/time.h: lib/time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU
-e 's|@''HAVE_NANOSLEEP''@|$(HAVE_NANOSLEEP)|g' \
-e 's|@''HAVE_STRPTIME''@|$(HAVE_STRPTIME)|g' \
-e 's|@''HAVE_TIMEGM''@|$(HAVE_TIMEGM)|g' \
+ -e 's|@''REPLACE_GMTIME''@|$(REPLACE_GMTIME)|g' \
+ -e 's|@''REPLACE_LOCALTIME''@|$(REPLACE_LOCALTIME)|g' \
-e 's|@''REPLACE_LOCALTIME_R''@|$(REPLACE_LOCALTIME_R)|g' \
-e 's|@''REPLACE_MKTIME''@|$(REPLACE_MKTIME)|g' \
-e 's|@''REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \
@@ -4997,6 +4834,7 @@ lib/unistd.h: lib/unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_N
-e 's|@''REPLACE_FTRUNCATE''@|$(REPLACE_FTRUNCATE)|g' \
-e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
-e 's|@''REPLACE_GETDOMAINNAME''@|$(REPLACE_GETDOMAINNAME)|g' \
+ -e 's|@''REPLACE_GETDTABLESIZE''@|$(REPLACE_GETDTABLESIZE)|g' \
-e 's|@''REPLACE_GETLOGIN_R''@|$(REPLACE_GETLOGIN_R)|g' \
-e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \
-e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \
@@ -5261,21 +5099,6 @@ EXTRA_lib_libcoreutils_a_SOURCES += lib/vprintf.c
## end gnulib module vprintf-posix
-## begin gnulib module wait-process
-
-lib_libcoreutils_a_SOURCES += lib/wait-process.h lib/wait-process.c
-
-## end gnulib module wait-process
-
-## begin gnulib module waitpid
-
-
-EXTRA_DIST += lib/waitpid.c
-
-EXTRA_lib_libcoreutils_a_SOURCES += lib/waitpid.c
-
-## end gnulib module waitpid
-
## begin gnulib module wchar
BUILT_SOURCES += lib/wchar.h
diff --git a/lib/group-member.c b/lib/group-member.c
index da015842..e869dca9 100644
--- a/lib/group-member.c
+++ b/lib/group-member.c
@@ -1,6 +1,6 @@
/* group-member.c -- determine whether group id is in calling user's group list
- Copyright (C) 1994, 1997-1998, 2003, 2005-2006, 2009-2013 Free Software
+ Copyright (C) 1994, 1997-1998, 2003, 2005-2006, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/hard-locale.c b/lib/hard-locale.c
index d55658df..93c53866 100644
--- a/lib/hard-locale.c
+++ b/lib/hard-locale.c
@@ -1,6 +1,6 @@
/* hard-locale.c -- Determine whether a locale is hard.
- Copyright (C) 1997-1999, 2002-2004, 2006-2007, 2009-2013 Free Software
+ Copyright (C) 1997-1999, 2002-2004, 2006-2007, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/hard-locale.h b/lib/hard-locale.h
index 1d43607f..ee9dd43a 100644
--- a/lib/hard-locale.h
+++ b/lib/hard-locale.h
@@ -1,6 +1,6 @@
/* Determine whether a locale is hard.
- Copyright (C) 1999, 2003-2004, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2003-2004, 2009-2014 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
diff --git a/lib/hash-pjw.c b/lib/hash-pjw.c
index e967a762..18f9f01b 100644
--- a/lib/hash-pjw.c
+++ b/lib/hash-pjw.c
@@ -1,6 +1,6 @@
/* hash-pjw.c -- compute a hash value from a NUL-terminated string.
- Copyright (C) 2001, 2003, 2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2003, 2006, 2009-2014 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
diff --git a/lib/hash-pjw.h b/lib/hash-pjw.h
index f6dcab85..e6456134 100644
--- a/lib/hash-pjw.h
+++ b/lib/hash-pjw.h
@@ -1,5 +1,5 @@
/* hash-pjw.h -- declaration for a simple hash function
- Copyright (C) 2001, 2003, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2003, 2009-2014 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
diff --git a/lib/hash-triple.c b/lib/hash-triple.c
index 12359347..d305fbf5 100644
--- a/lib/hash-triple.c
+++ b/lib/hash-triple.c
@@ -1,5 +1,5 @@
/* Hash functions for file-related triples: name, device, inode.
- Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2014 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
diff --git a/lib/hash.c b/lib/hash.c
index 685928ec..d312a264 100644
--- a/lib/hash.c
+++ b/lib/hash.c
@@ -1,6 +1,6 @@
/* hash - hashing table processing.
- Copyright (C) 1998-2004, 2006-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 1998-2004, 2006-2007, 2009-2014 Free Software Foundation, Inc.
Written by Jim Meyering, 1992.
diff --git a/lib/hash.h b/lib/hash.h
index bcd0d1d9..9994f5f6 100644
--- a/lib/hash.h
+++ b/lib/hash.h
@@ -1,5 +1,5 @@
/* hash - hashing table processing.
- Copyright (C) 1998-1999, 2001, 2003, 2009-2013 Free Software Foundation,
+ Copyright (C) 1998-1999, 2001, 2003, 2009-2014 Free Software Foundation,
Inc.
Written by Jim Meyering <meyering@ascend.com>, 1998.
diff --git a/lib/heap.c b/lib/heap.c
index af9ca1e7..75bd071a 100644
--- a/lib/heap.c
+++ b/lib/heap.c
@@ -1,6 +1,6 @@
/* Barebones heap implementation supporting only insert and pop.
- Copyright (C) 2010-2013 Free Software Foundation, Inc.
+ Copyright (C) 2010-2014 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
diff --git a/lib/heap.h b/lib/heap.h
index f59a1e42..02dc2ac6 100644
--- a/lib/heap.h
+++ b/lib/heap.h
@@ -1,6 +1,6 @@
/* Barebones heap implementation supporting only insert and pop.
- Copyright (C) 2010-2013 Free Software Foundation, Inc.
+ Copyright (C) 2010-2014 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
diff --git a/lib/human.c b/lib/human.c
index 613dc656..ab6b30d2 100644
--- a/lib/human.c
+++ b/lib/human.c
@@ -1,6 +1,6 @@
/* human.c -- print human readable file size
- Copyright (C) 1996-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 1996-2007, 2009-2014 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
diff --git a/lib/human.h b/lib/human.h
index 7ac30d55..2cb1c9e7 100644
--- a/lib/human.h
+++ b/lib/human.h
@@ -1,6 +1,6 @@
/* human.h -- print human readable file size
- Copyright (C) 1996-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 1996-2007, 2009-2014 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
diff --git a/lib/i-ring.c b/lib/i-ring.c
index ccab71a0..4173a03f 100644
--- a/lib/i-ring.c
+++ b/lib/i-ring.c
@@ -1,5 +1,5 @@
/* a simple ring buffer
- Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2009-2014 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
diff --git a/lib/i-ring.h b/lib/i-ring.h
index 1aac214b..7d993fa4 100644
--- a/lib/i-ring.h
+++ b/lib/i-ring.h
@@ -1,5 +1,5 @@
/* definitions for a simple ring buffer
- Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2009-2014 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
diff --git a/lib/iconv.c b/lib/iconv.c
index 6fb2f243..b5a427be 100644
--- a/lib/iconv.c
+++ b/lib/iconv.c
@@ -1,5 +1,5 @@
/* Character set conversion.
- Copyright (C) 1999-2001, 2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 1999-2001, 2007, 2009-2014 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
diff --git a/lib/iconv.in.h b/lib/iconv.in.h
index a88173d1..d0e98360 100644
--- a/lib/iconv.in.h
+++ b/lib/iconv.in.h
@@ -1,6 +1,6 @@
/* A GNU-like <iconv.h>.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007-2014 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
diff --git a/lib/iconv_close.c b/lib/iconv_close.c
index 6f019a0b..d66c1155 100644
--- a/lib/iconv_close.c
+++ b/lib/iconv_close.c
@@ -1,5 +1,5 @@
/* Character set conversion.
- Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2014 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
diff --git a/lib/iconv_open.c b/lib/iconv_open.c
index 9a38e7e8..37ce9ce2 100644
--- a/lib/iconv_open.c
+++ b/lib/iconv_open.c
@@ -1,5 +1,5 @@
/* Character set conversion.
- Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2014 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
diff --git a/lib/idcache.c b/lib/idcache.c
index 8b9db5ee..8c921bfe 100644
--- a/lib/idcache.c
+++ b/lib/idcache.c
@@ -1,6 +1,6 @@
/* idcache.c -- map user and group IDs, cached for speed
- Copyright (C) 1985, 1988-1990, 1997-1998, 2003, 2005-2007, 2009-2013 Free
+ Copyright (C) 1985, 1988-1990, 1997-1998, 2003, 2005-2007, 2009-2014 Free
Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/ignore-value.h b/lib/ignore-value.h
index 63ecde85..4dd0946d 100644
--- a/lib/ignore-value.h
+++ b/lib/ignore-value.h
@@ -1,6 +1,6 @@
/* ignore a function return without a compiler warning
- Copyright (C) 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2008-2014 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
@@ -33,15 +33,18 @@
declared with attribute warn_unused_result". */
#ifndef _GL_IGNORE_VALUE_H
-# define _GL_IGNORE_VALUE_H
-
-/* The __attribute__((__warn_unused_result__)) feature
- is available in gcc versions 3.4 and newer,
- while the typeof feature has been available since 2.7 at least. */
-# if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 4)
-# define ignore_value(x) ((void) (x))
-# else
-# define ignore_value(x) (({ __typeof__ (x) __x = (x); (void) __x; }))
-# endif
+#define _GL_IGNORE_VALUE_H
+
+/* Normally casting an expression to void discards its value, but GCC
+ versions 3.4 and newer have __attribute__ ((__warn_unused_result__))
+ which may cause unwanted diagnostics in that case. Use __typeof__
+ and __extension__ to work around the problem, if the workaround is
+ known to be needed. */
+#if 3 < __GNUC__ + (4 <= __GNUC_MINOR__)
+# define ignore_value(x) \
+ (__extension__ ({ __typeof__ (x) __x = (x); (void) __x; }))
+#else
+# define ignore_value(x) ((void) (x))
+#endif
#endif
diff --git a/lib/inet_ntop.c b/lib/inet_ntop.c
index fdfd21dc..c0258687 100644
--- a/lib/inet_ntop.c
+++ b/lib/inet_ntop.c
@@ -1,6 +1,6 @@
/* inet_ntop.c -- convert IPv4 and IPv6 addresses from binary to text form
- Copyright (C) 2005-2006, 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2008-2014 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
diff --git a/lib/ino-map.c b/lib/ino-map.c
index a6271607..2171279f 100644
--- a/lib/ino-map.c
+++ b/lib/ino-map.c
@@ -1,6 +1,6 @@
/* Map an ino_t inode number to a small integer.
- Copyright 2009-2013 Free Software Foundation, Inc.
+ Copyright 2009-2014 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
diff --git a/lib/intprops.h b/lib/intprops.h
index b473052d..d0bb7a6f 100644
--- a/lib/intprops.h
+++ b/lib/intprops.h
@@ -1,6 +1,6 @@
/* intprops.h -- properties of integer types
- Copyright (C) 2001-2005, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2001-2005, 2009-2014 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
@@ -89,7 +89,8 @@
/* Return 1 if the __typeof__ keyword works. This could be done by
'configure', but for now it's easier to do it by hand. */
-#if 2 <= __GNUC__ || 0x5110 <= __SUNPRO_C
+#if (2 <= __GNUC__ || defined __IBM__TYPEOF__ \
+ || (0x5110 <= __SUNPRO_C && !__STDC__))
# define _GL_HAVE___TYPEOF__ 1
#else
# define _GL_HAVE___TYPEOF__ 0
diff --git a/lib/inttostr.h b/lib/inttostr.h
index 4605145a..ff58c2b6 100644
--- a/lib/inttostr.h
+++ b/lib/inttostr.h
@@ -1,6 +1,6 @@
/* inttostr.h -- convert integers to printable strings
- Copyright (C) 2001-2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2001-2006, 2009-2014 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
diff --git a/lib/inttypes.in.h b/lib/inttypes.in.h
index 1893f556..4b2a13be 100644
--- a/lib/inttypes.in.h
+++ b/lib/inttypes.in.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006-2013 Free Software Foundation, Inc.
+/* Copyright (C) 2006-2014 Free Software Foundation, Inc.
Written by Paul Eggert, Bruno Haible, Derek Price.
This file is part of gnulib.
@@ -1105,12 +1105,22 @@ _GL_WARN_ON_USE (strtoimax, "strtoimax is unportable - "
#endif
#if @GNULIB_STRTOUMAX@
-# if !@HAVE_DECL_STRTOUMAX@
-# undef strtoumax
+# if @REPLACE_STRTOUMAX@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef strtoumax
+# define strtoumax rpl_strtoumax
+# endif
+_GL_FUNCDECL_RPL (strtoumax, uintmax_t,
+ (const char *, char **, int) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (strtoumax, uintmax_t, (const char *, char **, int));
+# else
+# if !@HAVE_DECL_STRTOUMAX@
+# undef strtoumax
_GL_FUNCDECL_SYS (strtoumax, uintmax_t,
(const char *, char **, int) _GL_ARG_NONNULL ((1)));
-# endif
+# endif
_GL_CXXALIAS_SYS (strtoumax, uintmax_t, (const char *, char **, int));
+# endif
_GL_CXXALIASWARN (strtoumax);
#elif defined GNULIB_POSIXCHECK
# undef strtoumax
diff --git a/lib/isapipe.c b/lib/isapipe.c
index 8b2d09e5..b59e2359 100644
--- a/lib/isapipe.c
+++ b/lib/isapipe.c
@@ -1,6 +1,6 @@
/* Test whether a file descriptor is a pipe.
- Copyright (C) 2006, 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2008-2014 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
diff --git a/lib/isatty.c b/lib/isatty.c
index 36fbc36e..7180eadd 100644
--- a/lib/isatty.c
+++ b/lib/isatty.c
@@ -1,5 +1,5 @@
/* isatty() replacement.
- Copyright (C) 2012-2013 Free Software Foundation, Inc.
+ Copyright (C) 2012-2014 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
@@ -32,9 +32,11 @@
/* Get _get_osfhandle(). */
#include "msvc-nothrow.h"
-/* Optimized test whether a HANDLE refers to a console.
- See <http://lists.gnu.org/archive/html/bug-gnulib/2009-08/msg00065.html>. */
-#define IsConsoleHandle(h) (((intptr_t) (h) & 3) == 3)
+static BOOL IsConsoleHandle (HANDLE h)
+{
+ DWORD mode;
+ return GetConsoleMode (h, &mode) != 0;
+}
#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
static int
diff --git a/lib/isblank.c b/lib/isblank.c
index c130af40..4e0aed1d 100644
--- a/lib/isblank.c
+++ b/lib/isblank.c
@@ -1,6 +1,6 @@
/* Test whether a character is a blank.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 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
diff --git a/lib/isnan.c b/lib/isnan.c
index d95e4bac..878c1804 100644
--- a/lib/isnan.c
+++ b/lib/isnan.c
@@ -1,5 +1,5 @@
/* Test for NaN that does not need libm.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007-2014 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
@@ -79,10 +79,21 @@ extern int rpl_isnanf (float x);
((sizeof (DOUBLE) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
typedef union { DOUBLE value; unsigned int word[NWORDS]; } memory_double;
+/* Most hosts nowadays use IEEE floating point, so they use IEC 60559
+ representations, have infinities and NaNs, and do not trap on
+ exceptions. Define IEEE_FLOATING_POINT if this host is one of the
+ typical ones. The C11 macro __STDC_IEC_559__ is close to what is
+ wanted here, but is not quite right because this file does not require
+ all the features of C11 Annex F (and does not require C11 at all,
+ for that matter). */
+
+#define IEEE_FLOATING_POINT (FLT_RADIX == 2 && FLT_MANT_DIG == 24 \
+ && FLT_MIN_EXP == -125 && FLT_MAX_EXP == 128)
+
int
FUNC (DOUBLE x)
{
-#ifdef KNOWN_EXPBIT0_LOCATION
+#if defined KNOWN_EXPBIT0_LOCATION && IEEE_FLOATING_POINT
# if defined USE_LONG_DOUBLE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
/* Special CPU dependent code is needed to treat bit patterns outside the
IEEE 754 specification (such as Pseudo-NaNs, Pseudo-Infinities,
@@ -153,8 +164,9 @@ FUNC (DOUBLE x)
}
# endif
#else
- /* The configuration did not find sufficient information. Give up about
- the signaling NaNs, handle only the quiet NaNs. */
+ /* The configuration did not find sufficient information, or does
+ not use IEEE floating point. Give up about the signaling NaNs;
+ handle only the quiet NaNs. */
if (x == x)
{
# if defined USE_LONG_DOUBLE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE
diff --git a/lib/isnand-nolibm.h b/lib/isnand-nolibm.h
index 8a84ff81..cee7eec0 100644
--- a/lib/isnand-nolibm.h
+++ b/lib/isnand-nolibm.h
@@ -1,5 +1,5 @@
/* Test for NaN that does not need libm.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007-2014 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
diff --git a/lib/isnand.c b/lib/isnand.c
index cbad17b5..318c3595 100644
--- a/lib/isnand.c
+++ b/lib/isnand.c
@@ -1,5 +1,5 @@
/* Test for NaN that does not need libm.
- Copyright (C) 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2008-2014 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
diff --git a/lib/isnanf-nolibm.h b/lib/isnanf-nolibm.h
index dc43863a..41c2ef30 100644
--- a/lib/isnanf-nolibm.h
+++ b/lib/isnanf-nolibm.h
@@ -1,5 +1,5 @@
/* Test for NaN that does not need libm.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007-2014 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
diff --git a/lib/isnanf.c b/lib/isnanf.c
index 946cb69c..583a607e 100644
--- a/lib/isnanf.c
+++ b/lib/isnanf.c
@@ -1,5 +1,5 @@
/* Test for NaN that does not need libm.
- Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2014 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
diff --git a/lib/isnanl-nolibm.h b/lib/isnanl-nolibm.h
index 18eb8037..371de004 100644
--- a/lib/isnanl-nolibm.h
+++ b/lib/isnanl-nolibm.h
@@ -1,5 +1,5 @@
/* Test for NaN that does not need libm.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007-2014 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
diff --git a/lib/isnanl.c b/lib/isnanl.c
index 9d9d84b9..4575e4c3 100644
--- a/lib/isnanl.c
+++ b/lib/isnanl.c
@@ -1,5 +1,5 @@
/* Test for NaN that does not need libm.
- Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2014 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
diff --git a/lib/iswblank.c b/lib/iswblank.c
index 613ef638..9c1672fb 100644
--- a/lib/iswblank.c
+++ b/lib/iswblank.c
@@ -1,5 +1,5 @@
/* Test wide character for being blank.
- Copyright (C) 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2008-2014 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
diff --git a/lib/itold.c b/lib/itold.c
index 9aabc7e4..937f4805 100644
--- a/lib/itold.c
+++ b/lib/itold.c
@@ -1,5 +1,5 @@
/* Replacement for 'int' to 'long double' conversion routine.
- Copyright (C) 2011-2013 Free Software Foundation, Inc.
+ Copyright (C) 2011-2014 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2011.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/langinfo.in.h b/lib/langinfo.in.h
index 5388ce62..338ffb6a 100644
--- a/lib/langinfo.in.h
+++ b/lib/langinfo.in.h
@@ -1,5 +1,5 @@
/* Substitute for and wrapper around <langinfo.h>.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 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
@@ -49,7 +49,10 @@ typedef int nl_item;
# define CODESET 10000
/* nl_langinfo items of the LC_NUMERIC category */
# define RADIXCHAR 10001
+# define DECIMAL_POINT RADIXCHAR
# define THOUSEP 10002
+# define THOUSANDS_SEP THOUSEP
+# define GROUPING 10114
/* nl_langinfo items of the LC_TIME category */
# define D_T_FMT 10003
# define D_FMT 10004
@@ -102,6 +105,21 @@ typedef int nl_item;
# define ALT_DIGITS 10051
/* nl_langinfo items of the LC_MONETARY category */
# define CRNCYSTR 10052
+# define CURRENCY_SYMBOL CRNCYSTR
+# define INT_CURR_SYMBOL 10100
+# define MON_DECIMAL_POINT 10101
+# define MON_THOUSANDS_SEP 10102
+# define MON_GROUPING 10103
+# define POSITIVE_SIGN 10104
+# define NEGATIVE_SIGN 10105
+# define FRAC_DIGITS 10106
+# define INT_FRAC_DIGITS 10107
+# define P_CS_PRECEDES 10108
+# define N_CS_PRECEDES 10109
+# define P_SEP_BY_SPACE 10110
+# define N_SEP_BY_SPACE 10111
+# define P_SIGN_POSN 10112
+# define N_SIGN_POSN 10113
/* nl_langinfo items of the LC_MESSAGES category */
# define YESEXPR 10053
# define NOEXPR 10054
diff --git a/lib/lchown.c b/lib/lchown.c
index ff48c183..647b0a8a 100644
--- a/lib/lchown.c
+++ b/lib/lchown.c
@@ -1,6 +1,6 @@
/* Provide a stub lchown function for systems that lack it.
- Copyright (C) 1998-1999, 2002, 2004, 2006-2007, 2009-2013 Free Software
+ Copyright (C) 1998-1999, 2002, 2004, 2006-2007, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/linebuffer.c b/lib/linebuffer.c
index c725b8ce..d1582fe3 100644
--- a/lib/linebuffer.c
+++ b/lib/linebuffer.c
@@ -1,6 +1,6 @@
/* linebuffer.c -- read arbitrarily long lines
- Copyright (C) 1986, 1991, 1998-1999, 2001, 2003-2004, 2006-2007, 2009-2013
+ Copyright (C) 1986, 1991, 1998-1999, 2001, 2003-2004, 2006-2007, 2009-2014
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/linebuffer.h b/lib/linebuffer.h
index 12030b50..740d5c41 100644
--- a/lib/linebuffer.h
+++ b/lib/linebuffer.h
@@ -1,6 +1,6 @@
/* linebuffer.h -- declarations for reading arbitrarily long lines
- Copyright (C) 1986, 1991, 1998-1999, 2002-2003, 2007, 2009-2013 Free
+ Copyright (C) 1986, 1991, 1998-1999, 2002-2003, 2007, 2009-2014 Free
Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/link.c b/lib/link.c
index ce3cc449..80f4f097 100644
--- a/lib/link.c
+++ b/lib/link.c
@@ -1,6 +1,6 @@
/* Emulate link on platforms that lack it, namely native Windows platforms.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 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
diff --git a/lib/linkat.c b/lib/linkat.c
index f358b2db..6ee30fb4 100644
--- a/lib/linkat.c
+++ b/lib/linkat.c
@@ -1,5 +1,5 @@
/* Create a hard link relative to open directories.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 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
diff --git a/lib/localcharset.c b/lib/localcharset.c
index 953cc1e7..a9288673 100644
--- a/lib/localcharset.c
+++ b/lib/localcharset.c
@@ -1,6 +1,6 @@
/* Determine a canonical name for the current locale's character encoding.
- Copyright (C) 2000-2006, 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2000-2006, 2008-2014 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
@@ -65,6 +65,11 @@
# include <os2.h>
#endif
+/* For MB_CUR_MAX_L */
+#if defined DARWIN7
+# include <xlocale.h>
+#endif
+
#if ENABLE_RELOCATABLE
# include "relocatable.h"
#else
@@ -545,7 +550,7 @@ locale_charset (void)
#ifdef DARWIN7
/* Mac OS X sets MB_CUR_MAX to 1 when LC_ALL=C, and "UTF-8"
(the default codeset) does not work when MB_CUR_MAX is 1. */
- if (strcmp (codeset, "UTF-8") == 0 && MB_CUR_MAX <= 1)
+ if (strcmp (codeset, "UTF-8") == 0 && MB_CUR_MAX_L (uselocale (NULL)) <= 1)
codeset = "ASCII";
#endif
diff --git a/lib/localcharset.h b/lib/localcharset.h
index c2098298..9011d580 100644
--- a/lib/localcharset.h
+++ b/lib/localcharset.h
@@ -1,5 +1,5 @@
/* Determine a canonical name for the current locale's character encoding.
- Copyright (C) 2000-2003, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2000-2003, 2009-2014 Free Software Foundation, Inc.
This file is part of the GNU CHARSET Library.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/locale.in.h b/lib/locale.in.h
index 264161a6..10cc44b1 100644
--- a/lib/locale.in.h
+++ b/lib/locale.in.h
@@ -1,5 +1,5 @@
/* A POSIX <locale.h>.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007-2014 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
diff --git a/lib/localeconv.c b/lib/localeconv.c
index 7c7c77cf..014e739c 100644
--- a/lib/localeconv.c
+++ b/lib/localeconv.c
@@ -1,5 +1,5 @@
/* Query locale dependent information for formatting numbers.
- Copyright (C) 2012-2013 Free Software Foundation, Inc.
+ Copyright (C) 2012-2014 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
diff --git a/lib/long-options.c b/lib/long-options.c
index 723cad5d..fa7d1cd7 100644
--- a/lib/long-options.c
+++ b/lib/long-options.c
@@ -1,6 +1,6 @@
/* Utility to accept --help and --version options as unobtrusively as possible.
- Copyright (C) 1993-1994, 1998-2000, 2002-2006, 2009-2013 Free Software
+ Copyright (C) 1993-1994, 1998-2000, 2002-2006, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/long-options.h b/lib/long-options.h
index e0e70853..a44ae2e8 100644
--- a/lib/long-options.h
+++ b/lib/long-options.h
@@ -1,5 +1,5 @@
/* long-options.h -- declaration for --help- and --version-handling function.
- Copyright (C) 1993-1994, 1998-1999, 2003, 2009-2013 Free Software
+ Copyright (C) 1993-1994, 1998-1999, 2003, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/lseek.c b/lib/lseek.c
index fa7440d1..f19b41b1 100644
--- a/lib/lseek.c
+++ b/lib/lseek.c
@@ -1,5 +1,5 @@
/* An lseek() function that detects pipes.
- Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2014 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
diff --git a/lib/lstat.c b/lib/lstat.c
index 1a613a89..f70fd435 100644
--- a/lib/lstat.c
+++ b/lib/lstat.c
@@ -1,6 +1,6 @@
/* Work around a bug of lstat on some systems
- Copyright (C) 1997-2006, 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 1997-2006, 2008-2014 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
diff --git a/lib/malloc.c b/lib/malloc.c
index 908735d2..bc81c54d 100644
--- a/lib/malloc.c
+++ b/lib/malloc.c
@@ -1,6 +1,6 @@
/* malloc() function that is glibc compatible.
- Copyright (C) 1997-1998, 2006-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 1997-1998, 2006-2007, 2009-2014 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
diff --git a/lib/malloca.c b/lib/malloca.c
index 3cd2f6d9..370551c5 100644
--- a/lib/malloca.c
+++ b/lib/malloca.c
@@ -1,5 +1,5 @@
/* Safe automatic memory allocation.
- Copyright (C) 2003, 2006-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2006-2007, 2009-2014 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2003.
This program is free software; you can redistribute it and/or modify
@@ -49,12 +49,18 @@
#define MAGIC_SIZE sizeof (int)
/* This is how the header info would look like without any alignment
considerations. */
-struct preliminary_header { void *next; char room[MAGIC_SIZE]; };
+struct preliminary_header { void *next; int magic; };
/* But the header's size must be a multiple of sa_alignment_max. */
#define HEADER_SIZE \
(((sizeof (struct preliminary_header) + sa_alignment_max - 1) / sa_alignment_max) * sa_alignment_max)
-struct header { void *next; char room[HEADER_SIZE - sizeof (struct preliminary_header) + MAGIC_SIZE]; };
-verify (HEADER_SIZE == sizeof (struct header));
+union header {
+ void *next;
+ struct {
+ char room[HEADER_SIZE - MAGIC_SIZE];
+ int word;
+ } magic;
+};
+verify (HEADER_SIZE == sizeof (union header));
/* We make the hash table quite big, so that during lookups the probability
of empty hash buckets is quite high. There is no need to make the hash
table resizable, because when the hash table gets filled so much that the
@@ -74,20 +80,21 @@ mmalloca (size_t n)
if (nplus >= n)
{
- char *p = (char *) malloc (nplus);
+ void *p = malloc (nplus);
if (p != NULL)
{
size_t slot;
+ union header *h = p;
- p += HEADER_SIZE;
+ p = h + 1;
/* Put a magic number into the indicator word. */
- ((int *) p)[-1] = MAGIC_NUMBER;
+ h->magic.word = MAGIC_NUMBER;
/* Enter p into the hash table. */
slot = (uintptr_t) p % HASH_TABLE_SIZE;
- ((struct header *) (p - HEADER_SIZE))->next = mmalloca_results[slot];
+ h->next = mmalloca_results[slot];
mmalloca_results[slot] = p;
return p;
@@ -123,15 +130,17 @@ freea (void *p)
void **chain = &mmalloca_results[slot];
for (; *chain != NULL;)
{
+ union header *h = p;
if (*chain == p)
{
/* Found it. Remove it from the hash table and free it. */
- char *p_begin = (char *) p - HEADER_SIZE;
- *chain = ((struct header *) p_begin)->next;
+ union header *p_begin = h - 1;
+ *chain = p_begin->next;
free (p_begin);
return;
}
- chain = &((struct header *) ((char *) *chain - HEADER_SIZE))->next;
+ h = *chain;
+ chain = &h[-1].next;
}
}
/* At this point, we know it was not a mmalloca() result. */
diff --git a/lib/malloca.h b/lib/malloca.h
index 906d47a2..5071e46f 100644
--- a/lib/malloca.h
+++ b/lib/malloca.h
@@ -1,5 +1,5 @@
/* Safe automatic memory allocation.
- Copyright (C) 2003-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2003-2007, 2009-2014 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2003.
This program is free software; you can redistribute it and/or modify
@@ -92,7 +92,7 @@ extern void * nmalloca (size_t n, size_t s);
/* ------------------- Auxiliary, non-public definitions ------------------- */
/* Determine the alignment of a type at compile time. */
-#if defined __GNUC__
+#if defined __GNUC__ || defined __IBM__ALIGNOF__
# define sa_alignof __alignof__
#elif defined __cplusplus
template <class type> struct sa_alignof_helper { char __slot1; type __slot2; };
diff --git a/lib/math.in.h b/lib/math.in.h
index 7189819b..9d73c5e5 100644
--- a/lib/math.in.h
+++ b/lib/math.in.h
@@ -1,6 +1,6 @@
/* A GNU-like <math.h>.
- Copyright (C) 2002-2003, 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2002-2003, 2007-2014 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
@@ -28,6 +28,9 @@
#ifndef _@GUARD_PREFIX@_MATH_H
#define _@GUARD_PREFIX@_MATH_H
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
_GL_INLINE_HEADER_BEGIN
#ifndef _GL_MATH_INLINE
# define _GL_MATH_INLINE _GL_INLINE
diff --git a/lib/mbchar.c b/lib/mbchar.c
index 7482c31f..7d5bfcc1 100644
--- a/lib/mbchar.c
+++ b/lib/mbchar.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2006, 2009-2013 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2006, 2009-2014 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
diff --git a/lib/mbchar.h b/lib/mbchar.h
index 327c9575..700174c5 100644
--- a/lib/mbchar.h
+++ b/lib/mbchar.h
@@ -1,5 +1,5 @@
/* Multibyte character data type.
- Copyright (C) 2001, 2005-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2005-2007, 2009-2014 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
@@ -156,6 +156,9 @@
#include <wchar.h>
#include <wctype.h>
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
_GL_INLINE_HEADER_BEGIN
#ifndef MBCHAR_INLINE
# define MBCHAR_INLINE _GL_INLINE
diff --git a/lib/mbiter.h b/lib/mbiter.h
index 24504c3f..32fff8cf 100644
--- a/lib/mbiter.h
+++ b/lib/mbiter.h
@@ -1,5 +1,5 @@
/* Iterating through multibyte strings: macros for multi-byte encodings.
- Copyright (C) 2001, 2005, 2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2005, 2007, 2009-2014 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
@@ -97,6 +97,9 @@
#include "mbchar.h"
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
_GL_INLINE_HEADER_BEGIN
#ifndef MBITER_INLINE
# define MBITER_INLINE _GL_INLINE
diff --git a/lib/mbrlen.c b/lib/mbrlen.c
index 7b124242..5f180ba2 100644
--- a/lib/mbrlen.c
+++ b/lib/mbrlen.c
@@ -1,5 +1,5 @@
/* Recognize multibyte character.
- Copyright (C) 1999-2000, 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 1999-2000, 2008-2014 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2008.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/mbrtowc.c b/lib/mbrtowc.c
index 5ee44aea..5743f437 100644
--- a/lib/mbrtowc.c
+++ b/lib/mbrtowc.c
@@ -1,5 +1,5 @@
/* Convert multibyte character to wide character.
- Copyright (C) 1999-2002, 2005-2013 Free Software Foundation, Inc.
+ Copyright (C) 1999-2002, 2005-2014 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2008.
This program is free software: you can redistribute it and/or modify
@@ -328,7 +328,7 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
size_t
rpl_mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
{
-# if MBRTOWC_NULL_ARG2_BUG || MBRTOWC_RETVAL_BUG
+# if MBRTOWC_NULL_ARG2_BUG || MBRTOWC_RETVAL_BUG || MBRTOWC_EMPTY_INPUT_BUG
if (s == NULL)
{
pwc = NULL;
@@ -337,6 +337,11 @@ rpl_mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
}
# endif
+# if MBRTOWC_EMPTY_INPUT_BUG
+ if (n == 0)
+ return (size_t) -2;
+# endif
+
# if MBRTOWC_RETVAL_BUG
{
static mbstate_t internal_state;
diff --git a/lib/mbsalign.c b/lib/mbsalign.c
index 816ada0a..fe0e6408 100644
--- a/lib/mbsalign.c
+++ b/lib/mbsalign.c
@@ -1,5 +1,5 @@
/* Align/Truncate a string in a given screen width
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 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
diff --git a/lib/mbsalign.h b/lib/mbsalign.h
index 72a6d69a..b3aa0fbf 100644
--- a/lib/mbsalign.h
+++ b/lib/mbsalign.h
@@ -1,5 +1,5 @@
/* Align/Truncate a string in a given screen width
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 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
diff --git a/lib/mbscasecmp.c b/lib/mbscasecmp.c
index 97ef1dab..d52448fe 100644
--- a/lib/mbscasecmp.c
+++ b/lib/mbscasecmp.c
@@ -1,5 +1,5 @@
/* Case-insensitive string comparison function.
- Copyright (C) 1998-1999, 2005-2013 Free Software Foundation, Inc.
+ Copyright (C) 1998-1999, 2005-2014 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2005,
based on earlier glibc code.
diff --git a/lib/mbsinit.c b/lib/mbsinit.c
index 26fbb7fa..df4bcd18 100644
--- a/lib/mbsinit.c
+++ b/lib/mbsinit.c
@@ -1,5 +1,5 @@
/* Test for initial conversion state.
- Copyright (C) 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2008-2014 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2008.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/mbslen.c b/lib/mbslen.c
index 85e938bc..74c6ec12 100644
--- a/lib/mbslen.c
+++ b/lib/mbslen.c
@@ -1,5 +1,5 @@
/* Counting the multibyte characters in a string.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007-2014 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2007.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/mbsrtowcs-impl.h b/lib/mbsrtowcs-impl.h
index b50e9739..d42af012 100644
--- a/lib/mbsrtowcs-impl.h
+++ b/lib/mbsrtowcs-impl.h
@@ -1,5 +1,5 @@
/* Convert string to wide string.
- Copyright (C) 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2008-2014 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2008.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/mbsrtowcs-state.c b/lib/mbsrtowcs-state.c
index 5a0b8882..2a7019aa 100644
--- a/lib/mbsrtowcs-state.c
+++ b/lib/mbsrtowcs-state.c
@@ -1,5 +1,5 @@
/* Convert string to wide string.
- Copyright (C) 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2008-2014 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2008.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/mbsrtowcs.c b/lib/mbsrtowcs.c
index 116ff493..136ec343 100644
--- a/lib/mbsrtowcs.c
+++ b/lib/mbsrtowcs.c
@@ -1,5 +1,5 @@
/* Convert string to wide string.
- Copyright (C) 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2008-2014 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2008.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/mbsstr.c b/lib/mbsstr.c
index f84e689e..1ae9fe42 100644
--- a/lib/mbsstr.c
+++ b/lib/mbsstr.c
@@ -1,5 +1,5 @@
/* Searching in a string.
- Copyright (C) 2005-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005-2014 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2005.
This program is free software: you can redistribute it and/or modify
@@ -45,11 +45,13 @@ knuth_morris_pratt_multibyte (const char *haystack, const char *needle,
size_t *table;
/* Allocate room for needle_mbchars and the table. */
- char *memory = (char *) nmalloca (m, sizeof (mbchar_t) + sizeof (size_t));
+ void *memory = nmalloca (m, sizeof (mbchar_t) + sizeof (size_t));
+ void *table_memory;
if (memory == NULL)
return false;
- needle_mbchars = (mbchar_t *) memory;
- table = (size_t *) (memory + m * sizeof (mbchar_t));
+ needle_mbchars = memory;
+ table_memory = needle_mbchars + m;
+ table = table_memory;
/* Fill needle_mbchars. */
{
diff --git a/lib/mbswidth.c b/lib/mbswidth.c
index 7c2dfce8..d39067a4 100644
--- a/lib/mbswidth.c
+++ b/lib/mbswidth.c
@@ -1,5 +1,5 @@
/* Determine the number of screen columns needed for a string.
- Copyright (C) 2000-2013 Free Software Foundation, Inc.
+ Copyright (C) 2000-2014 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
diff --git a/lib/mbswidth.h b/lib/mbswidth.h
index e9c0b039..ab7c1503 100644
--- a/lib/mbswidth.h
+++ b/lib/mbswidth.h
@@ -1,5 +1,5 @@
/* Determine the number of screen columns needed for a string.
- Copyright (C) 2000-2004, 2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2000-2004, 2007, 2009-2014 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
diff --git a/lib/mbtowc-impl.h b/lib/mbtowc-impl.h
index 767ab397..3cc70b0e 100644
--- a/lib/mbtowc-impl.h
+++ b/lib/mbtowc-impl.h
@@ -1,5 +1,5 @@
/* Convert multibyte character to wide character.
- Copyright (C) 2011-2013 Free Software Foundation, Inc.
+ Copyright (C) 2011-2014 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2011.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/mbtowc.c b/lib/mbtowc.c
index 632f2e1d..93a74454 100644
--- a/lib/mbtowc.c
+++ b/lib/mbtowc.c
@@ -1,5 +1,5 @@
/* Convert multibyte character to wide character.
- Copyright (C) 2011-2013 Free Software Foundation, Inc.
+ Copyright (C) 2011-2014 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2011.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/mbuiter.h b/lib/mbuiter.h
index c5f5fcee..1702f14c 100644
--- a/lib/mbuiter.h
+++ b/lib/mbuiter.h
@@ -1,5 +1,5 @@
/* Iterating through multibyte strings: macros for multi-byte encodings.
- Copyright (C) 2001, 2005, 2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2005, 2007, 2009-2014 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
@@ -106,6 +106,9 @@
#include "mbchar.h"
#include "strnlen1.h"
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
_GL_INLINE_HEADER_BEGIN
#ifndef MBUITER_INLINE
# define MBUITER_INLINE _GL_INLINE
diff --git a/lib/md5.c b/lib/md5.c
index f41b5beb..ece24ac9 100644
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -1,6 +1,6 @@
/* Functions to compute MD5 message digest of files or memory blocks.
according to the definition of MD5 in RFC 1321 from April 1992.
- Copyright (C) 1995-1997, 1999-2001, 2005-2006, 2008-2013 Free Software
+ Copyright (C) 1995-1997, 1999-2001, 2005-2006, 2008-2014 Free Software
Foundation, Inc.
This file is part of the GNU C Library.
@@ -21,6 +21,9 @@
#include <config.h>
+#if HAVE_OPENSSL_MD5
+# define GL_OPENSSL_INLINE _GL_EXTERN_INLINE
+#endif
#include "md5.h"
#include <stdalign.h>
@@ -61,6 +64,7 @@
# error "invalid BLOCKSIZE"
#endif
+#if ! HAVE_OPENSSL_MD5
/* This array contains the bytes used to pad the buffer to the next
64-byte boundary. (RFC 1321, 3.1: Step 1) */
static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ };
@@ -128,6 +132,7 @@ md5_finish_ctx (struct md5_ctx *ctx, void *resbuf)
return md5_read_ctx (ctx, resbuf);
}
+#endif
/* Compute MD5 message digest for bytes read from STREAM. The
resulting message digest number will be written into the 16 bytes
@@ -202,6 +207,7 @@ process_partial_block:
return 0;
}
+#if ! HAVE_OPENSSL_MD5
/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
result is always in little endian byte order, so that a byte-wise
output yields to the wanted ASCII representation of the message
@@ -459,3 +465,4 @@ md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx)
ctx->C = C;
ctx->D = D;
}
+#endif
diff --git a/lib/md5.h b/lib/md5.h
index 634a7470..1d6974ae 100644
--- a/lib/md5.h
+++ b/lib/md5.h
@@ -1,6 +1,6 @@
/* Declaration of functions and data types used for MD5 sum computing
library functions.
- Copyright (C) 1995-1997, 1999-2001, 2004-2006, 2008-2013 Free Software
+ Copyright (C) 1995-1997, 1999-2001, 2004-2006, 2008-2014 Free Software
Foundation, Inc.
This file is part of the GNU C Library.
@@ -23,6 +23,10 @@
#include <stdio.h>
#include <stdint.h>
+# if HAVE_OPENSSL_MD5
+# include <openssl/md5.h>
+# endif
+
#define MD5_DIGEST_SIZE 16
#define MD5_BLOCK_SIZE 64
@@ -57,6 +61,10 @@
extern "C" {
# endif
+# if HAVE_OPENSSL_MD5
+# define GL_OPENSSL_NAME 5
+# include "gl_openssl.h"
+# else
/* Structure to save state of computation between the single steps. */
struct md5_ctx
{
@@ -106,11 +114,6 @@ extern void *__md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) __THROW;
extern void *__md5_read_ctx (const struct md5_ctx *ctx, void *resbuf) __THROW;
-/* Compute MD5 message digest for bytes read from STREAM. The
- resulting message digest number will be written into the 16 bytes
- beginning at RESBLOCK. */
-extern int __md5_stream (FILE *stream, void *resblock) __THROW;
-
/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
result is always in little endian byte order, so that a byte-wise
output yields to the wanted ASCII representation of the message
@@ -118,6 +121,13 @@ extern int __md5_stream (FILE *stream, void *resblock) __THROW;
extern void *__md5_buffer (const char *buffer, size_t len,
void *resblock) __THROW;
+# endif
+/* Compute MD5 message digest for bytes read from STREAM. The
+ resulting message digest number will be written into the 16 bytes
+ beginning at RESBLOCK. */
+extern int __md5_stream (FILE *stream, void *resblock) __THROW;
+
+
# ifdef __cplusplus
}
# endif
diff --git a/lib/memcasecmp.c b/lib/memcasecmp.c
index e85add4e..c24039a4 100644
--- a/lib/memcasecmp.c
+++ b/lib/memcasecmp.c
@@ -1,5 +1,5 @@
/* Case-insensitive buffer comparator.
- Copyright (C) 1996-1997, 2000, 2003, 2006, 2009-2013 Free Software
+ Copyright (C) 1996-1997, 2000, 2003, 2006, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/memcasecmp.h b/lib/memcasecmp.h
index 27ae3f7e..8b53c302 100644
--- a/lib/memcasecmp.h
+++ b/lib/memcasecmp.h
@@ -1,6 +1,6 @@
/* Case-insensitive buffer comparator.
- Copyright (C) 1996, 1998, 2003, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1998, 2003, 2009-2014 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
diff --git a/lib/memchr.c b/lib/memchr.c
index 3db38a94..6709f6ea 100644
--- a/lib/memchr.c
+++ b/lib/memchr.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2013
+/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2014
Free Software Foundation, Inc.
Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
diff --git a/lib/memchr2.c b/lib/memchr2.c
index 3912e027..3d79f2a2 100644
--- a/lib/memchr2.c
+++ b/lib/memchr2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2013
+/* Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2004, 2006, 2008-2014
Free Software Foundation, Inc.
Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
@@ -43,6 +43,7 @@ memchr2 (void const *s, int c1_in, int c2_in, size_t n)
typedef unsigned long int longword;
const unsigned char *char_ptr;
+ void const *void_ptr;
const longword *longword_ptr;
longword repeated_one;
longword repeated_c1;
@@ -57,14 +58,18 @@ memchr2 (void const *s, int c1_in, int c2_in, size_t n)
return memchr (s, c1, n);
/* Handle the first few bytes by reading one byte at a time.
- Do this until CHAR_PTR is aligned on a longword boundary. */
- for (char_ptr = (const unsigned char *) s;
- n > 0 && (size_t) char_ptr % sizeof (longword) != 0;
- --n, ++char_ptr)
- if (*char_ptr == c1 || *char_ptr == c2)
- return (void *) char_ptr;
-
- longword_ptr = (const longword *) char_ptr;
+ Do this until VOID_PTR is aligned on a longword boundary. */
+ for (void_ptr = s;
+ n > 0 && (uintptr_t) void_ptr % sizeof (longword) != 0;
+ --n)
+ {
+ char_ptr = void_ptr;
+ if (*char_ptr == c1 || *char_ptr == c2)
+ return (void *) void_ptr;
+ void_ptr = char_ptr + 1;
+ }
+
+ longword_ptr = void_ptr;
/* All these elucidatory comments refer to 4-byte longwords,
but the theory applies equally well to any size longwords. */
diff --git a/lib/memchr2.h b/lib/memchr2.h
index cc04889f..220c2b54 100644
--- a/lib/memchr2.h
+++ b/lib/memchr2.h
@@ -1,5 +1,5 @@
/* Scan memory for the first of two bytes.
- Copyright (C) 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2008-2014 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
diff --git a/lib/memcmp2.c b/lib/memcmp2.c
index 8afb3199..a31ed5b5 100644
--- a/lib/memcmp2.c
+++ b/lib/memcmp2.c
@@ -1,5 +1,5 @@
/* Compare two memory areas with possibly different lengths.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 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
diff --git a/lib/memcmp2.h b/lib/memcmp2.h
index 619c7425..e346b389 100644
--- a/lib/memcmp2.h
+++ b/lib/memcmp2.h
@@ -1,5 +1,5 @@
/* Compare two memory areas with possibly different lengths.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 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
diff --git a/lib/memcoll.c b/lib/memcoll.c
index 1f5c2e3a..51321048 100644
--- a/lib/memcoll.c
+++ b/lib/memcoll.c
@@ -1,6 +1,6 @@
/* Locale-specific memory comparison.
- Copyright (C) 1999, 2002-2004, 2006, 2009-2013 Free Software Foundation,
+ Copyright (C) 1999, 2002-2004, 2006, 2009-2014 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/memcoll.h b/lib/memcoll.h
index 1aaca474..7f193b85 100644
--- a/lib/memcoll.h
+++ b/lib/memcoll.h
@@ -1,6 +1,6 @@
/* Locale-specific memory comparison.
- Copyright (C) 1999, 2003, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2003, 2009-2014 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
diff --git a/lib/mempcpy.c b/lib/mempcpy.c
index 5582368e..ff83ee11 100644
--- a/lib/mempcpy.c
+++ b/lib/mempcpy.c
@@ -1,5 +1,5 @@
/* Copy memory area and return pointer after last written byte.
- Copyright (C) 2003, 2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2007, 2009-2014 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
diff --git a/lib/memrchr.c b/lib/memrchr.c
index 5a023e06..742a0c9b 100644
--- a/lib/memrchr.c
+++ b/lib/memrchr.c
@@ -1,6 +1,6 @@
/* memrchr -- find the last occurrence of a byte in a memory block
- Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2013 Free Software
+ Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2014 Free Software
Foundation, Inc.
Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
diff --git a/lib/mgetgroups.c b/lib/mgetgroups.c
index 2d82f45c..9d302e74 100644
--- a/lib/mgetgroups.c
+++ b/lib/mgetgroups.c
@@ -1,6 +1,6 @@
/* mgetgroups.c -- return a list of the groups a user or current process is in
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007-2014 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
@@ -133,7 +133,7 @@ mgetgroups (char const *username, gid_t gid, gid_t **groups)
return -1;
}
- if (!username && gid != (gid_t) -1)
+ if (max_n_groups == 0 || (!username && gid != (gid_t) -1))
max_n_groups++;
g = realloc_groupbuf (NULL, max_n_groups);
if (g == NULL)
diff --git a/lib/mgetgroups.h b/lib/mgetgroups.h
index b8a99c6a..8ccac074 100644
--- a/lib/mgetgroups.h
+++ b/lib/mgetgroups.h
@@ -1,5 +1,5 @@
/* Get a list of all group IDs associated with a specified user ID.
- Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2014 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
diff --git a/lib/mkancesdirs.c b/lib/mkancesdirs.c
index 0c60a93c..0638b194 100644
--- a/lib/mkancesdirs.c
+++ b/lib/mkancesdirs.c
@@ -1,6 +1,6 @@
/* Make a file's ancestor directories.
- Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2009-2014 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
diff --git a/lib/mkdir-p.c b/lib/mkdir-p.c
index a66f7964..188fa3a4 100644
--- a/lib/mkdir-p.c
+++ b/lib/mkdir-p.c
@@ -1,6 +1,6 @@
/* mkdir-p.c -- Ensure that a directory and its parents exist.
- Copyright (C) 1990, 1997-2000, 2002-2007, 2009-2013 Free Software
+ Copyright (C) 1990, 1997-2000, 2002-2007, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -52,9 +52,9 @@
is retained on return if the ancestor directories could not be
created.
- Create DIR as a new directory with using mkdir with permissions
- MODE. It is also OK if MAKE_ANCESTOR is not null and a
- directory DIR already exists.
+ Create DIR as a new directory, using mkdir with permissions MODE;
+ here, MODE is affected by the umask in the usual way. It is also
+ OK if MAKE_ANCESTOR is not null and a directory DIR already exists.
Call ANNOUNCE (DIR, OPTIONS) just after successfully making DIR,
even if some of the following actions fail.
@@ -65,16 +65,15 @@
Set DIR's mode bits to MODE, except preserve any of the bits that
correspond to zero bits in MODE_BITS. In other words, MODE_BITS is
a mask that specifies which of DIR's mode bits should be set or
- cleared. MODE should be a subset of MODE_BITS, which in turn
- should be a subset of CHMOD_MODE_BITS. Changing the mode in this
- way is necessary if DIR already existed or if MODE and MODE_BITS
- specify non-permissions bits like S_ISUID.
+ cleared. Changing the mode in this way is necessary if DIR already
+ existed, if MODE and MODE_BITS specify non-permissions bits like
+ S_ISUID, or if MODE and MODE_BITS specify permissions bits that are
+ masked out by the umask. MODE_BITS should be a subset of
+ CHMOD_MODE_BITS.
However, if PRESERVE_EXISTING is true and DIR already exists,
do not attempt to set DIR's ownership and file mode bits.
- This implementation assumes the current umask is zero.
-
Return true if DIR exists as a directory with the proper ownership
and file mode bits when done, or if a child process has been
dispatched to do the real work (though the child process may not
@@ -130,8 +129,13 @@ make_dir_parents (char *dir,
if (mkdir (dir + prefix_len, mkdir_mode) == 0)
{
+ /* True if the caller does not care about the umask's
+ effect on the permissions. */
+ bool umask_must_be_ok = (mode & mode_bits & S_IRWXUGO) == 0;
+
announce (dir, options);
- preserve_existing = keep_owner & keep_special_mode_bits;
+ preserve_existing = (keep_owner & keep_special_mode_bits
+ & umask_must_be_ok);
savewd_chdir_options |=
(SAVEWD_CHDIR_NOFOLLOW
| (mode & S_IRUSR ? SAVEWD_CHDIR_READABLE : 0));
@@ -162,36 +166,17 @@ make_dir_parents (char *dir,
else
{
bool chdir_ok = (chdir_result == 0);
- int chdir_errno = errno;
- int fd = open_result[0];
- bool chdir_failed_unexpectedly =
- (mkdir_errno == 0
- && ((! chdir_ok && (mode & S_IXUSR))
- || (fd < 0 && (mode & S_IRUSR))));
-
- if (chdir_failed_unexpectedly)
- {
- /* No need to save errno here; it's irrelevant. */
- if (0 <= fd)
- close (fd);
- }
- else
- {
- char const *subdir = (chdir_ok ? "." : dir + prefix_len);
- if (dirchownmod (fd, subdir, mkdir_mode, owner, group,
- mode, mode_bits)
- == 0)
- return true;
- }
+ char const *subdir = (chdir_ok ? "." : dir + prefix_len);
+ if (dirchownmod (open_result[0], subdir, mkdir_mode,
+ owner, group, mode, mode_bits)
+ == 0)
+ return true;
if (mkdir_errno == 0
|| (mkdir_errno != ENOENT && make_ancestor
&& errno != ENOTDIR))
{
- error (0,
- (! chdir_failed_unexpectedly ? errno
- : ! chdir_ok && (mode & S_IXUSR) ? chdir_errno
- : open_result[1]),
+ error (0, errno,
_(keep_owner
? "cannot change permissions of %s"
: "cannot change owner and permissions of %s"),
diff --git a/lib/mkdir-p.h b/lib/mkdir-p.h
index 6e83a63d..c6d37aa9 100644
--- a/lib/mkdir-p.h
+++ b/lib/mkdir-p.h
@@ -1,6 +1,6 @@
/* mkdir-p.h -- Ensure that a directory and its parents exist.
- Copyright (C) 1994-1997, 2000, 2003-2006, 2009-2013 Free Software
+ Copyright (C) 1994-1997, 2000, 2003-2006, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/mkdir.c b/lib/mkdir.c
index 67f29d45..481bbf37 100644
--- a/lib/mkdir.c
+++ b/lib/mkdir.c
@@ -1,7 +1,7 @@
/* On some systems, mkdir ("foo/", 0700) fails because of the trailing
slash. On those systems, this wrapper removes the trailing slash.
- Copyright (C) 2001, 2003, 2006, 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2003, 2006, 2008-2014 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
diff --git a/lib/mkfifo.c b/lib/mkfifo.c
index 45d16cd4..a04b2252 100644
--- a/lib/mkfifo.c
+++ b/lib/mkfifo.c
@@ -1,5 +1,5 @@
/* Create a named fifo.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 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
diff --git a/lib/mknod.c b/lib/mknod.c
index 71e9d345..c738e591 100644
--- a/lib/mknod.c
+++ b/lib/mknod.c
@@ -1,5 +1,5 @@
/* Create a device inode.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 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
diff --git a/lib/mkstemp-safer.c b/lib/mkstemp-safer.c
index 6431f824..03a205f3 100644
--- a/lib/mkstemp-safer.c
+++ b/lib/mkstemp-safer.c
@@ -1,6 +1,6 @@
/* Invoke mkstemp, but avoid some glitches.
- Copyright (C) 2005-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005-2007, 2009-2014 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
diff --git a/lib/mkstemp.c b/lib/mkstemp.c
index 7a9af6c8..ce9c6db8 100644
--- a/lib/mkstemp.c
+++ b/lib/mkstemp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-1999, 2001, 2005-2007, 2009-2013 Free Software
+/* Copyright (C) 1998-1999, 2001, 2005-2007, 2009-2014 Free Software
Foundation, Inc.
This file is derived from the one in the GNU C Library.
diff --git a/lib/mktime.c b/lib/mktime.c
index e660a23c..48b3a40f 100644
--- a/lib/mktime.c
+++ b/lib/mktime.c
@@ -1,5 +1,5 @@
/* Convert a 'struct tm' to a time_t value.
- Copyright (C) 1993-2013 Free Software Foundation, Inc.
+ Copyright (C) 1993-2014 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Paul Eggert <eggert@twinsun.com>.
@@ -38,7 +38,7 @@
#include <string.h> /* For the real memcpy prototype. */
-#if DEBUG
+#if defined DEBUG && DEBUG
# include <stdio.h>
# include <stdlib.h>
/* Make it work even if the system's libc has its own mktime routine. */
@@ -600,7 +600,7 @@ libc_hidden_def (mktime)
libc_hidden_weak (timelocal)
#endif
-#if DEBUG
+#if defined DEBUG && DEBUG
static int
not_equal_tm (const struct tm *a, const struct tm *b)
diff --git a/lib/modechange.c b/lib/modechange.c
index 7cca3d1b..412fe1d2 100644
--- a/lib/modechange.c
+++ b/lib/modechange.c
@@ -1,6 +1,6 @@
/* modechange.c -- file mode manipulation
- Copyright (C) 1989-1990, 1997-1999, 2001, 2003-2006, 2009-2013 Free Software
+ Copyright (C) 1989-1990, 1997-1999, 2001, 2003-2006, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -220,12 +220,12 @@ mode_compile (char const *mode_string)
{
octal_mode = 8 * octal_mode + *p++ - '0';
if (ALLM < octal_mode)
- return NULL;
+ goto invalid;
}
while ('0' <= *p && *p < '8');
if (affected || (*p && *p != ','))
- return NULL;
+ goto invalid;
affected = mentioned = CHMOD_MODE_BITS;
value = octal_to_mode (octal_mode);
flag = MODE_ORDINARY_CHANGE;
diff --git a/lib/modechange.h b/lib/modechange.h
index fc4c944c..e969ba97 100644
--- a/lib/modechange.h
+++ b/lib/modechange.h
@@ -1,6 +1,6 @@
/* modechange.h -- definitions for file mode manipulation
- Copyright (C) 1989-1990, 1997, 2003-2006, 2009-2013 Free Software
+ Copyright (C) 1989-1990, 1997, 2003-2006, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/mountlist.c b/lib/mountlist.c
index 8fb7e9ab..b3be011a 100644
--- a/lib/mountlist.c
+++ b/lib/mountlist.c
@@ -1,6 +1,6 @@
/* mountlist.c -- return a list of mounted file systems
- Copyright (C) 1991-1992, 1997-2013 Free Software Foundation, Inc.
+ Copyright (C) 1991-1992, 1997-2014 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
@@ -128,9 +128,19 @@
# include <sys/mntent.h>
#endif
+#ifndef HAVE_HASMNTOPT
+# define hasmntopt(mnt, opt) ((char *) 0)
+#endif
+
#undef MNT_IGNORE
-#if defined MNTOPT_IGNORE && defined HAVE_HASMNTOPT
-# define MNT_IGNORE(M) hasmntopt (M, MNTOPT_IGNORE)
+#ifdef MNTOPT_IGNORE
+# if defined __sun && defined __SVR4
+/* Solaris defines hasmntopt(struct mnttab *, char *)
+ while it is otherwise hasmntopt(struct mnttab *, const char *). */
+# define MNT_IGNORE(M) hasmntopt (M, (char *) MNTOPT_IGNORE)
+# else
+# define MNT_IGNORE(M) hasmntopt (M, MNTOPT_IGNORE)
+# endif
#else
# define MNT_IGNORE(M) 0
#endif
@@ -139,11 +149,6 @@
# include "unlocked-io.h"
#endif
-/* The results of open() in this file are not used with fchdir,
- therefore save some unnecessary work in fchdir.c. */
-#undef open
-#undef close
-
/* The results of opendir() in this file are not used with dirfd and fchdir,
therefore save some unnecessary work in fchdir.c. */
#undef opendir
@@ -942,6 +947,7 @@ read_file_system_list (bool need_fs_type)
mtail = &me->me_next;
}
}
+ closedir (dirp);
}
#endif /* MOUNTED_INTERIX_STATVFS */
@@ -957,11 +963,7 @@ read_file_system_list (bool need_fs_type)
while (mount_list)
{
me = mount_list->me_next;
- free (mount_list->me_devname);
- free (mount_list->me_mountdir);
- if (mount_list->me_type_malloced)
- free (mount_list->me_type);
- free (mount_list);
+ free_mount_entry (mount_list);
mount_list = me;
}
@@ -969,3 +971,14 @@ read_file_system_list (bool need_fs_type)
return NULL;
}
}
+
+/* Free a mount entry as returned from read_file_system_list (). */
+
+void free_mount_entry (struct mount_entry *me)
+{
+ free (me->me_devname);
+ free (me->me_mountdir);
+ if (me->me_type_malloced)
+ free (me->me_type);
+ free (me);
+}
diff --git a/lib/mountlist.h b/lib/mountlist.h
index ffdcc02b..1e4dfae8 100644
--- a/lib/mountlist.h
+++ b/lib/mountlist.h
@@ -1,6 +1,6 @@
/* mountlist.h -- declarations for list of mounted file systems
- Copyright (C) 1991-1992, 1998, 2000-2005, 2009-2013 Free Software
+ Copyright (C) 1991-1992, 1998, 2000-2005, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -36,5 +36,6 @@ struct mount_entry
};
struct mount_entry *read_file_system_list (bool need_fs_type);
+void free_mount_entry (struct mount_entry *entry);
#endif
diff --git a/lib/mpsort.c b/lib/mpsort.c
index 8300fb39..08a8b3da 100644
--- a/lib/mpsort.c
+++ b/lib/mpsort.c
@@ -1,6 +1,6 @@
/* Sort a vector of pointers to data.
- Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2014 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
diff --git a/lib/msvc-inval.c b/lib/msvc-inval.c
index 72a6b6ee..f83827fb 100644
--- a/lib/msvc-inval.c
+++ b/lib/msvc-inval.c
@@ -1,5 +1,5 @@
/* Invalid parameter handler for MSVC runtime libraries.
- Copyright (C) 2011-2013 Free Software Foundation, Inc.
+ Copyright (C) 2011-2014 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
@@ -28,7 +28,7 @@
# if MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING
-static void cdecl
+static void __cdecl
gl_msvc_invalid_parameter_handler (const wchar_t *expression,
const wchar_t *function,
const wchar_t *file,
@@ -45,7 +45,7 @@ gl_msvc_invalid_parameter_handler (const wchar_t *expression,
# if defined _MSC_VER
-static void cdecl
+static void __cdecl
gl_msvc_invalid_parameter_handler (const wchar_t *expression,
const wchar_t *function,
const wchar_t *file,
@@ -94,7 +94,7 @@ gl_msvc_inval_current (void)
}
}
-static void cdecl
+static void __cdecl
gl_msvc_invalid_parameter_handler (const wchar_t *expression,
const wchar_t *function,
const wchar_t *file,
diff --git a/lib/msvc-inval.h b/lib/msvc-inval.h
index dcb0353d..a0ef540f 100644
--- a/lib/msvc-inval.h
+++ b/lib/msvc-inval.h
@@ -1,5 +1,5 @@
/* Invalid parameter handler for MSVC runtime libraries.
- Copyright (C) 2011-2013 Free Software Foundation, Inc.
+ Copyright (C) 2011-2014 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
diff --git a/lib/msvc-nothrow.c b/lib/msvc-nothrow.c
index 8d65472a..b1e5f0c9 100644
--- a/lib/msvc-nothrow.c
+++ b/lib/msvc-nothrow.c
@@ -1,6 +1,6 @@
/* Wrappers that don't throw invalid parameter notifications
with MSVC runtime libraries.
- Copyright (C) 2011-2013 Free Software Foundation, Inc.
+ Copyright (C) 2011-2014 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
diff --git a/lib/msvc-nothrow.h b/lib/msvc-nothrow.h
index 5f521813..0d4dea58 100644
--- a/lib/msvc-nothrow.h
+++ b/lib/msvc-nothrow.h
@@ -1,6 +1,6 @@
/* Wrappers that don't throw invalid parameter notifications
with MSVC runtime libraries.
- Copyright (C) 2011-2013 Free Software Foundation, Inc.
+ Copyright (C) 2011-2014 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
diff --git a/lib/nanosleep.c b/lib/nanosleep.c
index 9b5b3c11..d0b12e7a 100644
--- a/lib/nanosleep.c
+++ b/lib/nanosleep.c
@@ -1,6 +1,6 @@
/* Provide a replacement for the POSIX nanosleep function.
- Copyright (C) 1999-2000, 2002, 2004-2013 Free Software Foundation, Inc.
+ Copyright (C) 1999-2000, 2002, 2004-2014 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
diff --git a/lib/netdb.in.h b/lib/netdb.in.h
index 0da1800a..bb9d34ab 100644
--- a/lib/netdb.in.h
+++ b/lib/netdb.in.h
@@ -1,5 +1,5 @@
/* Provide a netdb.h header file for systems lacking it (read: MinGW).
- Copyright (C) 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2008-2014 Free Software Foundation, Inc.
Written by Simon Josefsson.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/netinet_in.in.h b/lib/netinet_in.in.h
index b456c4f9..f0129dfe 100644
--- a/lib/netinet_in.in.h
+++ b/lib/netinet_in.in.h
@@ -1,5 +1,5 @@
/* Substitute for <netinet/in.h>.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007-2014 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
diff --git a/lib/nl_langinfo.c b/lib/nl_langinfo.c
index 771c9533..1ab551d0 100644
--- a/lib/nl_langinfo.c
+++ b/lib/nl_langinfo.c
@@ -1,6 +1,6 @@
/* nl_langinfo() replacement: query locale dependent information.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007-2014 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,13 +20,72 @@
/* Specification. */
#include <langinfo.h>
+#include <locale.h>
+#include <string.h>
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+# define WIN32_LEAN_AND_MEAN /* avoid including junk */
+# include <windows.h>
+# include <stdio.h>
+#endif
+
+/* Return the codeset of the current locale, if this is easily deducible.
+ Otherwise, return "". */
+static char *
+ctype_codeset (void)
+{
+ static char buf[2 + 10 + 1];
+ size_t buflen = 0;
+ char const *locale = setlocale (LC_CTYPE, NULL);
+ char *codeset = buf;
+ size_t codesetlen;
+ codeset[0] = '\0';
+
+ if (locale && locale[0])
+ {
+ /* If the locale name contains an encoding after the dot, return it. */
+ char *dot = strchr (locale, '.');
+
+ if (dot)
+ {
+ /* Look for the possible @... trailer and remove it, if any. */
+ char *codeset_start = dot + 1;
+ char const *modifier = strchr (codeset_start, '@');
+
+ if (! modifier)
+ codeset = codeset_start;
+ else
+ {
+ codesetlen = modifier - codeset_start;
+ if (codesetlen < sizeof buf)
+ {
+ codeset = memcpy (buf, codeset_start, codesetlen);
+ codeset[codesetlen] = '\0';
+ }
+ }
+ }
+ }
+
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+ /* If setlocale is successful, it returns the number of the
+ codepage, as a string. Otherwise, fall back on Windows API
+ GetACP, which returns the locale's codepage as a number (although
+ this doesn't change according to what the 'setlocale' call specified).
+ Either way, prepend "CP" to make it a valid codeset name. */
+ codesetlen = strlen (codeset);
+ if (0 < codesetlen && codesetlen < sizeof buf - 2)
+ memmove (buf + 2, codeset, codesetlen + 1);
+ else
+ sprintf (buf + 2, "%u", GetACP ());
+ codeset = memcpy (buf, "CP", 2);
+#endif
+ return codeset;
+}
+
+
#if REPLACE_NL_LANGINFO
/* Override nl_langinfo with support for added nl_item values. */
-# include <locale.h>
-# include <string.h>
-
# undef nl_langinfo
char *
@@ -36,36 +95,7 @@ rpl_nl_langinfo (nl_item item)
{
# if GNULIB_defined_CODESET
case CODESET:
- {
- const char *locale;
- static char buf[2 + 10 + 1];
-
- locale = setlocale (LC_CTYPE, NULL);
- if (locale != NULL && locale[0] != '\0')
- {
- /* If the locale name contains an encoding after the dot, return
- it. */
- const char *dot = strchr (locale, '.');
-
- if (dot != NULL)
- {
- const char *modifier;
-
- dot++;
- /* Look for the possible @... trailer and remove it, if any. */
- modifier = strchr (dot, '@');
- if (modifier == NULL)
- return dot;
- if (modifier - dot < sizeof (buf))
- {
- memcpy (buf, dot, modifier - dot);
- buf [modifier - dot] = '\0';
- return buf;
- }
- }
- }
- return "";
- }
+ return ctype_codeset ();
# endif
# if GNULIB_defined_T_FMT_AMPM
case T_FMT_AMPM:
@@ -111,42 +141,28 @@ rpl_nl_langinfo (nl_item item)
#else
-/* Provide nl_langinfo from scratch. */
-
-# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+/* Provide nl_langinfo from scratch, either for native MS-Windows, or
+ for old Unix platforms without locales, such as Linux libc5 or
+ BeOS. */
-/* Native Windows platforms. */
-
-# define WIN32_LEAN_AND_MEAN /* avoid including junk */
-# include <windows.h>
-
-# include <stdio.h>
-
-# else
-
-/* An old Unix platform without locales, such as Linux libc5 or BeOS. */
-
-# endif
-
-# include <locale.h>
+# include <time.h>
char *
nl_langinfo (nl_item item)
{
+ static char nlbuf[100];
+ struct tm tmm = { 0 };
+
switch (item)
{
/* nl_langinfo items of the LC_CTYPE category */
case CODESET:
-# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
{
- static char buf[2 + 10 + 1];
-
- /* The Windows API has a function returning the locale's codepage as
- a number. */
- sprintf (buf, "CP%u", GetACP ());
- return buf;
+ char *codeset = ctype_codeset ();
+ if (*codeset)
+ return codeset;
}
-# elif defined __BEOS__
+# ifdef __BEOS__
return "UTF-8";
# else
return "ISO-8859-1";
@@ -156,6 +172,8 @@ nl_langinfo (nl_item item)
return localeconv () ->decimal_point;
case THOUSEP:
return localeconv () ->thousands_sep;
+ case GROUPING:
+ return localeconv () ->grouping;
/* nl_langinfo items of the LC_TIME category.
TODO: Really use the locale. */
case D_T_FMT:
@@ -170,93 +188,126 @@ nl_langinfo (nl_item item)
case T_FMT_AMPM:
return "%I:%M:%S %p";
case AM_STR:
- return "AM";
+ if (!strftime (nlbuf, sizeof nlbuf, "%p", &tmm))
+ return "AM";
+ return nlbuf;
case PM_STR:
- return "PM";
+ tmm.tm_hour = 12;
+ if (!strftime (nlbuf, sizeof nlbuf, "%p", &tmm))
+ return "PM";
+ return nlbuf;
case DAY_1:
- return "Sunday";
case DAY_2:
- return "Monday";
case DAY_3:
- return "Tuesday";
case DAY_4:
- return "Wednesday";
case DAY_5:
- return "Thursday";
case DAY_6:
- return "Friday";
case DAY_7:
- return "Saturday";
+ {
+ static char const days[][sizeof "Wednesday"] = {
+ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday",
+ "Friday", "Saturday"
+ };
+ tmm.tm_wday = item - DAY_1;
+ if (!strftime (nlbuf, sizeof nlbuf, "%A", &tmm))
+ return (char *) days[item - DAY_1];
+ return nlbuf;
+ }
case ABDAY_1:
- return "Sun";
case ABDAY_2:
- return "Mon";
case ABDAY_3:
- return "Tue";
case ABDAY_4:
- return "Wed";
case ABDAY_5:
- return "Thu";
case ABDAY_6:
- return "Fri";
case ABDAY_7:
- return "Sat";
+ {
+ static char const abdays[][sizeof "Sun"] = {
+ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
+ };
+ tmm.tm_wday = item - ABDAY_1;
+ if (!strftime (nlbuf, sizeof nlbuf, "%a", &tmm))
+ return (char *) abdays[item - ABDAY_1];
+ return nlbuf;
+ }
case MON_1:
- return "January";
case MON_2:
- return "February";
case MON_3:
- return "March";
case MON_4:
- return "April";
case MON_5:
- return "May";
case MON_6:
- return "June";
case MON_7:
- return "July";
case MON_8:
- return "August";
case MON_9:
- return "September";
case MON_10:
- return "October";
case MON_11:
- return "November";
case MON_12:
- return "December";
+ {
+ static char const months[][sizeof "September"] = {
+ "January", "February", "March", "April", "May", "June", "July",
+ "September", "October", "November", "December"
+ };
+ tmm.tm_mon = item - MON_1;
+ if (!strftime (nlbuf, sizeof nlbuf, "%B", &tmm))
+ return (char *) months[item - MON_1];
+ return nlbuf;
+ }
case ABMON_1:
- return "Jan";
case ABMON_2:
- return "Feb";
case ABMON_3:
- return "Mar";
case ABMON_4:
- return "Apr";
case ABMON_5:
- return "May";
case ABMON_6:
- return "Jun";
case ABMON_7:
- return "Jul";
case ABMON_8:
- return "Aug";
case ABMON_9:
- return "Sep";
case ABMON_10:
- return "Oct";
case ABMON_11:
- return "Nov";
case ABMON_12:
- return "Dec";
+ {
+ static char const abmonths[][sizeof "Jan"] = {
+ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul",
+ "Sep", "Oct", "Nov", "Dec"
+ };
+ tmm.tm_mon = item - ABMON_1;
+ if (!strftime (nlbuf, sizeof nlbuf, "%b", &tmm))
+ return (char *) abmonths[item - ABMON_1];
+ return nlbuf;
+ }
case ERA:
return "";
case ALT_DIGITS:
return "\0\0\0\0\0\0\0\0\0\0";
- /* nl_langinfo items of the LC_MONETARY category
- TODO: Really use the locale. */
+ /* nl_langinfo items of the LC_MONETARY category. */
case CRNCYSTR:
- return "-";
+ return localeconv () ->currency_symbol;
+ case INT_CURR_SYMBOL:
+ return localeconv () ->int_curr_symbol;
+ case MON_DECIMAL_POINT:
+ return localeconv () ->mon_decimal_point;
+ case MON_THOUSANDS_SEP:
+ return localeconv () ->mon_thousands_sep;
+ case MON_GROUPING:
+ return localeconv () ->mon_grouping;
+ case POSITIVE_SIGN:
+ return localeconv () ->positive_sign;
+ case NEGATIVE_SIGN:
+ return localeconv () ->negative_sign;
+ case FRAC_DIGITS:
+ return & localeconv () ->frac_digits;
+ case INT_FRAC_DIGITS:
+ return & localeconv () ->int_frac_digits;
+ case P_CS_PRECEDES:
+ return & localeconv () ->p_cs_precedes;
+ case N_CS_PRECEDES:
+ return & localeconv () ->n_cs_precedes;
+ case P_SEP_BY_SPACE:
+ return & localeconv () ->p_sep_by_space;
+ case N_SEP_BY_SPACE:
+ return & localeconv () ->n_sep_by_space;
+ case P_SIGN_POSN:
+ return & localeconv () ->p_sign_posn;
+ case N_SIGN_POSN:
+ return & localeconv () ->n_sign_posn;
/* nl_langinfo items of the LC_MESSAGES category
TODO: Really use the locale. */
case YESEXPR:
diff --git a/lib/nproc.c b/lib/nproc.c
index edede216..cadf959b 100644
--- a/lib/nproc.c
+++ b/lib/nproc.c
@@ -1,6 +1,6 @@
/* Detect the number of processors.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 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
diff --git a/lib/nproc.h b/lib/nproc.h
index a612ca47..0cf65839 100644
--- a/lib/nproc.h
+++ b/lib/nproc.h
@@ -1,6 +1,6 @@
/* Detect the number of processors.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 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
diff --git a/lib/obstack.c b/lib/obstack.c
index d915449d..2db87b35 100644
--- a/lib/obstack.c
+++ b/lib/obstack.c
@@ -1,19 +1,21 @@
/* obstack.c - subroutines used implicitly by object stack macros
+ Copyright (C) 1988-2014 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
- Copyright (C) 1988-1994, 1996-2006, 2009-2013 Free Software Foundation, Inc.
+ The GNU C Library 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.
- 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 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
+ The GNU C Library 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.
+ 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 the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifdef _LIBC
# include <obstack.h>
@@ -49,6 +51,7 @@
#ifndef ELIDE_CODE
+
# include <stdint.h>
/* Determine default alignment. */
@@ -67,10 +70,10 @@ struct fooalign
But in fact it might be less smart and round addresses to as much as
DEFAULT_ROUNDING. So we prepare for it to do that. */
enum
- {
- DEFAULT_ALIGNMENT = offsetof (struct fooalign, u),
- DEFAULT_ROUNDING = sizeof (union fooround)
- };
+{
+ DEFAULT_ALIGNMENT = offsetof (struct fooalign, u),
+ DEFAULT_ROUNDING = sizeof (union fooround)
+};
/* When we copy a long block of data, this is the unit to do it with.
On some machines, copying successive ints does not work;
@@ -104,7 +107,7 @@ int obstack_exit_failure = EXIT_FAILURE;
/* A looong time ago (before 1994, anyway; we're not sure) this global variable
was used by non-GNU-C macros to avoid multiple evaluation. The GNU C
library still exports it because somebody might use it. */
-struct obstack *_obstack_compat;
+struct obstack *_obstack_compat = 0;
compat_symbol (libc, _obstack_compat, _obstack, GLIBC_2_0);
# endif
# endif
@@ -116,19 +119,19 @@ compat_symbol (libc, _obstack_compat, _obstack, GLIBC_2_0);
do not allow (expr) ? void : void. */
# define CALL_CHUNKFUN(h, size) \
- (((h) -> use_extra_arg) \
- ? (*(h)->chunkfun) ((h)->extra_arg, (size)) \
- : (*(struct _obstack_chunk *(*) (long)) (h)->chunkfun) ((size)))
+ (((h)->use_extra_arg) \
+ ? (*(h)->chunkfun)((h)->extra_arg, (size)) \
+ : (*(struct _obstack_chunk *(*)(long))(h)->chunkfun)((size)))
# define CALL_FREEFUN(h, old_chunk) \
do { \
- if ((h) -> use_extra_arg) \
- (*(h)->freefun) ((h)->extra_arg, (old_chunk)); \
- else \
- (*(void (*) (void *)) (h)->freefun) ((old_chunk)); \
- } while (0)
+ if ((h)->use_extra_arg) \
+ (*(h)->freefun)((h)->extra_arg, (old_chunk)); \
+ else \
+ (*(void (*)(void *))(h)->freefun)((old_chunk)); \
+ } while (0)
+
-
/* Initialize an obstack H for use. Specify chunk size SIZE (0 means default).
Objects start on multiples of ALIGNMENT (0 means use default).
CHUNKFUN is the function to use to allocate chunks,
@@ -143,7 +146,7 @@ _obstack_begin (struct obstack *h,
void *(*chunkfun) (long),
void (*freefun) (void *))
{
- register struct _obstack_chunk *chunk; /* points to new chunk */
+ struct _obstack_chunk *chunk; /* points to new chunk */
if (alignment == 0)
alignment = DEFAULT_ALIGNMENT;
@@ -164,19 +167,19 @@ _obstack_begin (struct obstack *h,
size = 4096 - extra;
}
- h->chunkfun = (struct _obstack_chunk * (*)(void *, long)) chunkfun;
+ h->chunkfun = (struct _obstack_chunk * (*) (void *, long)) chunkfun;
h->freefun = (void (*) (void *, struct _obstack_chunk *)) freefun;
h->chunk_size = size;
h->alignment_mask = alignment - 1;
h->use_extra_arg = 0;
- chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size);
+ chunk = h->chunk = CALL_CHUNKFUN (h, h->chunk_size);
if (!chunk)
(*obstack_alloc_failed_handler) ();
h->next_free = h->object_base = __PTR_ALIGN ((char *) chunk, chunk->contents,
alignment - 1);
h->chunk_limit = chunk->limit
- = (char *) chunk + h->chunk_size;
+ = (char *) chunk + h->chunk_size;
chunk->prev = 0;
/* The initial chunk now contains no empty object. */
h->maybe_empty_object = 0;
@@ -190,7 +193,7 @@ _obstack_begin_1 (struct obstack *h, int size, int alignment,
void (*freefun) (void *, void *),
void *arg)
{
- register struct _obstack_chunk *chunk; /* points to new chunk */
+ struct _obstack_chunk *chunk; /* points to new chunk */
if (alignment == 0)
alignment = DEFAULT_ALIGNMENT;
@@ -218,13 +221,13 @@ _obstack_begin_1 (struct obstack *h, int size, int alignment,
h->extra_arg = arg;
h->use_extra_arg = 1;
- chunk = h->chunk = CALL_CHUNKFUN (h, h -> chunk_size);
+ chunk = h->chunk = CALL_CHUNKFUN (h, h->chunk_size);
if (!chunk)
(*obstack_alloc_failed_handler) ();
h->next_free = h->object_base = __PTR_ALIGN ((char *) chunk, chunk->contents,
alignment - 1);
h->chunk_limit = chunk->limit
- = (char *) chunk + h->chunk_size;
+ = (char *) chunk + h->chunk_size;
chunk->prev = 0;
/* The initial chunk now contains no empty object. */
h->maybe_empty_object = 0;
@@ -241,11 +244,11 @@ _obstack_begin_1 (struct obstack *h, int size, int alignment,
void
_obstack_newchunk (struct obstack *h, int length)
{
- register struct _obstack_chunk *old_chunk = h->chunk;
- register struct _obstack_chunk *new_chunk;
- register long new_size;
- register long obj_size = h->next_free - h->object_base;
- register long i;
+ struct _obstack_chunk *old_chunk = h->chunk;
+ struct _obstack_chunk *new_chunk;
+ long new_size;
+ long obj_size = h->next_free - h->object_base;
+ long i;
long already;
char *object_base;
@@ -257,7 +260,7 @@ _obstack_newchunk (struct obstack *h, int length)
/* Allocate and initialize the new chunk. */
new_chunk = CALL_CHUNKFUN (h, new_size);
if (!new_chunk)
- (*obstack_alloc_failed_handler) ();
+ (*obstack_alloc_failed_handler)();
h->chunk = new_chunk;
new_chunk->prev = old_chunk;
new_chunk->limit = h->chunk_limit = (char *) new_chunk + new_size;
@@ -273,8 +276,8 @@ _obstack_newchunk (struct obstack *h, int length)
{
for (i = obj_size / sizeof (COPYING_UNIT) - 1;
i >= 0; i--)
- ((COPYING_UNIT *)object_base)[i]
- = ((COPYING_UNIT *)h->object_base)[i];
+ ((COPYING_UNIT *) object_base)[i]
+ = ((COPYING_UNIT *) h->object_base)[i];
/* We used to copy the odd few remaining bytes as one extra COPYING_UNIT,
but that can cross a page boundary on a machine
which does not do strict alignment for COPYING_UNITS. */
@@ -289,7 +292,7 @@ _obstack_newchunk (struct obstack *h, int length)
/* If the object just copied was the only data in OLD_CHUNK,
free that chunk and remove it from the chain.
But not if that chunk might contain an empty object. */
- if (! h->maybe_empty_object
+ if (!h->maybe_empty_object
&& (h->object_base
== __PTR_ALIGN ((char *) old_chunk, old_chunk->contents,
h->alignment_mask)))
@@ -313,13 +316,13 @@ libc_hidden_def (_obstack_newchunk)
/* Suppress -Wmissing-prototypes warning. We don't want to declare this in
obstack.h because it is just for debugging. */
-int _obstack_allocated_p (struct obstack *h, void *obj);
+int _obstack_allocated_p (struct obstack *h, void *obj) __attribute_pure__;
int
_obstack_allocated_p (struct obstack *h, void *obj)
{
- register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */
- register struct _obstack_chunk *plp; /* point to previous chunk if any */
+ struct _obstack_chunk *lp; /* below addr of any objects in this chunk */
+ struct _obstack_chunk *plp; /* point to previous chunk if any */
lp = (h)->chunk;
/* We use >= rather than > since the object cannot be exactly at
@@ -332,7 +335,7 @@ _obstack_allocated_p (struct obstack *h, void *obj)
}
return lp != 0;
}
-
+
/* Free objects in obstack H, including OBJ and everything allocate
more recently than OBJ. If OBJ is zero, free everything in H. */
@@ -341,8 +344,8 @@ _obstack_allocated_p (struct obstack *h, void *obj)
void
__obstack_free (struct obstack *h, void *obj)
{
- register struct _obstack_chunk *lp; /* below addr of any objects in this chunk */
- register struct _obstack_chunk *plp; /* point to previous chunk if any */
+ struct _obstack_chunk *lp; /* below addr of any objects in this chunk */
+ struct _obstack_chunk *plp; /* point to previous chunk if any */
lp = h->chunk;
/* We use >= because there cannot be an object at the beginning of a chunk.
@@ -373,12 +376,12 @@ __obstack_free (struct obstack *h, void *obj)
called by non-GCC compilers. */
strong_alias (obstack_free, _obstack_free)
# endif
-
+
int
_obstack_memory_used (struct obstack *h)
{
- register struct _obstack_chunk* lp;
- register int nbytes = 0;
+ struct _obstack_chunk *lp;
+ int nbytes = 0;
for (lp = h->chunk; lp != 0; lp = lp->prev)
{
@@ -386,7 +389,7 @@ _obstack_memory_used (struct obstack *h)
}
return nbytes;
}
-
+
/* Define the error handler. */
# ifdef _LIBC
# include <libintl.h>
diff --git a/lib/obstack.h b/lib/obstack.h
index 159cfa2e..ebaa622f 100644
--- a/lib/obstack.h
+++ b/lib/obstack.h
@@ -1,90 +1,90 @@
/* obstack.h - object stack macros
- Copyright (C) 1988-1994, 1996-1999, 2003-2006, 2009-2013 Free Software
- Foundation, Inc.
+ Copyright (C) 1988-2014 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- 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 3 of the License, or
- (at your option) any later version.
+ The GNU C Library 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.
- This program is distributed in the hope that it will be useful,
+ The GNU C Library 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.
+ 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, see <http://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/* Summary:
-All the apparent functions defined here are macros. The idea
-is that you would use these pre-tested macros to solve a
-very specific set of problems, and they would run fast.
-Caution: no side-effects in arguments please!! They may be
-evaluated MANY times!!
-
-These macros operate a stack of objects. Each object starts life
-small, and may grow to maturity. (Consider building a word syllable
-by syllable.) An object can move while it is growing. Once it has
-been "finished" it never changes address again. So the "top of the
-stack" is typically an immature growing object, while the rest of the
-stack is of mature, fixed size and fixed address objects.
-
-These routines grab large chunks of memory, using a function you
-supply, called 'obstack_chunk_alloc'. On occasion, they free chunks,
-by calling 'obstack_chunk_free'. You must define them and declare
-them before using any obstack macros.
-
-Each independent stack is represented by a 'struct obstack'.
-Each of the obstack macros expects a pointer to such a structure
-as the first argument.
-
-One motivation for this package is the problem of growing char strings
-in symbol tables. Unless you are "fascist pig with a read-only mind"
---Gosper's immortal quote from HAKMEM item 154, out of context--you
-would not like to put any arbitrary upper limit on the length of your
-symbols.
-
-In practice this often means you will build many short symbols and a
-few long symbols. At the time you are reading a symbol you don't know
-how long it is. One traditional method is to read a symbol into a
-buffer, realloc()ating the buffer every time you try to read a symbol
-that is longer than the buffer. This is beaut, but you still will
-want to copy the symbol from the buffer to a more permanent
-symbol-table entry say about half the time.
-
-With obstacks, you can work differently. Use one obstack for all symbol
-names. As you read a symbol, grow the name in the obstack gradually.
-When the name is complete, finalize it. Then, if the symbol exists already,
-free the newly read name.
-
-The way we do this is to take a large chunk, allocating memory from
-low addresses. When you want to build a symbol in the chunk you just
-add chars above the current "high water mark" in the chunk. When you
-have finished adding chars, because you got to the end of the symbol,
-you know how long the chars are, and you can create a new object.
-Mostly the chars will not burst over the highest address of the chunk,
-because you would typically expect a chunk to be (say) 100 times as
-long as an average object.
-
-In case that isn't clear, when we have enough chars to make up
-the object, THEY ARE ALREADY CONTIGUOUS IN THE CHUNK (guaranteed)
-so we just point to it where it lies. No moving of chars is
-needed and this is the second win: potentially long strings need
-never be explicitly shuffled. Once an object is formed, it does not
-change its address during its lifetime.
-
-When the chars burst over a chunk boundary, we allocate a larger
-chunk, and then copy the partly formed object from the end of the old
-chunk to the beginning of the new larger chunk. We then carry on
-accreting characters to the end of the object as we normally would.
-
-A special macro is provided to add a single char at a time to a
-growing object. This allows the use of register variables, which
-break the ordinary 'growth' macro.
-
-Summary:
+ All the apparent functions defined here are macros. The idea
+ is that you would use these pre-tested macros to solve a
+ very specific set of problems, and they would run fast.
+ Caution: no side-effects in arguments please!! They may be
+ evaluated MANY times!!
+
+ These macros operate a stack of objects. Each object starts life
+ small, and may grow to maturity. (Consider building a word syllable
+ by syllable.) An object can move while it is growing. Once it has
+ been "finished" it never changes address again. So the "top of the
+ stack" is typically an immature growing object, while the rest of the
+ stack is of mature, fixed size and fixed address objects.
+
+ These routines grab large chunks of memory, using a function you
+ supply, called 'obstack_chunk_alloc'. On occasion, they free chunks,
+ by calling 'obstack_chunk_free'. You must define them and declare
+ them before using any obstack macros.
+
+ Each independent stack is represented by a 'struct obstack'.
+ Each of the obstack macros expects a pointer to such a structure
+ as the first argument.
+
+ One motivation for this package is the problem of growing char strings
+ in symbol tables. Unless you are "fascist pig with a read-only mind"
+ --Gosper's immortal quote from HAKMEM item 154, out of context--you
+ would not like to put any arbitrary upper limit on the length of your
+ symbols.
+
+ In practice this often means you will build many short symbols and a
+ few long symbols. At the time you are reading a symbol you don't know
+ how long it is. One traditional method is to read a symbol into a
+ buffer, realloc()ating the buffer every time you try to read a symbol
+ that is longer than the buffer. This is beaut, but you still will
+ want to copy the symbol from the buffer to a more permanent
+ symbol-table entry say about half the time.
+
+ With obstacks, you can work differently. Use one obstack for all symbol
+ names. As you read a symbol, grow the name in the obstack gradually.
+ When the name is complete, finalize it. Then, if the symbol exists already,
+ free the newly read name.
+
+ The way we do this is to take a large chunk, allocating memory from
+ low addresses. When you want to build a symbol in the chunk you just
+ add chars above the current "high water mark" in the chunk. When you
+ have finished adding chars, because you got to the end of the symbol,
+ you know how long the chars are, and you can create a new object.
+ Mostly the chars will not burst over the highest address of the chunk,
+ because you would typically expect a chunk to be (say) 100 times as
+ long as an average object.
+
+ In case that isn't clear, when we have enough chars to make up
+ the object, THEY ARE ALREADY CONTIGUOUS IN THE CHUNK (guaranteed)
+ so we just point to it where it lies. No moving of chars is
+ needed and this is the second win: potentially long strings need
+ never be explicitly shuffled. Once an object is formed, it does not
+ change its address during its lifetime.
+
+ When the chars burst over a chunk boundary, we allocate a larger
+ chunk, and then copy the partly formed object from the end of the old
+ chunk to the beginning of the new larger chunk. We then carry on
+ accreting characters to the end of the object as we normally would.
+
+ A special macro is provided to add a single char at a time to a
+ growing object. This allows the use of register variables, which
+ break the ordinary 'growth' macro.
+
+ Summary:
We allocate large chunks.
We carve out one object at a time from the current chunk.
Once carved, an object never moves.
@@ -96,14 +96,14 @@ Summary:
Because of the way we do it, you can "unwind" an obstack
back to a previous state. (You may remove objects much
as you would with a stack.)
-*/
+ */
/* Don't do the contents of this file more than once. */
#ifndef _OBSTACK_H
#define _OBSTACK_H 1
-
+
/* We need the type of a pointer subtraction. If __PTRDIFF_TYPE__ is
defined, as with GNU C, use that; that way we don't pollute the
namespace with <stddef.h>'s symbols. Otherwise, include <stddef.h>
@@ -129,70 +129,74 @@ Summary:
relative to B. Otherwise, use the faster strategy of computing the
alignment relative to 0. */
-#define __PTR_ALIGN(B, P, A) \
+#define __PTR_ALIGN(B, P, A) \
__BPTR_ALIGN (sizeof (PTR_INT_TYPE) < sizeof (void *) ? (B) : (char *) 0, \
P, A)
#include <string.h>
+#ifndef __attribute_pure__
+# define __attribute_pure__ _GL_ATTRIBUTE_PURE
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
struct _obstack_chunk /* Lives at front of each chunk. */
{
- char *limit; /* 1 past end of this chunk */
+ char *limit; /* 1 past end of this chunk */
struct _obstack_chunk *prev; /* address of prior chunk or NULL */
- char contents[4]; /* objects begin here */
+ char contents[4]; /* objects begin here */
};
struct obstack /* control current object in current chunk */
{
- long chunk_size; /* preferred size to allocate chunks in */
+ long chunk_size; /* preferred size to allocate chunks in */
struct _obstack_chunk *chunk; /* address of current struct obstack_chunk */
- char *object_base; /* address of object we are building */
- char *next_free; /* where to add next char to current object */
- char *chunk_limit; /* address of char after current chunk */
+ char *object_base; /* address of object we are building */
+ char *next_free; /* where to add next char to current object */
+ char *chunk_limit; /* address of char after current chunk */
union
{
PTR_INT_TYPE tempint;
void *tempptr;
} temp; /* Temporary for some macros. */
- int alignment_mask; /* Mask of alignment for each object. */
+ int alignment_mask; /* Mask of alignment for each object. */
/* These prototypes vary based on 'use_extra_arg', and we use
casts to the prototypeless function type in all assignments,
but having prototypes here quiets -Wstrict-prototypes. */
struct _obstack_chunk *(*chunkfun) (void *, long);
void (*freefun) (void *, struct _obstack_chunk *);
void *extra_arg; /* first arg for chunk alloc/dealloc funcs */
- unsigned use_extra_arg:1; /* chunk alloc/dealloc funcs take extra arg */
- unsigned maybe_empty_object:1;/* There is a possibility that the current
- chunk contains a zero-length object. This
- prevents freeing the chunk if we allocate
- a bigger chunk to replace it. */
- unsigned alloc_failed:1; /* No longer used, as we now call the failed
- handler on error, but retained for binary
- compatibility. */
+ unsigned use_extra_arg : 1; /* chunk alloc/dealloc funcs take extra arg */
+ unsigned maybe_empty_object : 1; /* There is a possibility that the current
+ chunk contains a zero-length object. This
+ prevents freeing the chunk if we allocate
+ a bigger chunk to replace it. */
+ unsigned alloc_failed : 1; /* No longer used, as we now call the failed
+ handler on error, but retained for binary
+ compatibility. */
};
/* Declare the external functions we use; they are in obstack.c. */
extern void _obstack_newchunk (struct obstack *, int);
extern int _obstack_begin (struct obstack *, int, int,
- void *(*) (long), void (*) (void *));
+ void *(*)(long), void (*)(void *));
extern int _obstack_begin_1 (struct obstack *, int, int,
- void *(*) (void *, long),
- void (*) (void *, void *), void *);
-extern int _obstack_memory_used (struct obstack *);
+ void *(*)(void *, long),
+ void (*)(void *, void *), void *);
+extern int _obstack_memory_used (struct obstack *) __attribute_pure__;
/* The default name of the function for freeing a chunk is 'obstack_free',
but gnulib users can override this by defining '__obstack_free'. */
#ifndef __obstack_free
# define __obstack_free obstack_free
#endif
-extern void __obstack_free (struct obstack *obstack, void *block);
+extern void __obstack_free (struct obstack *, void *);
+
-
/* Error handler called when 'obstack_chunk_alloc' failed to allocate
more memory. This can be set to a user defined function which
should either abort gracefully or use longjump - but shouldn't
@@ -201,7 +205,7 @@ extern void (*obstack_alloc_failed_handler) (void);
/* Exit value used when 'print_and_abort' is used. */
extern int obstack_exit_failure;
-
+
/* Pointer to beginning of object being allocated or to be allocated next.
Note that this might not be the final address of the object
because a new chunk might be needed to hold the final size. */
@@ -221,43 +225,40 @@ extern int obstack_exit_failure;
#define obstack_alignment_mask(h) ((h)->alignment_mask)
/* To prevent prototype warnings provide complete argument list. */
-#define obstack_init(h) \
- _obstack_begin ((h), 0, 0, \
- (void *(*) (long)) obstack_chunk_alloc, \
- (void (*) (void *)) obstack_chunk_free)
+#define obstack_init(h) \
+ _obstack_begin ((h), 0, 0, \
+ (void *(*)(long))obstack_chunk_alloc, \
+ (void (*)(void *))obstack_chunk_free)
-#define obstack_begin(h, size) \
- _obstack_begin ((h), (size), 0, \
- (void *(*) (long)) obstack_chunk_alloc, \
- (void (*) (void *)) obstack_chunk_free)
+#define obstack_begin(h, size) \
+ _obstack_begin ((h), (size), 0, \
+ (void *(*)(long))obstack_chunk_alloc, \
+ (void (*)(void *))obstack_chunk_free)
#define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \
- _obstack_begin ((h), (size), (alignment), \
- (void *(*) (long)) (chunkfun), \
- (void (*) (void *)) (freefun))
+ _obstack_begin ((h), (size), (alignment), \
+ (void *(*)(long))(chunkfun), \
+ (void (*)(void *))(freefun))
#define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \
- _obstack_begin_1 ((h), (size), (alignment), \
- (void *(*) (void *, long)) (chunkfun), \
- (void (*) (void *, void *)) (freefun), (arg))
+ _obstack_begin_1 ((h), (size), (alignment), \
+ (void *(*)(void *, long))(chunkfun), \
+ (void (*)(void *, void *))(freefun), (arg))
#define obstack_chunkfun(h, newchunkfun) \
- ((h) -> chunkfun = (struct _obstack_chunk *(*)(void *, long)) (newchunkfun))
+ ((h)->chunkfun = (struct _obstack_chunk *(*)(void *, long))(newchunkfun))
#define obstack_freefun(h, newfreefun) \
- ((h) -> freefun = (void (*)(void *, struct _obstack_chunk *)) (newfreefun))
+ ((h)->freefun = (void (*)(void *, struct _obstack_chunk *))(newfreefun))
-#define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = (achar))
+#define obstack_1grow_fast(h, achar) (*((h)->next_free)++ = (achar))
-#define obstack_blank_fast(h,n) ((h)->next_free += (n))
+#define obstack_blank_fast(h, n) ((h)->next_free += (n))
#define obstack_memory_used(h) _obstack_memory_used (h)
-
+
#if defined __GNUC__
-/* NextStep 2.0 cc is really gcc 1.93 but it defines __GNUC__ = 2 and
- does not implement __extension__. But that compiler doesn't define
- __GNUC_MINOR__. */
-# if __GNUC__ < 2 || (__NeXT__ && !__GNUC_MINOR__)
+# if ! (2 < __GNUC__ + (8 <= __GNUC_MINOR__))
# define __extension__
# endif
@@ -266,158 +267,160 @@ extern int obstack_exit_failure;
without using a global variable.
Also, we can avoid using the 'temp' slot, to make faster code. */
-# define obstack_object_size(OBSTACK) \
- __extension__ \
- ({ struct obstack const *__o = (OBSTACK); \
- (unsigned) (__o->next_free - __o->object_base); })
-
-# define obstack_room(OBSTACK) \
- __extension__ \
- ({ struct obstack const *__o = (OBSTACK); \
- (unsigned) (__o->chunk_limit - __o->next_free); })
-
-# define obstack_make_room(OBSTACK,length) \
-__extension__ \
-({ struct obstack *__o = (OBSTACK); \
- int __len = (length); \
- if (__o->chunk_limit - __o->next_free < __len) \
- _obstack_newchunk (__o, __len); \
- (void) 0; })
-
-# define obstack_empty_p(OBSTACK) \
- __extension__ \
- ({ struct obstack const *__o = (OBSTACK); \
- (__o->chunk->prev == 0 \
- && __o->next_free == __PTR_ALIGN ((char *) __o->chunk, \
- __o->chunk->contents, \
- __o->alignment_mask)); })
-
-# define obstack_grow(OBSTACK,where,length) \
-__extension__ \
-({ struct obstack *__o = (OBSTACK); \
- int __len = (length); \
- if (__o->next_free + __len > __o->chunk_limit) \
- _obstack_newchunk (__o, __len); \
- memcpy (__o->next_free, where, __len); \
- __o->next_free += __len; \
- (void) 0; })
-
-# define obstack_grow0(OBSTACK,where,length) \
-__extension__ \
-({ struct obstack *__o = (OBSTACK); \
- int __len = (length); \
- if (__o->next_free + __len + 1 > __o->chunk_limit) \
- _obstack_newchunk (__o, __len + 1); \
- memcpy (__o->next_free, where, __len); \
- __o->next_free += __len; \
- *(__o->next_free)++ = 0; \
- (void) 0; })
-
-# define obstack_1grow(OBSTACK,datum) \
-__extension__ \
-({ struct obstack *__o = (OBSTACK); \
- if (__o->next_free + 1 > __o->chunk_limit) \
- _obstack_newchunk (__o, 1); \
- obstack_1grow_fast (__o, datum); \
- (void) 0; })
+# define obstack_object_size(OBSTACK) \
+ __extension__ \
+ ({ struct obstack const *__o = (OBSTACK); \
+ (unsigned) (__o->next_free - __o->object_base); })
+
+# define obstack_room(OBSTACK) \
+ __extension__ \
+ ({ struct obstack const *__o = (OBSTACK); \
+ (unsigned) (__o->chunk_limit - __o->next_free); })
+
+# define obstack_make_room(OBSTACK, length) \
+ __extension__ \
+ ({ struct obstack *__o = (OBSTACK); \
+ int __len = (length); \
+ if (__o->chunk_limit - __o->next_free < __len) \
+ _obstack_newchunk (__o, __len); \
+ (void) 0; })
+
+# define obstack_empty_p(OBSTACK) \
+ __extension__ \
+ ({ struct obstack const *__o = (OBSTACK); \
+ (__o->chunk->prev == 0 \
+ && __o->next_free == __PTR_ALIGN ((char *) __o->chunk, \
+ __o->chunk->contents, \
+ __o->alignment_mask)); })
+
+# define obstack_grow(OBSTACK, where, length) \
+ __extension__ \
+ ({ struct obstack *__o = (OBSTACK); \
+ int __len = (length); \
+ if (__o->next_free + __len > __o->chunk_limit) \
+ _obstack_newchunk (__o, __len); \
+ memcpy (__o->next_free, where, __len); \
+ __o->next_free += __len; \
+ (void) 0; })
+
+# define obstack_grow0(OBSTACK, where, length) \
+ __extension__ \
+ ({ struct obstack *__o = (OBSTACK); \
+ int __len = (length); \
+ if (__o->next_free + __len + 1 > __o->chunk_limit) \
+ _obstack_newchunk (__o, __len + 1); \
+ memcpy (__o->next_free, where, __len); \
+ __o->next_free += __len; \
+ *(__o->next_free)++ = 0; \
+ (void) 0; })
+
+# define obstack_1grow(OBSTACK, datum) \
+ __extension__ \
+ ({ struct obstack *__o = (OBSTACK); \
+ if (__o->next_free + 1 > __o->chunk_limit) \
+ _obstack_newchunk (__o, 1); \
+ obstack_1grow_fast (__o, datum); \
+ (void) 0; })
/* These assume that the obstack alignment is good enough for pointers
or ints, and that the data added so far to the current object
shares that much alignment. */
-# define obstack_ptr_grow(OBSTACK,datum) \
-__extension__ \
-({ struct obstack *__o = (OBSTACK); \
- if (__o->next_free + sizeof (void *) > __o->chunk_limit) \
- _obstack_newchunk (__o, sizeof (void *)); \
- obstack_ptr_grow_fast (__o, datum); }) \
-
-# define obstack_int_grow(OBSTACK,datum) \
-__extension__ \
-({ struct obstack *__o = (OBSTACK); \
- if (__o->next_free + sizeof (int) > __o->chunk_limit) \
- _obstack_newchunk (__o, sizeof (int)); \
- obstack_int_grow_fast (__o, datum); })
-
-# define obstack_ptr_grow_fast(OBSTACK,aptr) \
-__extension__ \
-({ struct obstack *__o1 = (OBSTACK); \
- *(const void **) __o1->next_free = (aptr); \
- __o1->next_free += sizeof (const void *); \
- (void) 0; })
-
-# define obstack_int_grow_fast(OBSTACK,aint) \
-__extension__ \
-({ struct obstack *__o1 = (OBSTACK); \
- *(int *) __o1->next_free = (aint); \
- __o1->next_free += sizeof (int); \
- (void) 0; })
-
-# define obstack_blank(OBSTACK,length) \
-__extension__ \
-({ struct obstack *__o = (OBSTACK); \
- int __len = (length); \
- if (__o->chunk_limit - __o->next_free < __len) \
- _obstack_newchunk (__o, __len); \
- obstack_blank_fast (__o, __len); \
- (void) 0; })
-
-# define obstack_alloc(OBSTACK,length) \
-__extension__ \
-({ struct obstack *__h = (OBSTACK); \
- obstack_blank (__h, (length)); \
- obstack_finish (__h); })
-
-# define obstack_copy(OBSTACK,where,length) \
-__extension__ \
-({ struct obstack *__h = (OBSTACK); \
- obstack_grow (__h, (where), (length)); \
- obstack_finish (__h); })
-
-# define obstack_copy0(OBSTACK,where,length) \
-__extension__ \
-({ struct obstack *__h = (OBSTACK); \
- obstack_grow0 (__h, (where), (length)); \
- obstack_finish (__h); })
+# define obstack_ptr_grow(OBSTACK, datum) \
+ __extension__ \
+ ({ struct obstack *__o = (OBSTACK); \
+ if (__o->next_free + sizeof (void *) > __o->chunk_limit) \
+ _obstack_newchunk (__o, sizeof (void *)); \
+ obstack_ptr_grow_fast (__o, datum); }) \
+
+# define obstack_int_grow(OBSTACK, datum) \
+ __extension__ \
+ ({ struct obstack *__o = (OBSTACK); \
+ if (__o->next_free + sizeof (int) > __o->chunk_limit) \
+ _obstack_newchunk (__o, sizeof (int)); \
+ obstack_int_grow_fast (__o, datum); })
+
+# define obstack_ptr_grow_fast(OBSTACK, aptr) \
+ __extension__ \
+ ({ struct obstack *__o1 = (OBSTACK); \
+ void *__p1 = __o1->next_free; \
+ *(const void **) __p1 = (aptr); \
+ __o1->next_free += sizeof (const void *); \
+ (void) 0; })
+
+# define obstack_int_grow_fast(OBSTACK, aint) \
+ __extension__ \
+ ({ struct obstack *__o1 = (OBSTACK); \
+ void *__p1 = __o1->next_free; \
+ *(int *) __p1 = (aint); \
+ __o1->next_free += sizeof (int); \
+ (void) 0; })
+
+# define obstack_blank(OBSTACK, length) \
+ __extension__ \
+ ({ struct obstack *__o = (OBSTACK); \
+ int __len = (length); \
+ if (__o->chunk_limit - __o->next_free < __len) \
+ _obstack_newchunk (__o, __len); \
+ obstack_blank_fast (__o, __len); \
+ (void) 0; })
+
+# define obstack_alloc(OBSTACK, length) \
+ __extension__ \
+ ({ struct obstack *__h = (OBSTACK); \
+ obstack_blank (__h, (length)); \
+ obstack_finish (__h); })
+
+# define obstack_copy(OBSTACK, where, length) \
+ __extension__ \
+ ({ struct obstack *__h = (OBSTACK); \
+ obstack_grow (__h, (where), (length)); \
+ obstack_finish (__h); })
+
+# define obstack_copy0(OBSTACK, where, length) \
+ __extension__ \
+ ({ struct obstack *__h = (OBSTACK); \
+ obstack_grow0 (__h, (where), (length)); \
+ obstack_finish (__h); })
/* The local variable is named __o1 to avoid a name conflict
when obstack_blank is called. */
-# define obstack_finish(OBSTACK) \
-__extension__ \
-({ struct obstack *__o1 = (OBSTACK); \
- void *__value = (void *) __o1->object_base; \
- if (__o1->next_free == __value) \
- __o1->maybe_empty_object = 1; \
- __o1->next_free \
- = __PTR_ALIGN (__o1->object_base, __o1->next_free, \
- __o1->alignment_mask); \
- if (__o1->next_free - (char *)__o1->chunk \
- > __o1->chunk_limit - (char *)__o1->chunk) \
- __o1->next_free = __o1->chunk_limit; \
- __o1->object_base = __o1->next_free; \
- __value; })
-
-# define obstack_free(OBSTACK, OBJ) \
-__extension__ \
-({ struct obstack *__o = (OBSTACK); \
- void *__obj = (OBJ); \
- if (__obj > (void *)__o->chunk && __obj < (void *)__o->chunk_limit) \
- __o->next_free = __o->object_base = (char *)__obj; \
- else (__obstack_free) (__o, __obj); })
-
+# define obstack_finish(OBSTACK) \
+ __extension__ \
+ ({ struct obstack *__o1 = (OBSTACK); \
+ void *__value = (void *) __o1->object_base; \
+ if (__o1->next_free == __value) \
+ __o1->maybe_empty_object = 1; \
+ __o1->next_free \
+ = __PTR_ALIGN (__o1->object_base, __o1->next_free, \
+ __o1->alignment_mask); \
+ if (__o1->next_free - (char *) __o1->chunk \
+ > __o1->chunk_limit - (char *) __o1->chunk) \
+ __o1->next_free = __o1->chunk_limit; \
+ __o1->object_base = __o1->next_free; \
+ __value; })
+
+# define obstack_free(OBSTACK, OBJ) \
+ __extension__ \
+ ({ struct obstack *__o = (OBSTACK); \
+ void *__obj = (OBJ); \
+ if (__obj > (void *) __o->chunk && __obj < (void *) __o->chunk_limit) \
+ __o->next_free = __o->object_base = (char *) __obj; \
+ else (__obstack_free) (__o, __obj); })
+
#else /* not __GNUC__ */
# define obstack_object_size(h) \
- (unsigned) ((h)->next_free - (h)->object_base)
+ (unsigned) ((h)->next_free - (h)->object_base)
-# define obstack_room(h) \
- (unsigned) ((h)->chunk_limit - (h)->next_free)
+# define obstack_room(h) \
+ (unsigned) ((h)->chunk_limit - (h)->next_free)
# define obstack_empty_p(h) \
- ((h)->chunk->prev == 0 \
- && (h)->next_free == __PTR_ALIGN ((char *) (h)->chunk, \
- (h)->chunk->contents, \
- (h)->alignment_mask))
+ ((h)->chunk->prev == 0 \
+ && (h)->next_free == __PTR_ALIGN ((char *) (h)->chunk, \
+ (h)->chunk->contents, \
+ (h)->alignment_mask))
/* Note that the call to _obstack_newchunk is enclosed in (..., 0)
so that we can avoid having void expressions
@@ -425,83 +428,83 @@ __extension__ \
Casting the third operand to void was tried before,
but some compilers won't accept it. */
-# define obstack_make_room(h,length) \
-( (h)->temp.tempint = (length), \
- (((h)->next_free + (h)->temp.tempint > (h)->chunk_limit) \
+# define obstack_make_room(h, length) \
+ ((h)->temp.tempint = (length), \
+ (((h)->next_free + (h)->temp.tempint > (h)->chunk_limit) \
? (_obstack_newchunk ((h), (h)->temp.tempint), 0) : 0))
-# define obstack_grow(h,where,length) \
-( (h)->temp.tempint = (length), \
- (((h)->next_free + (h)->temp.tempint > (h)->chunk_limit) \
- ? (_obstack_newchunk ((h), (h)->temp.tempint), 0) : 0), \
- memcpy ((h)->next_free, where, (h)->temp.tempint), \
- (h)->next_free += (h)->temp.tempint)
-
-# define obstack_grow0(h,where,length) \
-( (h)->temp.tempint = (length), \
- (((h)->next_free + (h)->temp.tempint + 1 > (h)->chunk_limit) \
- ? (_obstack_newchunk ((h), (h)->temp.tempint + 1), 0) : 0), \
- memcpy ((h)->next_free, where, (h)->temp.tempint), \
- (h)->next_free += (h)->temp.tempint, \
- *((h)->next_free)++ = 0)
-
-# define obstack_1grow(h,datum) \
-( (((h)->next_free + 1 > (h)->chunk_limit) \
- ? (_obstack_newchunk ((h), 1), 0) : 0), \
- obstack_1grow_fast (h, datum))
-
-# define obstack_ptr_grow(h,datum) \
-( (((h)->next_free + sizeof (char *) > (h)->chunk_limit) \
- ? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0), \
- obstack_ptr_grow_fast (h, datum))
-
-# define obstack_int_grow(h,datum) \
-( (((h)->next_free + sizeof (int) > (h)->chunk_limit) \
- ? (_obstack_newchunk ((h), sizeof (int)), 0) : 0), \
- obstack_int_grow_fast (h, datum))
-
-# define obstack_ptr_grow_fast(h,aptr) \
+# define obstack_grow(h, where, length) \
+ ((h)->temp.tempint = (length), \
+ (((h)->next_free + (h)->temp.tempint > (h)->chunk_limit) \
+ ? (_obstack_newchunk ((h), (h)->temp.tempint), 0) : 0), \
+ memcpy ((h)->next_free, where, (h)->temp.tempint), \
+ (h)->next_free += (h)->temp.tempint)
+
+# define obstack_grow0(h, where, length) \
+ ((h)->temp.tempint = (length), \
+ (((h)->next_free + (h)->temp.tempint + 1 > (h)->chunk_limit) \
+ ? (_obstack_newchunk ((h), (h)->temp.tempint + 1), 0) : 0), \
+ memcpy ((h)->next_free, where, (h)->temp.tempint), \
+ (h)->next_free += (h)->temp.tempint, \
+ *((h)->next_free)++ = 0)
+
+# define obstack_1grow(h, datum) \
+ ((((h)->next_free + 1 > (h)->chunk_limit) \
+ ? (_obstack_newchunk ((h), 1), 0) : 0), \
+ obstack_1grow_fast (h, datum))
+
+# define obstack_ptr_grow(h, datum) \
+ ((((h)->next_free + sizeof (char *) > (h)->chunk_limit) \
+ ? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0), \
+ obstack_ptr_grow_fast (h, datum))
+
+# define obstack_int_grow(h, datum) \
+ ((((h)->next_free + sizeof (int) > (h)->chunk_limit) \
+ ? (_obstack_newchunk ((h), sizeof (int)), 0) : 0), \
+ obstack_int_grow_fast (h, datum))
+
+# define obstack_ptr_grow_fast(h, aptr) \
(((const void **) ((h)->next_free += sizeof (void *)))[-1] = (aptr))
-# define obstack_int_grow_fast(h,aint) \
+# define obstack_int_grow_fast(h, aint) \
(((int *) ((h)->next_free += sizeof (int)))[-1] = (aint))
-# define obstack_blank(h,length) \
-( (h)->temp.tempint = (length), \
- (((h)->chunk_limit - (h)->next_free < (h)->temp.tempint) \
- ? (_obstack_newchunk ((h), (h)->temp.tempint), 0) : 0), \
- obstack_blank_fast (h, (h)->temp.tempint))
-
-# define obstack_alloc(h,length) \
- (obstack_blank ((h), (length)), obstack_finish ((h)))
-
-# define obstack_copy(h,where,length) \
- (obstack_grow ((h), (where), (length)), obstack_finish ((h)))
-
-# define obstack_copy0(h,where,length) \
- (obstack_grow0 ((h), (where), (length)), obstack_finish ((h)))
-
-# define obstack_finish(h) \
-( ((h)->next_free == (h)->object_base \
- ? (((h)->maybe_empty_object = 1), 0) \
- : 0), \
- (h)->temp.tempptr = (h)->object_base, \
- (h)->next_free \
- = __PTR_ALIGN ((h)->object_base, (h)->next_free, \
- (h)->alignment_mask), \
- (((h)->next_free - (char *) (h)->chunk \
- > (h)->chunk_limit - (char *) (h)->chunk) \
- ? ((h)->next_free = (h)->chunk_limit) : 0), \
- (h)->object_base = (h)->next_free, \
- (h)->temp.tempptr)
-
-# define obstack_free(h,obj) \
-( (h)->temp.tempint = (char *) (obj) - (char *) (h)->chunk, \
- ((((h)->temp.tempint > 0 \
- && (h)->temp.tempint < (h)->chunk_limit - (char *) (h)->chunk)) \
- ? (int) ((h)->next_free = (h)->object_base \
- = (h)->temp.tempint + (char *) (h)->chunk) \
- : (((__obstack_free) ((h), (h)->temp.tempint + (char *) (h)->chunk), 0), 0)))
+# define obstack_blank(h, length) \
+ ((h)->temp.tempint = (length), \
+ (((h)->chunk_limit - (h)->next_free < (h)->temp.tempint) \
+ ? (_obstack_newchunk ((h), (h)->temp.tempint), 0) : 0), \
+ obstack_blank_fast (h, (h)->temp.tempint))
+
+# define obstack_alloc(h, length) \
+ (obstack_blank ((h), (length)), obstack_finish ((h)))
+
+# define obstack_copy(h, where, length) \
+ (obstack_grow ((h), (where), (length)), obstack_finish ((h)))
+
+# define obstack_copy0(h, where, length) \
+ (obstack_grow0 ((h), (where), (length)), obstack_finish ((h)))
+
+# define obstack_finish(h) \
+ (((h)->next_free == (h)->object_base \
+ ? (((h)->maybe_empty_object = 1), 0) \
+ : 0), \
+ (h)->temp.tempptr = (h)->object_base, \
+ (h)->next_free \
+ = __PTR_ALIGN ((h)->object_base, (h)->next_free, \
+ (h)->alignment_mask), \
+ (((h)->next_free - (char *) (h)->chunk \
+ > (h)->chunk_limit - (char *) (h)->chunk) \
+ ? ((h)->next_free = (h)->chunk_limit) : 0), \
+ (h)->object_base = (h)->next_free, \
+ (h)->temp.tempptr)
+
+# define obstack_free(h, obj) \
+ ((h)->temp.tempint = (char *) (obj) - (char *) (h)->chunk, \
+ ((((h)->temp.tempint > 0 \
+ && (h)->temp.tempint < (h)->chunk_limit - (char *) (h)->chunk)) \
+ ? (void) ((h)->next_free = (h)->object_base \
+ = (h)->temp.tempint + (char *) (h)->chunk) \
+ : (__obstack_free) (h, (h)->temp.tempint + (char *) (h)->chunk)))
#endif /* not __GNUC__ */
diff --git a/lib/open-safer.c b/lib/open-safer.c
index badeffad..91d69230 100644
--- a/lib/open-safer.c
+++ b/lib/open-safer.c
@@ -1,6 +1,6 @@
/* Invoke open, but avoid some glitches.
- Copyright (C) 2005-2006, 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2008-2014 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
diff --git a/lib/open.c b/lib/open.c
index a0c43ead..d6f8e0df 100644
--- a/lib/open.c
+++ b/lib/open.c
@@ -1,5 +1,5 @@
/* Open a descriptor to a file.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007-2014 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
diff --git a/lib/openat-die.c b/lib/openat-die.c
index 4f18d51f..02f1fd7d 100644
--- a/lib/openat-die.c
+++ b/lib/openat-die.c
@@ -1,6 +1,6 @@
/* Report a save- or restore-cwd failure in our openat replacement and then exit.
- Copyright (C) 2005-2006, 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2008-2014 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
diff --git a/lib/openat-priv.h b/lib/openat-priv.h
index 829cf7d0..326c739e 100644
--- a/lib/openat-priv.h
+++ b/lib/openat-priv.h
@@ -1,6 +1,6 @@
/* Internals for openat-like functions.
- Copyright (C) 2005-2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2009-2014 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
diff --git a/lib/openat-proc.c b/lib/openat-proc.c
index d7a68e26..7b40bb8f 100644
--- a/lib/openat-proc.c
+++ b/lib/openat-proc.c
@@ -1,6 +1,6 @@
/* Create /proc/self/fd-related names for subfiles of open directories.
- Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2009-2014 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
@@ -32,14 +32,6 @@
#include "intprops.h"
-/* The results of open() in this file are not used with fchdir,
- and we do not leak fds to any single-threaded code that could use stdio,
- therefore save some unnecessary work in fchdir.c.
- FIXME - if the kernel ever adds support for multi-thread safety for
- avoiding standard fds, then we should use open_safer. */
-#undef open
-#undef close
-
#define PROC_SELF_FD_FORMAT "/proc/self/fd/%d/%s"
#define PROC_SELF_FD_NAME_SIZE_BOUND(len) \
diff --git a/lib/openat-safer.c b/lib/openat-safer.c
index a95600ed..d0dc2d70 100644
--- a/lib/openat-safer.c
+++ b/lib/openat-safer.c
@@ -1,6 +1,6 @@
/* Invoke openat, but avoid some glitches.
- Copyright (C) 2005-2006, 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2008-2014 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
diff --git a/lib/openat.c b/lib/openat.c
index fd1ff911..9d2f7d49 100644
--- a/lib/openat.c
+++ b/lib/openat.c
@@ -1,5 +1,5 @@
/* provide a replacement openat function
- Copyright (C) 2004-2013 Free Software Foundation, Inc.
+ Copyright (C) 2004-2014 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
diff --git a/lib/openat.h b/lib/openat.h
index eb90990d..29e23a54 100644
--- a/lib/openat.h
+++ b/lib/openat.h
@@ -1,5 +1,5 @@
/* provide a replacement openat function
- Copyright (C) 2004-2006, 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2004-2006, 2008-2014 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
@@ -26,6 +26,9 @@
#include <unistd.h>
#include <stdbool.h>
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
_GL_INLINE_HEADER_BEGIN
#if !HAVE_OPENAT
diff --git a/lib/opendir-safer.c b/lib/opendir-safer.c
index 0052ce1d..e31da884 100644
--- a/lib/opendir-safer.c
+++ b/lib/opendir-safer.c
@@ -1,6 +1,6 @@
/* Invoke opendir, but avoid some glitches.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 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
diff --git a/lib/opendir.c b/lib/opendir.c
index de0ea5a2..c67f2e5a 100644
--- a/lib/opendir.c
+++ b/lib/opendir.c
@@ -1,5 +1,5 @@
/* Start reading the entries of a directory.
- Copyright (C) 2006-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006-2014 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
diff --git a/lib/parse-datetime.c b/lib/parse-datetime.c
index 5c21d0ba..009b204b 100644
--- a/lib/parse-datetime.c
+++ b/lib/parse-datetime.c
@@ -1,9 +1,8 @@
-/* A Bison parser, made by GNU Bison 2.4.3. */
+/* A Bison parser, made by GNU Bison 2.7. */
-/* Skeleton implementation for Bison's Yacc-like parsers in C
+/* Bison implementation for Yacc-like parsers in C
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989-1990, 2000-2012 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
@@ -45,7 +44,7 @@
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "2.4.3"
+#define YYBISON_VERSION "2.7"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -59,19 +58,16 @@
/* Pull parsers. */
#define YYPULL 1
-/* Using locations. */
-#define YYLSP_NEEDED 0
/* Copy the first part of user declarations. */
-
-/* Line 189 of yacc.c */
-#line 1 "parse-datetime.y"
+/* Line 371 of yacc.c */
+#line 1 "./lib/parse-datetime.y"
/* Parse a string into an internal time stamp.
- Copyright (C) 1999-2000, 2002-2013 Free Software Foundation, Inc.
+ Copyright (C) 1999-2000, 2002-2014 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
@@ -353,14 +349,16 @@ set_hhmmss (parser_control *pc, long int hour, long int minutes,
}
+/* Line 371 of yacc.c */
+#line 354 "parse-datetime.c"
-/* Line 189 of yacc.c */
-#line 359 "parse-datetime.c"
-
-/* Enabling traces. */
-#ifndef YYDEBUG
-# define YYDEBUG 0
-#endif
+# ifndef YY_NULL
+# if defined __cplusplus && 201103L <= __cplusplus
+# define YY_NULL nullptr
+# else
+# define YY_NULL 0
+# endif
+# endif
/* Enabling verbose error messages. */
#ifdef YYERROR_VERBOSE
@@ -370,11 +368,14 @@ set_hhmmss (parser_control *pc, long int hour, long int minutes,
# define YYERROR_VERBOSE 0
#endif
-/* Enabling the token table. */
-#ifndef YYTOKEN_TABLE
-# define YYTOKEN_TABLE 0
-#endif
+/* Enabling traces. */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+#if YYDEBUG
+extern int yydebug;
+#endif
/* Tokens. */
#ifndef YYTOKENTYPE
@@ -428,13 +429,11 @@ set_hhmmss (parser_control *pc, long int hour, long int minutes,
-
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
{
-
-/* Line 214 of yacc.c */
-#line 297 "parse-datetime.y"
+/* Line 387 of yacc.c */
+#line 297 "./lib/parse-datetime.y"
long int intval;
textint textintval;
@@ -442,9 +441,8 @@ typedef union YYSTYPE
relative_time rel;
-
-/* Line 214 of yacc.c */
-#line 448 "parse-datetime.c"
+/* Line 387 of yacc.c */
+#line 446 "parse-datetime.c"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
@@ -452,11 +450,26 @@ typedef union YYSTYPE
#endif
-/* Copy the second part of user declarations. */
+#ifdef YYPARSE_PARAM
+#if defined __STDC__ || defined __cplusplus
+int yyparse (void *YYPARSE_PARAM);
+#else
+int yyparse ();
+#endif
+#else /* ! YYPARSE_PARAM */
+#if defined __STDC__ || defined __cplusplus
+int yyparse (parser_control *pc);
+#else
+int yyparse ();
+#endif
+#endif /* ! YYPARSE_PARAM */
+
+
+/* Copy the second part of user declarations. */
-/* Line 264 of yacc.c */
-#line 460 "parse-datetime.c"
+/* Line 390 of yacc.c */
+#line 473 "parse-datetime.c"
#ifdef short
# undef short
@@ -509,24 +522,24 @@ typedef short int yytype_int16;
# if defined YYENABLE_NLS && YYENABLE_NLS
# if ENABLE_NLS
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
-# define YY_(msgid) dgettext ("bison-runtime", msgid)
+# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
# endif
# endif
# ifndef YY_
-# define YY_(msgid) msgid
+# define YY_(Msgid) Msgid
# endif
#endif
/* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__
-# define YYUSE(e) ((void) (e))
+# define YYUSE(E) ((void) (E))
#else
-# define YYUSE(e) /* empty */
+# define YYUSE(E) /* empty */
#endif
/* Identity function, used to suppress warnings about constant conditions. */
#ifndef lint
-# define YYID(n) (n)
+# define YYID(N) (N)
#else
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
@@ -559,11 +572,12 @@ YYID (yyi)
# define alloca _alloca
# else
# define YYSTACK_ALLOC alloca
-# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-# ifndef _STDLIB_H
-# define _STDLIB_H 1
+ /* Use EXIT_SUCCESS as a witness for stdlib.h. */
+# ifndef EXIT_SUCCESS
+# define EXIT_SUCCESS 0
# endif
# endif
# endif
@@ -586,24 +600,24 @@ YYID (yyi)
# ifndef YYSTACK_ALLOC_MAXIMUM
# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
# endif
-# if (defined __cplusplus && ! defined _STDLIB_H \
+# if (defined __cplusplus && ! defined EXIT_SUCCESS \
&& ! ((defined YYMALLOC || defined malloc) \
&& (defined YYFREE || defined free)))
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-# ifndef _STDLIB_H
-# define _STDLIB_H 1
+# ifndef EXIT_SUCCESS
+# define EXIT_SUCCESS 0
# endif
# endif
# ifndef YYMALLOC
# define YYMALLOC malloc
-# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# ifndef YYFREE
# define YYFREE free
-# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
void free (void *); /* INFRINGES ON USER NAME SPACE */
# endif
@@ -632,23 +646,7 @@ union yyalloc
((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
+ YYSTACK_GAP_MAXIMUM)
-/* Copy COUNT objects from FROM to TO. The source and destination do
- not overlap. */
-# ifndef YYCOPY
-# if defined __GNUC__ && 1 < __GNUC__
-# define YYCOPY(To, From, Count) \
- __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
-# else
-# define YYCOPY(To, From, Count) \
- do \
- { \
- YYSIZE_T yyi; \
- for (yyi = 0; yyi < (Count); yyi++) \
- (To)[yyi] = (From)[yyi]; \
- } \
- while (YYID (0))
-# endif
-# endif
+# define YYCOPY_NEEDED 1
/* Relocate STACK from its old location to the new one. The
local variables YYSIZE and YYSTACKSIZE give the old and new number of
@@ -668,6 +666,26 @@ union yyalloc
#endif
+#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
+/* Copy COUNT objects from SRC to DST. The source and destination do
+ not overlap. */
+# ifndef YYCOPY
+# if defined __GNUC__ && 1 < __GNUC__
+# define YYCOPY(Dst, Src, Count) \
+ __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
+# else
+# define YYCOPY(Dst, Src, Count) \
+ do \
+ { \
+ YYSIZE_T yyi; \
+ for (yyi = 0; yyi < (Count); yyi++) \
+ (Dst)[yyi] = (Src)[yyi]; \
+ } \
+ while (YYID (0))
+# endif
+# endif
+#endif /* !YYCOPY_NEEDED */
+
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 12
/* YYLAST -- Last index in YYTABLE. */
@@ -786,7 +804,7 @@ static const yytype_uint16 yyrline[] =
};
#endif
-#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
+#if YYDEBUG || YYERROR_VERBOSE || 0
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
@@ -800,7 +818,7 @@ static const char *const yytname[] =
"iso_8601_time", "o_zone_offset", "zone_offset", "local_zone", "zone",
"day", "date", "iso_8601_date", "rel", "relunit", "relunit_snumber",
"dayshift", "seconds", "signed_seconds", "unsigned_seconds", "number",
- "hybrid", "o_colon_minutes", 0
+ "hybrid", "o_colon_minutes", YY_NULL
};
#endif
@@ -845,8 +863,8 @@ static const yytype_uint8 yyr2[] =
0, 2
};
-/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
- STATE-NUM when YYTABLE doesn't specify something else to do. Zero
+/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
+ Performed when YYTABLE doesn't specify something else to do. Zero
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
@@ -901,8 +919,7 @@ static const yytype_int8 yypgoto[] =
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule which
- number is the opposite. If zero, do what YYDEFACT says.
- If YYTABLE_NINF, syntax error. */
+ number is the opposite. If YYTABLE_NINF, syntax error. */
#define YYTABLE_NINF -1
static const yytype_uint8 yytable[] =
{
@@ -920,6 +937,12 @@ static const yytype_uint8 yytable[] =
101, 0, 88
};
+#define yypact_value_is_default(Yystate) \
+ (!!((Yystate) == (-93)))
+
+#define yytable_value_is_error(Yytable_value) \
+ YYID (0)
+
static const yytype_int8 yycheck[] =
{
27, 5, 6, 7, 8, 9, 10, 4, 12, 15,
@@ -981,72 +1004,35 @@ static const yytype_uint8 yystos[] =
#define YYRECOVERING() (!!yyerrstatus)
-#define YYBACKUP(Token, Value) \
-do \
- if (yychar == YYEMPTY && yylen == 1) \
- { \
- yychar = (Token); \
- yylval = (Value); \
- yytoken = YYTRANSLATE (yychar); \
- YYPOPSTACK (1); \
- goto yybackup; \
- } \
- else \
- { \
+#define YYBACKUP(Token, Value) \
+do \
+ if (yychar == YYEMPTY) \
+ { \
+ yychar = (Token); \
+ yylval = (Value); \
+ YYPOPSTACK (yylen); \
+ yystate = *yyssp; \
+ goto yybackup; \
+ } \
+ else \
+ { \
yyerror (pc, YY_("syntax error: cannot back up")); \
YYERROR; \
} \
while (YYID (0))
-
+/* Error token number */
#define YYTERROR 1
#define YYERRCODE 256
-/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
- If N is 0, then set CURRENT to the empty location which ends
- the previous symbol: RHS[0] (always defined). */
-
-#define YYRHSLOC(Rhs, K) ((Rhs)[K])
-#ifndef YYLLOC_DEFAULT
-# define YYLLOC_DEFAULT(Current, Rhs, N) \
- do \
- if (YYID (N)) \
- { \
- (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
- (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
- (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
- (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
- } \
- else \
- { \
- (Current).first_line = (Current).last_line = \
- YYRHSLOC (Rhs, 0).last_line; \
- (Current).first_column = (Current).last_column = \
- YYRHSLOC (Rhs, 0).last_column; \
- } \
- while (YYID (0))
-#endif
-
-
-/* YY_LOCATION_PRINT -- Print the location on the stream.
- This macro was not mandated originally: define only if we know
- we won't break user code: when these are the locations we know. */
-
+/* This macro is provided for backward compatibility. */
#ifndef YY_LOCATION_PRINT
-# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
-# define YY_LOCATION_PRINT(File, Loc) \
- fprintf (File, "%d.%d-%d.%d", \
- (Loc).first_line, (Loc).first_column, \
- (Loc).last_line, (Loc).last_column)
-# else
-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-# endif
+# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
#endif
/* YYLEX -- calling `yylex' with the right arguments. */
-
#ifdef YYLEX_PARAM
# define YYLEX yylex (&yylval, YYLEX_PARAM)
#else
@@ -1097,6 +1083,8 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, pc)
parser_control *pc;
#endif
{
+ FILE *yyo = yyoutput;
+ YYUSE (yyo);
if (!yyvaluep)
return;
YYUSE (pc);
@@ -1109,7 +1097,7 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, pc)
switch (yytype)
{
default:
- break;
+ break;
}
}
@@ -1237,7 +1225,6 @@ int yydebug;
# define YYMAXDEPTH 10000
#endif
-
#if YYERROR_VERBOSE
@@ -1340,115 +1327,145 @@ yytnamerr (char *yyres, const char *yystr)
}
# endif
-/* Copy into YYRESULT an error message about the unexpected token
- YYCHAR while in state YYSTATE. Return the number of bytes copied,
- including the terminating null byte. If YYRESULT is null, do not
- copy anything; just return the number of bytes that would be
- copied. As a special case, return 0 if an ordinary "syntax error"
- message will do. Return YYSIZE_MAXIMUM if overflow occurs during
- size calculation. */
-static YYSIZE_T
-yysyntax_error (char *yyresult, int yystate, int yychar)
-{
- int yyn = yypact[yystate];
+/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
+ about the unexpected token YYTOKEN for the state stack whose top is
+ YYSSP.
- if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
- return 0;
- else
+ Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
+ not large enough to hold the message. In that case, also set
+ *YYMSG_ALLOC to the required number of bytes. Return 2 if the
+ required number of bytes is too large to store. */
+static int
+yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
+ yytype_int16 *yyssp, int yytoken)
+{
+ YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
+ YYSIZE_T yysize = yysize0;
+ enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
+ /* Internationalized format string. */
+ const char *yyformat = YY_NULL;
+ /* Arguments of yyformat. */
+ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
+ /* Number of reported tokens (one for the "unexpected", one per
+ "expected"). */
+ int yycount = 0;
+
+ /* There are many possibilities here to consider:
+ - Assume YYFAIL is not used. It's too flawed to consider. See
+ <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
+ for details. YYERROR is fine as it does not invoke this
+ function.
+ - If this state is a consistent state with a default action, then
+ the only way this function was invoked is if the default action
+ is an error action. In that case, don't check for expected
+ tokens because there are none.
+ - The only way there can be no lookahead present (in yychar) is if
+ this state is a consistent state with a default action. Thus,
+ detecting the absence of a lookahead is sufficient to determine
+ that there is no unexpected or expected token to report. In that
+ case, just report a simple "syntax error".
+ - Don't assume there isn't a lookahead just because this state is a
+ consistent state with a default action. There might have been a
+ previous inconsistent state, consistent state with a non-default
+ action, or user semantic action that manipulated yychar.
+ - Of course, the expected token list depends on states to have
+ correct lookahead information, and it depends on the parser not
+ to perform extra reductions after fetching a lookahead from the
+ scanner and before detecting a syntax error. Thus, state merging
+ (from LALR or IELR) and default reductions corrupt the expected
+ token list. However, the list is correct for canonical LR with
+ one exception: it will still contain any token that will not be
+ accepted due to an error action in a later state.
+ */
+ if (yytoken != YYEMPTY)
{
- int yytype = YYTRANSLATE (yychar);
- YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
- YYSIZE_T yysize = yysize0;
- YYSIZE_T yysize1;
- int yysize_overflow = 0;
- enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
- char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
- int yyx;
-
-# if 0
- /* This is so xgettext sees the translatable formats that are
- constructed on the fly. */
- YY_("syntax error, unexpected %s");
- YY_("syntax error, unexpected %s, expecting %s");
- YY_("syntax error, unexpected %s, expecting %s or %s");
- YY_("syntax error, unexpected %s, expecting %s or %s or %s");
- YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
-# endif
- char *yyfmt;
- char const *yyf;
- static char const yyunexpected[] = "syntax error, unexpected %s";
- static char const yyexpecting[] = ", expecting %s";
- static char const yyor[] = " or %s";
- char yyformat[sizeof yyunexpected
- + sizeof yyexpecting - 1
- + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
- * (sizeof yyor - 1))];
- char const *yyprefix = yyexpecting;
-
- /* Start YYX at -YYN if negative to avoid negative indexes in
- YYCHECK. */
- int yyxbegin = yyn < 0 ? -yyn : 0;
-
- /* Stay within bounds of both yycheck and yytname. */
- int yychecklim = YYLAST - yyn + 1;
- int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
- int yycount = 1;
-
- yyarg[0] = yytname[yytype];
- yyfmt = yystpcpy (yyformat, yyunexpected);
-
- for (yyx = yyxbegin; yyx < yyxend; ++yyx)
- if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
- {
- if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
- {
- yycount = 1;
- yysize = yysize0;
- yyformat[sizeof yyunexpected - 1] = '\0';
- break;
- }
- yyarg[yycount++] = yytname[yyx];
- yysize1 = yysize + yytnamerr (0, yytname[yyx]);
- yysize_overflow |= (yysize1 < yysize);
- yysize = yysize1;
- yyfmt = yystpcpy (yyfmt, yyprefix);
- yyprefix = yyor;
- }
+ int yyn = yypact[*yyssp];
+ yyarg[yycount++] = yytname[yytoken];
+ if (!yypact_value_is_default (yyn))
+ {
+ /* Start YYX at -YYN if negative to avoid negative indexes in
+ YYCHECK. In other words, skip the first -YYN actions for
+ this state because they are default actions. */
+ int yyxbegin = yyn < 0 ? -yyn : 0;
+ /* Stay within bounds of both yycheck and yytname. */
+ int yychecklim = YYLAST - yyn + 1;
+ int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+ int yyx;
+
+ for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+ if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
+ && !yytable_value_is_error (yytable[yyx + yyn]))
+ {
+ if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
+ {
+ yycount = 1;
+ yysize = yysize0;
+ break;
+ }
+ yyarg[yycount++] = yytname[yyx];
+ {
+ YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
+ if (! (yysize <= yysize1
+ && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
+ }
+ }
+ }
+ }
- yyf = YY_(yyformat);
- yysize1 = yysize + yystrlen (yyf);
- yysize_overflow |= (yysize1 < yysize);
- yysize = yysize1;
+ switch (yycount)
+ {
+# define YYCASE_(N, S) \
+ case N: \
+ yyformat = S; \
+ break
+ YYCASE_(0, YY_("syntax error"));
+ YYCASE_(1, YY_("syntax error, unexpected %s"));
+ YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
+ YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
+ YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
+ YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
+# undef YYCASE_
+ }
- if (yysize_overflow)
- return YYSIZE_MAXIMUM;
+ {
+ YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
+ if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
+ }
- if (yyresult)
- {
- /* Avoid sprintf, as that infringes on the user's name space.
- Don't have undefined behavior even if the translation
- produced a string with the wrong number of "%s"s. */
- char *yyp = yyresult;
- int yyi = 0;
- while ((*yyp = *yyf) != '\0')
- {
- if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
- {
- yyp += yytnamerr (yyp, yyarg[yyi++]);
- yyf += 2;
- }
- else
- {
- yyp++;
- yyf++;
- }
- }
- }
- return yysize;
+ if (*yymsg_alloc < yysize)
+ {
+ *yymsg_alloc = 2 * yysize;
+ if (! (yysize <= *yymsg_alloc
+ && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
+ *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
+ return 1;
}
+
+ /* Avoid sprintf, as that infringes on the user's name space.
+ Don't have undefined behavior even if the translation
+ produced a string with the wrong number of "%s"s. */
+ {
+ char *yyp = *yymsg;
+ int yyi = 0;
+ while ((*yyp = *yyformat) != '\0')
+ if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
+ {
+ yyp += yytnamerr (yyp, yyarg[yyi++]);
+ yyformat += 2;
+ }
+ else
+ {
+ yyp++;
+ yyformat++;
+ }
+ }
+ return 0;
}
#endif /* YYERROR_VERBOSE */
-
/*-----------------------------------------------.
| Release the memory associated to this symbol. |
@@ -1479,32 +1496,16 @@ yydestruct (yymsg, yytype, yyvaluep, pc)
{
default:
- break;
+ break;
}
}
-/* Prevent warnings from -Wmissing-prototypes. */
-#ifdef YYPARSE_PARAM
-#if defined __STDC__ || defined __cplusplus
-int yyparse (void *YYPARSE_PARAM);
-#else
-int yyparse ();
-#endif
-#else /* ! YYPARSE_PARAM */
-#if defined __STDC__ || defined __cplusplus
-int yyparse (parser_control *pc);
-#else
-int yyparse ();
-#endif
-#endif /* ! YYPARSE_PARAM */
-
-
-/*-------------------------.
-| yyparse or yypush_parse. |
-`-------------------------*/
+/*----------.
+| yyparse. |
+`----------*/
#ifdef YYPARSE_PARAM
#if (defined __STDC__ || defined __C99__FUNC__ \
@@ -1531,8 +1532,31 @@ yyparse (pc)
/* The lookahead symbol. */
int yychar;
+
+#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
+/* Suppress an incorrect diagnostic about yylval being uninitialized. */
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
+ _Pragma ("GCC diagnostic push") \
+ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
+ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
+ _Pragma ("GCC diagnostic pop")
+#else
+/* Default value used for initialization, for pacifying older GCCs
+ or non-GCC compilers. */
+static YYSTYPE yyval_default;
+# define YY_INITIAL_VALUE(Value) = Value
+#endif
+#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END
+#endif
+#ifndef YY_INITIAL_VALUE
+# define YY_INITIAL_VALUE(Value) /* Nothing. */
+#endif
+
/* The semantic value of the lookahead symbol. */
-YYSTYPE yylval;
+YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
/* Number of syntax errors so far. */
int yynerrs;
@@ -1545,7 +1569,7 @@ YYSTYPE yylval;
`yyss': related to states.
`yyvs': related to semantic values.
- Refer to the stacks thru separate pointers, to allow yyoverflow
+ Refer to the stacks through separate pointers, to allow yyoverflow
to reallocate them elsewhere. */
/* The state stack. */
@@ -1563,7 +1587,7 @@ YYSTYPE yylval;
int yyn;
int yyresult;
/* Lookahead token as an internal (translated) token number. */
- int yytoken;
+ int yytoken = 0;
/* The variables used to return semantic value and location from the
action routines. */
YYSTYPE yyval;
@@ -1581,9 +1605,8 @@ YYSTYPE yylval;
Keep to zero when no symbol should be popped. */
int yylen = 0;
- yytoken = 0;
- yyss = yyssa;
- yyvs = yyvsa;
+ yyssp = yyss = yyssa;
+ yyvsp = yyvs = yyvsa;
yystacksize = YYINITDEPTH;
YYDPRINTF ((stderr, "Starting parse\n"));
@@ -1592,14 +1615,6 @@ YYSTYPE yylval;
yyerrstatus = 0;
yynerrs = 0;
yychar = YYEMPTY; /* Cause a token to be read. */
-
- /* Initialize stack pointers.
- Waste one element of value and location stack
- so that they stay on the same level as the state stack.
- The wasted elements are never initialized. */
- yyssp = yyss;
- yyvsp = yyvs;
-
goto yysetstate;
/*------------------------------------------------------------.
@@ -1691,7 +1706,7 @@ yybackup:
/* First try to decide what to do without reference to lookahead token. */
yyn = yypact[yystate];
- if (yyn == YYPACT_NINF)
+ if (yypact_value_is_default (yyn))
goto yydefault;
/* Not known => get a lookahead token if don't already have one. */
@@ -1722,8 +1737,8 @@ yybackup:
yyn = yytable[yyn];
if (yyn <= 0)
{
- if (yyn == 0 || yyn == YYTABLE_NINF)
- goto yyerrlab;
+ if (yytable_value_is_error (yyn))
+ goto yyerrlab;
yyn = -yyn;
goto yyreduce;
}
@@ -1740,7 +1755,9 @@ yybackup:
yychar = YYEMPTY;
yystate = yyn;
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
*++yyvsp = yylval;
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
goto yynewstate;
@@ -1777,9 +1794,8 @@ yyreduce:
switch (yyn)
{
case 4:
-
-/* Line 1464 of yacc.c */
-#line 330 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 330 "./lib/parse-datetime.y"
{
pc->seconds = (yyvsp[(2) - (2)].timespec);
pc->timespec_seen = true;
@@ -1787,51 +1803,44 @@ yyreduce:
break;
case 7:
-
-/* Line 1464 of yacc.c */
-#line 343 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 343 "./lib/parse-datetime.y"
{ pc->times_seen++; pc->dates_seen++; }
break;
case 8:
-
-/* Line 1464 of yacc.c */
-#line 345 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 345 "./lib/parse-datetime.y"
{ pc->times_seen++; }
break;
case 9:
-
-/* Line 1464 of yacc.c */
-#line 347 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 347 "./lib/parse-datetime.y"
{ pc->local_zones_seen++; }
break;
case 10:
-
-/* Line 1464 of yacc.c */
-#line 349 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 349 "./lib/parse-datetime.y"
{ pc->zones_seen++; }
break;
case 11:
-
-/* Line 1464 of yacc.c */
-#line 351 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 351 "./lib/parse-datetime.y"
{ pc->dates_seen++; }
break;
case 12:
-
-/* Line 1464 of yacc.c */
-#line 353 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 353 "./lib/parse-datetime.y"
{ pc->days_seen++; }
break;
case 18:
-
-/* Line 1464 of yacc.c */
-#line 369 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 369 "./lib/parse-datetime.y"
{
set_hhmmss (pc, (yyvsp[(1) - (2)].textintval).value, 0, 0, 0);
pc->meridian = (yyvsp[(2) - (2)].intval);
@@ -1839,9 +1848,8 @@ yyreduce:
break;
case 19:
-
-/* Line 1464 of yacc.c */
-#line 374 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 374 "./lib/parse-datetime.y"
{
set_hhmmss (pc, (yyvsp[(1) - (4)].textintval).value, (yyvsp[(3) - (4)].textintval).value, 0, 0);
pc->meridian = (yyvsp[(4) - (4)].intval);
@@ -1849,9 +1857,8 @@ yyreduce:
break;
case 20:
-
-/* Line 1464 of yacc.c */
-#line 379 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 379 "./lib/parse-datetime.y"
{
set_hhmmss (pc, (yyvsp[(1) - (6)].textintval).value, (yyvsp[(3) - (6)].textintval).value, (yyvsp[(5) - (6)].timespec).tv_sec, (yyvsp[(5) - (6)].timespec).tv_nsec);
pc->meridian = (yyvsp[(6) - (6)].intval);
@@ -1859,9 +1866,8 @@ yyreduce:
break;
case 22:
-
-/* Line 1464 of yacc.c */
-#line 388 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 388 "./lib/parse-datetime.y"
{
set_hhmmss (pc, (yyvsp[(1) - (2)].textintval).value, 0, 0, 0);
pc->meridian = MER24;
@@ -1869,9 +1875,8 @@ yyreduce:
break;
case 23:
-
-/* Line 1464 of yacc.c */
-#line 393 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 393 "./lib/parse-datetime.y"
{
set_hhmmss (pc, (yyvsp[(1) - (4)].textintval).value, (yyvsp[(3) - (4)].textintval).value, 0, 0);
pc->meridian = MER24;
@@ -1879,9 +1884,8 @@ yyreduce:
break;
case 24:
-
-/* Line 1464 of yacc.c */
-#line 398 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 398 "./lib/parse-datetime.y"
{
set_hhmmss (pc, (yyvsp[(1) - (6)].textintval).value, (yyvsp[(3) - (6)].textintval).value, (yyvsp[(5) - (6)].timespec).tv_sec, (yyvsp[(5) - (6)].timespec).tv_nsec);
pc->meridian = MER24;
@@ -1889,9 +1893,8 @@ yyreduce:
break;
case 27:
-
-/* Line 1464 of yacc.c */
-#line 411 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 411 "./lib/parse-datetime.y"
{
pc->zones_seen++;
pc->time_zone = time_zone_hhmm (pc, (yyvsp[(1) - (2)].textintval), (yyvsp[(2) - (2)].intval));
@@ -1899,9 +1902,8 @@ yyreduce:
break;
case 28:
-
-/* Line 1464 of yacc.c */
-#line 419 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 419 "./lib/parse-datetime.y"
{
pc->local_isdst = (yyvsp[(1) - (1)].intval);
pc->dsts_seen += (0 < (yyvsp[(1) - (1)].intval));
@@ -1909,9 +1911,8 @@ yyreduce:
break;
case 29:
-
-/* Line 1464 of yacc.c */
-#line 424 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 424 "./lib/parse-datetime.y"
{
pc->local_isdst = 1;
pc->dsts_seen += (0 < (yyvsp[(1) - (2)].intval)) + 1;
@@ -1919,60 +1920,52 @@ yyreduce:
break;
case 30:
-
-/* Line 1464 of yacc.c */
-#line 434 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 434 "./lib/parse-datetime.y"
{ pc->time_zone = (yyvsp[(1) - (1)].intval); }
break;
case 31:
-
-/* Line 1464 of yacc.c */
-#line 436 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 436 "./lib/parse-datetime.y"
{ pc->time_zone = HOUR(7); }
break;
case 32:
-
-/* Line 1464 of yacc.c */
-#line 438 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 438 "./lib/parse-datetime.y"
{ pc->time_zone = (yyvsp[(1) - (2)].intval);
apply_relative_time (pc, (yyvsp[(2) - (2)].rel), 1); }
break;
case 33:
-
-/* Line 1464 of yacc.c */
-#line 441 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 441 "./lib/parse-datetime.y"
{ pc->time_zone = HOUR(7);
apply_relative_time (pc, (yyvsp[(2) - (2)].rel), 1); }
break;
case 34:
-
-/* Line 1464 of yacc.c */
-#line 444 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 444 "./lib/parse-datetime.y"
{ pc->time_zone = (yyvsp[(1) - (3)].intval) + time_zone_hhmm (pc, (yyvsp[(2) - (3)].textintval), (yyvsp[(3) - (3)].intval)); }
break;
case 35:
-
-/* Line 1464 of yacc.c */
-#line 446 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 446 "./lib/parse-datetime.y"
{ pc->time_zone = (yyvsp[(1) - (1)].intval) + 60; }
break;
case 36:
-
-/* Line 1464 of yacc.c */
-#line 448 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 448 "./lib/parse-datetime.y"
{ pc->time_zone = (yyvsp[(1) - (2)].intval) + 60; }
break;
case 37:
-
-/* Line 1464 of yacc.c */
-#line 453 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 453 "./lib/parse-datetime.y"
{
pc->day_ordinal = 0;
pc->day_number = (yyvsp[(1) - (1)].intval);
@@ -1980,9 +1973,8 @@ yyreduce:
break;
case 38:
-
-/* Line 1464 of yacc.c */
-#line 458 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 458 "./lib/parse-datetime.y"
{
pc->day_ordinal = 0;
pc->day_number = (yyvsp[(1) - (2)].intval);
@@ -1990,9 +1982,8 @@ yyreduce:
break;
case 39:
-
-/* Line 1464 of yacc.c */
-#line 463 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 463 "./lib/parse-datetime.y"
{
pc->day_ordinal = (yyvsp[(1) - (2)].intval);
pc->day_number = (yyvsp[(2) - (2)].intval);
@@ -2000,9 +1991,8 @@ yyreduce:
break;
case 40:
-
-/* Line 1464 of yacc.c */
-#line 468 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 468 "./lib/parse-datetime.y"
{
pc->day_ordinal = (yyvsp[(1) - (2)].textintval).value;
pc->day_number = (yyvsp[(2) - (2)].intval);
@@ -2010,9 +2000,8 @@ yyreduce:
break;
case 41:
-
-/* Line 1464 of yacc.c */
-#line 476 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 476 "./lib/parse-datetime.y"
{
pc->month = (yyvsp[(1) - (3)].textintval).value;
pc->day = (yyvsp[(3) - (3)].textintval).value;
@@ -2020,9 +2009,8 @@ yyreduce:
break;
case 42:
-
-/* Line 1464 of yacc.c */
-#line 481 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 481 "./lib/parse-datetime.y"
{
/* Interpret as YYYY/MM/DD if the first value has 4 or more digits,
otherwise as MM/DD/YY.
@@ -2045,9 +2033,8 @@ yyreduce:
break;
case 43:
-
-/* Line 1464 of yacc.c */
-#line 501 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 501 "./lib/parse-datetime.y"
{
/* e.g. 17-JUN-1992. */
pc->day = (yyvsp[(1) - (3)].textintval).value;
@@ -2058,9 +2045,8 @@ yyreduce:
break;
case 44:
-
-/* Line 1464 of yacc.c */
-#line 509 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 509 "./lib/parse-datetime.y"
{
/* e.g. JUN-17-1992. */
pc->month = (yyvsp[(1) - (3)].intval);
@@ -2071,9 +2057,8 @@ yyreduce:
break;
case 45:
-
-/* Line 1464 of yacc.c */
-#line 517 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 517 "./lib/parse-datetime.y"
{
pc->month = (yyvsp[(1) - (2)].intval);
pc->day = (yyvsp[(2) - (2)].textintval).value;
@@ -2081,9 +2066,8 @@ yyreduce:
break;
case 46:
-
-/* Line 1464 of yacc.c */
-#line 522 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 522 "./lib/parse-datetime.y"
{
pc->month = (yyvsp[(1) - (4)].intval);
pc->day = (yyvsp[(2) - (4)].textintval).value;
@@ -2092,9 +2076,8 @@ yyreduce:
break;
case 47:
-
-/* Line 1464 of yacc.c */
-#line 528 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 528 "./lib/parse-datetime.y"
{
pc->day = (yyvsp[(1) - (2)].textintval).value;
pc->month = (yyvsp[(2) - (2)].intval);
@@ -2102,9 +2085,8 @@ yyreduce:
break;
case 48:
-
-/* Line 1464 of yacc.c */
-#line 533 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 533 "./lib/parse-datetime.y"
{
pc->day = (yyvsp[(1) - (3)].textintval).value;
pc->month = (yyvsp[(2) - (3)].intval);
@@ -2113,9 +2095,8 @@ yyreduce:
break;
case 50:
-
-/* Line 1464 of yacc.c */
-#line 543 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 543 "./lib/parse-datetime.y"
{
/* ISO 8601 format. YYYY-MM-DD. */
pc->year = (yyvsp[(1) - (3)].textintval);
@@ -2125,240 +2106,206 @@ yyreduce:
break;
case 51:
-
-/* Line 1464 of yacc.c */
-#line 553 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 553 "./lib/parse-datetime.y"
{ apply_relative_time (pc, (yyvsp[(1) - (2)].rel), (yyvsp[(2) - (2)].intval)); }
break;
case 52:
-
-/* Line 1464 of yacc.c */
-#line 555 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 555 "./lib/parse-datetime.y"
{ apply_relative_time (pc, (yyvsp[(1) - (1)].rel), 1); }
break;
case 53:
-
-/* Line 1464 of yacc.c */
-#line 557 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 557 "./lib/parse-datetime.y"
{ apply_relative_time (pc, (yyvsp[(1) - (1)].rel), 1); }
break;
case 54:
-
-/* Line 1464 of yacc.c */
-#line 562 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 562 "./lib/parse-datetime.y"
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = (yyvsp[(1) - (2)].intval); }
break;
case 55:
-
-/* Line 1464 of yacc.c */
-#line 564 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 564 "./lib/parse-datetime.y"
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = (yyvsp[(1) - (2)].textintval).value; }
break;
case 56:
-
-/* Line 1464 of yacc.c */
-#line 566 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 566 "./lib/parse-datetime.y"
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = 1; }
break;
case 57:
-
-/* Line 1464 of yacc.c */
-#line 568 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 568 "./lib/parse-datetime.y"
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = (yyvsp[(1) - (2)].intval); }
break;
case 58:
-
-/* Line 1464 of yacc.c */
-#line 570 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 570 "./lib/parse-datetime.y"
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = (yyvsp[(1) - (2)].textintval).value; }
break;
case 59:
-
-/* Line 1464 of yacc.c */
-#line 572 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 572 "./lib/parse-datetime.y"
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = 1; }
break;
case 60:
-
-/* Line 1464 of yacc.c */
-#line 574 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 574 "./lib/parse-datetime.y"
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[(1) - (2)].intval) * (yyvsp[(2) - (2)].intval); }
break;
case 61:
-
-/* Line 1464 of yacc.c */
-#line 576 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 576 "./lib/parse-datetime.y"
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[(1) - (2)].textintval).value * (yyvsp[(2) - (2)].intval); }
break;
case 62:
-
-/* Line 1464 of yacc.c */
-#line 578 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 578 "./lib/parse-datetime.y"
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[(1) - (1)].intval); }
break;
case 63:
-
-/* Line 1464 of yacc.c */
-#line 580 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 580 "./lib/parse-datetime.y"
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = (yyvsp[(1) - (2)].intval); }
break;
case 64:
-
-/* Line 1464 of yacc.c */
-#line 582 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 582 "./lib/parse-datetime.y"
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = (yyvsp[(1) - (2)].textintval).value; }
break;
case 65:
-
-/* Line 1464 of yacc.c */
-#line 584 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 584 "./lib/parse-datetime.y"
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = 1; }
break;
case 66:
-
-/* Line 1464 of yacc.c */
-#line 586 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 586 "./lib/parse-datetime.y"
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = (yyvsp[(1) - (2)].intval); }
break;
case 67:
-
-/* Line 1464 of yacc.c */
-#line 588 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 588 "./lib/parse-datetime.y"
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = (yyvsp[(1) - (2)].textintval).value; }
break;
case 68:
-
-/* Line 1464 of yacc.c */
-#line 590 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 590 "./lib/parse-datetime.y"
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = 1; }
break;
case 69:
-
-/* Line 1464 of yacc.c */
-#line 592 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 592 "./lib/parse-datetime.y"
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[(1) - (2)].intval); }
break;
case 70:
-
-/* Line 1464 of yacc.c */
-#line 594 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 594 "./lib/parse-datetime.y"
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[(1) - (2)].textintval).value; }
break;
case 71:
-
-/* Line 1464 of yacc.c */
-#line 596 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 596 "./lib/parse-datetime.y"
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[(1) - (2)].timespec).tv_sec; (yyval.rel).ns = (yyvsp[(1) - (2)].timespec).tv_nsec; }
break;
case 72:
-
-/* Line 1464 of yacc.c */
-#line 598 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 598 "./lib/parse-datetime.y"
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[(1) - (2)].timespec).tv_sec; (yyval.rel).ns = (yyvsp[(1) - (2)].timespec).tv_nsec; }
break;
case 73:
-
-/* Line 1464 of yacc.c */
-#line 600 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 600 "./lib/parse-datetime.y"
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = 1; }
break;
case 75:
-
-/* Line 1464 of yacc.c */
-#line 606 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 606 "./lib/parse-datetime.y"
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).year = (yyvsp[(1) - (2)].textintval).value; }
break;
case 76:
-
-/* Line 1464 of yacc.c */
-#line 608 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 608 "./lib/parse-datetime.y"
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).month = (yyvsp[(1) - (2)].textintval).value; }
break;
case 77:
-
-/* Line 1464 of yacc.c */
-#line 610 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 610 "./lib/parse-datetime.y"
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[(1) - (2)].textintval).value * (yyvsp[(2) - (2)].intval); }
break;
case 78:
-
-/* Line 1464 of yacc.c */
-#line 612 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 612 "./lib/parse-datetime.y"
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).hour = (yyvsp[(1) - (2)].textintval).value; }
break;
case 79:
-
-/* Line 1464 of yacc.c */
-#line 614 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 614 "./lib/parse-datetime.y"
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).minutes = (yyvsp[(1) - (2)].textintval).value; }
break;
case 80:
-
-/* Line 1464 of yacc.c */
-#line 616 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 616 "./lib/parse-datetime.y"
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).seconds = (yyvsp[(1) - (2)].textintval).value; }
break;
case 81:
-
-/* Line 1464 of yacc.c */
-#line 621 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 621 "./lib/parse-datetime.y"
{ (yyval.rel) = RELATIVE_TIME_0; (yyval.rel).day = (yyvsp[(1) - (1)].intval); }
break;
case 85:
-
-/* Line 1464 of yacc.c */
-#line 629 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 629 "./lib/parse-datetime.y"
{ (yyval.timespec).tv_sec = (yyvsp[(1) - (1)].textintval).value; (yyval.timespec).tv_nsec = 0; }
break;
case 87:
-
-/* Line 1464 of yacc.c */
-#line 635 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 635 "./lib/parse-datetime.y"
{ (yyval.timespec).tv_sec = (yyvsp[(1) - (1)].textintval).value; (yyval.timespec).tv_nsec = 0; }
break;
case 88:
-
-/* Line 1464 of yacc.c */
-#line 640 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 640 "./lib/parse-datetime.y"
{ digits_to_date_time (pc, (yyvsp[(1) - (1)].textintval)); }
break;
case 89:
-
-/* Line 1464 of yacc.c */
-#line 645 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 645 "./lib/parse-datetime.y"
{
/* Hybrid all-digit and relative offset, so that we accept e.g.,
"YYYYMMDD +N days" as well as "YYYYMMDD N days". */
@@ -2368,25 +2315,33 @@ yyreduce:
break;
case 90:
-
-/* Line 1464 of yacc.c */
-#line 655 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 655 "./lib/parse-datetime.y"
{ (yyval.intval) = -1; }
break;
case 91:
-
-/* Line 1464 of yacc.c */
-#line 657 "parse-datetime.y"
+/* Line 1792 of yacc.c */
+#line 657 "./lib/parse-datetime.y"
{ (yyval.intval) = (yyvsp[(2) - (2)].textintval).value; }
break;
-
-/* Line 1464 of yacc.c */
-#line 2388 "parse-datetime.c"
+/* Line 1792 of yacc.c */
+#line 2332 "parse-datetime.c"
default: break;
}
+ /* User semantic actions sometimes alter yychar, and that requires
+ that yytoken be updated with the new translation. We take the
+ approach of translating immediately before every use of yytoken.
+ One alternative is translating here after every semantic action,
+ but that translation would be missed if the semantic action invokes
+ YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
+ if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
+ incorrect destructor might then be invoked immediately. In the
+ case of YYERROR or YYBACKUP, subsequent parser actions might lead
+ to an incorrect destructor call or verbose syntax error message
+ before the lookahead is translated. */
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
YYPOPSTACK (yylen);
@@ -2414,6 +2369,10 @@ yyreduce:
| yyerrlab -- here on detecting error |
`------------------------------------*/
yyerrlab:
+ /* Make sure we have latest lookahead translation. See comments at
+ user semantic actions for why this is necessary. */
+ yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
+
/* If not already recovering from an error, report this error. */
if (!yyerrstatus)
{
@@ -2421,37 +2380,36 @@ yyerrlab:
#if ! YYERROR_VERBOSE
yyerror (pc, YY_("syntax error"));
#else
+# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
+ yyssp, yytoken)
{
- YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
- if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
- {
- YYSIZE_T yyalloc = 2 * yysize;
- if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
- yyalloc = YYSTACK_ALLOC_MAXIMUM;
- if (yymsg != yymsgbuf)
- YYSTACK_FREE (yymsg);
- yymsg = (char *) YYSTACK_ALLOC (yyalloc);
- if (yymsg)
- yymsg_alloc = yyalloc;
- else
- {
- yymsg = yymsgbuf;
- yymsg_alloc = sizeof yymsgbuf;
- }
- }
-
- if (0 < yysize && yysize <= yymsg_alloc)
- {
- (void) yysyntax_error (yymsg, yystate, yychar);
- yyerror (pc, yymsg);
- }
- else
- {
- yyerror (pc, YY_("syntax error"));
- if (yysize != 0)
- goto yyexhaustedlab;
- }
+ char const *yymsgp = YY_("syntax error");
+ int yysyntax_error_status;
+ yysyntax_error_status = YYSYNTAX_ERROR;
+ if (yysyntax_error_status == 0)
+ yymsgp = yymsg;
+ else if (yysyntax_error_status == 1)
+ {
+ if (yymsg != yymsgbuf)
+ YYSTACK_FREE (yymsg);
+ yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
+ if (!yymsg)
+ {
+ yymsg = yymsgbuf;
+ yymsg_alloc = sizeof yymsgbuf;
+ yysyntax_error_status = 2;
+ }
+ else
+ {
+ yysyntax_error_status = YYSYNTAX_ERROR;
+ yymsgp = yymsg;
+ }
+ }
+ yyerror (pc, yymsgp);
+ if (yysyntax_error_status == 2)
+ goto yyexhaustedlab;
}
+# undef YYSYNTAX_ERROR
#endif
}
@@ -2510,7 +2468,7 @@ yyerrlab1:
for (;;)
{
yyn = yypact[yystate];
- if (yyn != YYPACT_NINF)
+ if (!yypact_value_is_default (yyn))
{
yyn += YYTERROR;
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
@@ -2533,7 +2491,9 @@ yyerrlab1:
YY_STACK_PRINT (yyss, yyssp);
}
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
*++yyvsp = yylval;
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
/* Shift the error token. */
@@ -2557,7 +2517,7 @@ yyabortlab:
yyresult = 1;
goto yyreturn;
-#if !defined(yyoverflow) || YYERROR_VERBOSE
+#if !defined yyoverflow || YYERROR_VERBOSE
/*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here. |
`-------------------------------------------------*/
@@ -2569,8 +2529,13 @@ yyexhaustedlab:
yyreturn:
if (yychar != YYEMPTY)
- yydestruct ("Cleanup: discarding lookahead",
- yytoken, &yylval, pc);
+ {
+ /* Make sure we have latest lookahead translation. See comments at
+ user semantic actions for why this is necessary. */
+ yytoken = YYTRANSLATE (yychar);
+ yydestruct ("Cleanup: discarding lookahead",
+ yytoken, &yylval, pc);
+ }
/* Do not reclaim the symbols of the rule which action triggered
this YYABORT or YYACCEPT. */
YYPOPSTACK (yylen);
@@ -2594,9 +2559,8 @@ yyreturn:
}
-
-/* Line 1684 of yacc.c */
-#line 660 "parse-datetime.y"
+/* Line 2055 of yacc.c */
+#line 660 "./lib/parse-datetime.y"
static table const meridian_table[] =
@@ -3243,8 +3207,6 @@ parse_datetime (struct timespec *result, char const *p,
char tz1buf[TZBUFSIZE];
bool large_tz = TZBUFSIZE < tzsize;
bool setenv_ok;
- /* Free tz0, in case this is the 2nd or subsequent time through. */
- free (tz0);
tz0 = get_tz (tz0buf);
z = tz1 = large_tz ? xmalloc (tzsize) : tz1buf;
for (s = tzbase; *s != '"'; s++)
@@ -3256,7 +3218,12 @@ parse_datetime (struct timespec *result, char const *p,
if (!setenv_ok)
goto fail;
tz_was_altered = true;
+
p = s + 1;
+ while (c = *p, c_isspace (c))
+ p++;
+
+ break;
}
}
@@ -3412,7 +3379,7 @@ parse_datetime (struct timespec *result, char const *p,
+ sizeof pc.time_zone * CHAR_BIT / 3];
if (!tz_was_altered)
tz0 = get_tz (tz0buf);
- sprintf (tz1buf, "XXX%s%ld:%02d", "-" + (time_zone < 0),
+ sprintf (tz1buf, "XXX%s%ld:%02d", &"-"[time_zone < 0],
abs_time_zone_hour, abs_time_zone_min);
if (setenv ("TZ", tz1buf, 1) != 0)
goto fail;
@@ -3561,4 +3528,3 @@ main (int ac, char **av)
return 0;
}
#endif /* TEST */
-
diff --git a/lib/parse-datetime.h b/lib/parse-datetime.h
index 80e35919..9c9bb93f 100644
--- a/lib/parse-datetime.h
+++ b/lib/parse-datetime.h
@@ -1,6 +1,6 @@
/* Parse a string into an internal time stamp.
- Copyright (C) 1995, 1997-1998, 2003-2004, 2007, 2009-2013 Free Software
+ Copyright (C) 1995, 1997-1998, 2003-2004, 2007, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/parse-datetime.y b/lib/parse-datetime.y
index 77d95b70..0ba0a525 100644
--- a/lib/parse-datetime.y
+++ b/lib/parse-datetime.y
@@ -1,7 +1,7 @@
%{
/* Parse a string into an internal time stamp.
- Copyright (C) 1999-2000, 2002-2013 Free Software Foundation, Inc.
+ Copyright (C) 1999-2000, 2002-2014 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
@@ -1303,8 +1303,6 @@ parse_datetime (struct timespec *result, char const *p,
char tz1buf[TZBUFSIZE];
bool large_tz = TZBUFSIZE < tzsize;
bool setenv_ok;
- /* Free tz0, in case this is the 2nd or subsequent time through. */
- free (tz0);
tz0 = get_tz (tz0buf);
z = tz1 = large_tz ? xmalloc (tzsize) : tz1buf;
for (s = tzbase; *s != '"'; s++)
@@ -1316,7 +1314,12 @@ parse_datetime (struct timespec *result, char const *p,
if (!setenv_ok)
goto fail;
tz_was_altered = true;
+
p = s + 1;
+ while (c = *p, c_isspace (c))
+ p++;
+
+ break;
}
}
@@ -1472,7 +1475,7 @@ parse_datetime (struct timespec *result, char const *p,
+ sizeof pc.time_zone * CHAR_BIT / 3];
if (!tz_was_altered)
tz0 = get_tz (tz0buf);
- sprintf (tz1buf, "XXX%s%ld:%02d", "-" + (time_zone < 0),
+ sprintf (tz1buf, "XXX%s%ld:%02d", &"-"[time_zone < 0],
abs_time_zone_hour, abs_time_zone_min);
if (setenv ("TZ", tz1buf, 1) != 0)
goto fail;
diff --git a/lib/pathmax.h b/lib/pathmax.h
index a9ddc33d..33fc3553 100644
--- a/lib/pathmax.h
+++ b/lib/pathmax.h
@@ -1,5 +1,5 @@
/* Define PATH_MAX somehow. Requires sys/types.h.
- Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2013 Free Software
+ Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2014 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/physmem.c b/lib/physmem.c
index 26299361..d0989aa8 100644
--- a/lib/physmem.c
+++ b/lib/physmem.c
@@ -1,6 +1,6 @@
/* Calculate the size of physical memory.
- Copyright (C) 2000-2001, 2003, 2005-2006, 2009-2013 Free Software
+ Copyright (C) 2000-2001, 2003, 2005-2006, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -32,8 +32,11 @@
# include <sys/sysmp.h>
#endif
-#if HAVE_SYS_SYSINFO_H && HAVE_MACHINE_HAL_SYSINFO_H
+#if HAVE_SYS_SYSINFO_H
# include <sys/sysinfo.h>
+#endif
+
+#if HAVE_MACHINE_HAL_SYSINFO_H
# include <machine/hal_sysinfo.h>
#endif
@@ -90,6 +93,14 @@ physmem_total (void)
}
#endif
+#if HAVE_SYSINFO && HAVE_STRUCT_SYSINFO_MEM_UNIT
+ { /* This works on linux. */
+ struct sysinfo si;
+ if (sysinfo(&si) == 0)
+ return (double) si.totalram * si.mem_unit;
+ }
+#endif
+
#if HAVE_PSTAT_GETSTATIC
{ /* This works on hpux11. */
struct pst_static pss;
@@ -194,6 +205,14 @@ physmem_available (void)
}
#endif
+#if HAVE_SYSINFO && HAVE_STRUCT_SYSINFO_MEM_UNIT
+ { /* This works on linux. */
+ struct sysinfo si;
+ if (sysinfo(&si) == 0)
+ return ((double) si.freeram + si.bufferram) * si.mem_unit;
+ }
+#endif
+
#if HAVE_PSTAT_GETSTATIC && HAVE_PSTAT_GETDYNAMIC
{ /* This works on hpux11. */
struct pst_static pss;
diff --git a/lib/physmem.h b/lib/physmem.h
index 1b2706dd..ab67e0ca 100644
--- a/lib/physmem.h
+++ b/lib/physmem.h
@@ -1,6 +1,6 @@
/* Calculate the size of physical memory.
- Copyright (C) 2000, 2003, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2003, 2009-2014 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
diff --git a/lib/pipe-safer.c b/lib/pipe-safer.c
index f2e0ad6f..70fb40f8 100644
--- a/lib/pipe-safer.c
+++ b/lib/pipe-safer.c
@@ -1,5 +1,5 @@
/* Invoke pipe, but avoid some glitches.
- Copyright (C) 2005-2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2009-2014 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
diff --git a/lib/pipe.c b/lib/pipe.c
new file mode 100644
index 00000000..4db9041c
--- /dev/null
+++ b/lib/pipe.c
@@ -0,0 +1,50 @@
+/* Create a pipe.
+ Copyright (C) 2009-2014 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 3, 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, see <http://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+/* Specification. */
+#include <unistd.h>
+
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+/* Native Windows API. */
+
+/* Get _pipe(). */
+# include <io.h>
+
+/* Get _O_BINARY. */
+# include <fcntl.h>
+
+int
+pipe (int fd[2])
+{
+ /* Mingw changes fd to {-1,-1} on failure, but this violates
+ http://austingroupbugs.net/view.php?id=467 */
+ int tmp[2];
+ int result = _pipe (tmp, 4096, _O_BINARY);
+ if (!result)
+ {
+ fd[0] = tmp[0];
+ fd[1] = tmp[1];
+ }
+ return result;
+}
+
+#else
+
+# error "This platform lacks a pipe function, and Gnulib doesn't provide a replacement. This is a bug in Gnulib."
+
+#endif
diff --git a/lib/pipe.h b/lib/pipe.h
deleted file mode 100644
index 3c1b4b8f..00000000
--- a/lib/pipe.h
+++ /dev/null
@@ -1,2 +0,0 @@
-/* Obsolete; consider using spawn-pipe.h instead. */
-#include "spawn-pipe.h"
diff --git a/lib/pipe2-safer.c b/lib/pipe2-safer.c
deleted file mode 100644
index e831d0c6..00000000
--- a/lib/pipe2-safer.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/* Invoke pipe2, but avoid some glitches.
- Copyright (C) 2005-2006, 2009-2013 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Eric Blake. */
-
-#include <config.h>
-
-/* Specification. */
-#include "unistd-safer.h"
-
-#include <unistd.h>
-#include <errno.h>
-
-/* Like pipe2, but ensure that neither of the file descriptors is
- STDIN_FILENO, STDOUT_FILENO, or STDERR_FILENO. */
-
-int
-pipe2_safer (int fd[2], int flags)
-{
- /* This is a generalization of the pipe_safer implementation. */
- if (pipe2 (fd, flags) == 0)
- {
- int i;
- for (i = 0; i < 2; i++)
- {
- fd[i] = fd_safer_flag (fd[i], flags);
- if (fd[i] < 0)
- {
- int e = errno;
- close (fd[1 - i]);
- errno = e;
- return -1;
- }
- }
-
- return 0;
- }
- return -1;
-}
diff --git a/lib/pipe2.c b/lib/pipe2.c
deleted file mode 100644
index 5925cf9e..00000000
--- a/lib/pipe2.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/* Create a pipe, with specific opening flags.
- Copyright (C) 2009-2013 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 3, 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, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-/* Specification. */
-#include <unistd.h>
-
-#include <errno.h>
-#include <fcntl.h>
-
-#include "binary-io.h"
-#include "verify.h"
-
-#if GNULIB_defined_O_NONBLOCK
-# include "nonblocking.h"
-#endif
-
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-/* Native Windows API. */
-
-# include <io.h>
-
-#endif
-
-int
-pipe2 (int fd[2], int flags)
-{
- /* Mingw _pipe() corrupts fd on failure; also, if we succeed at
- creating the pipe but later fail at changing fcntl, we want
- to leave fd unchanged: http://austingroupbugs.net/view.php?id=467 */
- int tmp[2];
- tmp[0] = fd[0];
- tmp[1] = fd[1];
-
-#if HAVE_PIPE2
-# undef pipe2
- /* Try the system call first, if it exists. (We may be running with a glibc
- that has the function but with an older kernel that lacks it.) */
- {
- /* Cache the information whether the system call really exists. */
- static int have_pipe2_really; /* 0 = unknown, 1 = yes, -1 = no */
- if (have_pipe2_really >= 0)
- {
- int result = pipe2 (fd, flags);
- if (!(result < 0 && errno == ENOSYS))
- {
- have_pipe2_really = 1;
- return result;
- }
- have_pipe2_really = -1;
- }
- }
-#endif
-
- /* Check the supported flags. */
- if ((flags & ~(O_CLOEXEC | O_NONBLOCK | O_BINARY | O_TEXT)) != 0)
- {
- errno = EINVAL;
- return -1;
- }
-
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-/* Native Windows API. */
-
- if (_pipe (fd, 4096, flags & ~O_NONBLOCK) < 0)
- {
- fd[0] = tmp[0];
- fd[1] = tmp[1];
- return -1;
- }
-
- /* O_NONBLOCK handling.
- On native Windows platforms, O_NONBLOCK is defined by gnulib. Use the
- functions defined by the gnulib module 'nonblocking'. */
-# if GNULIB_defined_O_NONBLOCK
- if (flags & O_NONBLOCK)
- {
- if (set_nonblocking_flag (fd[0], true) != 0
- || set_nonblocking_flag (fd[1], true) != 0)
- goto fail;
- }
-# else
- {
- verify (O_NONBLOCK == 0);
- }
-# endif
-
- return 0;
-
-#else
-/* Unix API. */
-
- if (pipe (fd) < 0)
- return -1;
-
- /* POSIX <http://www.opengroup.org/onlinepubs/9699919799/functions/pipe.html>
- says that initially, the O_NONBLOCK and FD_CLOEXEC flags are cleared on
- both fd[0] and fd[1]. */
-
- /* O_NONBLOCK handling.
- On Unix platforms, O_NONBLOCK is defined by the system. Use fcntl(). */
- if (flags & O_NONBLOCK)
- {
- int fcntl_flags;
-
- if ((fcntl_flags = fcntl (fd[1], F_GETFL, 0)) < 0
- || fcntl (fd[1], F_SETFL, fcntl_flags | O_NONBLOCK) == -1
- || (fcntl_flags = fcntl (fd[0], F_GETFL, 0)) < 0
- || fcntl (fd[0], F_SETFL, fcntl_flags | O_NONBLOCK) == -1)
- goto fail;
- }
-
- if (flags & O_CLOEXEC)
- {
- int fcntl_flags;
-
- if ((fcntl_flags = fcntl (fd[1], F_GETFD, 0)) < 0
- || fcntl (fd[1], F_SETFD, fcntl_flags | FD_CLOEXEC) == -1
- || (fcntl_flags = fcntl (fd[0], F_GETFD, 0)) < 0
- || fcntl (fd[0], F_SETFD, fcntl_flags | FD_CLOEXEC) == -1)
- goto fail;
- }
-
-# if O_BINARY
- if (flags & O_BINARY)
- {
- setmode (fd[1], O_BINARY);
- setmode (fd[0], O_BINARY);
- }
- else if (flags & O_TEXT)
- {
- setmode (fd[1], O_TEXT);
- setmode (fd[0], O_TEXT);
- }
-# endif
-
- return 0;
-
-#endif
-
-#if GNULIB_defined_O_NONBLOCK || \
- !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
- fail:
- {
- int saved_errno = errno;
- close (fd[0]);
- close (fd[1]);
- fd[0] = tmp[0];
- fd[1] = tmp[1];
- errno = saved_errno;
- return -1;
- }
-#endif
-}
diff --git a/lib/posixtm.c b/lib/posixtm.c
index 31b5563a..2fe81ab6 100644
--- a/lib/posixtm.c
+++ b/lib/posixtm.c
@@ -1,6 +1,6 @@
/* Parse dates for touch and date.
- Copyright (C) 1989-1991, 1998, 2000-2013 Free Software Foundation, Inc.
+ Copyright (C) 1989-1991, 1998, 2000-2014 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
diff --git a/lib/posixtm.h b/lib/posixtm.h
index 8a4383bb..56680ec4 100644
--- a/lib/posixtm.h
+++ b/lib/posixtm.h
@@ -1,6 +1,6 @@
/* Parse dates for touch and date.
- Copyright (C) 1998, 2003, 2005, 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2003, 2005, 2007-2014 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
diff --git a/lib/posixver.c b/lib/posixver.c
index f3193e07..a3bff114 100644
--- a/lib/posixver.c
+++ b/lib/posixver.c
@@ -1,6 +1,6 @@
/* Which POSIX version to conform to, for utilities.
- Copyright (C) 2002-2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2002-2006, 2009-2014 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
diff --git a/lib/printf-args.c b/lib/printf-args.c
index c27e6bc6..39cd0a4f 100644
--- a/lib/printf-args.c
+++ b/lib/printf-args.c
@@ -1,5 +1,5 @@
/* Decomposed printf argument list.
- Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2013 Free Software
+ Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2014 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/printf-args.h b/lib/printf-args.h
index 2a9c2a3f..9364eed5 100644
--- a/lib/printf-args.h
+++ b/lib/printf-args.h
@@ -1,5 +1,5 @@
/* Decomposed printf argument list.
- Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2013 Free Software
+ Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2014 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/printf-frexp.c b/lib/printf-frexp.c
index 1a7b0c43..39ec0938 100644
--- a/lib/printf-frexp.c
+++ b/lib/printf-frexp.c
@@ -1,5 +1,5 @@
/* Split a double into fraction and mantissa, for hexadecimal printf.
- Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2014 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
diff --git a/lib/printf-frexp.h b/lib/printf-frexp.h
index 3976b736..2c46eca2 100644
--- a/lib/printf-frexp.h
+++ b/lib/printf-frexp.h
@@ -1,5 +1,5 @@
/* Split a double into fraction and mantissa, for hexadecimal printf.
- Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2014 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
diff --git a/lib/printf-frexpl.c b/lib/printf-frexpl.c
index 26987a7b..00e7a67d 100644
--- a/lib/printf-frexpl.c
+++ b/lib/printf-frexpl.c
@@ -1,5 +1,5 @@
/* Split a 'long double' into fraction and mantissa, for hexadecimal printf.
- Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2014 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
diff --git a/lib/printf-frexpl.h b/lib/printf-frexpl.h
index 3768b091..29825e86 100644
--- a/lib/printf-frexpl.h
+++ b/lib/printf-frexpl.h
@@ -1,5 +1,5 @@
/* Split a 'long double' into fraction and mantissa, for hexadecimal printf.
- Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2014 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
diff --git a/lib/printf-parse.c b/lib/printf-parse.c
index 23cacc1d..131d0f00 100644
--- a/lib/printf-parse.c
+++ b/lib/printf-parse.c
@@ -1,5 +1,5 @@
/* Formatted output to strings.
- Copyright (C) 1999-2000, 2002-2003, 2006-2013 Free Software Foundation, Inc.
+ Copyright (C) 1999-2000, 2002-2003, 2006-2014 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
diff --git a/lib/printf-parse.h b/lib/printf-parse.h
index d8474bee..2651195f 100644
--- a/lib/printf-parse.h
+++ b/lib/printf-parse.h
@@ -1,5 +1,5 @@
/* Parse printf format string.
- Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2013 Free Software
+ Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2014 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/priv-set.c b/lib/priv-set.c
index ad78b92d..08843606 100644
--- a/lib/priv-set.c
+++ b/lib/priv-set.c
@@ -1,6 +1,6 @@
/* Query, remove, or restore a Solaris privilege.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 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
diff --git a/lib/priv-set.h b/lib/priv-set.h
index 6f62cce0..ff5877c1 100644
--- a/lib/priv-set.h
+++ b/lib/priv-set.h
@@ -1,6 +1,6 @@
/* Query, remove, or restore a Solaris privilege.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 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
@@ -17,6 +17,9 @@
Written by David Bartley. */
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
_GL_INLINE_HEADER_BEGIN
#ifndef PRIV_SET_INLINE
# define PRIV_SET_INLINE _GL_INLINE
diff --git a/lib/progname.c b/lib/progname.c
index 0c195e52..2919be99 100644
--- a/lib/progname.c
+++ b/lib/progname.c
@@ -1,5 +1,5 @@
/* Program name management.
- Copyright (C) 2001-2003, 2005-2013 Free Software Foundation, Inc.
+ Copyright (C) 2001-2003, 2005-2014 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2001.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/progname.h b/lib/progname.h
index b4f3c277..fa15871d 100644
--- a/lib/progname.h
+++ b/lib/progname.h
@@ -1,5 +1,5 @@
/* Program name management.
- Copyright (C) 2001-2004, 2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2001-2004, 2006, 2009-2014 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2001.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/propername.c b/lib/propername.c
index 8cc83080..54a6adaf 100644
--- a/lib/propername.c
+++ b/lib/propername.c
@@ -1,5 +1,5 @@
/* Localization of proper names.
- Copyright (C) 2006-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006-2014 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2006.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/propername.h b/lib/propername.h
index 59dfade4..7e3de0fc 100644
--- a/lib/propername.h
+++ b/lib/propername.h
@@ -1,5 +1,5 @@
/* Localization of proper names.
- Copyright (C) 2006, 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2008-2014 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2006.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/pthread.in.h b/lib/pthread.in.h
index aea5e60f..9d263953 100644
--- a/lib/pthread.in.h
+++ b/lib/pthread.in.h
@@ -1,6 +1,6 @@
/* Implement a trivial subset of POSIX 1003.1-2008 pthread.h.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 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
@@ -36,11 +36,23 @@
#include <stdlib.h>
#undef __need_system_stdlib_h
+
+/* The pthreads-win32 <pthread.h> defines a couple of broken macros. */
+#undef asctime_r
+#undef ctime_r
+#undef gmtime_r
+#undef localtime_r
+#undef rand_r
+#undef strtok_r
+
#include <errno.h>
#include <sched.h>
#include <sys/types.h>
#include <time.h>
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
_GL_INLINE_HEADER_BEGIN
#ifndef _GL_PTHREAD_INLINE
# define _GL_PTHREAD_INLINE _GL_INLINE
diff --git a/lib/putenv.c b/lib/putenv.c
index 5f0fedaf..b9f50792 100644
--- a/lib/putenv.c
+++ b/lib/putenv.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1994, 1997-1998, 2000, 2003-2013 Free Software
+/* Copyright (C) 1991, 1994, 1997-1998, 2000, 2003-2014 Free Software
Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C
@@ -34,6 +34,11 @@
#include <string.h>
#include <unistd.h>
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+#endif
+
#if _LIBC
# if HAVE_GNU_LD
# define environ __environ
@@ -57,7 +62,9 @@ static int
_unsetenv (const char *name)
{
size_t len;
+#if !HAVE_DECL__PUTENV
char **ep;
+#endif
if (name == NULL || *name == '\0' || strchr (name, '=') != NULL)
{
@@ -67,6 +74,21 @@ _unsetenv (const char *name)
len = strlen (name);
+#if HAVE_DECL__PUTENV
+ {
+ int putenv_result, putenv_errno;
+ char *name_ = malloc (len + 2);
+ memcpy (name_, name, len);
+ name_[len] = '=';
+ name_[len + 1] = 0;
+ putenv_result = _putenv (name_);
+ putenv_errno = errno;
+ free (name_);
+ __set_errno (putenv_errno);
+ return putenv_result;
+ }
+#else
+
LOCK;
ep = environ;
@@ -87,6 +109,7 @@ _unsetenv (const char *name)
UNLOCK;
return 0;
+#endif
}
@@ -95,9 +118,8 @@ _unsetenv (const char *name)
int
putenv (char *string)
{
- const char *const name_end = strchr (string, '=');
- register size_t size;
- register char **ep;
+ const char *name_end = strchr (string, '=');
+ char **ep;
if (name_end == NULL)
{
@@ -105,30 +127,68 @@ putenv (char *string)
return _unsetenv (string);
}
- size = 0;
- for (ep = environ; *ep != NULL; ++ep)
- if (!strncmp (*ep, string, name_end - string) &&
- (*ep)[name_end - string] == '=')
+#if HAVE_DECL__PUTENV
+ /* Rely on _putenv to allocate the new environment. If other
+ parts of the application use _putenv, the !HAVE_DECL__PUTENV code
+ would fight over who owns the environ vector, causing a crash. */
+ if (name_end[1])
+ return _putenv (string);
+ else
+ {
+ /* _putenv ("NAME=") unsets NAME, so invoke _putenv ("NAME= ")
+ to allocate the environ vector and then replace the new
+ entry with "NAME=". */
+ int putenv_result, putenv_errno;
+ char *name_x = malloc (name_end - string + sizeof "= ");
+ if (!name_x)
+ return -1;
+ memcpy (name_x, string, name_end - string + 1);
+ name_x[name_end - string + 1] = ' ';
+ name_x[name_end - string + 2] = 0;
+ putenv_result = _putenv (name_x);
+ putenv_errno = errno;
+ for (ep = environ; *ep; ep++)
+ if (strcmp (*ep, name_x) == 0)
+ {
+ *ep = string;
+ break;
+ }
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+ if (putenv_result == 0)
+ {
+ /* _putenv propagated "NAME= " into the subprocess environment;
+ fix that by calling SetEnvironmentVariable directly. */
+ name_x[name_end - string] = 0;
+ putenv_result = SetEnvironmentVariable (name_x, "") ? 0 : -1;
+ putenv_errno = ENOMEM; /* ENOMEM is the only way to fail. */
+ }
+# endif
+ free (name_x);
+ __set_errno (putenv_errno);
+ return putenv_result;
+ }
+#else
+ for (ep = environ; *ep; ep++)
+ if (strncmp (*ep, string, name_end - string) == 0
+ && (*ep)[name_end - string] == '=')
break;
- else
- ++size;
- if (*ep == NULL)
+ if (*ep)
+ *ep = string;
+ else
{
static char **last_environ = NULL;
- char **new_environ = (char **) malloc ((size + 2) * sizeof (char *));
- if (new_environ == NULL)
+ size_t size = ep - environ;
+ char **new_environ = malloc ((size + 2) * sizeof *new_environ);
+ if (! new_environ)
return -1;
- (void) memcpy ((void *) new_environ, (void *) environ,
- size * sizeof (char *));
- new_environ[size] = (char *) string;
- new_environ[size + 1] = NULL;
+ new_environ[0] = string;
+ memcpy (new_environ + 1, environ, (size + 1) * sizeof *new_environ);
free (last_environ);
last_environ = new_environ;
environ = new_environ;
}
- else
- *ep = string;
return 0;
+#endif
}
diff --git a/lib/qcopy-acl.c b/lib/qcopy-acl.c
new file mode 100644
index 00000000..4e53b633
--- /dev/null
+++ b/lib/qcopy-acl.c
@@ -0,0 +1,583 @@
+/* copy-acl.c - copy access control list from one file to another file
+
+ Copyright (C) 2002-2003, 2005-2014 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
+
+ Written by Paul Eggert, Andreas Grünbacher, and Bruno Haible. */
+
+#include <config.h>
+
+#include "acl.h"
+
+#include "acl-internal.h"
+
+
+/* Copy access control lists from one file to another. If SOURCE_DESC is
+ a valid file descriptor, use file descriptor operations, else use
+ filename based operations on SRC_NAME. Likewise for DEST_DESC and
+ DST_NAME.
+ If access control lists are not available, fchmod the target file to
+ MODE. Also sets the non-permission bits of the destination file
+ (S_ISUID, S_ISGID, S_ISVTX) to those from MODE if any are set.
+ Return 0 if successful.
+ Return -2 and set errno for an error relating to the source file.
+ Return -1 and set errno for an error relating to the destination file. */
+
+int
+qcopy_acl (const char *src_name, int source_desc, const char *dst_name,
+ int dest_desc, mode_t mode)
+{
+#if USE_ACL && HAVE_ACL_GET_FILE
+ /* POSIX 1003.1e (draft 17 -- abandoned) specific version. */
+ /* Linux, FreeBSD, Mac OS X, IRIX, Tru64 */
+# if !HAVE_ACL_TYPE_EXTENDED
+ /* Linux, FreeBSD, IRIX, Tru64 */
+
+ acl_t acl;
+ int ret;
+
+ if (HAVE_ACL_GET_FD && source_desc != -1)
+ acl = acl_get_fd (source_desc);
+ else
+ acl = acl_get_file (src_name, ACL_TYPE_ACCESS);
+ if (acl == NULL)
+ {
+ if (! acl_errno_valid (errno))
+ return qset_acl (dst_name, dest_desc, mode);
+ else
+ return -2;
+ }
+
+ if (HAVE_ACL_SET_FD && dest_desc != -1)
+ ret = acl_set_fd (dest_desc, acl);
+ else
+ ret = acl_set_file (dst_name, ACL_TYPE_ACCESS, acl);
+ if (ret != 0)
+ {
+ int saved_errno = errno;
+
+ if (! acl_errno_valid (errno) && !acl_access_nontrivial (acl))
+ {
+ acl_free (acl);
+ return chmod_or_fchmod (dst_name, dest_desc, mode);
+ }
+ else
+ {
+ acl_free (acl);
+ chmod_or_fchmod (dst_name, dest_desc, mode);
+ errno = saved_errno;
+ return -1;
+ }
+ }
+ else
+ acl_free (acl);
+
+ if (!MODE_INSIDE_ACL || (mode & (S_ISUID | S_ISGID | S_ISVTX)))
+ {
+ /* We did not call chmod so far, and either the mode and the ACL are
+ separate or special bits are to be set which don't fit into ACLs. */
+
+ if (chmod_or_fchmod (dst_name, dest_desc, mode) != 0)
+ return -1;
+ }
+
+ if (S_ISDIR (mode))
+ {
+ acl = acl_get_file (src_name, ACL_TYPE_DEFAULT);
+ if (acl == NULL)
+ return -2;
+
+ if (acl_set_file (dst_name, ACL_TYPE_DEFAULT, acl))
+ {
+ int saved_errno = errno;
+
+ acl_free (acl);
+ errno = saved_errno;
+ return -1;
+ }
+ else
+ acl_free (acl);
+ }
+ return 0;
+
+# else /* HAVE_ACL_TYPE_EXTENDED */
+ /* Mac OS X */
+
+ /* On Mac OS X, acl_get_file (name, ACL_TYPE_ACCESS)
+ and acl_get_file (name, ACL_TYPE_DEFAULT)
+ always return NULL / EINVAL. You have to use
+ acl_get_file (name, ACL_TYPE_EXTENDED)
+ or acl_get_fd (open (name, ...))
+ to retrieve an ACL.
+ On the other hand,
+ acl_set_file (name, ACL_TYPE_ACCESS, acl)
+ and acl_set_file (name, ACL_TYPE_DEFAULT, acl)
+ have the same effect as
+ acl_set_file (name, ACL_TYPE_EXTENDED, acl):
+ Each of these calls sets the file's ACL. */
+
+ acl_t acl;
+ int ret;
+
+ if (HAVE_ACL_GET_FD && source_desc != -1)
+ acl = acl_get_fd (source_desc);
+ else
+ acl = acl_get_file (src_name, ACL_TYPE_EXTENDED);
+ if (acl == NULL)
+ {
+ if (!acl_errno_valid (errno))
+ return qset_acl (dst_name, dest_desc, mode);
+ else
+ return -2;
+ }
+
+ if (HAVE_ACL_SET_FD && dest_desc != -1)
+ ret = acl_set_fd (dest_desc, acl);
+ else
+ ret = acl_set_file (dst_name, ACL_TYPE_EXTENDED, acl);
+ if (ret != 0)
+ {
+ int saved_errno = errno;
+
+ if (!acl_errno_valid (saved_errno) && !acl_extended_nontrivial (acl))
+ {
+ acl_free (acl);
+ return chmod_or_fchmod (dst_name, dest_desc, mode);
+ }
+ else
+ {
+ acl_free (acl);
+ chmod_or_fchmod (dst_name, dest_desc, mode);
+ errno = saved_errno;
+ return -1;
+ }
+ }
+ else
+ acl_free (acl);
+
+ /* Since !MODE_INSIDE_ACL, we have to call chmod explicitly. */
+ return chmod_or_fchmod (dst_name, dest_desc, mode);
+
+# endif
+
+#elif USE_ACL && defined GETACL /* Solaris, Cygwin, not HP-UX */
+
+ /* Solaris 2.5 through Solaris 10, Cygwin, and contemporaneous versions
+ of Unixware. The acl() call returns the access and default ACL both
+ at once. */
+# ifdef ACE_GETACL
+ int ace_count;
+ ace_t *ace_entries;
+# endif
+ int count;
+ aclent_t *entries;
+ int did_chmod;
+ int saved_errno;
+ int ret;
+
+# ifdef ACE_GETACL
+ /* Solaris also has a different variant of ACLs, used in ZFS and NFSv4
+ file systems (whereas the other ones are used in UFS file systems).
+ There is an API
+ pathconf (name, _PC_ACL_ENABLED)
+ fpathconf (desc, _PC_ACL_ENABLED)
+ that allows to determine which of the two kinds of ACLs is supported
+ for the given file. But some file systems may implement this call
+ incorrectly, so better not use it.
+ When fetching the source ACL, we simply fetch both ACL types.
+ When setting the destination ACL, we try either ACL types, assuming
+ that the kernel will translate the ACL from one form to the other.
+ (See in <http://docs.sun.com/app/docs/doc/819-2241/6n4huc7ia?l=en&a=view>
+ the description of ENOTSUP.) */
+ for (;;)
+ {
+ ace_count = (source_desc != -1
+ ? facl (source_desc, ACE_GETACLCNT, 0, NULL)
+ : acl (src_name, ACE_GETACLCNT, 0, NULL));
+
+ if (ace_count < 0)
+ {
+ if (errno == ENOSYS || errno == EINVAL)
+ {
+ ace_count = 0;
+ ace_entries = NULL;
+ break;
+ }
+ else
+ return -2;
+ }
+
+ if (ace_count == 0)
+ {
+ ace_entries = NULL;
+ break;
+ }
+
+ ace_entries = (ace_t *) malloc (ace_count * sizeof (ace_t));
+ if (ace_entries == NULL)
+ {
+ errno = ENOMEM;
+ return -2;
+ }
+
+ ret = (source_desc != -1
+ ? facl (source_desc, ACE_GETACL, ace_count, ace_entries)
+ : acl (src_name, ACE_GETACL, ace_count, ace_entries));
+ if (ret < 0)
+ {
+ free (ace_entries);
+ if (errno == ENOSYS || errno == EINVAL)
+ {
+ ace_count = 0;
+ ace_entries = NULL;
+ break;
+ }
+ else
+ return -2;
+ }
+ if (ret == ace_count)
+ break;
+ /* Huh? The number of ACL entries changed since the last call.
+ Repeat. */
+ }
+# endif
+
+ for (;;)
+ {
+ count = (source_desc != -1
+ ? facl (source_desc, GETACLCNT, 0, NULL)
+ : acl (src_name, GETACLCNT, 0, NULL));
+
+ if (count < 0)
+ {
+ if (errno == ENOSYS || errno == ENOTSUP || errno == EOPNOTSUPP)
+ {
+ count = 0;
+ entries = NULL;
+ break;
+ }
+ else
+ return -2;
+ }
+
+ if (count == 0)
+ {
+ entries = NULL;
+ break;
+ }
+
+ entries = (aclent_t *) malloc (count * sizeof (aclent_t));
+ if (entries == NULL)
+ {
+ errno = ENOMEM;
+ return -2;
+ }
+
+ if ((source_desc != -1
+ ? facl (source_desc, GETACL, count, entries)
+ : acl (src_name, GETACL, count, entries))
+ == count)
+ break;
+ /* Huh? The number of ACL entries changed since the last call.
+ Repeat. */
+ }
+
+ /* Is there an ACL of either kind? */
+# ifdef ACE_GETACL
+ if (ace_count == 0)
+# endif
+ if (count == 0)
+ return qset_acl (dst_name, dest_desc, mode);
+
+ did_chmod = 0; /* set to 1 once the mode bits in 0777 have been set */
+ saved_errno = 0; /* the first non-ignorable error code */
+
+ if (!MODE_INSIDE_ACL)
+ {
+ /* On Cygwin, it is necessary to call chmod before acl, because
+ chmod can change the contents of the ACL (in ways that don't
+ change the allowed accesses, but still visible). */
+ if (chmod_or_fchmod (dst_name, dest_desc, mode) != 0)
+ saved_errno = errno;
+ did_chmod = 1;
+ }
+
+ /* If both ace_entries and entries are available, try SETACL before
+ ACE_SETACL, because SETACL cannot fail with ENOTSUP whereas ACE_SETACL
+ can. */
+
+ if (count > 0)
+ {
+ ret = (dest_desc != -1
+ ? facl (dest_desc, SETACL, count, entries)
+ : acl (dst_name, SETACL, count, entries));
+ if (ret < 0 && saved_errno == 0)
+ {
+ saved_errno = errno;
+ if ((errno == ENOSYS || errno == EOPNOTSUPP || errno == EINVAL)
+ && !acl_nontrivial (count, entries))
+ saved_errno = 0;
+ }
+ else
+ did_chmod = 1;
+ }
+ free (entries);
+
+# ifdef ACE_GETACL
+ if (ace_count > 0)
+ {
+ ret = (dest_desc != -1
+ ? facl (dest_desc, ACE_SETACL, ace_count, ace_entries)
+ : acl (dst_name, ACE_SETACL, ace_count, ace_entries));
+ if (ret < 0 && saved_errno == 0)
+ {
+ saved_errno = errno;
+ if ((errno == ENOSYS || errno == EINVAL || errno == ENOTSUP)
+ && !acl_ace_nontrivial (ace_count, ace_entries))
+ saved_errno = 0;
+ }
+ }
+ free (ace_entries);
+# endif
+
+ if (MODE_INSIDE_ACL
+ && did_chmod <= ((mode & (S_ISUID | S_ISGID | S_ISVTX)) ? 1 : 0))
+ {
+ /* We did not call chmod so far, and either the mode and the ACL are
+ separate or special bits are to be set which don't fit into ACLs. */
+
+ if (chmod_or_fchmod (dst_name, dest_desc, mode) != 0)
+ {
+ if (saved_errno == 0)
+ saved_errno = errno;
+ }
+ }
+
+ if (saved_errno)
+ {
+ errno = saved_errno;
+ return -1;
+ }
+ return 0;
+
+#elif USE_ACL && HAVE_GETACL /* HP-UX */
+
+ struct acl_entry entries[NACLENTRIES];
+ int count;
+# if HAVE_ACLV_H
+ struct acl aclv_entries[NACLVENTRIES];
+ int aclv_count;
+# endif
+ int did_chmod;
+ int saved_errno;
+ int ret;
+
+ count = (source_desc != -1
+ ? fgetacl (source_desc, NACLENTRIES, entries)
+ : getacl (src_name, NACLENTRIES, entries));
+
+ if (count < 0)
+ {
+ if (errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTSUP)
+ count = 0;
+ else
+ return -2;
+ }
+ else if (count > 0)
+ {
+ if (count > NACLENTRIES)
+ /* If NACLENTRIES cannot be trusted, use dynamic memory allocation. */
+ abort ();
+ }
+
+# if HAVE_ACLV_H
+ aclv_count = acl ((char *) src_name, ACL_GET, NACLVENTRIES, aclv_entries);
+
+ if (aclv_count < 0)
+ {
+ if (errno == ENOSYS || errno == EOPNOTSUPP || errno == EINVAL)
+ count = 0;
+ else
+ return -2;
+ }
+ else if (aclv_count > 0)
+ {
+ if (aclv_count > NACLVENTRIES)
+ /* If NACLVENTRIES cannot be trusted, use dynamic memory allocation. */
+ abort ();
+ }
+# endif
+
+ if (count == 0)
+# if HAVE_ACLV_H
+ if (aclv_count == 0)
+# endif
+ return qset_acl (dst_name, dest_desc, mode);
+
+ did_chmod = 0; /* set to 1 once the mode bits in 0777 have been set */
+ saved_errno = 0; /* the first non-ignorable error code */
+
+ if (count > 0)
+ {
+ ret = (dest_desc != -1
+ ? fsetacl (dest_desc, count, entries)
+ : setacl (dst_name, count, entries));
+ if (ret < 0 && saved_errno == 0)
+ {
+ saved_errno = errno;
+ if (errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTSUP)
+ {
+ struct stat source_statbuf;
+
+ if ((source_desc != -1
+ ? fstat (source_desc, &source_statbuf)
+ : stat (src_name, &source_statbuf)) == 0)
+ {
+ if (!acl_nontrivial (count, entries, &source_statbuf))
+ saved_errno = 0;
+ }
+ else
+ saved_errno = errno;
+ }
+ }
+ else
+ did_chmod = 1;
+ }
+
+# if HAVE_ACLV_H
+ if (aclv_count > 0)
+ {
+ ret = acl ((char *) dst_name, ACL_SET, aclv_count, aclv_entries);
+ if (ret < 0 && saved_errno == 0)
+ {
+ saved_errno = errno;
+ if (errno == ENOSYS || errno == EOPNOTSUPP || errno == EINVAL)
+ {
+ if (!aclv_nontrivial (aclv_count, aclv_entries))
+ saved_errno = 0;
+ }
+ }
+ else
+ did_chmod = 1;
+ }
+# endif
+
+ if (did_chmod <= ((mode & (S_ISUID | S_ISGID | S_ISVTX)) ? 1 : 0))
+ {
+ /* We did not call chmod so far, and special bits are to be set which
+ don't fit into ACLs. */
+
+ if (chmod_or_fchmod (dst_name, dest_desc, mode) != 0)
+ {
+ if (saved_errno == 0)
+ saved_errno = errno;
+ }
+ }
+
+ if (saved_errno)
+ {
+ errno = saved_errno;
+ return -1;
+ }
+ return 0;
+
+#elif USE_ACL && HAVE_ACLX_GET && 0 /* AIX */
+
+ /* TODO */
+
+#elif USE_ACL && HAVE_STATACL /* older AIX */
+
+ union { struct acl a; char room[4096]; } u;
+ int ret;
+
+ if ((source_desc != -1
+ ? fstatacl (source_desc, STX_NORMAL, &u.a, sizeof (u))
+ : statacl (src_name, STX_NORMAL, &u.a, sizeof (u)))
+ < 0)
+ return -2;
+
+ ret = (dest_desc != -1
+ ? fchacl (dest_desc, &u.a, u.a.acl_len)
+ : chacl (dst_name, &u.a, u.a.acl_len));
+ if (ret < 0)
+ {
+ int saved_errno = errno;
+
+ chmod_or_fchmod (dst_name, dest_desc, mode);
+ errno = saved_errno;
+ return -1;
+ }
+
+ /* No need to call chmod_or_fchmod at this point, since the mode bits
+ S_ISUID, S_ISGID, S_ISVTX are also stored in the ACL. */
+
+ return 0;
+
+#elif USE_ACL && HAVE_ACLSORT /* NonStop Kernel */
+
+ struct acl entries[NACLENTRIES];
+ int count;
+ int ret;
+
+ count = acl ((char *) src_name, ACL_GET, NACLENTRIES, entries);
+
+ if (count < 0)
+ {
+ if (0)
+ count = 0;
+ else
+ return -2;
+ }
+ else if (count > 0)
+ {
+ if (count > NACLENTRIES)
+ /* If NACLENTRIES cannot be trusted, use dynamic memory allocation. */
+ abort ();
+ }
+
+ if (count == 0)
+ return qset_acl (dst_name, dest_desc, mode);
+
+ ret = acl ((char *) dst_name, ACL_SET, count, entries);
+ if (ret < 0)
+ {
+ int saved_errno = errno;
+
+ if (0)
+ {
+ if (!acl_nontrivial (count, entries))
+ return chmod_or_fchmod (dst_name, dest_desc, mode);
+ }
+
+ chmod_or_fchmod (dst_name, dest_desc, mode);
+ errno = saved_errno;
+ return -1;
+ }
+
+ if (mode & (S_ISUID | S_ISGID | S_ISVTX))
+ {
+ /* We did not call chmod so far, and either the mode and the ACL are
+ separate or special bits are to be set which don't fit into ACLs. */
+
+ return chmod_or_fchmod (dst_name, dest_desc, mode);
+ }
+ return 0;
+
+#else
+
+ return qset_acl (dst_name, dest_desc, mode);
+
+#endif
+}
diff --git a/lib/set-mode-acl.c b/lib/qset-acl.c
index 35fe2a81..7d9af573 100644
--- a/lib/set-mode-acl.c
+++ b/lib/qset-acl.c
@@ -1,6 +1,6 @@
-/* set-mode-acl.c - set access control list equivalent to a mode
+/* qset-acl.c - set access control list equivalent to a mode
- Copyright (C) 2002-2003, 2005-2013 Free Software Foundation, Inc.
+ Copyright (C) 2002-2003, 2005-2014 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
@@ -25,13 +25,10 @@
#include "acl-internal.h"
-#include "gettext.h"
-#define _(msgid) gettext (msgid)
-
/* If DESC is a valid file descriptor use fchmod to change the
- file's mode to MODE on systems that have fchown. On systems
- that don't have fchown and if DESC is invalid, use chown on
+ file's mode to MODE on systems that have fchmod. On systems
+ that don't have fchmod and if DESC is invalid, use chmod on
NAME instead.
Return 0 if successful. Return -1 and set errno upon failure. */
@@ -119,14 +116,10 @@ qset_acl (char const *name, int desc, mode_t mode)
{
int saved_errno = errno;
acl_free (acl);
-
- if (ACL_NOT_WELL_SUPPORTED (errno))
+ if (! acl_errno_valid (errno))
return chmod_or_fchmod (name, desc, mode);
- else
- {
- errno = saved_errno;
- return -1;
- }
+ errno = saved_errno;
+ return -1;
}
else
acl_free (acl);
@@ -180,16 +173,11 @@ qset_acl (char const *name, int desc, mode_t mode)
if (ret != 0)
{
int saved_errno = errno;
-
acl_free (acl);
-
- if (ACL_NOT_WELL_SUPPORTED (saved_errno))
+ if (! acl_errno_valid (saved_errno))
return chmod_or_fchmod (name, desc, mode);
- else
- {
- errno = saved_errno;
- return -1;
- }
+ errno = saved_errno;
+ return -1;
}
acl_free (acl);
}
@@ -686,14 +674,3 @@ qset_acl (char const *name, int desc, mode_t mode)
return chmod_or_fchmod (name, desc, mode);
#endif
}
-
-/* As with qset_acl, but also output a diagnostic on failure. */
-
-int
-set_acl (char const *name, int desc, mode_t mode)
-{
- int ret = qset_acl (name, desc, mode);
- if (ret != 0)
- error (0, errno, _("setting permissions for %s"), quote (name));
- return ret;
-}
diff --git a/lib/quote.h b/lib/quote.h
index 16797967..fb338a77 100644
--- a/lib/quote.h
+++ b/lib/quote.h
@@ -1,6 +1,6 @@
/* quote.h - prototypes for quote.c
- Copyright (C) 1998-2001, 2003, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 1998-2001, 2003, 2009-2014 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
diff --git a/lib/quotearg.c b/lib/quotearg.c
index 57a83822..bef7b98b 100644
--- a/lib/quotearg.c
+++ b/lib/quotearg.c
@@ -1,6 +1,6 @@
/* quotearg.c - quote arguments for output
- Copyright (C) 1998-2002, 2004-2013 Free Software Foundation, Inc.
+ Copyright (C) 1998-2002, 2004-2014 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
@@ -178,7 +178,7 @@ set_custom_quoting (struct quoting_options *o,
static struct quoting_options /* NOT PURE!! */
quoting_options_from_style (enum quoting_style style)
{
- struct quoting_options o = { 0, 0, { 0 }, NULL, NULL };
+ struct quoting_options o = { literal_quoting_style, 0, { 0 }, NULL, NULL };
if (style == custom_quoting_style)
abort ();
o.style = style;
@@ -348,7 +348,12 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize,
if (backslash_escapes
&& quote_string_len
- && i + quote_string_len <= argsize
+ && (i + quote_string_len
+ <= (argsize == SIZE_MAX && 1 < quote_string_len
+ /* Use strlen only if we must: when argsize is SIZE_MAX,
+ and when the quote string is more than 1 byte long.
+ If we do call strlen, save the result. */
+ ? (argsize = strlen (arg)) : argsize))
&& memcmp (arg + i, quote_string, quote_string_len) == 0)
{
if (elide_outer_quotes)
@@ -621,7 +626,7 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize,
if (! ((backslash_escapes || elide_outer_quotes)
&& quote_these_too
- && quote_these_too[c / INT_BITS] & (1 << (c % INT_BITS)))
+ && quote_these_too[c / INT_BITS] >> (c % INT_BITS) & 1)
&& !is_right_quote)
goto store_c;
diff --git a/lib/quotearg.h b/lib/quotearg.h
index 58ee3f60..da29d7b5 100644
--- a/lib/quotearg.h
+++ b/lib/quotearg.h
@@ -1,6 +1,6 @@
/* quotearg.h - quote arguments for output
- Copyright (C) 1998-2002, 2004, 2006, 2008-2013 Free Software Foundation,
+ Copyright (C) 1998-2002, 2004, 2006, 2008-2014 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/raise.c b/lib/raise.c
index 5b546d2b..cf58a7e9 100644
--- a/lib/raise.c
+++ b/lib/raise.c
@@ -1,6 +1,6 @@
/* Provide a non-threads replacement for the POSIX raise function.
- Copyright (C) 2002-2003, 2005-2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2002-2003, 2005-2006, 2009-2014 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
diff --git a/lib/rand-isaac.c b/lib/rand-isaac.c
index defd2177..c03242f6 100644
--- a/lib/rand-isaac.c
+++ b/lib/rand-isaac.c
@@ -1,6 +1,6 @@
/* Bob Jenkins's cryptographic random number generators, ISAAC and ISAAC64.
- Copyright (C) 1999-2013 Free Software Foundation, Inc.
+ Copyright (C) 1999-2014 Free Software Foundation, Inc.
Copyright (C) 1997, 1998, 1999 Colin Plumb.
This program is free software: you can redistribute it and/or modify
@@ -58,16 +58,26 @@ just (isaac_word a)
return a & desired_bits;
}
-/* The index operation. On typical machines whose words are exactly
- the right size, this is optimized to a mask, an addition, and an
- indirect load. Atypical machines need more work. */
+/* The index operation. */
static inline isaac_word
ind (isaac_word const *m, isaac_word x)
{
- return (sizeof *m * CHAR_BIT == ISAAC_BITS
- ? (* (isaac_word *) ((char *) m
- + (x & ((ISAAC_WORDS - 1) * sizeof *m))))
- : m[(x / (ISAAC_BITS / CHAR_BIT)) & (ISAAC_WORDS - 1)]);
+ if (sizeof *m * CHAR_BIT == ISAAC_BITS)
+ {
+ /* The typical case, where words are exactly the right size.
+ Optimize this to a mask, an addition, and an indirect
+ load. */
+ void const *void_m = m;
+ char const *base_p = void_m;
+ void const *word_p = base_p + (x & ((ISAAC_WORDS - 1) * sizeof *m));
+ isaac_word const *p = word_p;
+ return *p;
+ }
+ else
+ {
+ /* Atypical machines need more work. */
+ return m[(x / (ISAAC_BITS / CHAR_BIT)) & (ISAAC_WORDS - 1)];
+ }
}
/* Use and update *S to generate random data to fill RESULT. */
diff --git a/lib/rand-isaac.h b/lib/rand-isaac.h
index 8e45c703..a34a0a73 100644
--- a/lib/rand-isaac.h
+++ b/lib/rand-isaac.h
@@ -1,6 +1,6 @@
/* Bob Jenkins's cryptographic random number generators, ISAAC and ISAAC64.
- Copyright (C) 1999-2013 Free Software Foundation, Inc.
+ Copyright (C) 1999-2014 Free Software Foundation, Inc.
Copyright (C) 1997, 1998, 1999 Colin Plumb.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/randint.c b/lib/randint.c
index 2ae76584..1e5e0a0c 100644
--- a/lib/randint.c
+++ b/lib/randint.c
@@ -1,6 +1,6 @@
/* Generate random integers.
- Copyright (C) 2006-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006-2014 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
diff --git a/lib/randint.h b/lib/randint.h
index fc13270b..151edfdc 100644
--- a/lib/randint.h
+++ b/lib/randint.h
@@ -1,6 +1,6 @@
/* Generate random integers.
- Copyright (C) 2006-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006-2014 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
diff --git a/lib/randperm.c b/lib/randperm.c
index ffa8faa1..1be13511 100644
--- a/lib/randperm.c
+++ b/lib/randperm.c
@@ -1,6 +1,6 @@
/* Generate random permutations.
- Copyright (C) 2006-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006-2014 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
diff --git a/lib/randread.c b/lib/randread.c
index dfba6118..a073cab2 100644
--- a/lib/randread.c
+++ b/lib/randread.c
@@ -1,6 +1,6 @@
/* Generate buffers of random data.
- Copyright (C) 2006-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006-2014 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
@@ -275,12 +275,14 @@ readsource (struct randread_source *s, unsigned char *p, size_t size)
the buffered ISAAC generator in ISAAC. */
static void
-readisaac (struct isaac *isaac, unsigned char *p, size_t size)
+readisaac (struct isaac *isaac, void *p, size_t size)
{
size_t inbytes = isaac->buffered;
while (true)
{
+ char *char_p = p;
+
if (size <= inbytes)
{
memcpy (p, isaac->data.b + ISAAC_BYTES - inbytes, size);
@@ -289,14 +291,14 @@ readisaac (struct isaac *isaac, unsigned char *p, size_t size)
}
memcpy (p, isaac->data.b + ISAAC_BYTES - inbytes, inbytes);
- p += inbytes;
+ p = char_p + inbytes;
size -= inbytes;
/* If P is aligned, write to *P directly to avoid the overhead
of copying from the buffer. */
if (ALIGNED_POINTER (p, isaac_word))
{
- isaac_word *wp = (isaac_word *) p;
+ isaac_word *wp = p;
while (ISAAC_BYTES <= size)
{
isaac_refill (&isaac->state, wp);
@@ -308,7 +310,7 @@ readisaac (struct isaac *isaac, unsigned char *p, size_t size)
return;
}
}
- p = (unsigned char *) wp;
+ p = wp;
}
isaac_refill (&isaac->state, isaac->data.w);
diff --git a/lib/randread.h b/lib/randread.h
index 72ce8581..7223c9d2 100644
--- a/lib/randread.h
+++ b/lib/randread.h
@@ -1,6 +1,6 @@
/* Generate buffers of random data.
- Copyright (C) 2006-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006-2014 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
diff --git a/lib/rawmemchr.c b/lib/rawmemchr.c
deleted file mode 100644
index a0298ce6..00000000
--- a/lib/rawmemchr.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/* Searching in a string.
- Copyright (C) 2008-2013 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-/* Specification. */
-#include <string.h>
-
-/* Find the first occurrence of C in S. */
-void *
-rawmemchr (const void *s, int c_in)
-{
- /* On 32-bit hardware, choosing longword to be a 32-bit unsigned
- long instead of a 64-bit uintmax_t tends to give better
- performance. On 64-bit hardware, unsigned long is generally 64
- bits already. Change this typedef to experiment with
- performance. */
- typedef unsigned long int longword;
-
- const unsigned char *char_ptr;
- const longword *longword_ptr;
- longword repeated_one;
- longword repeated_c;
- unsigned char c;
-
- c = (unsigned char) c_in;
-
- /* Handle the first few bytes by reading one byte at a time.
- Do this until CHAR_PTR is aligned on a longword boundary. */
- for (char_ptr = (const unsigned char *) s;
- (size_t) char_ptr % sizeof (longword) != 0;
- ++char_ptr)
- if (*char_ptr == c)
- return (void *) char_ptr;
-
- longword_ptr = (const longword *) char_ptr;
-
- /* All these elucidatory comments refer to 4-byte longwords,
- but the theory applies equally well to any size longwords. */
-
- /* Compute auxiliary longword values:
- repeated_one is a value which has a 1 in every byte.
- repeated_c has c in every byte. */
- repeated_one = 0x01010101;
- repeated_c = c | (c << 8);
- repeated_c |= repeated_c << 16;
- if (0xffffffffU < (longword) -1)
- {
- repeated_one |= repeated_one << 31 << 1;
- repeated_c |= repeated_c << 31 << 1;
- if (8 < sizeof (longword))
- {
- size_t i;
-
- for (i = 64; i < sizeof (longword) * 8; i *= 2)
- {
- repeated_one |= repeated_one << i;
- repeated_c |= repeated_c << i;
- }
- }
- }
-
- /* Instead of the traditional loop which tests each byte, we will
- test a longword at a time. The tricky part is testing if *any of
- the four* bytes in the longword in question are equal to NUL or
- c. We first use an xor with repeated_c. This reduces the task
- to testing whether *any of the four* bytes in longword1 is zero.
-
- We compute tmp =
- ((longword1 - repeated_one) & ~longword1) & (repeated_one << 7).
- That is, we perform the following operations:
- 1. Subtract repeated_one.
- 2. & ~longword1.
- 3. & a mask consisting of 0x80 in every byte.
- Consider what happens in each byte:
- - If a byte of longword1 is zero, step 1 and 2 transform it into 0xff,
- and step 3 transforms it into 0x80. A carry can also be propagated
- to more significant bytes.
- - If a byte of longword1 is nonzero, let its lowest 1 bit be at
- position k (0 <= k <= 7); so the lowest k bits are 0. After step 1,
- the byte ends in a single bit of value 0 and k bits of value 1.
- After step 2, the result is just k bits of value 1: 2^k - 1. After
- step 3, the result is 0. And no carry is produced.
- So, if longword1 has only non-zero bytes, tmp is zero.
- Whereas if longword1 has a zero byte, call j the position of the least
- significant zero byte. Then the result has a zero at positions 0, ...,
- j-1 and a 0x80 at position j. We cannot predict the result at the more
- significant bytes (positions j+1..3), but it does not matter since we
- already have a non-zero bit at position 8*j+7.
-
- The test whether any byte in longword1 is zero is equivalent
- to testing whether tmp is nonzero.
-
- This test can read beyond the end of a string, depending on where
- C_IN is encountered. However, this is considered safe since the
- initialization phase ensured that the read will be aligned,
- therefore, the read will not cross page boundaries and will not
- cause a fault. */
-
- while (1)
- {
- longword longword1 = *longword_ptr ^ repeated_c;
-
- if ((((longword1 - repeated_one) & ~longword1)
- & (repeated_one << 7)) != 0)
- break;
- longword_ptr++;
- }
-
- char_ptr = (const unsigned char *) longword_ptr;
-
- /* At this point, we know that one of the sizeof (longword) bytes
- starting at char_ptr is == c. On little-endian machines, we
- could determine the first such byte without any further memory
- accesses, just by looking at the tmp result from the last loop
- iteration. But this does not work on big-endian machines.
- Choose code that works in both cases. */
-
- char_ptr = (unsigned char *) longword_ptr;
- while (*char_ptr != c)
- char_ptr++;
- return (void *) char_ptr;
-}
diff --git a/lib/rawmemchr.valgrind b/lib/rawmemchr.valgrind
deleted file mode 100644
index 63639236..00000000
--- a/lib/rawmemchr.valgrind
+++ /dev/null
@@ -1,12 +0,0 @@
-# Suppress a valgrind message about use of uninitialized memory in rawmemchr().
-# This use is OK because it provides only a speedup.
-{
- rawmemchr-value4
- Memcheck:Value4
- fun:rawmemchr
-}
-{
- rawmemchr-value8
- Memcheck:Value8
- fun:rawmemchr
-}
diff --git a/lib/read-file.c b/lib/read-file.c
index bcc5a92f..45f66900 100644
--- a/lib/read-file.c
+++ b/lib/read-file.c
@@ -1,5 +1,5 @@
/* read-file.c -- read file contents into a string
- Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2009-2014 Free Software Foundation, Inc.
Written by Simon Josefsson and Bruno Haible.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/read-file.h b/lib/read-file.h
index 507135f2..f458b482 100644
--- a/lib/read-file.h
+++ b/lib/read-file.h
@@ -1,5 +1,5 @@
/* read-file.h -- read file contents into a string
- Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2009-2014 Free Software Foundation, Inc.
Written by Simon Josefsson.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/read.c b/lib/read.c
index 0fe0306f..d125b51a 100644
--- a/lib/read.c
+++ b/lib/read.c
@@ -1,5 +1,5 @@
/* POSIX compatible read() function.
- Copyright (C) 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2008-2014 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2011.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/readdir.c b/lib/readdir.c
index 3db00806..b74aebe0 100644
--- a/lib/readdir.c
+++ b/lib/readdir.c
@@ -1,5 +1,5 @@
/* Read the next entry of a directory.
- Copyright (C) 2011-2013 Free Software Foundation, Inc.
+ Copyright (C) 2011-2014 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
diff --git a/lib/readlink.c b/lib/readlink.c
index f83a1e01..4c496395 100644
--- a/lib/readlink.c
+++ b/lib/readlink.c
@@ -1,5 +1,5 @@
/* Stub for readlink().
- Copyright (C) 2003-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2003-2007, 2009-2014 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
diff --git a/lib/readlinkat.c b/lib/readlinkat.c
index 504e6ebb..c8a60500 100644
--- a/lib/readlinkat.c
+++ b/lib/readlinkat.c
@@ -1,5 +1,5 @@
/* Read a symlink relative to an open directory.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 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
diff --git a/lib/readtokens.c b/lib/readtokens.c
index b2464bfa..fbed2ca7 100644
--- a/lib/readtokens.c
+++ b/lib/readtokens.c
@@ -1,6 +1,6 @@
/* readtokens.c -- Functions for reading tokens from an input stream.
- Copyright (C) 1990-1991, 1999-2004, 2006, 2009-2013 Free Software
+ Copyright (C) 1990-1991, 1999-2004, 2006, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/readtokens.h b/lib/readtokens.h
index 4f5048b1..e03d3311 100644
--- a/lib/readtokens.h
+++ b/lib/readtokens.h
@@ -1,6 +1,6 @@
/* readtokens.h -- Functions for reading tokens from an input stream.
- Copyright (C) 1990-1991, 1999, 2001-2004, 2009-2013 Free Software
+ Copyright (C) 1990-1991, 1999, 2001-2004, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/readtokens0.c b/lib/readtokens0.c
index b20cb39f..3ced091e 100644
--- a/lib/readtokens0.c
+++ b/lib/readtokens0.c
@@ -1,6 +1,6 @@
/* readtokens0.c -- Read NUL-separated tokens from an input stream.
- Copyright (C) 2004, 2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006, 2009-2014 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
diff --git a/lib/readtokens0.h b/lib/readtokens0.h
index d8852618..cb51f9f9 100644
--- a/lib/readtokens0.h
+++ b/lib/readtokens0.h
@@ -1,6 +1,6 @@
/* readtokens0.h -- read NUL-separated tokens from an input stream.
- Copyright (C) 2004, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2009-2014 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
diff --git a/lib/readutmp.c b/lib/readutmp.c
index ec6e2759..a90290b6 100644
--- a/lib/readutmp.c
+++ b/lib/readutmp.c
@@ -1,6 +1,6 @@
/* GNU's read utmp module.
- Copyright (C) 1992-2001, 2003-2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 1992-2001, 2003-2006, 2009-2014 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
diff --git a/lib/readutmp.h b/lib/readutmp.h
index bfbcca1b..0c5623c2 100644
--- a/lib/readutmp.h
+++ b/lib/readutmp.h
@@ -1,6 +1,6 @@
/* Declarations for GNU's read utmp module.
- Copyright (C) 1992-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 1992-2007, 2009-2014 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
diff --git a/lib/realloc.c b/lib/realloc.c
index b51010a6..8dfcfbe5 100644
--- a/lib/realloc.c
+++ b/lib/realloc.c
@@ -1,6 +1,6 @@
/* realloc() function that is glibc compatible.
- Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2013 Free Software
+ Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/ref-add.sin b/lib/ref-add.sin
index 112bcdc6..0e140229 100644
--- a/lib/ref-add.sin
+++ b/lib/ref-add.sin
@@ -1,6 +1,6 @@
# Add this package to a list of references stored in a text file.
#
-# Copyright (C) 2000, 2009-2013 Free Software Foundation, Inc.
+# Copyright (C) 2000, 2009-2014 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
diff --git a/lib/ref-del.sin b/lib/ref-del.sin
index 6f738684..2dbcf7b2 100644
--- a/lib/ref-del.sin
+++ b/lib/ref-del.sin
@@ -1,6 +1,6 @@
# Remove this package from a list of references stored in a text file.
#
-# Copyright (C) 2000, 2009-2013 Free Software Foundation, Inc.
+# Copyright (C) 2000, 2009-2014 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
diff --git a/lib/regcomp.c b/lib/regcomp.c
index 62dcbed7..a9640922 100644
--- a/lib/regcomp.c
+++ b/lib/regcomp.c
@@ -1,5 +1,5 @@
/* Extended regular expression matching and search library.
- Copyright (C) 2002-2013 Free Software Foundation, Inc.
+ Copyright (C) 2002-2014 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
@@ -292,7 +292,7 @@ weak_alias (__re_compile_fastmap, re_compile_fastmap)
#endif
static inline void
-__attribute ((always_inline))
+__attribute__ ((always_inline))
re_set_fastmap (char *fastmap, bool icase, int ch)
{
fastmap[ch] = 1;
@@ -586,7 +586,7 @@ weak_alias (__regerror, regerror)
static const bitset_t utf8_sb_map =
{
/* Set the first 128 bits. */
-# ifdef __GNUC__
+# if defined __GNUC__ && !defined __STRICT_ANSI__
[0 ... 0x80 / BITSET_WORD_BITS - 1] = BITSET_WORD_MAX
# else
# if 4 * BITSET_WORD_BITS < ASCII_CHARS
@@ -663,7 +663,10 @@ regfree (preg)
{
re_dfa_t *dfa = preg->buffer;
if (BE (dfa != NULL, 1))
- free_dfa_content (dfa);
+ {
+ lock_fini (dfa->lock);
+ free_dfa_content (dfa);
+ }
preg->buffer = NULL;
preg->allocated = 0;
@@ -784,6 +787,8 @@ re_compile_internal (regex_t *preg, const char * pattern, size_t length,
preg->used = sizeof (re_dfa_t);
err = init_dfa (dfa, length);
+ if (BE (err == REG_NOERROR && lock_init (dfa->lock) != 0, 0))
+ err = REG_ESPACE;
if (BE (err != REG_NOERROR, 0))
{
free_dfa_content (dfa);
@@ -797,8 +802,6 @@ re_compile_internal (regex_t *preg, const char * pattern, size_t length,
strncpy (dfa->re_str, pattern, length + 1);
#endif
- __libc_lock_init (dfa->lock);
-
err = re_string_construct (&regexp, pattern, length, preg->translate,
(syntax & RE_ICASE) != 0, dfa);
if (BE (err != REG_NOERROR, 0))
@@ -806,6 +809,7 @@ re_compile_internal (regex_t *preg, const char * pattern, size_t length,
re_compile_internal_free_return:
free_workarea_compile (preg);
re_string_destruct (&regexp);
+ lock_fini (dfa->lock);
free_dfa_content (dfa);
preg->buffer = NULL;
preg->allocated = 0;
@@ -838,6 +842,7 @@ re_compile_internal (regex_t *preg, const char * pattern, size_t length,
if (BE (err != REG_NOERROR, 0))
{
+ lock_fini (dfa->lock);
free_dfa_content (dfa);
preg->buffer = NULL;
preg->allocated = 0;
@@ -2194,7 +2199,11 @@ parse_reg_exp (re_string_t *regexp, regex_t *preg, re_token_t *token,
{
branch = parse_branch (regexp, preg, token, syntax, nest, err);
if (BE (*err != REG_NOERROR && branch == NULL, 0))
- return NULL;
+ {
+ if (tree != NULL)
+ postorder (tree, free_tree, NULL);
+ return NULL;
+ }
}
else
branch = NULL;
@@ -2455,14 +2464,22 @@ parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token,
while (token->type == OP_DUP_ASTERISK || token->type == OP_DUP_PLUS
|| token->type == OP_DUP_QUESTION || token->type == OP_OPEN_DUP_NUM)
{
- tree = parse_dup_op (tree, regexp, dfa, token, syntax, err);
- if (BE (*err != REG_NOERROR && tree == NULL, 0))
- return NULL;
+ bin_tree_t *dup_tree = parse_dup_op (tree, regexp, dfa, token,
+ syntax, err);
+ if (BE (*err != REG_NOERROR && dup_tree == NULL, 0))
+ {
+ if (tree != NULL)
+ postorder (tree, free_tree, NULL);
+ return NULL;
+ }
+ tree = dup_tree;
/* In BRE consecutive duplications are not allowed. */
if ((syntax & RE_CONTEXT_INVALID_DUP)
&& (token->type == OP_DUP_ASTERISK
|| token->type == OP_OPEN_DUP_NUM))
{
+ if (tree != NULL)
+ postorder (tree, free_tree, NULL);
*err = REG_BADRPT;
return NULL;
}
@@ -2618,6 +2635,8 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa,
/* Duplicate ELEM before it is marked optional. */
elem = duplicate_tree (elem, dfa);
+ if (BE (elem == NULL, 0))
+ goto parse_dup_op_espace;
old_tree = tree;
}
else
@@ -2837,40 +2856,29 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
/* Local function for parse_bracket_exp used in _LIBC environment.
Seek the collating symbol entry corresponding to NAME.
- Return the index of the symbol in the SYMB_TABLE. */
+ Return the index of the symbol in the SYMB_TABLE,
+ or -1 if not found. */
auto inline int32_t
- __attribute ((always_inline))
- seek_collating_symbol_entry (name, name_len)
- const unsigned char *name;
- size_t name_len;
+ __attribute__ ((always_inline))
+ seek_collating_symbol_entry (const unsigned char *name, size_t name_len)
{
- int32_t hash = elem_hash ((const char *) name, name_len);
- int32_t elem = hash % table_size;
- if (symb_table[2 * elem] != 0)
- {
- int32_t second = hash % (table_size - 2) + 1;
-
- do
- {
- /* First compare the hashing value. */
- if (symb_table[2 * elem] == hash
- /* Compare the length of the name. */
- && name_len == extra[symb_table[2 * elem + 1]]
- /* Compare the name. */
- && memcmp (name, &extra[symb_table[2 * elem + 1] + 1],
- name_len) == 0)
- {
- /* Yep, this is the entry. */
- break;
- }
+ int32_t elem;
- /* Next entry. */
- elem += second;
- }
- while (symb_table[2 * elem] != 0);
- }
- return elem;
+ for (elem = 0; elem < table_size; elem++)
+ if (symb_table[2 * elem] != 0)
+ {
+ int32_t idx = symb_table[2 * elem + 1];
+ /* Skip the name of collating element name. */
+ idx += 1 + extra[idx];
+ if (/* Compare the length of the name. */
+ name_len == extra[idx]
+ /* Compare the name. */
+ && memcmp (name, &extra[idx + 1], name_len) == 0)
+ /* Yep, this is the entry. */
+ return elem;
+ }
+ return -1;
}
/* Local function for parse_bracket_exp used in _LIBC environment.
@@ -2878,9 +2886,8 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
Return the value if succeeded, UINT_MAX otherwise. */
auto inline unsigned int
- __attribute ((always_inline))
- lookup_collation_sequence_value (br_elem)
- bracket_elem_t *br_elem;
+ __attribute__ ((always_inline))
+ lookup_collation_sequence_value (bracket_elem_t *br_elem)
{
if (br_elem->type == SB_CHAR)
{
@@ -2908,7 +2915,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
int32_t elem, idx;
elem = seek_collating_symbol_entry (br_elem->opr.name,
sym_name_len);
- if (symb_table[2 * elem] != 0)
+ if (elem != -1)
{
/* We found the entry. */
idx = symb_table[2 * elem + 1];
@@ -2926,7 +2933,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
/* Return the collation sequence value. */
return *(unsigned int *) (extra + idx);
}
- else if (symb_table[2 * elem] == 0 && sym_name_len == 1)
+ else if (sym_name_len == 1)
{
/* No valid character. Match it as a single byte
character. */
@@ -2947,12 +2954,9 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
update it. */
auto inline reg_errcode_t
- __attribute ((always_inline))
- build_range_exp (sbcset, mbcset, range_alloc, start_elem, end_elem)
- re_charset_t *mbcset;
- Idx *range_alloc;
- bitset_t sbcset;
- bracket_elem_t *start_elem, *end_elem;
+ __attribute__ ((always_inline))
+ build_range_exp (bitset_t sbcset, re_charset_t *mbcset, int *range_alloc,
+ bracket_elem_t *start_elem, bracket_elem_t *end_elem)
{
unsigned int ch;
uint32_t start_collseq;
@@ -3031,26 +3035,23 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
pointer argument since we may update it. */
auto inline reg_errcode_t
- __attribute ((always_inline))
- build_collating_symbol (sbcset, mbcset, coll_sym_alloc, name)
- re_charset_t *mbcset;
- Idx *coll_sym_alloc;
- bitset_t sbcset;
- const unsigned char *name;
+ __attribute__ ((always_inline))
+ build_collating_symbol (bitset_t sbcset, re_charset_t *mbcset,
+ Idx *coll_sym_alloc, const unsigned char *name)
{
int32_t elem, idx;
size_t name_len = strlen ((const char *) name);
if (nrules != 0)
{
elem = seek_collating_symbol_entry (name, name_len);
- if (symb_table[2 * elem] != 0)
+ if (elem != -1)
{
/* We found the entry. */
idx = symb_table[2 * elem + 1];
/* Skip the name of collating element name. */
idx += 1 + extra[idx];
}
- else if (symb_table[2 * elem] == 0 && name_len == 1)
+ else if (name_len == 1)
{
/* No valid character, treat it as a normal
character. */
diff --git a/lib/regex.c b/lib/regex.c
index df90e10d..95beb6fb 100644
--- a/lib/regex.c
+++ b/lib/regex.c
@@ -1,5 +1,5 @@
/* Extended regular expression matching and search library.
- Copyright (C) 2002-2013 Free Software Foundation, Inc.
+ Copyright (C) 2002-2014 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
@@ -24,6 +24,7 @@
# pragma GCC diagnostic ignored "-Wsuggest-attribute=pure"
# endif
# if (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) || 4 < __GNUC__
+# pragma GCC diagnostic ignored "-Wold-style-definition"
# pragma GCC diagnostic ignored "-Wtype-limits"
# endif
#endif
diff --git a/lib/regex.h b/lib/regex.h
index 854c6eda..70f2126c 100644
--- a/lib/regex.h
+++ b/lib/regex.h
@@ -1,6 +1,6 @@
/* Definitions for data structures and routines for the regular
expression library.
- Copyright (C) 1985, 1989-1993, 1995-1998, 2000-2003, 2005-2013 Free Software
+ Copyright (C) 1985, 1989-1993, 1995-1998, 2000-2003, 2005-2014 Free Software
Foundation, Inc.
This file is part of the GNU C Library.
@@ -608,7 +608,7 @@ extern void re_set_registers (struct re_pattern_buffer *__buffer,
regoff_t *__starts, regoff_t *__ends);
#endif /* Use GNU */
-#if defined _REGEX_RE_COMP || (defined _LIBC && defined __USE_BSD)
+#if defined _REGEX_RE_COMP || (defined _LIBC && defined __USE_MISC)
# ifndef _CRAY
/* 4.2 bsd compatibility. */
extern char *re_comp (const char *);
diff --git a/lib/regex_internal.c b/lib/regex_internal.c
index d8bdbd3f..3186b793 100644
--- a/lib/regex_internal.c
+++ b/lib/regex_internal.c
@@ -1,5 +1,5 @@
/* Extended regular expression matching and search library.
- Copyright (C) 2002-2013 Free Software Foundation, Inc.
+ Copyright (C) 2002-2014 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
@@ -313,12 +313,11 @@ build_wcs_upper_buffer (re_string_t *pstr)
+ byte_idx), remain_len, &pstr->cur_state);
if (BE (mbclen < (size_t) -2, 1))
{
- wchar_t wcu = wc;
- if (iswlower (wc))
+ wchar_t wcu = towupper (wc);
+ if (wcu != wc)
{
size_t mbcdlen;
- wcu = towupper (wc);
mbcdlen = wcrtomb (buf, wcu, &prev_st);
if (BE (mbclen == mbcdlen, 1))
memcpy (pstr->mbs + byte_idx, buf, mbclen);
@@ -383,12 +382,11 @@ build_wcs_upper_buffer (re_string_t *pstr)
mbclen = __mbrtowc (&wc, p, remain_len, &pstr->cur_state);
if (BE (mbclen < (size_t) -2, 1))
{
- wchar_t wcu = wc;
- if (iswlower (wc))
+ wchar_t wcu = towupper (wc);
+ if (wcu != wc)
{
size_t mbcdlen;
- wcu = towupper (wc);
mbcdlen = wcrtomb ((char *) buf, wcu, &prev_st);
if (BE (mbclen == mbcdlen, 1))
memcpy (pstr->mbs + byte_idx, buf, mbclen);
@@ -540,10 +538,7 @@ build_upper_buffer (re_string_t *pstr)
int ch = pstr->raw_mbs[pstr->raw_mbs_idx + char_idx];
if (BE (pstr->trans != NULL, 0))
ch = pstr->trans[ch];
- if (islower (ch))
- pstr->mbs[char_idx] = toupper (ch);
- else
- pstr->mbs[char_idx] = ch;
+ pstr->mbs[char_idx] = toupper (ch);
}
pstr->valid_len = char_idx;
pstr->valid_raw_len = char_idx;
@@ -836,7 +831,7 @@ re_string_reconstruct (re_string_t *pstr, Idx idx, int eflags)
}
static unsigned char
-internal_function __attribute ((pure))
+internal_function __attribute__ ((pure))
re_string_peek_byte_case (const re_string_t *pstr, Idx idx)
{
int ch;
@@ -1356,7 +1351,7 @@ re_node_set_insert_last (re_node_set *set, Idx elem)
Return true if SET1 and SET2 are equivalent. */
static bool
-internal_function __attribute ((pure))
+internal_function __attribute__ ((pure))
re_node_set_compare (const re_node_set *set1, const re_node_set *set2)
{
Idx i;
@@ -1371,7 +1366,7 @@ re_node_set_compare (const re_node_set *set1, const re_node_set *set2)
/* Return (idx + 1) if SET contains the element ELEM, return 0 otherwise. */
static Idx
-internal_function __attribute ((pure))
+internal_function __attribute__ ((pure))
re_node_set_contains (const re_node_set *set, Idx elem)
{
__re_size_t idx, right, mid;
diff --git a/lib/regex_internal.h b/lib/regex_internal.h
index 8e720218..a35ccb72 100644
--- a/lib/regex_internal.h
+++ b/lib/regex_internal.h
@@ -1,5 +1,5 @@
/* Extended regular expression matching and search library.
- Copyright (C) 2002-2013 Free Software Foundation, Inc.
+ Copyright (C) 2002-2014 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
@@ -32,12 +32,50 @@
#include <wctype.h>
#include <stdbool.h>
#include <stdint.h>
-#if defined _LIBC
+
+#ifdef _LIBC
# include <bits/libc-lock.h>
+# define lock_define(name) __libc_lock_define (, name)
+# define lock_init(lock) (__libc_lock_init (lock), 0)
+# define lock_fini(lock) 0
+# define lock_lock(lock) __libc_lock_lock (lock)
+# define lock_unlock(lock) __libc_lock_unlock (lock)
+#elif defined GNULIB_LOCK && !defined USE_UNLOCKED_IO
+# include "glthread/lock.h"
+ /* Use gl_lock_define if empty macro arguments are known to work.
+ Otherwise, fall back on less-portable substitutes. */
+# if ((defined __GNUC__ && !defined __STRICT_ANSI__) \
+ || (defined __STDC_VERSION__ && 199901L <= __STDC_VERSION__))
+# define lock_define(name) gl_lock_define (, name)
+# elif USE_POSIX_THREADS
+# define lock_define(name) pthread_mutex_t name;
+# elif USE_PTH_THREADS
+# define lock_define(name) pth_mutex_t name;
+# elif USE_SOLARIS_THREADS
+# define lock_define(name) mutex_t name;
+# elif USE_WINDOWS_THREADS
+# define lock_define(name) gl_lock_t name;
+# else
+# define lock_define(name)
+# endif
+# define lock_init(lock) glthread_lock_init (&(lock))
+# define lock_fini(lock) glthread_lock_destroy (&(lock))
+# define lock_lock(lock) glthread_lock_lock (&(lock))
+# define lock_unlock(lock) glthread_lock_unlock (&(lock))
+#elif defined GNULIB_PTHREAD && !defined USE_UNLOCKED_IO
+# include <pthread.h>
+# define lock_define(name) pthread_mutex_t name;
+# define lock_init(lock) pthread_mutex_init (&(lock), 0)
+# define lock_fini(lock) pthread_mutex_destroy (&(lock))
+# define lock_lock(lock) pthread_mutex_lock (&(lock))
+# define lock_unlock(lock) pthread_mutex_unlock (&(lock))
#else
-# define __libc_lock_init(NAME) do { } while (0)
-# define __libc_lock_lock(NAME) do { } while (0)
-# define __libc_lock_unlock(NAME) do { } while (0)
+# define lock_define(name)
+# define lock_init(lock) 0
+# define lock_fini(lock) ((void) 0)
+ /* The 'dfa' avoids an "unused variable 'dfa'" warning from GCC. */
+# define lock_lock(lock) ((void) dfa)
+# define lock_unlock(lock) ((void) 0)
#endif
/* In case that the system doesn't have isblank(). */
@@ -72,7 +110,7 @@
# define gettext_noop(String) String
#endif
-#if (defined MB_CUR_MAX && HAVE_WCTYPE_H && HAVE_ISWCTYPE && HAVE_WCSCOLL) || _LIBC
+#if (defined MB_CUR_MAX && HAVE_WCTYPE_H && HAVE_ISWCTYPE) || _LIBC
# define RE_ENABLE_I18N
#endif
@@ -107,10 +145,8 @@
# define attribute_hidden
#endif /* not _LIBC */
-#if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
-# define __attribute(arg) __attribute__ (arg)
-#else
-# define __attribute(arg)
+#if __GNUC__ < 3 + (__GNUC_MINOR__ < 1)
+# define __attribute__(arg)
#endif
typedef __re_idx_t Idx;
@@ -426,7 +462,7 @@ static void build_upper_buffer (re_string_t *pstr) internal_function;
static void re_string_translate_buffer (re_string_t *pstr) internal_function;
static unsigned int re_string_context_at (const re_string_t *input, Idx idx,
int eflags)
- internal_function __attribute ((pure));
+ internal_function __attribute__ ((pure));
#endif
#define re_string_peek_byte(pstr, offset) \
((pstr)->mbs[(pstr)->cur_idx + offset])
@@ -700,9 +736,7 @@ struct re_dfa_t
#ifdef DEBUG
char* re_str;
#endif
-#ifdef _LIBC
- __libc_lock_define (, lock)
-#endif
+ lock_define (lock)
};
#define re_node_set_init_empty(set) memset (set, '\0', sizeof (re_node_set))
@@ -774,7 +808,7 @@ bitset_copy (bitset_t dest, const bitset_t src)
memcpy (dest, src, sizeof (bitset_t));
}
-static void
+static void __attribute__ ((unused))
bitset_not (bitset_t set)
{
int bitset_i;
@@ -786,7 +820,7 @@ bitset_not (bitset_t set)
& ~set[BITSET_WORDS - 1]);
}
-static void
+static void __attribute__ ((unused))
bitset_merge (bitset_t dest, const bitset_t src)
{
int bitset_i;
@@ -794,7 +828,7 @@ bitset_merge (bitset_t dest, const bitset_t src)
dest[bitset_i] |= src[bitset_i];
}
-static void
+static void __attribute__ ((unused))
bitset_mask (bitset_t dest, const bitset_t src)
{
int bitset_i;
@@ -805,7 +839,7 @@ bitset_mask (bitset_t dest, const bitset_t src)
#ifdef RE_ENABLE_I18N
/* Functions for re_string. */
static int
-internal_function __attribute ((pure))
+internal_function __attribute__ ((pure, unused))
re_string_char_size_at (const re_string_t *pstr, Idx idx)
{
int byte_idx;
@@ -818,7 +852,7 @@ re_string_char_size_at (const re_string_t *pstr, Idx idx)
}
static wint_t
-internal_function __attribute ((pure))
+internal_function __attribute__ ((pure, unused))
re_string_wchar_at (const re_string_t *pstr, Idx idx)
{
if (pstr->mb_cur_max == 1)
@@ -828,7 +862,7 @@ re_string_wchar_at (const re_string_t *pstr, Idx idx)
# ifndef NOT_IN_libc
static int
-internal_function __attribute ((pure))
+internal_function __attribute__ ((pure, unused))
re_string_elem_size_at (const re_string_t *pstr _UNUSED_PARAMETER_,
Idx idx _UNUSED_PARAMETER_)
{
diff --git a/lib/regexec.c b/lib/regexec.c
index 6be6d7e4..fc05e925 100644
--- a/lib/regexec.c
+++ b/lib/regexec.c
@@ -1,5 +1,5 @@
/* Extended regular expression matching and search library.
- Copyright (C) 2002-2013 Free Software Foundation, Inc.
+ Copyright (C) 2002-2014 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
@@ -230,9 +230,7 @@ regexec (preg, string, nmatch, pmatch, eflags)
{
reg_errcode_t err;
Idx start, length;
-#ifdef _LIBC
re_dfa_t *dfa = preg->buffer;
-#endif
if (eflags & ~(REG_NOTBOL | REG_NOTEOL | REG_STARTEND))
return REG_BADPAT;
@@ -248,14 +246,14 @@ regexec (preg, string, nmatch, pmatch, eflags)
length = strlen (string);
}
- __libc_lock_lock (dfa->lock);
+ lock_lock (dfa->lock);
if (preg->no_sub)
err = re_search_internal (preg, string, length, start, length,
length, 0, NULL, eflags);
else
err = re_search_internal (preg, string, length, start, length,
length, nmatch, pmatch, eflags);
- __libc_lock_unlock (dfa->lock);
+ lock_unlock (dfa->lock);
return err != REG_NOERROR;
}
@@ -426,9 +424,7 @@ re_search_stub (struct re_pattern_buffer *bufp,
Idx nregs;
regoff_t rval;
int eflags = 0;
-#ifdef _LIBC
re_dfa_t *dfa = bufp->buffer;
-#endif
Idx last_start = start + range;
/* Check for out-of-range. */
@@ -442,7 +438,7 @@ re_search_stub (struct re_pattern_buffer *bufp,
else if (BE (/* last_start < 0 || */ (range < 0 && start <= last_start), 0))
last_start = 0;
- __libc_lock_lock (dfa->lock);
+ lock_lock (dfa->lock);
eflags |= (bufp->not_bol) ? REG_NOTBOL : 0;
eflags |= (bufp->not_eol) ? REG_NOTEOL : 0;
@@ -506,7 +502,7 @@ re_search_stub (struct re_pattern_buffer *bufp,
}
re_free (pmatch);
out:
- __libc_lock_unlock (dfa->lock);
+ lock_unlock (dfa->lock);
return rval;
}
@@ -1072,7 +1068,7 @@ prune_impossible_nodes (re_match_context_t *mctx)
since initial states may have constraints like "\<", "^", etc.. */
static inline re_dfastate_t *
-__attribute ((always_inline)) internal_function
+__attribute__ ((always_inline)) internal_function
acquire_init_state_context (reg_errcode_t *err, const re_match_context_t *mctx,
Idx idx)
{
diff --git a/lib/remove.c b/lib/remove.c
index 020fdab8..15d762dd 100644
--- a/lib/remove.c
+++ b/lib/remove.c
@@ -1,5 +1,5 @@
/* Remove a file or directory.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 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
diff --git a/lib/rename.c b/lib/rename.c
index 3e463ea8..608f8387 100644
--- a/lib/rename.c
+++ b/lib/rename.c
@@ -1,6 +1,6 @@
/* Work around rename bugs in some systems.
- Copyright (C) 2001-2003, 2005-2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2001-2003, 2005-2006, 2009-2014 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
@@ -285,7 +285,7 @@ rpl_rename (char const *src, char const *dst)
char *dst_temp = (char *) dst;
bool src_slash;
bool dst_slash;
- bool dst_exists;
+ bool dst_exists _GL_UNUSED;
int ret_val = -1;
int rename_errno = ENOTDIR;
struct stat src_st;
@@ -462,7 +462,9 @@ rpl_rename (char const *src, char const *dst)
ret_val = rename (src_temp, dst_temp);
rename_errno = errno;
- out:
+
+ out: _GL_UNUSED_LABEL;
+
if (src_temp != src)
free (src_temp);
if (dst_temp != dst)
diff --git a/lib/rewinddir.c b/lib/rewinddir.c
index d842f8ce..d201ffa0 100644
--- a/lib/rewinddir.c
+++ b/lib/rewinddir.c
@@ -1,5 +1,5 @@
/* Restart reading the entries of a directory from the beginning.
- Copyright (C) 2011-2013 Free Software Foundation, Inc.
+ Copyright (C) 2011-2014 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
diff --git a/lib/rmdir.c b/lib/rmdir.c
index a8d907eb..ec7a586f 100644
--- a/lib/rmdir.c
+++ b/lib/rmdir.c
@@ -1,6 +1,6 @@
/* Work around rmdir bugs.
- Copyright (C) 1988, 1990, 1999, 2003-2006, 2009-2013 Free Software
+ Copyright (C) 1988, 1990, 1999, 2003-2006, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/root-dev-ino.c b/lib/root-dev-ino.c
index 96e3a624..3a4ec67c 100644
--- a/lib/root-dev-ino.c
+++ b/lib/root-dev-ino.c
@@ -1,5 +1,5 @@
/* root-dev-ino.c -- get the device and inode numbers for '/'.
- Copyright (C) 2003-2013 Free Software Foundation, Inc.
+ Copyright (C) 2003-2014 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
diff --git a/lib/root-dev-ino.h b/lib/root-dev-ino.h
index 1a0f8ff4..60232083 100644
--- a/lib/root-dev-ino.h
+++ b/lib/root-dev-ino.h
@@ -1,6 +1,6 @@
/* Root device and inode number checking.
- Copyright (C) 2003-2013 Free Software Foundation, Inc.
+ Copyright (C) 2003-2014 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
diff --git a/lib/root-uid.h b/lib/root-uid.h
index c75d8889..39e3c995 100644
--- a/lib/root-uid.h
+++ b/lib/root-uid.h
@@ -1,6 +1,6 @@
/* The user ID that always has appropriate privileges in the POSIX sense.
- Copyright 2012-2013 Free Software Foundation, Inc.
+ Copyright 2012-2014 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
diff --git a/lib/rpmatch.c b/lib/rpmatch.c
index cf125238..44810820 100644
--- a/lib/rpmatch.c
+++ b/lib/rpmatch.c
@@ -1,7 +1,7 @@
/* Determine whether string value is affirmation or negative response
according to current locale's data.
- Copyright (C) 1996, 1998, 2000, 2002-2003, 2006-2013 Free Software
+ Copyright (C) 1996, 1998, 2000, 2002-2003, 2006-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -110,7 +110,10 @@ try (const char *response, const char *pattern, char **lastp, regex_t *re)
return -1;
/* Compile the pattern and cache it for future runs. */
if (regcomp (re, safe_pattern, REG_EXTENDED) != 0)
- return -1;
+ {
+ free (safe_pattern);
+ return -1;
+ }
*lastp = safe_pattern;
}
diff --git a/lib/safe-read.c b/lib/safe-read.c
index 6a48c0cc..c9b8828a 100644
--- a/lib/safe-read.c
+++ b/lib/safe-read.c
@@ -1,6 +1,6 @@
/* An interface to read and write that retries after interrupts.
- Copyright (C) 1993-1994, 1998, 2002-2006, 2009-2013 Free Software
+ Copyright (C) 1993-1994, 1998, 2002-2006, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/safe-read.h b/lib/safe-read.h
index 992b7a6a..aba8bdb3 100644
--- a/lib/safe-read.h
+++ b/lib/safe-read.h
@@ -1,5 +1,5 @@
/* An interface to read() that retries after interrupts.
- Copyright (C) 2002, 2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006, 2009-2014 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
diff --git a/lib/safe-write.c b/lib/safe-write.c
index fed363ce..bf72dd4d 100644
--- a/lib/safe-write.c
+++ b/lib/safe-write.c
@@ -1,5 +1,5 @@
/* An interface to write that retries after interrupts.
- Copyright (C) 2002, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2009-2014 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
diff --git a/lib/safe-write.h b/lib/safe-write.h
index 30f6e799..ae186572 100644
--- a/lib/safe-write.h
+++ b/lib/safe-write.h
@@ -1,5 +1,5 @@
/* An interface to write() that retries after interrupts.
- Copyright (C) 2002, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2009-2014 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
diff --git a/lib/same-inode.h b/lib/same-inode.h
index 3843b070..584f6065 100644
--- a/lib/same-inode.h
+++ b/lib/same-inode.h
@@ -1,6 +1,6 @@
/* Determine whether two stat buffers refer to the same file.
- Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2009-2014 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
diff --git a/lib/same.c b/lib/same.c
index 5457f218..5c00e8a3 100644
--- a/lib/same.c
+++ b/lib/same.c
@@ -1,6 +1,6 @@
/* Determine whether two file names refer to the same file.
- Copyright (C) 1997-2000, 2002-2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 1997-2000, 2002-2006, 2009-2014 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
diff --git a/lib/same.h b/lib/same.h
index 9a686060..5f5c0059 100644
--- a/lib/same.h
+++ b/lib/same.h
@@ -1,6 +1,6 @@
/* Determine whether two file names refer to the same file.
- Copyright (C) 1997-2000, 2003-2004, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 1997-2000, 2003-2004, 2009-2014 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
diff --git a/lib/save-cwd.c b/lib/save-cwd.c
index 9ae37b08..7aafacd4 100644
--- a/lib/save-cwd.c
+++ b/lib/save-cwd.c
@@ -1,6 +1,6 @@
/* save-cwd.c -- Save and restore current working directory.
- Copyright (C) 1995, 1997-1998, 2003-2006, 2009-2013 Free Software
+ Copyright (C) 1995, 1997-1998, 2003-2006, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/save-cwd.h b/lib/save-cwd.h
index 614b035e..6b84e460 100644
--- a/lib/save-cwd.h
+++ b/lib/save-cwd.h
@@ -1,6 +1,6 @@
/* Save and restore current working directory.
- Copyright (C) 1995, 1997-1998, 2003, 2009-2013 Free Software Foundation,
+ Copyright (C) 1995, 1997-1998, 2003, 2009-2014 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/savedir.c b/lib/savedir.c
index 6d5ed7f4..111d84be 100644
--- a/lib/savedir.c
+++ b/lib/savedir.c
@@ -1,6 +1,6 @@
/* savedir.c -- save the list of files in a directory in a string
- Copyright (C) 1990, 1997-2001, 2003-2006, 2009-2013 Free Software
+ Copyright (C) 1990, 1997-2001, 2003-2006, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -37,29 +37,71 @@
#include "xalloc.h"
-#ifndef NAME_SIZE_DEFAULT
-# define NAME_SIZE_DEFAULT 512
+typedef struct
+{
+ char *name;
+#if D_INO_IN_DIRENT
+ ino_t ino;
+#endif
+} direntry_t;
+
+/* Compare the names of two directory entries */
+
+static int
+direntry_cmp_name (void const *a, void const *b)
+{
+ direntry_t const *dea = a;
+ direntry_t const *deb = b;
+
+ return strcmp (dea->name, deb->name);
+}
+
+#if D_INO_IN_DIRENT
+/* Compare the inode numbers of two directory entries */
+
+static int
+direntry_cmp_inode (void const *a, void const *b)
+{
+ direntry_t const *dea = a;
+ direntry_t const *deb = b;
+
+ return dea->ino < deb->ino ? -1 : dea->ino > deb->ino;
+}
#endif
+typedef int (*comparison_function) (void const *, void const *);
+
+static comparison_function const comparison_function_table[] =
+ {
+ 0,
+ direntry_cmp_name
+#if D_INO_IN_DIRENT
+ , direntry_cmp_inode
+#endif
+ };
+
/* Return a freshly allocated string containing the file names
in directory DIRP, separated by '\0' characters;
the end is marked by two '\0' characters in a row.
+ Returned values are sorted according to OPTION.
Return NULL (setting errno) if DIRP cannot be read.
If DIRP is NULL, return NULL without affecting errno. */
char *
-streamsavedir (DIR *dirp)
+streamsavedir (DIR *dirp, enum savedir_option option)
{
- char *name_space;
- size_t allocated = NAME_SIZE_DEFAULT;
+ char *name_space = NULL;
+ size_t allocated = 0;
+ direntry_t *entries = NULL;
+ size_t entries_allocated = 0;
+ size_t entries_used = 0;
size_t used = 0;
- int save_errno;
+ int readdir_errno;
+ comparison_function cmp = comparison_function_table[option];
if (dirp == NULL)
return NULL;
- name_space = xmalloc (allocated);
-
for (;;)
{
struct dirent const *dp;
@@ -76,48 +118,64 @@ streamsavedir (DIR *dirp)
if (entry[entry[0] != '.' ? 0 : entry[1] != '.' ? 1 : 2] != '\0')
{
size_t entry_size = _D_EXACT_NAMLEN (dp) + 1;
- if (used + entry_size < used)
- xalloc_die ();
- if (allocated <= used + entry_size)
+ if (cmp)
+ {
+ if (entries_allocated == entries_used)
+ {
+ size_t n = entries_allocated;
+ entries = x2nrealloc (entries, &n, sizeof *entries);
+ entries_allocated = n;
+ }
+ entries[entries_used].name = xstrdup (entry);
+#if D_INO_IN_DIRENT
+ entries[entries_used].ino = dp->d_ino;
+#endif
+ entries_used++;
+ }
+ else
{
- do
+ if (allocated - used <= entry_size)
{
- if (2 * allocated < allocated)
+ size_t n = used + entry_size;
+ if (n < used)
xalloc_die ();
- allocated *= 2;
+ name_space = x2nrealloc (name_space, &n, 1);
+ allocated = n;
}
- while (allocated <= used + entry_size);
-
- name_space = xrealloc (name_space, allocated);
+ memcpy (name_space + used, entry, entry_size);
}
- memcpy (name_space + used, entry, entry_size);
used += entry_size;
}
}
- name_space[used] = '\0';
- save_errno = errno;
- if (save_errno != 0)
+
+ readdir_errno = errno;
+ if (readdir_errno != 0)
{
+ free (entries);
free (name_space);
- errno = save_errno;
+ errno = readdir_errno;
return NULL;
}
- return name_space;
-}
-
-/* Like streamsavedir (DIRP), except also close DIRP. */
-static char *
-savedirstream (DIR *dirp)
-{
- char *name_space = streamsavedir (dirp);
- if (dirp && closedir (dirp) != 0)
+ if (cmp)
{
- int save_errno = errno;
- free (name_space);
- errno = save_errno;
- return NULL;
+ size_t i;
+
+ qsort (entries, entries_used, sizeof *entries, cmp);
+ name_space = xmalloc (used + 1);
+ used = 0;
+ for (i = 0; i < entries_used; i++)
+ {
+ char *dest = name_space + used;
+ used += stpcpy (dest, entries[i].name) - dest + 1;
+ free (entries[i].name);
+ }
+ free (entries);
}
+ else if (used == allocated)
+ name_space = xrealloc (name_space, used + 1);
+
+ name_space[used] = '\0';
return name_space;
}
@@ -127,19 +185,21 @@ savedirstream (DIR *dirp)
Return NULL (setting errno) if DIR cannot be opened, read, or closed. */
char *
-savedir (char const *dir)
+savedir (char const *dir, enum savedir_option option)
{
- return savedirstream (opendir (dir));
-}
-
-/* Return a freshly allocated string containing the file names
- in directory FD, separated by '\0' characters;
- the end is marked by two '\0' characters in a row.
- Return NULL (setting errno) if FD cannot be read or closed. */
-
-/* deprecated */
-char *
-fdsavedir (int fd)
-{
- return savedirstream (fdopendir (fd));
+ DIR *dirp = opendir (dir);
+ if (! dirp)
+ return NULL;
+ else
+ {
+ char *name_space = streamsavedir (dirp, option);
+ if (closedir (dirp) != 0)
+ {
+ int closedir_errno = errno;
+ free (name_space);
+ errno = closedir_errno;
+ return NULL;
+ }
+ return name_space;
+ }
}
diff --git a/lib/savedir.h b/lib/savedir.h
index eedb0c45..aff4ad99 100644
--- a/lib/savedir.h
+++ b/lib/savedir.h
@@ -1,6 +1,6 @@
/* Save the list of files in a directory in a string.
- Copyright (C) 1997, 1999, 2001, 2003, 2005, 2009-2013 Free Software
+ Copyright (C) 1997, 1999, 2001, 2003, 2005, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -22,8 +22,20 @@
#define _GL_SAVEDIR_H
#include <dirent.h>
-char *streamsavedir (DIR *dirp);
-char *savedir (char const *dir);
-char *fdsavedir (int fd); /* deprecated */
+
+enum savedir_option
+ {
+ SAVEDIR_SORT_NONE,
+ SAVEDIR_SORT_NAME,
+#if D_INO_IN_DIRENT
+ SAVEDIR_SORT_INODE,
+ SAVEDIR_SORT_FASTREAD = SAVEDIR_SORT_INODE
+#else
+ SAVEDIR_SORT_FASTREAD = SAVEDIR_SORT_NONE
+#endif
+ };
+
+char *streamsavedir (DIR *, enum savedir_option);
+char *savedir (char const *, enum savedir_option);
#endif
diff --git a/lib/savewd.c b/lib/savewd.c
index 728bc8a7..88c5feff 100644
--- a/lib/savewd.c
+++ b/lib/savewd.c
@@ -1,6 +1,6 @@
/* Save and restore the working directory, possibly using a child process.
- Copyright (C) 2006-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006-2007, 2009-2014 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
diff --git a/lib/savewd.h b/lib/savewd.h
index 61912bc9..cd0817b7 100644
--- a/lib/savewd.h
+++ b/lib/savewd.h
@@ -1,6 +1,6 @@
/* Save and restore the working directory, possibly using a subprocess.
- Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2009-2014 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
@@ -23,6 +23,9 @@
#include <stdbool.h>
#include <sys/types.h>
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
_GL_INLINE_HEADER_BEGIN
#ifndef SAVEWD_INLINE
# define SAVEWD_INLINE _GL_INLINE
diff --git a/lib/sched.in.h b/lib/sched.in.h
index 731e800f..edebf810 100644
--- a/lib/sched.in.h
+++ b/lib/sched.in.h
@@ -1,5 +1,5 @@
/* Replacement <sched.h> for platforms that lack it.
- Copyright (C) 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2008-2014 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
diff --git a/lib/se-context.in.h b/lib/se-context.in.h
index a692f5a0..c3890a2b 100644
--- a/lib/se-context.in.h
+++ b/lib/se-context.in.h
@@ -3,6 +3,9 @@
# include <errno.h>
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
_GL_INLINE_HEADER_BEGIN
#ifndef SE_CONTEXT_INLINE
# define SE_CONTEXT_INLINE _GL_INLINE
@@ -29,6 +32,14 @@ SE_CONTEXT_INLINE int context_range_set (context_t sc _GL_UNUSED_PARAMETER,
SE_CONTEXT_INLINE int context_type_set (context_t sc _GL_UNUSED_PARAMETER,
char const *s _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
+SE_CONTEXT_INLINE char *context_type_get (context_t sc _GL_UNUSED_PARAMETER)
+ { errno = ENOTSUP; return (void *) 0; }
+SE_CONTEXT_INLINE char *context_range_get (context_t sc _GL_UNUSED_PARAMETER)
+ { errno = ENOTSUP; return (void *) 0; }
+SE_CONTEXT_INLINE char *context_role_get (context_t sc _GL_UNUSED_PARAMETER)
+ { errno = ENOTSUP; return (void *) 0; }
+SE_CONTEXT_INLINE char *context_user_get (context_t sc _GL_UNUSED_PARAMETER)
+ { errno = ENOTSUP; return (void *) 0; }
_GL_INLINE_HEADER_END
diff --git a/lib/se-selinux.in.h b/lib/se-selinux.in.h
index 7f54f1e9..5eb92a20 100644
--- a/lib/se-selinux.in.h
+++ b/lib/se-selinux.in.h
@@ -1,5 +1,5 @@
/* Replacement <selinux/selinux.h> for platforms that lack it.
- Copyright (C) 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2008-2014 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
@@ -31,6 +31,9 @@
# include <sys/types.h>
# include <errno.h>
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
_GL_INLINE_HEADER_BEGIN
# ifndef SE_SELINUX_INLINE
# define SE_SELINUX_INLINE _GL_INLINE
@@ -41,7 +44,7 @@ _GL_INLINE_HEADER_BEGIN
# if !GNULIB_defined_security_types
typedef unsigned short security_class_t;
-# define security_context_t char*
+typedef char *security_context_t;
# define is_selinux_enabled() 0
SE_SELINUX_INLINE int
@@ -100,6 +103,9 @@ security_compute_create (security_context_t scon _GL_UNUSED_PARAMETER,
security_class_t tclass _GL_UNUSED_PARAMETER,
security_context_t *newcon _GL_UNUSED_PARAMETER)
{ errno = ENOTSUP; return -1; }
+SE_SELINUX_INLINE security_class_t
+string_to_security_class (char const *name)
+ { errno = ENOTSUP; return 0; }
SE_SELINUX_INLINE int
matchpathcon_init_prefix (char const *path _GL_UNUSED_PARAMETER,
char const *prefix _GL_UNUSED_PARAMETER)
@@ -108,6 +114,9 @@ matchpathcon_init_prefix (char const *path _GL_UNUSED_PARAMETER,
# define GNULIB_defined_security_types 1
# endif
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
_GL_INLINE_HEADER_BEGIN
# endif
diff --git a/lib/secure_getenv.c b/lib/secure_getenv.c
new file mode 100644
index 00000000..32819e6d
--- /dev/null
+++ b/lib/secure_getenv.c
@@ -0,0 +1,41 @@
+/* Look up an environment variable more securely.
+
+ Copyright 2013-2014 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+#include <stdlib.h>
+
+#if !HAVE___SECURE_GETENV
+# if HAVE_ISSETUGID
+# include <unistd.h>
+# else
+# undef issetugid
+# define issetugid() 1
+# endif
+#endif
+
+char *
+secure_getenv (char const *name)
+{
+#if HAVE___SECURE_GETENV
+ return __secure_getenv (name);
+#else
+ if (issetugid ())
+ return 0;
+ return getenv (name);
+#endif
+}
diff --git a/lib/select.c b/lib/select.c
index c02558e1..81af82cd 100644
--- a/lib/select.c
+++ b/lib/select.c
@@ -1,7 +1,7 @@
/* Emulation for select(2)
Contributed by Paolo Bonzini.
- Copyright 2008-2013 Free Software Foundation, Inc.
+ Copyright 2008-2014 Free Software Foundation, Inc.
This file is part of gnulib.
@@ -82,9 +82,11 @@ typedef DWORD (WINAPI *PNtQueryInformationFile)
#define PIPE_BUF 512
#endif
-/* Optimized test whether a HANDLE refers to a console.
- See <http://lists.gnu.org/archive/html/bug-gnulib/2009-08/msg00065.html>. */
-#define IsConsoleHandle(h) (((intptr_t) (h) & 3) == 3)
+static BOOL IsConsoleHandle (HANDLE h)
+{
+ DWORD mode;
+ return GetConsoleMode (h, &mode) != 0;
+}
static BOOL
IsSocketHandle (HANDLE h)
@@ -252,6 +254,7 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *xfds,
DWORD ret, wait_timeout, nhandles, nsock, nbuffer;
MSG msg;
int i, fd, rc;
+ clock_t tend;
if (nfds > FD_SETSIZE)
nfds = FD_SETSIZE;
@@ -388,6 +391,10 @@ rpl_select (int nfds, fd_set *rfds, fd_set *wfds, fd_set *xfds,
/* Place a sentinel at the end of the array. */
handle_array[nhandles] = NULL;
+ /* When will the waiting period expire? */
+ if (wait_timeout != INFINITE)
+ tend = clock () + wait_timeout;
+
restart:
if (wait_timeout == 0 || nsock == 0)
rc = 0;
@@ -408,6 +415,16 @@ restart:
wait_timeout = 0;
}
+ /* How much is left to wait? */
+ if (wait_timeout != INFINITE)
+ {
+ clock_t tnow = clock ();
+ if (tend >= tnow)
+ wait_timeout = tend - tnow;
+ else
+ wait_timeout = 0;
+ }
+
for (;;)
{
ret = MsgWaitForMultipleObjects (nhandles, handle_array, FALSE,
@@ -453,7 +470,16 @@ restart:
}
}
- if (rc == 0 && wait_timeout == INFINITE)
+ if (rc == 0
+ && (wait_timeout == INFINITE
+ /* If NHANDLES > 1, but no bits are set, it means we've
+ been told incorrectly that some handle was signaled.
+ This happens with anonymous pipes, which always cause
+ MsgWaitForMultipleObjects to exit immediately, but no
+ data is found ready to be read by windows_poll_handle.
+ To avoid a total failure (whereby we return zero and
+ don't wait at all), let's poll in a more busy loop. */
+ || (wait_timeout != 0 && nhandles > 1)))
{
/* Sleep 1 millisecond to avoid busy wait and retry with the
original fd_sets. */
@@ -463,6 +489,8 @@ restart:
SleepEx (1, TRUE);
goto restart;
}
+ if (timeout && wait_timeout == 0 && rc == 0)
+ timeout->tv_sec = timeout->tv_usec = 0;
}
/* Now fill in the results. */
diff --git a/lib/selinux-at.c b/lib/selinux-at.c
index 386763f7..d2032c07 100644
--- a/lib/selinux-at.c
+++ b/lib/selinux-at.c
@@ -1,5 +1,5 @@
/* openat-style fd-relative functions for SE Linux
- Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2014 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
@@ -26,7 +26,6 @@
#include <errno.h>
#include <fcntl.h>
-#include "dirname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */
#include "save-cwd.h"
#include "openat-priv.h"
diff --git a/lib/selinux-at.h b/lib/selinux-at.h
index a01ffeb6..e65687e8 100644
--- a/lib/selinux-at.h
+++ b/lib/selinux-at.h
@@ -1,5 +1,5 @@
/* Prototypes for openat-style fd-relative SELinux functions
- Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2014 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
diff --git a/lib/set-acl.c b/lib/set-acl.c
new file mode 100644
index 00000000..9807f107
--- /dev/null
+++ b/lib/set-acl.c
@@ -0,0 +1,48 @@
+/* set-acl.c - set access control list equivalent to a mode
+
+ Copyright (C) 2002-2003, 2005-2014 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
+
+ Written by Paul Eggert and Andreas Gruenbacher, and Bruno Haible. */
+
+#include <config.h>
+
+#include "acl.h"
+
+#include <errno.h>
+
+#include "quote.h"
+#include "error.h"
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+
+
+/* Set the access control lists of a file. If DESC is a valid file
+ descriptor, use file descriptor operations where available, else use
+ filename based operations on NAME. If access control lists are not
+ available, fchmod the target file to MODE. Also sets the
+ non-permission bits of the destination file (S_ISUID, S_ISGID, S_ISVTX)
+ to those from MODE if any are set.
+ Return 0 if successful. On failure, output a diagnostic, set errno and
+ return -1. */
+
+int
+set_acl (char const *name, int desc, mode_t mode)
+{
+ int ret = qset_acl (name, desc, mode);
+ if (ret != 0)
+ error (0, errno, _("setting permissions for %s"), quote (name));
+ return ret;
+}
diff --git a/lib/setenv.c b/lib/setenv.c
index d7851a8b..06791a90 100644
--- a/lib/setenv.c
+++ b/lib/setenv.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1995-2003, 2005-2013 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1995-2003, 2005-2014 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software: you can redistribute it and/or modify
@@ -15,14 +15,14 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#if !_LIBC
+/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
+ optimizes away the name == NULL test below. */
+# define _GL_ARG_NONNULL(params)
+
# define _GL_USE_STDLIB_ALLOC 1
# include <config.h>
#endif
-/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
- optimizes away the name == NULL test below. */
-#define _GL_ARG_NONNULL(params)
-
#include <alloca.h>
/* Specification. */
diff --git a/lib/settime.c b/lib/settime.c
index a61333f2..135c9a38 100644
--- a/lib/settime.c
+++ b/lib/settime.c
@@ -1,6 +1,6 @@
/* settime -- set the system clock
- Copyright (C) 2002, 2004-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004-2007, 2009-2014 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
diff --git a/lib/sha1.c b/lib/sha1.c
index 778389af..0ea35b08 100644
--- a/lib/sha1.c
+++ b/lib/sha1.c
@@ -1,7 +1,7 @@
/* sha1.c - Functions to compute SHA1 message digest of files or
memory blocks according to the NIST specification FIPS-180-1.
- Copyright (C) 2000-2001, 2003-2006, 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2000-2001, 2003-2006, 2008-2014 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
@@ -23,6 +23,9 @@
#include <config.h>
+#if HAVE_OPENSSL_SHA1
+# define GL_OPENSSL_INLINE _GL_EXTERN_INLINE
+#endif
#include "sha1.h"
#include <stdalign.h>
@@ -46,6 +49,7 @@
# error "invalid BLOCKSIZE"
#endif
+#if ! HAVE_OPENSSL_SHA1
/* This array contains the bytes used to pad the buffer to the next
64-byte boundary. (RFC 1321, 3.1: Step 1) */
static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ };
@@ -116,6 +120,7 @@ sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf)
return sha1_read_ctx (ctx, resbuf);
}
+#endif
/* Compute SHA1 message digest for bytes read from STREAM. The
resulting message digest number will be written into the 16 bytes
@@ -190,6 +195,7 @@ sha1_stream (FILE *stream, void *resblock)
return 0;
}
+#if ! HAVE_OPENSSL_SHA1
/* Compute SHA1 message digest for LEN bytes beginning at BUFFER. The
result is always in little endian byte order, so that a byte-wise
output yields to the wanted ASCII representation of the message
@@ -424,3 +430,4 @@ sha1_process_block (const void *buffer, size_t len, struct sha1_ctx *ctx)
e = ctx->E += e;
}
}
+#endif
diff --git a/lib/sha1.h b/lib/sha1.h
index ddd386f9..4fd7d668 100644
--- a/lib/sha1.h
+++ b/lib/sha1.h
@@ -1,6 +1,6 @@
/* Declarations of functions and data types used for SHA1 sum
library functions.
- Copyright (C) 2000-2001, 2003, 2005-2006, 2008-2013 Free Software
+ Copyright (C) 2000-2001, 2003, 2005-2006, 2008-2014 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
@@ -22,12 +22,20 @@
# include <stdio.h>
# include <stdint.h>
+# if HAVE_OPENSSL_SHA1
+# include <openssl/sha.h>
+# endif
+
# ifdef __cplusplus
extern "C" {
# endif
#define SHA1_DIGEST_SIZE 20
+# if HAVE_OPENSSL_SHA1
+# define GL_OPENSSL_NAME 1
+# include "gl_openssl.h"
+# else
/* Structure to save state of computation between the single steps. */
struct sha1_ctx
{
@@ -42,7 +50,6 @@ struct sha1_ctx
uint32_t buffer[32];
};
-
/* Initialize structure containing state of computation. */
extern void sha1_init_ctx (struct sha1_ctx *ctx);
@@ -73,17 +80,19 @@ extern void *sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf);
extern void *sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf);
-/* Compute SHA1 message digest for bytes read from STREAM. The
- resulting message digest number will be written into the 20 bytes
- beginning at RESBLOCK. */
-extern int sha1_stream (FILE *stream, void *resblock);
-
/* Compute SHA1 message digest for LEN bytes beginning at BUFFER. The
result is always in little endian byte order, so that a byte-wise
output yields to the wanted ASCII representation of the message
digest. */
extern void *sha1_buffer (const char *buffer, size_t len, void *resblock);
+# endif
+/* Compute SHA1 message digest for bytes read from STREAM. The
+ resulting message digest number will be written into the 20 bytes
+ beginning at RESBLOCK. */
+extern int sha1_stream (FILE *stream, void *resblock);
+
+
# ifdef __cplusplus
}
# endif
diff --git a/lib/sha256.c b/lib/sha256.c
index 4b2cee37..a07e4f9f 100644
--- a/lib/sha256.c
+++ b/lib/sha256.c
@@ -1,7 +1,7 @@
/* sha256.c - Functions to compute SHA256 and SHA224 message digest of files or
memory blocks according to the NIST specification FIPS-180-2.
- Copyright (C) 2005-2006, 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2008-2014 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
@@ -22,6 +22,9 @@
#include <config.h>
+#if HAVE_OPENSSL_SHA256
+# define GL_OPENSSL_INLINE _GL_EXTERN_INLINE
+#endif
#include "sha256.h"
#include <stdalign.h>
@@ -45,6 +48,7 @@
# error "invalid BLOCKSIZE"
#endif
+#if ! HAVE_OPENSSL_SHA256
/* This array contains the bytes used to pad the buffer to the next
64-byte boundary. */
static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ };
@@ -163,6 +167,7 @@ sha224_finish_ctx (struct sha256_ctx *ctx, void *resbuf)
sha256_conclude_ctx (ctx);
return sha224_read_ctx (ctx, resbuf);
}
+#endif
/* Compute SHA256 message digest for bytes read from STREAM. The
resulting message digest number will be written into the 32 bytes
@@ -308,6 +313,7 @@ sha224_stream (FILE *stream, void *resblock)
return 0;
}
+#if ! HAVE_OPENSSL_SHA256
/* Compute SHA512 message digest for LEN bytes beginning at BUFFER. The
result is always in little endian byte order, so that a byte-wise
output yields to the wanted ASCII representation of the message
@@ -567,3 +573,4 @@ sha256_process_block (const void *buffer, size_t len, struct sha256_ctx *ctx)
h = ctx->state[7] += h;
}
}
+#endif
diff --git a/lib/sha256.h b/lib/sha256.h
index 7e625228..92c0b955 100644
--- a/lib/sha256.h
+++ b/lib/sha256.h
@@ -1,6 +1,6 @@
/* Declarations of functions and data types used for SHA256 and SHA224 sum
library functions.
- Copyright (C) 2005-2006, 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2008-2014 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
@@ -21,10 +21,23 @@
# include <stdio.h>
# include <stdint.h>
+# if HAVE_OPENSSL_SHA256
+# include <openssl/sha.h>
+# endif
+
# ifdef __cplusplus
extern "C" {
# endif
+enum { SHA224_DIGEST_SIZE = 224 / 8 };
+enum { SHA256_DIGEST_SIZE = 256 / 8 };
+
+# if HAVE_OPENSSL_SHA256
+# define GL_OPENSSL_NAME 224
+# include "gl_openssl.h"
+# define GL_OPENSSL_NAME 256
+# include "gl_openssl.h"
+# else
/* Structure to save state of computation between the single steps. */
struct sha256_ctx
{
@@ -35,9 +48,6 @@ struct sha256_ctx
uint32_t buffer[32];
};
-enum { SHA224_DIGEST_SIZE = 224 / 8 };
-enum { SHA256_DIGEST_SIZE = 256 / 8 };
-
/* Initialize structure containing state of computation. */
extern void sha256_init_ctx (struct sha256_ctx *ctx);
extern void sha224_init_ctx (struct sha256_ctx *ctx);
@@ -71,12 +81,6 @@ extern void *sha256_read_ctx (const struct sha256_ctx *ctx, void *resbuf);
extern void *sha224_read_ctx (const struct sha256_ctx *ctx, void *resbuf);
-/* Compute SHA256 (SHA224) message digest for bytes read from STREAM. The
- resulting message digest number will be written into the 32 (28) bytes
- beginning at RESBLOCK. */
-extern int sha256_stream (FILE *stream, void *resblock);
-extern int sha224_stream (FILE *stream, void *resblock);
-
/* Compute SHA256 (SHA224) message digest for LEN bytes beginning at BUFFER. The
result is always in little endian byte order, so that a byte-wise
output yields to the wanted ASCII representation of the message
@@ -84,6 +88,14 @@ extern int sha224_stream (FILE *stream, void *resblock);
extern void *sha256_buffer (const char *buffer, size_t len, void *resblock);
extern void *sha224_buffer (const char *buffer, size_t len, void *resblock);
+# endif
+/* Compute SHA256 (SHA224) message digest for bytes read from STREAM. The
+ resulting message digest number will be written into the 32 (28) bytes
+ beginning at RESBLOCK. */
+extern int sha256_stream (FILE *stream, void *resblock);
+extern int sha224_stream (FILE *stream, void *resblock);
+
+
# ifdef __cplusplus
}
# endif
diff --git a/lib/sha512.c b/lib/sha512.c
index 79f11257..5d3a1725 100644
--- a/lib/sha512.c
+++ b/lib/sha512.c
@@ -1,7 +1,7 @@
/* sha512.c - Functions to compute SHA512 and SHA384 message digest of files or
memory blocks according to the NIST specification FIPS-180-2.
- Copyright (C) 2005-2006, 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2008-2014 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
@@ -22,6 +22,9 @@
#include <config.h>
+#if HAVE_OPENSSL_SHA512
+# define GL_OPENSSL_INLINE _GL_EXTERN_INLINE
+#endif
#include "sha512.h"
#include <stdalign.h>
@@ -52,6 +55,7 @@
# error "invalid BLOCKSIZE"
#endif
+#if ! HAVE_OPENSSL_SHA512
/* This array contains the bytes used to pad the buffer to the next
128-byte boundary. */
static const unsigned char fillbuf[128] = { 0x80, 0 /* , 0, 0, ... */ };
@@ -171,6 +175,7 @@ sha384_finish_ctx (struct sha512_ctx *ctx, void *resbuf)
sha512_conclude_ctx (ctx);
return sha384_read_ctx (ctx, resbuf);
}
+#endif
/* Compute SHA512 message digest for bytes read from STREAM. The
resulting message digest number will be written into the 64 bytes
@@ -316,6 +321,7 @@ sha384_stream (FILE *stream, void *resblock)
return 0;
}
+#if ! HAVE_OPENSSL_SHA512
/* Compute SHA512 message digest for LEN bytes beginning at BUFFER. The
result is always in little endian byte order, so that a byte-wise
output yields to the wanted ASCII representation of the message
@@ -619,3 +625,4 @@ sha512_process_block (const void *buffer, size_t len, struct sha512_ctx *ctx)
h = ctx->state[7] = u64plus (ctx->state[7], h);
}
}
+#endif
diff --git a/lib/sha512.h b/lib/sha512.h
index 2e78a5f9..17aeea6c 100644
--- a/lib/sha512.h
+++ b/lib/sha512.h
@@ -1,6 +1,6 @@
/* Declarations of functions and data types used for SHA512 and SHA384 sum
library functions.
- Copyright (C) 2005-2006, 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2008-2014 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
@@ -19,13 +19,25 @@
# define SHA512_H 1
# include <stdio.h>
-
# include "u64.h"
+# if HAVE_OPENSSL_SHA512
+# include <openssl/sha.h>
+# endif
+
# ifdef __cplusplus
extern "C" {
# endif
+enum { SHA384_DIGEST_SIZE = 384 / 8 };
+enum { SHA512_DIGEST_SIZE = 512 / 8 };
+
+# if HAVE_OPENSSL_SHA512
+# define GL_OPENSSL_NAME 384
+# include "gl_openssl.h"
+# define GL_OPENSSL_NAME 512
+# include "gl_openssl.h"
+# else
/* Structure to save state of computation between the single steps. */
struct sha512_ctx
{
@@ -36,9 +48,6 @@ struct sha512_ctx
u64 buffer[32];
};
-enum { SHA384_DIGEST_SIZE = 384 / 8 };
-enum { SHA512_DIGEST_SIZE = 512 / 8 };
-
/* Initialize structure containing state of computation. */
extern void sha512_init_ctx (struct sha512_ctx *ctx);
extern void sha384_init_ctx (struct sha512_ctx *ctx);
@@ -75,12 +84,6 @@ extern void *sha512_read_ctx (const struct sha512_ctx *ctx, void *resbuf);
extern void *sha384_read_ctx (const struct sha512_ctx *ctx, void *resbuf);
-/* Compute SHA512 (SHA384) message digest for bytes read from STREAM. The
- resulting message digest number will be written into the 64 (48) bytes
- beginning at RESBLOCK. */
-extern int sha512_stream (FILE *stream, void *resblock);
-extern int sha384_stream (FILE *stream, void *resblock);
-
/* Compute SHA512 (SHA384) message digest for LEN bytes beginning at BUFFER. The
result is always in little endian byte order, so that a byte-wise
output yields to the wanted ASCII representation of the message
@@ -88,6 +91,14 @@ extern int sha384_stream (FILE *stream, void *resblock);
extern void *sha512_buffer (const char *buffer, size_t len, void *resblock);
extern void *sha384_buffer (const char *buffer, size_t len, void *resblock);
+# endif
+/* Compute SHA512 (SHA384) message digest for bytes read from STREAM. The
+ resulting message digest number will be written into the 64 (48) bytes
+ beginning at RESBLOCK. */
+extern int sha512_stream (FILE *stream, void *resblock);
+extern int sha384_stream (FILE *stream, void *resblock);
+
+
# ifdef __cplusplus
}
# endif
diff --git a/lib/sig-handler.h b/lib/sig-handler.h
index ca9f979c..f4fe7eca 100644
--- a/lib/sig-handler.h
+++ b/lib/sig-handler.h
@@ -1,6 +1,6 @@
/* Convenience declarations when working with <signal.h>.
- Copyright (C) 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2008-2014 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,9 @@
#include <signal.h>
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
_GL_INLINE_HEADER_BEGIN
#ifndef SIG_HANDLER_INLINE
# define SIG_HANDLER_INLINE _GL_INLINE
diff --git a/lib/sig2str.c b/lib/sig2str.c
index 8b36e2fa..119006af 100644
--- a/lib/sig2str.c
+++ b/lib/sig2str.c
@@ -1,6 +1,6 @@
/* sig2str.c -- convert between signal names and numbers
- Copyright (C) 2002, 2004, 2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2006, 2009-2014 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
@@ -325,21 +325,25 @@ sig2str (int signum, char *signame)
{
int rtmin = SIGRTMIN;
int rtmax = SIGRTMAX;
+ int base, delta;
if (! (rtmin <= signum && signum <= rtmax))
return -1;
if (signum <= rtmin + (rtmax - rtmin) / 2)
{
- int delta = signum - rtmin;
- sprintf (signame, delta ? "RTMIN+%d" : "RTMIN", delta);
+ strcpy (signame, "RTMIN");
+ base = rtmin;
}
else
{
- int delta = rtmax - signum;
- sprintf (signame, delta ? "RTMAX-%d" : "RTMAX", delta);
+ strcpy (signame, "RTMAX");
+ base = rtmax;
}
+ delta = signum - base;
+ if (delta != 0)
+ sprintf (signame + 5, "%+d", delta);
return 0;
}
}
diff --git a/lib/sig2str.h b/lib/sig2str.h
index d16be98c..fc90b720 100644
--- a/lib/sig2str.h
+++ b/lib/sig2str.h
@@ -1,6 +1,6 @@
/* sig2str.h -- convert between signal names and numbers
- Copyright (C) 2002, 2005, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005, 2009-2014 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
@@ -27,9 +27,17 @@
/* Size of a buffer needed to hold a signal name like "HUP". */
# define SIG2STR_MAX (sizeof "SIGRTMAX" + INT_STRLEN_BOUND (int) - 1)
+#ifdef __cplusplus
+extern "C" {
+#endif
+
int sig2str (int, char *);
int str2sig (char const *, int *);
+#ifdef __cplusplus
+}
+#endif
+
#endif
/* An upper bound on signal numbers allowed by the system. */
diff --git a/lib/sigaction.c b/lib/sigaction.c
index 97eb76d9..c56ca460 100644
--- a/lib/sigaction.c
+++ b/lib/sigaction.c
@@ -1,5 +1,5 @@
/* POSIX compatible signal blocking.
- Copyright (C) 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2008-2014 Free Software Foundation, Inc.
Written by Eric Blake <ebb9@byu.net>, 2008.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/siglist.h b/lib/siglist.h
index 7817c95b..7b682ff3 100644
--- a/lib/siglist.h
+++ b/lib/siglist.h
@@ -1,5 +1,5 @@
/* Canonical list of all signal names.
- Copyright (C) 1996-1999, 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 1996-1999, 2008-2014 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/signal.in.h b/lib/signal.in.h
index 54849504..925e16f2 100644
--- a/lib/signal.in.h
+++ b/lib/signal.in.h
@@ -1,6 +1,6 @@
/* A GNU-like <signal.h>.
- Copyright (C) 2006-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006-2014 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
@@ -195,6 +195,20 @@ typedef int verify_NSIG_constraint[NSIG <= 32 ? 1 : -1];
# endif
+/* When also using extern inline, suppress the use of static inline in
+ standard headers of problematic Apple configurations, as Libc at
+ least through Libc-825.26 (2013-04-09) mishandles it; see, e.g.,
+ <http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>.
+ Perhaps Apple will fix this some day. */
+#if (defined _GL_EXTERN_INLINE_IN_USE && defined __APPLE__ \
+ && (defined __i386__ || defined __x86_64__))
+# undef sigaddset
+# undef sigdelset
+# undef sigemptyset
+# undef sigfillset
+# undef sigismember
+#endif
+
/* Test whether a given signal is contained in a signal set. */
# if @HAVE_POSIX_SIGNALBLOCKING@
/* This function is defined as a macro on Mac OS X. */
diff --git a/lib/signbitd.c b/lib/signbitd.c
index 7a434f8e..26f30d59 100644
--- a/lib/signbitd.c
+++ b/lib/signbitd.c
@@ -1,5 +1,5 @@
/* signbit() macro: Determine the sign bit of a floating-point number.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007-2014 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
diff --git a/lib/signbitf.c b/lib/signbitf.c
index f133be57..191deb91 100644
--- a/lib/signbitf.c
+++ b/lib/signbitf.c
@@ -1,5 +1,5 @@
/* signbit() macro: Determine the sign bit of a floating-point number.
- Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2014 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
diff --git a/lib/signbitl.c b/lib/signbitl.c
index 9e1e900e..9da26c6c 100644
--- a/lib/signbitl.c
+++ b/lib/signbitl.c
@@ -1,5 +1,5 @@
/* signbit() macro: Determine the sign bit of a floating-point number.
- Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2014 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
diff --git a/lib/sigprocmask.c b/lib/sigprocmask.c
index 8de3777d..506a51fe 100644
--- a/lib/sigprocmask.c
+++ b/lib/sigprocmask.c
@@ -1,5 +1,5 @@
/* POSIX compatible signal blocking.
- Copyright (C) 2006-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006-2014 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2006.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/size_max.h b/lib/size_max.h
index 5f331240..461ff1ca 100644
--- a/lib/size_max.h
+++ b/lib/size_max.h
@@ -1,5 +1,5 @@
/* size_max.h -- declare SIZE_MAX through system headers
- Copyright (C) 2005-2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2009-2014 Free Software Foundation, Inc.
Written by Simon Josefsson.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/smack.h b/lib/smack.h
new file mode 100644
index 00000000..e1e8a842
--- /dev/null
+++ b/lib/smack.h
@@ -0,0 +1,46 @@
+/* Include and determine availability of smack routines
+ Copyright (C) 2013-2014 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
+
+/* Here we replace or wrap the most common smack functions used by coreutils.
+ Others will need to be protected by HAVE_SMACK. */
+
+#include <config.h>
+
+#ifdef HAVE_SMACK
+# include <sys/smack.h>
+#else
+static inline ssize_t
+smack_new_label_from_self (char **label)
+{
+ return -1;
+}
+
+static inline int
+smack_set_label_for_self (const char *label)
+{
+ return -1;
+}
+#endif
+
+static inline bool
+is_smack_enabled (void)
+{
+#ifdef HAVE_SMACK
+ return smack_smackfs_path () != NULL;
+#else
+ return false;
+#endif
+}
diff --git a/lib/snprintf.c b/lib/snprintf.c
index 9c4ab3f2..ea1321c4 100644
--- a/lib/snprintf.c
+++ b/lib/snprintf.c
@@ -1,5 +1,5 @@
/* Formatted output to strings.
- Copyright (C) 2004, 2006-2013 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006-2014 Free Software Foundation, Inc.
Written by Simon Josefsson and Paul Eggert.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/sockets.c b/lib/sockets.c
index ae961482..962c5785 100644
--- a/lib/sockets.c
+++ b/lib/sockets.c
@@ -1,6 +1,6 @@
/* sockets.c --- wrappers for Windows socket functions
- Copyright (C) 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2008-2014 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
diff --git a/lib/sockets.h b/lib/sockets.h
index 1570ad84..0bee1ddf 100644
--- a/lib/sockets.h
+++ b/lib/sockets.h
@@ -1,6 +1,6 @@
/* sockets.h - wrappers for Windows socket functions
- Copyright (C) 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2008-2014 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
diff --git a/lib/spawn-pipe.c b/lib/spawn-pipe.c
deleted file mode 100644
index 35567d4d..00000000
--- a/lib/spawn-pipe.c
+++ /dev/null
@@ -1,452 +0,0 @@
-/* Creation of subprocesses, communicating via pipes.
- Copyright (C) 2001-2004, 2006-2013 Free Software Foundation, Inc.
- Written by Bruno Haible <haible@clisp.cons.org>, 2001.
-
- 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
-
-
-#include <config.h>
-
-/* Specification. */
-#include "spawn-pipe.h"
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <signal.h>
-#include <unistd.h>
-
-#include "error.h"
-#include "fatal-signal.h"
-#include "unistd-safer.h"
-#include "wait-process.h"
-#include "gettext.h"
-
-#define _(str) gettext (str)
-
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-
-/* Native Windows API. */
-# include <process.h>
-# include "w32spawn.h"
-
-#else
-
-/* Unix API. */
-# include <spawn.h>
-
-#endif
-
-/* The results of open() in this file are not used with fchdir,
- therefore save some unnecessary work in fchdir.c. */
-#undef open
-#undef close
-
-
-#ifdef EINTR
-
-/* EINTR handling for close().
- These functions can return -1/EINTR even though we don't have any
- signal handlers set up, namely when we get interrupted via SIGSTOP. */
-
-static int
-nonintr_close (int fd)
-{
- int retval;
-
- do
- retval = close (fd);
- while (retval < 0 && errno == EINTR);
-
- return retval;
-}
-#define close nonintr_close
-
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-static int
-nonintr_open (const char *pathname, int oflag, mode_t mode)
-{
- int retval;
-
- do
- retval = open (pathname, oflag, mode);
- while (retval < 0 && errno == EINTR);
-
- return retval;
-}
-# undef open /* avoid warning on VMS */
-# define open nonintr_open
-#endif
-
-#endif
-
-
-/* Open a pipe connected to a child process.
- *
- * write system read
- * parent -> fd[1] -> STDIN_FILENO -> child if pipe_stdin
- * parent <- fd[0] <- STDOUT_FILENO <- child if pipe_stdout
- * read system write
- *
- * At least one of pipe_stdin, pipe_stdout must be true.
- * pipe_stdin and prog_stdin together determine the child's standard input.
- * pipe_stdout and prog_stdout together determine the child's standard output.
- * If pipe_stdin is true, prog_stdin is ignored.
- * If pipe_stdout is true, prog_stdout is ignored.
- */
-static pid_t
-create_pipe (const char *progname,
- const char *prog_path, char **prog_argv,
- bool pipe_stdin, bool pipe_stdout,
- const char *prog_stdin, const char *prog_stdout,
- bool null_stderr,
- bool slave_process, bool exit_on_error,
- int fd[2])
-{
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-
- /* Native Windows API.
- This uses _pipe(), dup2(), and spawnv(). It could also be implemented
- using the low-level functions CreatePipe(), DuplicateHandle(),
- CreateProcess() and _open_osfhandle(); see the GNU make and GNU clisp
- and cvs source code. */
- int ifd[2];
- int ofd[2];
- int orig_stdin;
- int orig_stdout;
- int orig_stderr;
- int child;
- int nulloutfd;
- int stdinfd;
- int stdoutfd;
- int saved_errno;
-
- /* FIXME: Need to free memory allocated by prepare_spawn. */
- prog_argv = prepare_spawn (prog_argv);
-
- if (pipe_stdout)
- if (pipe2_safer (ifd, O_BINARY | O_CLOEXEC) < 0)
- error (EXIT_FAILURE, errno, _("cannot create pipe"));
- if (pipe_stdin)
- if (pipe2_safer (ofd, O_BINARY | O_CLOEXEC) < 0)
- error (EXIT_FAILURE, errno, _("cannot create pipe"));
-/* Data flow diagram:
- *
- * write system read
- * parent -> ofd[1] -> ofd[0] -> child if pipe_stdin
- * parent <- ifd[0] <- ifd[1] <- child if pipe_stdout
- * read system write
- *
- */
-
- /* Save standard file handles of parent process. */
- if (pipe_stdin || prog_stdin != NULL)
- orig_stdin = dup_safer_noinherit (STDIN_FILENO);
- if (pipe_stdout || prog_stdout != NULL)
- orig_stdout = dup_safer_noinherit (STDOUT_FILENO);
- if (null_stderr)
- orig_stderr = dup_safer_noinherit (STDERR_FILENO);
- child = -1;
-
- /* Create standard file handles of child process. */
- nulloutfd = -1;
- stdinfd = -1;
- stdoutfd = -1;
- if ((!pipe_stdin || dup2 (ofd[0], STDIN_FILENO) >= 0)
- && (!pipe_stdout || dup2 (ifd[1], STDOUT_FILENO) >= 0)
- && (!null_stderr
- || ((nulloutfd = open ("NUL", O_RDWR, 0)) >= 0
- && (nulloutfd == STDERR_FILENO
- || (dup2 (nulloutfd, STDERR_FILENO) >= 0
- && close (nulloutfd) >= 0))))
- && (pipe_stdin
- || prog_stdin == NULL
- || ((stdinfd = open (prog_stdin, O_RDONLY, 0)) >= 0
- && (stdinfd == STDIN_FILENO
- || (dup2 (stdinfd, STDIN_FILENO) >= 0
- && close (stdinfd) >= 0))))
- && (pipe_stdout
- || prog_stdout == NULL
- || ((stdoutfd = open (prog_stdout, O_WRONLY, 0)) >= 0
- && (stdoutfd == STDOUT_FILENO
- || (dup2 (stdoutfd, STDOUT_FILENO) >= 0
- && close (stdoutfd) >= 0)))))
- /* The child process doesn't inherit ifd[0], ifd[1], ofd[0], ofd[1],
- but it inherits all open()ed or dup2()ed file handles (which is what
- we want in the case of STD*_FILENO). */
- /* Use spawnvpe and pass the environment explicitly. This is needed if
- the program has modified the environment using putenv() or [un]setenv().
- On Windows, programs have two environments, one in the "environment
- block" of the process and managed through SetEnvironmentVariable(), and
- one inside the process, in the location retrieved by the 'environ'
- macro. When using spawnvp() without 'e', the child process inherits a
- copy of the environment block - ignoring the effects of putenv() and
- [un]setenv(). */
- {
- child = spawnvpe (P_NOWAIT, prog_path, (const char **) prog_argv,
- (const char **) environ);
- if (child < 0 && errno == ENOEXEC)
- {
- /* prog is not a native executable. Try to execute it as a
- shell script. Note that prepare_spawn() has already prepended
- a hidden element "sh.exe" to prog_argv. */
- --prog_argv;
- child = spawnvpe (P_NOWAIT, prog_argv[0], (const char **) prog_argv,
- (const char **) environ);
- }
- }
- if (child == -1)
- saved_errno = errno;
- if (stdinfd >= 0)
- close (stdinfd);
- if (stdoutfd >= 0)
- close (stdoutfd);
- if (nulloutfd >= 0)
- close (nulloutfd);
-
- /* Restore standard file handles of parent process. */
- if (null_stderr)
- undup_safer_noinherit (orig_stderr, STDERR_FILENO);
- if (pipe_stdout || prog_stdout != NULL)
- undup_safer_noinherit (orig_stdout, STDOUT_FILENO);
- if (pipe_stdin || prog_stdin != NULL)
- undup_safer_noinherit (orig_stdin, STDIN_FILENO);
-
- if (pipe_stdin)
- close (ofd[0]);
- if (pipe_stdout)
- close (ifd[1]);
- if (child == -1)
- {
- if (exit_on_error || !null_stderr)
- error (exit_on_error ? EXIT_FAILURE : 0, saved_errno,
- _("%s subprocess failed"), progname);
- if (pipe_stdout)
- close (ifd[0]);
- if (pipe_stdin)
- close (ofd[1]);
- errno = saved_errno;
- return -1;
- }
-
- if (pipe_stdout)
- fd[0] = ifd[0];
- if (pipe_stdin)
- fd[1] = ofd[1];
- return child;
-
-#else
-
- /* Unix API. */
- int ifd[2];
- int ofd[2];
- sigset_t blocked_signals;
- posix_spawn_file_actions_t actions;
- bool actions_allocated;
- posix_spawnattr_t attrs;
- bool attrs_allocated;
- int err;
- pid_t child;
-
- if (pipe_stdout)
- if (pipe_safer (ifd) < 0)
- error (EXIT_FAILURE, errno, _("cannot create pipe"));
- if (pipe_stdin)
- if (pipe_safer (ofd) < 0)
- error (EXIT_FAILURE, errno, _("cannot create pipe"));
-/* Data flow diagram:
- *
- * write system read
- * parent -> ofd[1] -> ofd[0] -> child if pipe_stdin
- * parent <- ifd[0] <- ifd[1] <- child if pipe_stdout
- * read system write
- *
- */
-
- if (slave_process)
- {
- sigprocmask (SIG_SETMASK, NULL, &blocked_signals);
- block_fatal_signals ();
- }
- actions_allocated = false;
- attrs_allocated = false;
- if ((err = posix_spawn_file_actions_init (&actions)) != 0
- || (actions_allocated = true,
- (pipe_stdin
- && (err = posix_spawn_file_actions_adddup2 (&actions,
- ofd[0], STDIN_FILENO))
- != 0)
- || (pipe_stdout
- && (err = posix_spawn_file_actions_adddup2 (&actions,
- ifd[1], STDOUT_FILENO))
- != 0)
- || (pipe_stdin
- && (err = posix_spawn_file_actions_addclose (&actions, ofd[0]))
- != 0)
- || (pipe_stdout
- && (err = posix_spawn_file_actions_addclose (&actions, ifd[1]))
- != 0)
- || (pipe_stdin
- && (err = posix_spawn_file_actions_addclose (&actions, ofd[1]))
- != 0)
- || (pipe_stdout
- && (err = posix_spawn_file_actions_addclose (&actions, ifd[0]))
- != 0)
- || (null_stderr
- && (err = posix_spawn_file_actions_addopen (&actions,
- STDERR_FILENO,
- "/dev/null", O_RDWR,
- 0))
- != 0)
- || (!pipe_stdin
- && prog_stdin != NULL
- && (err = posix_spawn_file_actions_addopen (&actions,
- STDIN_FILENO,
- prog_stdin, O_RDONLY,
- 0))
- != 0)
- || (!pipe_stdout
- && prog_stdout != NULL
- && (err = posix_spawn_file_actions_addopen (&actions,
- STDOUT_FILENO,
- prog_stdout, O_WRONLY,
- 0))
- != 0)
- || (slave_process
- && ((err = posix_spawnattr_init (&attrs)) != 0
- || (attrs_allocated = true,
- (err = posix_spawnattr_setsigmask (&attrs,
- &blocked_signals))
- != 0
- || (err = posix_spawnattr_setflags (&attrs,
- POSIX_SPAWN_SETSIGMASK))
- != 0)))
- || (err = posix_spawnp (&child, prog_path, &actions,
- attrs_allocated ? &attrs : NULL, prog_argv,
- environ))
- != 0))
- {
- if (actions_allocated)
- posix_spawn_file_actions_destroy (&actions);
- if (attrs_allocated)
- posix_spawnattr_destroy (&attrs);
- if (slave_process)
- unblock_fatal_signals ();
- if (exit_on_error || !null_stderr)
- error (exit_on_error ? EXIT_FAILURE : 0, err,
- _("%s subprocess failed"), progname);
- if (pipe_stdout)
- {
- close (ifd[0]);
- close (ifd[1]);
- }
- if (pipe_stdin)
- {
- close (ofd[0]);
- close (ofd[1]);
- }
- errno = err;
- return -1;
- }
- posix_spawn_file_actions_destroy (&actions);
- if (attrs_allocated)
- posix_spawnattr_destroy (&attrs);
- if (slave_process)
- {
- register_slave_subprocess (child);
- unblock_fatal_signals ();
- }
- if (pipe_stdin)
- close (ofd[0]);
- if (pipe_stdout)
- close (ifd[1]);
-
- if (pipe_stdout)
- fd[0] = ifd[0];
- if (pipe_stdin)
- fd[1] = ofd[1];
- return child;
-
-#endif
-}
-
-/* Open a bidirectional pipe.
- *
- * write system read
- * parent -> fd[1] -> STDIN_FILENO -> child
- * parent <- fd[0] <- STDOUT_FILENO <- child
- * read system write
- *
- */
-pid_t
-create_pipe_bidi (const char *progname,
- const char *prog_path, char **prog_argv,
- bool null_stderr,
- bool slave_process, bool exit_on_error,
- int fd[2])
-{
- pid_t result = create_pipe (progname, prog_path, prog_argv,
- true, true, NULL, NULL,
- null_stderr, slave_process, exit_on_error,
- fd);
- return result;
-}
-
-/* Open a pipe for input from a child process.
- * The child's stdin comes from a file.
- *
- * read system write
- * parent <- fd[0] <- STDOUT_FILENO <- child
- *
- */
-pid_t
-create_pipe_in (const char *progname,
- const char *prog_path, char **prog_argv,
- const char *prog_stdin, bool null_stderr,
- bool slave_process, bool exit_on_error,
- int fd[1])
-{
- int iofd[2];
- pid_t result = create_pipe (progname, prog_path, prog_argv,
- false, true, prog_stdin, NULL,
- null_stderr, slave_process, exit_on_error,
- iofd);
- if (result != -1)
- fd[0] = iofd[0];
- return result;
-}
-
-/* Open a pipe for output to a child process.
- * The child's stdout goes to a file.
- *
- * write system read
- * parent -> fd[0] -> STDIN_FILENO -> child
- *
- */
-pid_t
-create_pipe_out (const char *progname,
- const char *prog_path, char **prog_argv,
- const char *prog_stdout, bool null_stderr,
- bool slave_process, bool exit_on_error,
- int fd[1])
-{
- int iofd[2];
- pid_t result = create_pipe (progname, prog_path, prog_argv,
- true, false, NULL, prog_stdout,
- null_stderr, slave_process, exit_on_error,
- iofd);
- if (result != -1)
- fd[0] = iofd[1];
- return result;
-}
diff --git a/lib/spawn-pipe.h b/lib/spawn-pipe.h
deleted file mode 100644
index ea8284f2..00000000
--- a/lib/spawn-pipe.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/* Creation of subprocesses, communicating via pipes.
- Copyright (C) 2001-2003, 2006, 2008-2013 Free Software Foundation, Inc.
- Written by Bruno Haible <haible@clisp.cons.org>, 2001.
-
- 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
-
-#ifndef _SPAWN_PIPE_H
-#define _SPAWN_PIPE_H
-
-/* Get pid_t. */
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-
-#include <stdbool.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* All these functions create a subprocess and don't wait for its termination.
- They return the process id of the subprocess. They also return in fd[]
- one or two file descriptors for communication with the subprocess.
- If the subprocess creation fails: if exit_on_error is true, the main
- process exits with an error message; otherwise, an error message is given
- if null_stderr is false, then -1 is returned, with errno set, and fd[]
- remain uninitialized.
-
- After finishing communication, the caller should call wait_subprocess()
- to get rid of the subprocess in the process table.
-
- If slave_process is true, the child process will be terminated when its
- creator receives a catchable fatal signal or exits normally. If
- slave_process is false, the child process will continue running in this
- case, until it is lucky enough to attempt to communicate with its creator
- and thus get a SIGPIPE signal.
-
- If exit_on_error is false, a child process id of -1 should be treated the
- same way as a subprocess which accepts no input, produces no output and
- terminates with exit code 127. Why? Some errors during posix_spawnp()
- cause the function posix_spawnp() to return an error code; some other
- errors cause the subprocess to exit with return code 127. It is
- implementation dependent which error is reported which way. The caller
- must treat both cases as equivalent.
-
- It is recommended that no signal is blocked or ignored (i.e. have a
- signal handler with value SIG_IGN) while any of these functions is called.
- The reason is that child processes inherit the mask of blocked signals
- from their parent (both through posix_spawn() and fork()/exec());
- likewise, signals ignored in the parent are also ignored in the child
- (except possibly for SIGCHLD). And POSIX:2001 says [in the description
- of exec()]:
- "it should be noted that many existing applications wrongly
- assume that they start with certain signals set to the default
- action and/or unblocked. In particular, applications written
- with a simpler signal model that does not include blocking of
- signals, such as the one in the ISO C standard, may not behave
- properly if invoked with some signals blocked. Therefore, it is
- best not to block or ignore signals across execs without explicit
- reason to do so, and especially not to block signals across execs
- of arbitrary (not closely co-operating) programs." */
-
-/* Open a pipe for output to a child process.
- * The child's stdout goes to a file.
- *
- * write system read
- * parent -> fd[0] -> STDIN_FILENO -> child
- *
- * Note: When writing to a child process, it is useful to ignore the SIGPIPE
- * signal and the EPIPE error code.
- */
-extern pid_t create_pipe_out (const char *progname,
- const char *prog_path, char **prog_argv,
- const char *prog_stdout, bool null_stderr,
- bool slave_process, bool exit_on_error,
- int fd[1]);
-
-/* Open a pipe for input from a child process.
- * The child's stdin comes from a file.
- *
- * read system write
- * parent <- fd[0] <- STDOUT_FILENO <- child
- *
- */
-extern pid_t create_pipe_in (const char *progname,
- const char *prog_path, char **prog_argv,
- const char *prog_stdin, bool null_stderr,
- bool slave_process, bool exit_on_error,
- int fd[1]);
-
-/* Open a bidirectional pipe.
- *
- * write system read
- * parent -> fd[1] -> STDIN_FILENO -> child
- * parent <- fd[0] <- STDOUT_FILENO <- child
- * read system write
- *
- * Note: When writing to a child process, it is useful to ignore the SIGPIPE
- * signal and the EPIPE error code.
- *
- * Note: The parent process must be careful to avoid deadlock.
- * 1) If you write more than PIPE_MAX bytes or, more generally, if you write
- * more bytes than the subprocess can handle at once, the subprocess
- * may write its data and wait on you to read it, but you are currently
- * busy writing.
- * 2) When you don't know ahead of time how many bytes the subprocess
- * will produce, the usual technique of calling read (fd, buf, BUFSIZ)
- * with a fixed BUFSIZ will, on Linux 2.2.17 and on BSD systems, cause
- * the read() call to block until *all* of the buffer has been filled.
- * But the subprocess cannot produce more data until you gave it more
- * input. But you are currently busy reading from it.
- */
-extern pid_t create_pipe_bidi (const char *progname,
- const char *prog_path, char **prog_argv,
- bool null_stderr,
- bool slave_process, bool exit_on_error,
- int fd[2]);
-
-/* The name of the "always silent" device. */
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-/* Native Windows API. */
-# define DEV_NULL "NUL"
-#else
-/* Unix API. */
-# define DEV_NULL "/dev/null"
-#endif
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* _SPAWN_PIPE_H */
diff --git a/lib/spawn.in.h b/lib/spawn.in.h
deleted file mode 100644
index bca29981..00000000
--- a/lib/spawn.in.h
+++ /dev/null
@@ -1,881 +0,0 @@
-/* Definitions for POSIX spawn interface.
- Copyright (C) 2000, 2003-2004, 2008-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
-
-#ifndef _@GUARD_PREFIX@_SPAWN_H
-
-#if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-#endif
-@PRAGMA_COLUMNS@
-
-/* The include_next requires a split double-inclusion guard. */
-#if @HAVE_SPAWN_H@
-# @INCLUDE_NEXT@ @NEXT_SPAWN_H@
-#endif
-
-#ifndef _@GUARD_PREFIX@_SPAWN_H
-#define _@GUARD_PREFIX@_SPAWN_H
-
-/* Get definitions of 'struct sched_param' and 'sigset_t'.
- But avoid namespace pollution on glibc systems. */
-#if !(defined __GLIBC__ && !defined __UCLIBC__)
-# include <sched.h>
-# include <signal.h>
-#endif
-
-#include <sys/types.h>
-
-#ifndef __THROW
-# define __THROW
-#endif
-
-/* GCC 2.95 and later have "__restrict"; C99 compilers have
- "restrict", and "configure" may have defined "restrict".
- Other compilers use __restrict, __restrict__, and _Restrict, and
- 'configure' might #define 'restrict' to those words, so pick a
- different name. */
-#ifndef _Restrict_
-# if 199901L <= __STDC_VERSION__
-# define _Restrict_ restrict
-# elif 2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__)
-# define _Restrict_ __restrict
-# else
-# define _Restrict_
-# endif
-#endif
-/* gcc 3.1 and up support the [restrict] syntax. Don't trust
- sys/cdefs.h's definition of __restrict_arr, though, as it
- mishandles gcc -ansi -pedantic. */
-#ifndef _Restrict_arr_
-# if ((199901L <= __STDC_VERSION__ \
- || ((3 < __GNUC__ || (3 == __GNUC__ && 1 <= __GNUC_MINOR__)) \
- && !defined __STRICT_ANSI__)) \
- && !defined __GNUG__)
-# define _Restrict_arr_ _Restrict_
-# else
-# define _Restrict_arr_
-# endif
-#endif
-
-/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
-
-/* The definition of _GL_ARG_NONNULL is copied here. */
-
-/* The definition of _GL_WARN_ON_USE is copied here. */
-
-
-/* Data structure to contain attributes for thread creation. */
-#if @REPLACE_POSIX_SPAWN@
-# define posix_spawnattr_t rpl_posix_spawnattr_t
-#endif
-#if @REPLACE_POSIX_SPAWN@ || !@HAVE_POSIX_SPAWNATTR_T@
-# if !GNULIB_defined_posix_spawnattr_t
-typedef struct
-{
- short int _flags;
- pid_t _pgrp;
- sigset_t _sd;
- sigset_t _ss;
- struct sched_param _sp;
- int _policy;
- int __pad[16];
-} posix_spawnattr_t;
-# define GNULIB_defined_posix_spawnattr_t 1
-# endif
-#endif
-
-
-/* Data structure to contain information about the actions to be
- performed in the new process with respect to file descriptors. */
-#if @REPLACE_POSIX_SPAWN@
-# define posix_spawn_file_actions_t rpl_posix_spawn_file_actions_t
-#endif
-#if @REPLACE_POSIX_SPAWN@ || !@HAVE_POSIX_SPAWN_FILE_ACTIONS_T@
-# if !GNULIB_defined_posix_spawn_file_actions_t
-typedef struct
-{
- int _allocated;
- int _used;
- struct __spawn_action *_actions;
- int __pad[16];
-} posix_spawn_file_actions_t;
-# define GNULIB_defined_posix_spawn_file_actions_t 1
-# endif
-#endif
-
-
-/* Flags to be set in the 'posix_spawnattr_t'. */
-#if @HAVE_POSIX_SPAWN@
-/* Use the values from the system, but provide the missing ones. */
-# ifndef POSIX_SPAWN_SETSCHEDPARAM
-# define POSIX_SPAWN_SETSCHEDPARAM 0
-# endif
-# ifndef POSIX_SPAWN_SETSCHEDULER
-# define POSIX_SPAWN_SETSCHEDULER 0
-# endif
-#else
-# if @REPLACE_POSIX_SPAWN@
-/* Use the values from the system, for better compatibility. */
-/* But this implementation does not support AIX extensions. */
-# undef POSIX_SPAWN_FORK_HANDLERS
-# else
-# define POSIX_SPAWN_RESETIDS 0x01
-# define POSIX_SPAWN_SETPGROUP 0x02
-# define POSIX_SPAWN_SETSIGDEF 0x04
-# define POSIX_SPAWN_SETSIGMASK 0x08
-# define POSIX_SPAWN_SETSCHEDPARAM 0x10
-# define POSIX_SPAWN_SETSCHEDULER 0x20
-# endif
-#endif
-/* A GNU extension. Use the next free bit position. */
-#define POSIX_SPAWN_USEVFORK \
- ((POSIX_SPAWN_RESETIDS | (POSIX_SPAWN_RESETIDS - 1) \
- | POSIX_SPAWN_SETPGROUP | (POSIX_SPAWN_SETPGROUP - 1) \
- | POSIX_SPAWN_SETSIGDEF | (POSIX_SPAWN_SETSIGDEF - 1) \
- | POSIX_SPAWN_SETSIGMASK | (POSIX_SPAWN_SETSIGMASK - 1) \
- | POSIX_SPAWN_SETSCHEDPARAM \
- | (POSIX_SPAWN_SETSCHEDPARAM > 0 ? POSIX_SPAWN_SETSCHEDPARAM - 1 : 0) \
- | POSIX_SPAWN_SETSCHEDULER \
- | (POSIX_SPAWN_SETSCHEDULER > 0 ? POSIX_SPAWN_SETSCHEDULER - 1 : 0)) \
- + 1)
-#if !GNULIB_defined_verify_POSIX_SPAWN_USEVFORK_no_overlap
-typedef int verify_POSIX_SPAWN_USEVFORK_no_overlap
- [(((POSIX_SPAWN_RESETIDS | POSIX_SPAWN_SETPGROUP
- | POSIX_SPAWN_SETSIGDEF | POSIX_SPAWN_SETSIGMASK
- | POSIX_SPAWN_SETSCHEDPARAM | POSIX_SPAWN_SETSCHEDULER)
- & POSIX_SPAWN_USEVFORK)
- == 0)
- ? 1 : -1];
-# define GNULIB_defined_verify_POSIX_SPAWN_USEVFORK_no_overlap 1
-#endif
-
-
-#if @GNULIB_POSIX_SPAWN@
-/* Spawn a new process executing PATH with the attributes describes in *ATTRP.
- Before running the process perform the actions described in FILE-ACTIONS.
-
- This function is a possible cancellation points and therefore not
- marked with __THROW. */
-# if @REPLACE_POSIX_SPAWN@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define posix_spawn rpl_posix_spawn
-# endif
-_GL_FUNCDECL_RPL (posix_spawn, int,
- (pid_t *_Restrict_ __pid,
- const char *_Restrict_ __path,
- const posix_spawn_file_actions_t *_Restrict_ __file_actions,
- const posix_spawnattr_t *_Restrict_ __attrp,
- char *const argv[_Restrict_arr_],
- char *const envp[_Restrict_arr_])
- _GL_ARG_NONNULL ((2, 5, 6)));
-_GL_CXXALIAS_RPL (posix_spawn, int,
- (pid_t *_Restrict_ __pid,
- const char *_Restrict_ __path,
- const posix_spawn_file_actions_t *_Restrict_ __file_actions,
- const posix_spawnattr_t *_Restrict_ __attrp,
- char *const argv[_Restrict_arr_],
- char *const envp[_Restrict_arr_]));
-# else
-# if !@HAVE_POSIX_SPAWN@
-_GL_FUNCDECL_SYS (posix_spawn, int,
- (pid_t *_Restrict_ __pid,
- const char *_Restrict_ __path,
- const posix_spawn_file_actions_t *_Restrict_ __file_actions,
- const posix_spawnattr_t *_Restrict_ __attrp,
- char *const argv[_Restrict_arr_],
- char *const envp[_Restrict_arr_])
- _GL_ARG_NONNULL ((2, 5, 6)));
-# endif
-_GL_CXXALIAS_SYS (posix_spawn, int,
- (pid_t *_Restrict_ __pid,
- const char *_Restrict_ __path,
- const posix_spawn_file_actions_t *_Restrict_ __file_actions,
- const posix_spawnattr_t *_Restrict_ __attrp,
- char *const argv[_Restrict_arr_],
- char *const envp[_Restrict_arr_]));
-# endif
-_GL_CXXALIASWARN (posix_spawn);
-#elif defined GNULIB_POSIXCHECK
-# undef posix_spawn
-# if HAVE_RAW_DECL_POSIX_SPAWN
-_GL_WARN_ON_USE (posix_spawn, "posix_spawn is unportable - "
- "use gnulib module posix_spawn for portability");
-# endif
-#endif
-
-#if @GNULIB_POSIX_SPAWNP@
-/* Similar to 'posix_spawn' but search for FILE in the PATH.
-
- This function is a possible cancellation points and therefore not
- marked with __THROW. */
-# if @REPLACE_POSIX_SPAWN@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define posix_spawnp rpl_posix_spawnp
-# endif
-_GL_FUNCDECL_RPL (posix_spawnp, int,
- (pid_t *__pid, const char *__file,
- const posix_spawn_file_actions_t *__file_actions,
- const posix_spawnattr_t *__attrp,
- char *const argv[], char *const envp[])
- _GL_ARG_NONNULL ((2, 5, 6)));
-_GL_CXXALIAS_RPL (posix_spawnp, int,
- (pid_t *__pid, const char *__file,
- const posix_spawn_file_actions_t *__file_actions,
- const posix_spawnattr_t *__attrp,
- char *const argv[], char *const envp[]));
-# else
-# if !@HAVE_POSIX_SPAWN@
-_GL_FUNCDECL_SYS (posix_spawnp, int,
- (pid_t *__pid, const char *__file,
- const posix_spawn_file_actions_t *__file_actions,
- const posix_spawnattr_t *__attrp,
- char *const argv[], char *const envp[])
- _GL_ARG_NONNULL ((2, 5, 6)));
-# endif
-_GL_CXXALIAS_SYS (posix_spawnp, int,
- (pid_t *__pid, const char *__file,
- const posix_spawn_file_actions_t *__file_actions,
- const posix_spawnattr_t *__attrp,
- char *const argv[], char *const envp[]));
-# endif
-_GL_CXXALIASWARN (posix_spawnp);
-#elif defined GNULIB_POSIXCHECK
-# undef posix_spawnp
-# if HAVE_RAW_DECL_POSIX_SPAWNP
-_GL_WARN_ON_USE (posix_spawnp, "posix_spawnp is unportable - "
- "use gnulib module posix_spawnp for portability");
-# endif
-#endif
-
-
-#if @GNULIB_POSIX_SPAWNATTR_INIT@
-/* Initialize data structure with attributes for 'spawn' to default values. */
-# if @REPLACE_POSIX_SPAWN@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define posix_spawnattr_init rpl_posix_spawnattr_init
-# endif
-_GL_FUNCDECL_RPL (posix_spawnattr_init, int, (posix_spawnattr_t *__attr)
- __THROW _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (posix_spawnattr_init, int, (posix_spawnattr_t *__attr));
-# else
-# if !@HAVE_POSIX_SPAWN@
-_GL_FUNCDECL_SYS (posix_spawnattr_init, int, (posix_spawnattr_t *__attr)
- __THROW _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (posix_spawnattr_init, int, (posix_spawnattr_t *__attr));
-# endif
-_GL_CXXALIASWARN (posix_spawnattr_init);
-#elif defined GNULIB_POSIXCHECK
-# undef posix_spawnattr_init
-# if HAVE_RAW_DECL_POSIX_SPAWNATTR_INIT
-_GL_WARN_ON_USE (posix_spawnattr_init, "posix_spawnattr_init is unportable - "
- "use gnulib module posix_spawnattr_init for portability");
-# endif
-#endif
-
-#if @GNULIB_POSIX_SPAWNATTR_DESTROY@
-/* Free resources associated with ATTR. */
-# if @REPLACE_POSIX_SPAWN@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define posix_spawnattr_destroy rpl_posix_spawnattr_destroy
-# endif
-_GL_FUNCDECL_RPL (posix_spawnattr_destroy, int, (posix_spawnattr_t *__attr)
- __THROW _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (posix_spawnattr_destroy, int, (posix_spawnattr_t *__attr));
-# else
-# if !@HAVE_POSIX_SPAWN@
-_GL_FUNCDECL_SYS (posix_spawnattr_destroy, int, (posix_spawnattr_t *__attr)
- __THROW _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (posix_spawnattr_destroy, int, (posix_spawnattr_t *__attr));
-# endif
-_GL_CXXALIASWARN (posix_spawnattr_destroy);
-#elif defined GNULIB_POSIXCHECK
-# undef posix_spawnattr_destroy
-# if HAVE_RAW_DECL_POSIX_SPAWNATTR_DESTROY
-_GL_WARN_ON_USE (posix_spawnattr_destroy,
- "posix_spawnattr_destroy is unportable - "
- "use gnulib module posix_spawnattr_destroy for portability");
-# endif
-#endif
-
-#if @GNULIB_POSIX_SPAWNATTR_GETSIGDEFAULT@
-/* Store signal mask for signals with default handling from ATTR in
- SIGDEFAULT. */
-# if @REPLACE_POSIX_SPAWN@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define posix_spawnattr_getsigdefault rpl_posix_spawnattr_getsigdefault
-# endif
-_GL_FUNCDECL_RPL (posix_spawnattr_getsigdefault, int,
- (const posix_spawnattr_t *_Restrict_ __attr,
- sigset_t *_Restrict_ __sigdefault)
- __THROW _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (posix_spawnattr_getsigdefault, int,
- (const posix_spawnattr_t *_Restrict_ __attr,
- sigset_t *_Restrict_ __sigdefault));
-# else
-# if !@HAVE_POSIX_SPAWN@
-_GL_FUNCDECL_SYS (posix_spawnattr_getsigdefault, int,
- (const posix_spawnattr_t *_Restrict_ __attr,
- sigset_t *_Restrict_ __sigdefault)
- __THROW _GL_ARG_NONNULL ((1, 2)));
-# endif
-_GL_CXXALIAS_SYS (posix_spawnattr_getsigdefault, int,
- (const posix_spawnattr_t *_Restrict_ __attr,
- sigset_t *_Restrict_ __sigdefault));
-# endif
-_GL_CXXALIASWARN (posix_spawnattr_getsigdefault);
-#elif defined GNULIB_POSIXCHECK
-# undef posix_spawnattr_getsigdefault
-# if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSIGDEFAULT
-_GL_WARN_ON_USE (posix_spawnattr_getsigdefault,
- "posix_spawnattr_getsigdefault is unportable - "
- "use gnulib module posix_spawnattr_getsigdefault for portability");
-# endif
-#endif
-
-#if @GNULIB_POSIX_SPAWNATTR_SETSIGDEFAULT@
-/* Set signal mask for signals with default handling in ATTR to SIGDEFAULT. */
-# if @REPLACE_POSIX_SPAWN@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define posix_spawnattr_setsigdefault rpl_posix_spawnattr_setsigdefault
-# endif
-_GL_FUNCDECL_RPL (posix_spawnattr_setsigdefault, int,
- (posix_spawnattr_t *_Restrict_ __attr,
- const sigset_t *_Restrict_ __sigdefault)
- __THROW _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (posix_spawnattr_setsigdefault, int,
- (posix_spawnattr_t *_Restrict_ __attr,
- const sigset_t *_Restrict_ __sigdefault));
-# else
-# if !@HAVE_POSIX_SPAWN@
-_GL_FUNCDECL_SYS (posix_spawnattr_setsigdefault, int,
- (posix_spawnattr_t *_Restrict_ __attr,
- const sigset_t *_Restrict_ __sigdefault)
- __THROW _GL_ARG_NONNULL ((1, 2)));
-# endif
-_GL_CXXALIAS_SYS (posix_spawnattr_setsigdefault, int,
- (posix_spawnattr_t *_Restrict_ __attr,
- const sigset_t *_Restrict_ __sigdefault));
-# endif
-_GL_CXXALIASWARN (posix_spawnattr_setsigdefault);
-#elif defined GNULIB_POSIXCHECK
-# undef posix_spawnattr_setsigdefault
-# if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSIGDEFAULT
-_GL_WARN_ON_USE (posix_spawnattr_setsigdefault,
- "posix_spawnattr_setsigdefault is unportable - "
- "use gnulib module posix_spawnattr_setsigdefault for portability");
-# endif
-#endif
-
-#if @GNULIB_POSIX_SPAWNATTR_GETSIGMASK@
-/* Store signal mask for the new process from ATTR in SIGMASK. */
-# if @REPLACE_POSIX_SPAWN@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define posix_spawnattr_getsigmask rpl_posix_spawnattr_getsigmask
-# endif
-_GL_FUNCDECL_RPL (posix_spawnattr_getsigmask, int,
- (const posix_spawnattr_t *_Restrict_ __attr,
- sigset_t *_Restrict_ __sigmask)
- __THROW _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (posix_spawnattr_getsigmask, int,
- (const posix_spawnattr_t *_Restrict_ __attr,
- sigset_t *_Restrict_ __sigmask));
-# else
-# if !@HAVE_POSIX_SPAWN@
-_GL_FUNCDECL_SYS (posix_spawnattr_getsigmask, int,
- (const posix_spawnattr_t *_Restrict_ __attr,
- sigset_t *_Restrict_ __sigmask)
- __THROW _GL_ARG_NONNULL ((1, 2)));
-# endif
-_GL_CXXALIAS_SYS (posix_spawnattr_getsigmask, int,
- (const posix_spawnattr_t *_Restrict_ __attr,
- sigset_t *_Restrict_ __sigmask));
-# endif
-_GL_CXXALIASWARN (posix_spawnattr_getsigmask);
-#elif defined GNULIB_POSIXCHECK
-# undef posix_spawnattr_getsigmask
-# if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSIGMASK
-_GL_WARN_ON_USE (posix_spawnattr_getsigmask,
- "posix_spawnattr_getsigmask is unportable - "
- "use gnulib module posix_spawnattr_getsigmask for portability");
-# endif
-#endif
-
-#if @GNULIB_POSIX_SPAWNATTR_SETSIGMASK@
-/* Set signal mask for the new process in ATTR to SIGMASK. */
-# if @REPLACE_POSIX_SPAWN@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define posix_spawnattr_setsigmask rpl_posix_spawnattr_setsigmask
-# endif
-_GL_FUNCDECL_RPL (posix_spawnattr_setsigmask, int,
- (posix_spawnattr_t *_Restrict_ __attr,
- const sigset_t *_Restrict_ __sigmask)
- __THROW _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (posix_spawnattr_setsigmask, int,
- (posix_spawnattr_t *_Restrict_ __attr,
- const sigset_t *_Restrict_ __sigmask));
-# else
-# if !@HAVE_POSIX_SPAWN@
-_GL_FUNCDECL_SYS (posix_spawnattr_setsigmask, int,
- (posix_spawnattr_t *_Restrict_ __attr,
- const sigset_t *_Restrict_ __sigmask)
- __THROW _GL_ARG_NONNULL ((1, 2)));
-# endif
-_GL_CXXALIAS_SYS (posix_spawnattr_setsigmask, int,
- (posix_spawnattr_t *_Restrict_ __attr,
- const sigset_t *_Restrict_ __sigmask));
-# endif
-_GL_CXXALIASWARN (posix_spawnattr_setsigmask);
-#elif defined GNULIB_POSIXCHECK
-# undef posix_spawnattr_setsigmask
-# if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSIGMASK
-_GL_WARN_ON_USE (posix_spawnattr_setsigmask,
- "posix_spawnattr_setsigmask is unportable - "
- "use gnulib module posix_spawnattr_setsigmask for portability");
-# endif
-#endif
-
-#if @GNULIB_POSIX_SPAWNATTR_GETFLAGS@
-/* Get flag word from the attribute structure. */
-# if @REPLACE_POSIX_SPAWN@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define posix_spawnattr_getflags rpl_posix_spawnattr_getflags
-# endif
-_GL_FUNCDECL_RPL (posix_spawnattr_getflags, int,
- (const posix_spawnattr_t *_Restrict_ __attr,
- short int *_Restrict_ __flags)
- __THROW _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (posix_spawnattr_getflags, int,
- (const posix_spawnattr_t *_Restrict_ __attr,
- short int *_Restrict_ __flags));
-# else
-# if !@HAVE_POSIX_SPAWN@
-_GL_FUNCDECL_SYS (posix_spawnattr_getflags, int,
- (const posix_spawnattr_t *_Restrict_ __attr,
- short int *_Restrict_ __flags)
- __THROW _GL_ARG_NONNULL ((1, 2)));
-# endif
-_GL_CXXALIAS_SYS (posix_spawnattr_getflags, int,
- (const posix_spawnattr_t *_Restrict_ __attr,
- short int *_Restrict_ __flags));
-# endif
-_GL_CXXALIASWARN (posix_spawnattr_getflags);
-#elif defined GNULIB_POSIXCHECK
-# undef posix_spawnattr_getflags
-# if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETFLAGS
-_GL_WARN_ON_USE (posix_spawnattr_getflags,
- "posix_spawnattr_getflags is unportable - "
- "use gnulib module posix_spawnattr_getflags for portability");
-# endif
-#endif
-
-#if @GNULIB_POSIX_SPAWNATTR_SETFLAGS@
-/* Store flags in the attribute structure. */
-# if @REPLACE_POSIX_SPAWN@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define posix_spawnattr_setflags rpl_posix_spawnattr_setflags
-# endif
-_GL_FUNCDECL_RPL (posix_spawnattr_setflags, int,
- (posix_spawnattr_t *__attr, short int __flags)
- __THROW _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (posix_spawnattr_setflags, int,
- (posix_spawnattr_t *__attr, short int __flags));
-# else
-# if !@HAVE_POSIX_SPAWN@
-_GL_FUNCDECL_SYS (posix_spawnattr_setflags, int,
- (posix_spawnattr_t *__attr, short int __flags)
- __THROW _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (posix_spawnattr_setflags, int,
- (posix_spawnattr_t *__attr, short int __flags));
-# endif
-_GL_CXXALIASWARN (posix_spawnattr_setflags);
-#elif defined GNULIB_POSIXCHECK
-# undef posix_spawnattr_setflags
-# if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETFLAGS
-_GL_WARN_ON_USE (posix_spawnattr_setflags,
- "posix_spawnattr_setflags is unportable - "
- "use gnulib module posix_spawnattr_setflags for portability");
-# endif
-#endif
-
-#if @GNULIB_POSIX_SPAWNATTR_GETPGROUP@
-/* Get process group ID from the attribute structure. */
-# if @REPLACE_POSIX_SPAWN@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define posix_spawnattr_getpgroup rpl_posix_spawnattr_getpgroup
-# endif
-_GL_FUNCDECL_RPL (posix_spawnattr_getpgroup, int,
- (const posix_spawnattr_t *_Restrict_ __attr,
- pid_t *_Restrict_ __pgroup)
- __THROW _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (posix_spawnattr_getpgroup, int,
- (const posix_spawnattr_t *_Restrict_ __attr,
- pid_t *_Restrict_ __pgroup));
-# else
-# if !@HAVE_POSIX_SPAWN@
-_GL_FUNCDECL_SYS (posix_spawnattr_getpgroup, int,
- (const posix_spawnattr_t *_Restrict_ __attr,
- pid_t *_Restrict_ __pgroup)
- __THROW _GL_ARG_NONNULL ((1, 2)));
-# endif
-_GL_CXXALIAS_SYS (posix_spawnattr_getpgroup, int,
- (const posix_spawnattr_t *_Restrict_ __attr,
- pid_t *_Restrict_ __pgroup));
-# endif
-_GL_CXXALIASWARN (posix_spawnattr_getpgroup);
-#elif defined GNULIB_POSIXCHECK
-# undef posix_spawnattr_getpgroup
-# if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETPGROUP
-_GL_WARN_ON_USE (posix_spawnattr_getpgroup,
- "posix_spawnattr_getpgroup is unportable - "
- "use gnulib module posix_spawnattr_getpgroup for portability");
-# endif
-#endif
-
-#if @GNULIB_POSIX_SPAWNATTR_SETPGROUP@
-/* Store process group ID in the attribute structure. */
-# if @REPLACE_POSIX_SPAWN@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define posix_spawnattr_setpgroup rpl_posix_spawnattr_setpgroup
-# endif
-_GL_FUNCDECL_RPL (posix_spawnattr_setpgroup, int,
- (posix_spawnattr_t *__attr, pid_t __pgroup)
- __THROW _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (posix_spawnattr_setpgroup, int,
- (posix_spawnattr_t *__attr, pid_t __pgroup));
-# else
-# if !@HAVE_POSIX_SPAWN@
-_GL_FUNCDECL_SYS (posix_spawnattr_setpgroup, int,
- (posix_spawnattr_t *__attr, pid_t __pgroup)
- __THROW _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (posix_spawnattr_setpgroup, int,
- (posix_spawnattr_t *__attr, pid_t __pgroup));
-# endif
-_GL_CXXALIASWARN (posix_spawnattr_setpgroup);
-#elif defined GNULIB_POSIXCHECK
-# undef posix_spawnattr_setpgroup
-# if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETPGROUP
-_GL_WARN_ON_USE (posix_spawnattr_setpgroup,
- "posix_spawnattr_setpgroup is unportable - "
- "use gnulib module posix_spawnattr_setpgroup for portability");
-# endif
-#endif
-
-#if @GNULIB_POSIX_SPAWNATTR_GETSCHEDPOLICY@
-/* Get scheduling policy from the attribute structure. */
-# if @REPLACE_POSIX_SPAWN@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define posix_spawnattr_getschedpolicy rpl_posix_spawnattr_getschedpolicy
-# endif
-_GL_FUNCDECL_RPL (posix_spawnattr_getschedpolicy, int,
- (const posix_spawnattr_t *_Restrict_ __attr,
- int *_Restrict_ __schedpolicy)
- __THROW _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (posix_spawnattr_getschedpolicy, int,
- (const posix_spawnattr_t *_Restrict_ __attr,
- int *_Restrict_ __schedpolicy));
-# else
-# if !@HAVE_POSIX_SPAWN@ || POSIX_SPAWN_SETSCHEDULER == 0
-_GL_FUNCDECL_SYS (posix_spawnattr_getschedpolicy, int,
- (const posix_spawnattr_t *_Restrict_ __attr,
- int *_Restrict_ __schedpolicy)
- __THROW _GL_ARG_NONNULL ((1, 2)));
-# endif
-_GL_CXXALIAS_SYS (posix_spawnattr_getschedpolicy, int,
- (const posix_spawnattr_t *_Restrict_ __attr,
- int *_Restrict_ __schedpolicy));
-# endif
-_GL_CXXALIASWARN (posix_spawnattr_getschedpolicy);
-#elif defined GNULIB_POSIXCHECK
-# undef posix_spawnattr_getschedpolicy
-# if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSCHEDPOLICY
-_GL_WARN_ON_USE (posix_spawnattr_getschedpolicy,
- "posix_spawnattr_getschedpolicy is unportable - "
- "use gnulib module posix_spawnattr_getschedpolicy for portability");
-# endif
-#endif
-
-#if @GNULIB_POSIX_SPAWNATTR_SETSCHEDPOLICY@
-/* Store scheduling policy in the attribute structure. */
-# if @REPLACE_POSIX_SPAWN@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define posix_spawnattr_setschedpolicy rpl_posix_spawnattr_setschedpolicy
-# endif
-_GL_FUNCDECL_RPL (posix_spawnattr_setschedpolicy, int,
- (posix_spawnattr_t *__attr, int __schedpolicy)
- __THROW _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (posix_spawnattr_setschedpolicy, int,
- (posix_spawnattr_t *__attr, int __schedpolicy));
-# else
-# if !@HAVE_POSIX_SPAWN@ || POSIX_SPAWN_SETSCHEDULER == 0
-_GL_FUNCDECL_SYS (posix_spawnattr_setschedpolicy, int,
- (posix_spawnattr_t *__attr, int __schedpolicy)
- __THROW _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (posix_spawnattr_setschedpolicy, int,
- (posix_spawnattr_t *__attr, int __schedpolicy));
-# endif
-_GL_CXXALIASWARN (posix_spawnattr_setschedpolicy);
-#elif defined GNULIB_POSIXCHECK
-# undef posix_spawnattr_setschedpolicy
-# if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSCHEDPOLICY
-_GL_WARN_ON_USE (posix_spawnattr_setschedpolicy,
- "posix_spawnattr_setschedpolicy is unportable - "
- "use gnulib module posix_spawnattr_setschedpolicy for portability");
-# endif
-#endif
-
-#if @GNULIB_POSIX_SPAWNATTR_GETSCHEDPARAM@
-/* Get scheduling parameters from the attribute structure. */
-# if @REPLACE_POSIX_SPAWN@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define posix_spawnattr_getschedparam rpl_posix_spawnattr_getschedparam
-# endif
-_GL_FUNCDECL_RPL (posix_spawnattr_getschedparam, int,
- (const posix_spawnattr_t *_Restrict_ __attr,
- struct sched_param *_Restrict_ __schedparam)
- __THROW _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (posix_spawnattr_getschedparam, int,
- (const posix_spawnattr_t *_Restrict_ __attr,
- struct sched_param *_Restrict_ __schedparam));
-# else
-# if !@HAVE_POSIX_SPAWN@ || POSIX_SPAWN_SETSCHEDPARAM == 0
-_GL_FUNCDECL_SYS (posix_spawnattr_getschedparam, int,
- (const posix_spawnattr_t *_Restrict_ __attr,
- struct sched_param *_Restrict_ __schedparam)
- __THROW _GL_ARG_NONNULL ((1, 2)));
-# endif
-_GL_CXXALIAS_SYS (posix_spawnattr_getschedparam, int,
- (const posix_spawnattr_t *_Restrict_ __attr,
- struct sched_param *_Restrict_ __schedparam));
-# endif
-_GL_CXXALIASWARN (posix_spawnattr_getschedparam);
-#elif defined GNULIB_POSIXCHECK
-# undef posix_spawnattr_getschedparam
-# if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSCHEDPARAM
-_GL_WARN_ON_USE (posix_spawnattr_getschedparam,
- "posix_spawnattr_getschedparam is unportable - "
- "use gnulib module posix_spawnattr_getschedparam for portability");
-# endif
-#endif
-
-#if @GNULIB_POSIX_SPAWNATTR_SETSCHEDPARAM@
-/* Store scheduling parameters in the attribute structure. */
-# if @REPLACE_POSIX_SPAWN@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define posix_spawnattr_setschedparam rpl_posix_spawnattr_setschedparam
-# endif
-_GL_FUNCDECL_RPL (posix_spawnattr_setschedparam, int,
- (posix_spawnattr_t *_Restrict_ __attr,
- const struct sched_param *_Restrict_ __schedparam)
- __THROW _GL_ARG_NONNULL ((1, 2)));
-_GL_CXXALIAS_RPL (posix_spawnattr_setschedparam, int,
- (posix_spawnattr_t *_Restrict_ __attr,
- const struct sched_param *_Restrict_ __schedparam));
-# else
-# if !@HAVE_POSIX_SPAWN@ || POSIX_SPAWN_SETSCHEDPARAM == 0
-_GL_FUNCDECL_SYS (posix_spawnattr_setschedparam, int,
- (posix_spawnattr_t *_Restrict_ __attr,
- const struct sched_param *_Restrict_ __schedparam)
- __THROW _GL_ARG_NONNULL ((1, 2)));
-# endif
-_GL_CXXALIAS_SYS (posix_spawnattr_setschedparam, int,
- (posix_spawnattr_t *_Restrict_ __attr,
- const struct sched_param *_Restrict_ __schedparam));
-# endif
-_GL_CXXALIASWARN (posix_spawnattr_setschedparam);
-#elif defined GNULIB_POSIXCHECK
-# undef posix_spawnattr_setschedparam
-# if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSCHEDPARAM
-_GL_WARN_ON_USE (posix_spawnattr_setschedparam,
- "posix_spawnattr_setschedparam is unportable - "
- "use gnulib module posix_spawnattr_setschedparam for portability");
-# endif
-#endif
-
-
-#if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_INIT@
-/* Initialize data structure for file attribute for 'spawn' call. */
-# if @REPLACE_POSIX_SPAWN@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define posix_spawn_file_actions_init rpl_posix_spawn_file_actions_init
-# endif
-_GL_FUNCDECL_RPL (posix_spawn_file_actions_init, int,
- (posix_spawn_file_actions_t *__file_actions)
- __THROW _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (posix_spawn_file_actions_init, int,
- (posix_spawn_file_actions_t *__file_actions));
-# else
-# if !@HAVE_POSIX_SPAWN@
-_GL_FUNCDECL_SYS (posix_spawn_file_actions_init, int,
- (posix_spawn_file_actions_t *__file_actions)
- __THROW _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (posix_spawn_file_actions_init, int,
- (posix_spawn_file_actions_t *__file_actions));
-# endif
-_GL_CXXALIASWARN (posix_spawn_file_actions_init);
-#elif defined GNULIB_POSIXCHECK
-# undef posix_spawn_file_actions_init
-# if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_INIT
-_GL_WARN_ON_USE (posix_spawn_file_actions_init,
- "posix_spawn_file_actions_init is unportable - "
- "use gnulib module posix_spawn_file_actions_init for portability");
-# endif
-#endif
-
-#if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_DESTROY@
-/* Free resources associated with FILE-ACTIONS. */
-# if @REPLACE_POSIX_SPAWN@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define posix_spawn_file_actions_destroy rpl_posix_spawn_file_actions_destroy
-# endif
-_GL_FUNCDECL_RPL (posix_spawn_file_actions_destroy, int,
- (posix_spawn_file_actions_t *__file_actions)
- __THROW _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (posix_spawn_file_actions_destroy, int,
- (posix_spawn_file_actions_t *__file_actions));
-# else
-# if !@HAVE_POSIX_SPAWN@
-_GL_FUNCDECL_SYS (posix_spawn_file_actions_destroy, int,
- (posix_spawn_file_actions_t *__file_actions)
- __THROW _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (posix_spawn_file_actions_destroy, int,
- (posix_spawn_file_actions_t *__file_actions));
-# endif
-_GL_CXXALIASWARN (posix_spawn_file_actions_destroy);
-#elif defined GNULIB_POSIXCHECK
-# undef posix_spawn_file_actions_destroy
-# if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_DESTROY
-_GL_WARN_ON_USE (posix_spawn_file_actions_destroy,
- "posix_spawn_file_actions_destroy is unportable - "
- "use gnulib module posix_spawn_file_actions_destroy for portability");
-# endif
-#endif
-
-#if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN@
-/* Add an action to FILE-ACTIONS which tells the implementation to call
- 'open' for the given file during the 'spawn' call. */
-# if @REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define posix_spawn_file_actions_addopen rpl_posix_spawn_file_actions_addopen
-# endif
-_GL_FUNCDECL_RPL (posix_spawn_file_actions_addopen, int,
- (posix_spawn_file_actions_t *_Restrict_ __file_actions,
- int __fd,
- const char *_Restrict_ __path, int __oflag, mode_t __mode)
- __THROW _GL_ARG_NONNULL ((1, 3)));
-_GL_CXXALIAS_RPL (posix_spawn_file_actions_addopen, int,
- (posix_spawn_file_actions_t *_Restrict_ __file_actions,
- int __fd,
- const char *_Restrict_ __path, int __oflag, mode_t __mode));
-# else
-# if !@HAVE_POSIX_SPAWN@
-_GL_FUNCDECL_SYS (posix_spawn_file_actions_addopen, int,
- (posix_spawn_file_actions_t *_Restrict_ __file_actions,
- int __fd,
- const char *_Restrict_ __path, int __oflag, mode_t __mode)
- __THROW _GL_ARG_NONNULL ((1, 3)));
-# endif
-_GL_CXXALIAS_SYS (posix_spawn_file_actions_addopen, int,
- (posix_spawn_file_actions_t *_Restrict_ __file_actions,
- int __fd,
- const char *_Restrict_ __path, int __oflag, mode_t __mode));
-# endif
-_GL_CXXALIASWARN (posix_spawn_file_actions_addopen);
-#elif defined GNULIB_POSIXCHECK
-# undef posix_spawn_file_actions_addopen
-# if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN
-_GL_WARN_ON_USE (posix_spawn_file_actions_addopen,
- "posix_spawn_file_actions_addopen is unportable - "
- "use gnulib module posix_spawn_file_actions_addopen for portability");
-# endif
-#endif
-
-#if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE@
-/* Add an action to FILE-ACTIONS which tells the implementation to call
- 'close' for the given file descriptor during the 'spawn' call. */
-# if @REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define posix_spawn_file_actions_addclose rpl_posix_spawn_file_actions_addclose
-# endif
-_GL_FUNCDECL_RPL (posix_spawn_file_actions_addclose, int,
- (posix_spawn_file_actions_t *__file_actions, int __fd)
- __THROW _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (posix_spawn_file_actions_addclose, int,
- (posix_spawn_file_actions_t *__file_actions, int __fd));
-# else
-# if !@HAVE_POSIX_SPAWN@
-_GL_FUNCDECL_SYS (posix_spawn_file_actions_addclose, int,
- (posix_spawn_file_actions_t *__file_actions, int __fd)
- __THROW _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (posix_spawn_file_actions_addclose, int,
- (posix_spawn_file_actions_t *__file_actions, int __fd));
-# endif
-_GL_CXXALIASWARN (posix_spawn_file_actions_addclose);
-#elif defined GNULIB_POSIXCHECK
-# undef posix_spawn_file_actions_addclose
-# if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE
-_GL_WARN_ON_USE (posix_spawn_file_actions_addclose,
- "posix_spawn_file_actions_addclose is unportable - "
- "use gnulib module posix_spawn_file_actions_addclose for portability");
-# endif
-#endif
-
-#if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2@
-/* Add an action to FILE-ACTIONS which tells the implementation to call
- 'dup2' for the given file descriptors during the 'spawn' call. */
-# if @REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# define posix_spawn_file_actions_adddup2 rpl_posix_spawn_file_actions_adddup2
-# endif
-_GL_FUNCDECL_RPL (posix_spawn_file_actions_adddup2, int,
- (posix_spawn_file_actions_t *__file_actions,
- int __fd, int __newfd)
- __THROW _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (posix_spawn_file_actions_adddup2, int,
- (posix_spawn_file_actions_t *__file_actions,
- int __fd, int __newfd));
-# else
-# if !@HAVE_POSIX_SPAWN@
-_GL_FUNCDECL_SYS (posix_spawn_file_actions_adddup2, int,
- (posix_spawn_file_actions_t *__file_actions,
- int __fd, int __newfd)
- __THROW _GL_ARG_NONNULL ((1)));
-# endif
-_GL_CXXALIAS_SYS (posix_spawn_file_actions_adddup2, int,
- (posix_spawn_file_actions_t *__file_actions,
- int __fd, int __newfd));
-# endif
-_GL_CXXALIASWARN (posix_spawn_file_actions_adddup2);
-#elif defined GNULIB_POSIXCHECK
-# undef posix_spawn_file_actions_adddup2
-# if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2
-_GL_WARN_ON_USE (posix_spawn_file_actions_adddup2,
- "posix_spawn_file_actions_adddup2 is unportable - "
- "use gnulib module posix_spawn_file_actions_adddup2 for portability");
-# endif
-#endif
-
-
-#endif /* _@GUARD_PREFIX@_SPAWN_H */
-#endif /* _@GUARD_PREFIX@_SPAWN_H */
diff --git a/lib/spawn_faction_addclose.c b/lib/spawn_faction_addclose.c
deleted file mode 100644
index 86a9aba2..00000000
--- a/lib/spawn_faction_addclose.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Copyright (C) 2000, 2009-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-/* Specification. */
-#include <spawn.h>
-
-#include <errno.h>
-#include <unistd.h>
-
-#if !_LIBC
-# define __sysconf(open_max) getdtablesize ()
-#endif
-
-#if !HAVE_WORKING_POSIX_SPAWN
-# include "spawn_int.h"
-#endif
-
-/* Add an action to FILE-ACTIONS which tells the implementation to call
- 'close' for the given file descriptor during the 'spawn' call. */
-int
-posix_spawn_file_actions_addclose (posix_spawn_file_actions_t *file_actions,
- int fd)
-#undef posix_spawn_file_actions_addclose
-{
- int maxfd = __sysconf (_SC_OPEN_MAX);
-
- /* Test for the validity of the file descriptor. */
- if (fd < 0 || fd >= maxfd)
- return EBADF;
-
-#if HAVE_WORKING_POSIX_SPAWN
- return posix_spawn_file_actions_addclose (file_actions, fd);
-#else
- /* Allocate more memory if needed. */
- if (file_actions->_used == file_actions->_allocated
- && __posix_spawn_file_actions_realloc (file_actions) != 0)
- /* This can only mean we ran out of memory. */
- return ENOMEM;
-
- {
- struct __spawn_action *rec;
-
- /* Add the new value. */
- rec = &file_actions->_actions[file_actions->_used];
- rec->tag = spawn_do_close;
- rec->action.open_action.fd = fd;
-
- /* Account for the new entry. */
- ++file_actions->_used;
-
- return 0;
- }
-#endif
-}
diff --git a/lib/spawn_faction_adddup2.c b/lib/spawn_faction_adddup2.c
deleted file mode 100644
index 56ff1ecc..00000000
--- a/lib/spawn_faction_adddup2.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/* Copyright (C) 2000, 2009-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-/* Specification. */
-#include <spawn.h>
-
-#include <errno.h>
-#include <unistd.h>
-
-#if !_LIBC
-# define __sysconf(open_max) getdtablesize ()
-#endif
-
-#if !HAVE_WORKING_POSIX_SPAWN
-# include "spawn_int.h"
-#endif
-
-/* Add an action to FILE-ACTIONS which tells the implementation to call
- 'dup2' for the given file descriptors during the 'spawn' call. */
-int
-posix_spawn_file_actions_adddup2 (posix_spawn_file_actions_t *file_actions,
- int fd, int newfd)
-#undef posix_spawn_file_actions_adddup2
-{
- int maxfd = __sysconf (_SC_OPEN_MAX);
-
- /* Test for the validity of the file descriptor. */
- if (fd < 0 || newfd < 0 || fd >= maxfd || newfd >= maxfd)
- return EBADF;
-
-#if HAVE_WORKING_POSIX_SPAWN
- return posix_spawn_file_actions_adddup2 (file_actions, fd, newfd);
-#else
- /* Allocate more memory if needed. */
- if (file_actions->_used == file_actions->_allocated
- && __posix_spawn_file_actions_realloc (file_actions) != 0)
- /* This can only mean we ran out of memory. */
- return ENOMEM;
-
- {
- struct __spawn_action *rec;
-
- /* Add the new value. */
- rec = &file_actions->_actions[file_actions->_used];
- rec->tag = spawn_do_dup2;
- rec->action.dup2_action.fd = fd;
- rec->action.dup2_action.newfd = newfd;
-
- /* Account for the new entry. */
- ++file_actions->_used;
-
- return 0;
- }
-#endif
-}
diff --git a/lib/spawn_faction_addopen.c b/lib/spawn_faction_addopen.c
deleted file mode 100644
index 8aaeca6a..00000000
--- a/lib/spawn_faction_addopen.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/* Copyright (C) 2000, 2009-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-/* Specification. */
-#include <spawn.h>
-
-#include <errno.h>
-#include <unistd.h>
-
-#if !_LIBC
-# define __sysconf(open_max) getdtablesize ()
-#endif
-
-#if !HAVE_WORKING_POSIX_SPAWN
-# include "spawn_int.h"
-#endif
-
-/* Add an action to FILE-ACTIONS which tells the implementation to call
- 'open' for the given file during the 'spawn' call. */
-int
-posix_spawn_file_actions_addopen (posix_spawn_file_actions_t *file_actions,
- int fd, const char *path, int oflag,
- mode_t mode)
-#undef posix_spawn_file_actions_addopen
-{
- int maxfd = __sysconf (_SC_OPEN_MAX);
-
- /* Test for the validity of the file descriptor. */
- if (fd < 0 || fd >= maxfd)
- return EBADF;
-
-#if HAVE_WORKING_POSIX_SPAWN
- return posix_spawn_file_actions_addopen (file_actions, fd, path, oflag, mode);
-#else
- /* Allocate more memory if needed. */
- if (file_actions->_used == file_actions->_allocated
- && __posix_spawn_file_actions_realloc (file_actions) != 0)
- /* This can only mean we ran out of memory. */
- return ENOMEM;
-
- {
- struct __spawn_action *rec;
-
- /* Add the new value. */
- rec = &file_actions->_actions[file_actions->_used];
- rec->tag = spawn_do_open;
- rec->action.open_action.fd = fd;
- rec->action.open_action.path = path;
- rec->action.open_action.oflag = oflag;
- rec->action.open_action.mode = mode;
-
- /* Account for the new entry. */
- ++file_actions->_used;
-
- return 0;
- }
-#endif
-}
diff --git a/lib/spawn_faction_destroy.c b/lib/spawn_faction_destroy.c
deleted file mode 100644
index 942733dc..00000000
--- a/lib/spawn_faction_destroy.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 2000, 2009-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-/* Specification. */
-#include <spawn.h>
-
-#include <stdlib.h>
-
-/* Initialize data structure for file attribute for 'spawn' call. */
-int
-posix_spawn_file_actions_destroy (posix_spawn_file_actions_t *file_actions)
-{
- /* Free the memory allocated. */
- free (file_actions->_actions);
- return 0;
-}
diff --git a/lib/spawn_faction_init.c b/lib/spawn_faction_init.c
deleted file mode 100644
index cf1d0a6a..00000000
--- a/lib/spawn_faction_init.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Copyright (C) 2000, 2009-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-/* Specification. */
-#include <spawn.h>
-
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "spawn_int.h"
-
-
-/* Function used to increase the size of the allocated array. This
- function is called from the 'add'-functions. */
-int
-__posix_spawn_file_actions_realloc (posix_spawn_file_actions_t *file_actions)
-{
- int newalloc = file_actions->_allocated + 8;
- void *newmem = realloc (file_actions->_actions,
- newalloc * sizeof (struct __spawn_action));
-
- if (newmem == NULL)
- /* Not enough memory. */
- return ENOMEM;
-
- file_actions->_actions = (struct __spawn_action *) newmem;
- file_actions->_allocated = newalloc;
-
- return 0;
-}
-
-
-/* Initialize data structure for file attribute for 'spawn' call. */
-int
-posix_spawn_file_actions_init (posix_spawn_file_actions_t *file_actions)
-{
- /* Simply clear all the elements. */
- memset (file_actions, '\0', sizeof (*file_actions));
- return 0;
-}
diff --git a/lib/spawn_int.h b/lib/spawn_int.h
deleted file mode 100644
index f22a659f..00000000
--- a/lib/spawn_int.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Copyright (C) 2000, 2008-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
-
-#include <sys/types.h>
-
-/* Data structure to contain the action information. */
-struct __spawn_action
-{
- enum
- {
- spawn_do_close,
- spawn_do_dup2,
- spawn_do_open
- } tag;
-
- union
- {
- struct
- {
- int fd;
- } close_action;
- struct
- {
- int fd;
- int newfd;
- } dup2_action;
- struct
- {
- int fd;
- const char *path;
- int oflag;
- mode_t mode;
- } open_action;
- } action;
-};
-
-#if !_LIBC
-# define __posix_spawn_file_actions_realloc gl_posix_spawn_file_actions_realloc
-#endif
-extern int __posix_spawn_file_actions_realloc (posix_spawn_file_actions_t *
- file_actions);
-
-#if !_LIBC
-# define __spawni gl_posix_spawn_internal
-#endif
-extern int __spawni (pid_t *pid, const char *path,
- const posix_spawn_file_actions_t *file_actions,
- const posix_spawnattr_t *attrp, char *const argv[],
- char *const envp[], int use_path);
diff --git a/lib/spawnattr_destroy.c b/lib/spawnattr_destroy.c
deleted file mode 100644
index ec6c7cf0..00000000
--- a/lib/spawnattr_destroy.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright (C) 2000, 2009-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-/* Specification. */
-#include <spawn.h>
-
-/* Initialize data structure for file attribute for 'spawn' call. */
-int
-posix_spawnattr_destroy (posix_spawnattr_t *attr)
-{
- /* Nothing to do in the moment. */
- return 0;
-}
diff --git a/lib/spawnattr_init.c b/lib/spawnattr_init.c
deleted file mode 100644
index b050fb4a..00000000
--- a/lib/spawnattr_init.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 2000, 2009-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-/* Specification. */
-#include <spawn.h>
-
-#include <string.h>
-
-/* Initialize data structure for file attribute for 'spawn' call. */
-int
-posix_spawnattr_init (posix_spawnattr_t *attr)
-{
- /* All elements have to be initialized to the default values which
- is generally zero. */
- memset (attr, '\0', sizeof (*attr));
-
- return 0;
-}
diff --git a/lib/spawnattr_setflags.c b/lib/spawnattr_setflags.c
deleted file mode 100644
index babbb195..00000000
--- a/lib/spawnattr_setflags.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Copyright (C) 2000, 2004, 2009-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-/* Specification. */
-#include <spawn.h>
-
-#include <errno.h>
-#include <string.h>
-
-#define ALL_FLAGS (POSIX_SPAWN_RESETIDS \
- | POSIX_SPAWN_SETPGROUP \
- | POSIX_SPAWN_SETSIGDEF \
- | POSIX_SPAWN_SETSIGMASK \
- | POSIX_SPAWN_SETSCHEDPARAM \
- | POSIX_SPAWN_SETSCHEDULER \
- | POSIX_SPAWN_USEVFORK)
-
-/* Store flags in the attribute structure. */
-int
-posix_spawnattr_setflags (posix_spawnattr_t *attr, short int flags)
-{
- /* Check no invalid bits are set. */
- if (flags & ~ALL_FLAGS)
- return EINVAL;
-
- /* Store the flag word. */
- attr->_flags = flags;
-
- return 0;
-}
diff --git a/lib/spawnattr_setsigmask.c b/lib/spawnattr_setsigmask.c
deleted file mode 100644
index 8aa6da94..00000000
--- a/lib/spawnattr_setsigmask.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 2000, 2009-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-/* Specification. */
-#include <spawn.h>
-
-#include <string.h>
-
-/* Set signal mask for the new process in ATTR to SIGMASK. */
-int
-posix_spawnattr_setsigmask (posix_spawnattr_t *attr,
- const sigset_t *sigmask)
-{
- /* Copy the sigset_t data to the user buffer. */
- memcpy (&attr->_ss, sigmask, sizeof (sigset_t));
-
- return 0;
-}
diff --git a/lib/spawni.c b/lib/spawni.c
deleted file mode 100644
index 17b903f3..00000000
--- a/lib/spawni.c
+++ /dev/null
@@ -1,374 +0,0 @@
-/* Guts of POSIX spawn interface. Generic POSIX.1 version.
- Copyright (C) 2000-2006, 2008-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-/* Specification. */
-#include <spawn.h>
-#include "spawn_int.h"
-
-#include <alloca.h>
-#include <errno.h>
-
-#include <fcntl.h>
-#ifndef O_LARGEFILE
-# define O_LARGEFILE 0
-#endif
-
-#if _LIBC || HAVE_PATHS_H
-# include <paths.h>
-#else
-# define _PATH_BSHELL "/bin/sh"
-#endif
-
-#include <signal.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#if _LIBC
-# include <not-cancel.h>
-#else
-# define close_not_cancel close
-# define open_not_cancel open
-#endif
-
-#if _LIBC
-# include <local-setxid.h>
-#else
-# if !HAVE_SETEUID
-# define seteuid(id) setresuid (-1, id, -1)
-# endif
-# if !HAVE_SETEGID
-# define setegid(id) setresgid (-1, id, -1)
-# endif
-# define local_seteuid(id) seteuid (id)
-# define local_setegid(id) setegid (id)
-#endif
-
-#if _LIBC
-# define alloca __alloca
-# define execve __execve
-# define dup2 __dup2
-# define fork __fork
-# define getgid __getgid
-# define getuid __getuid
-# define sched_setparam __sched_setparam
-# define sched_setscheduler __sched_setscheduler
-# define setpgid __setpgid
-# define sigaction __sigaction
-# define sigismember __sigismember
-# define sigprocmask __sigprocmask
-# define strchrnul __strchrnul
-# define vfork __vfork
-#else
-# undef internal_function
-# define internal_function /* empty */
-#endif
-
-
-/* The Unix standard contains a long explanation of the way to signal
- an error after the fork() was successful. Since no new wait status
- was wanted there is no way to signal an error using one of the
- available methods. The committee chose to signal an error by a
- normal program exit with the exit code 127. */
-#define SPAWN_ERROR 127
-
-
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-
-/* Native Windows API. */
-int
-__spawni (pid_t *pid, const char *file,
- const posix_spawn_file_actions_t *file_actions,
- const posix_spawnattr_t *attrp, char *const argv[],
- char *const envp[], int use_path)
-{
- /* Not yet implemented. */
- return ENOSYS;
-}
-
-#else
-
-
-/* The file is accessible but it is not an executable file. Invoke
- the shell to interpret it as a script. */
-static void
-internal_function
-script_execute (const char *file, char *const argv[], char *const envp[])
-{
- /* Count the arguments. */
- int argc = 0;
- while (argv[argc++])
- ;
-
- /* Construct an argument list for the shell. */
- {
- char **new_argv = (char **) alloca ((argc + 1) * sizeof (char *));
- new_argv[0] = (char *) _PATH_BSHELL;
- new_argv[1] = (char *) file;
- while (argc > 1)
- {
- new_argv[argc] = argv[argc - 1];
- --argc;
- }
-
- /* Execute the shell. */
- execve (new_argv[0], new_argv, envp);
- }
-}
-
-
-/* Spawn a new process executing PATH with the attributes describes in *ATTRP.
- Before running the process perform the actions described in FILE-ACTIONS. */
-int
-__spawni (pid_t *pid, const char *file,
- const posix_spawn_file_actions_t *file_actions,
- const posix_spawnattr_t *attrp, char *const argv[],
- char *const envp[], int use_path)
-{
- pid_t new_pid;
- char *path, *p, *name;
- size_t len;
- size_t pathlen;
-
- /* Do this once. */
- short int flags = attrp == NULL ? 0 : attrp->_flags;
-
- /* Avoid gcc warning
- "variable 'flags' might be clobbered by 'longjmp' or 'vfork'" */
- (void) &flags;
-
- /* Generate the new process. */
-#if HAVE_VFORK
- if ((flags & POSIX_SPAWN_USEVFORK) != 0
- /* If no major work is done, allow using vfork. Note that we
- might perform the path searching. But this would be done by
- a call to execvp(), too, and such a call must be OK according
- to POSIX. */
- || ((flags & (POSIX_SPAWN_SETSIGMASK | POSIX_SPAWN_SETSIGDEF
- | POSIX_SPAWN_SETSCHEDPARAM | POSIX_SPAWN_SETSCHEDULER
- | POSIX_SPAWN_SETPGROUP | POSIX_SPAWN_RESETIDS)) == 0
- && file_actions == NULL))
- new_pid = vfork ();
- else
-#endif
- new_pid = fork ();
-
- if (new_pid != 0)
- {
- if (new_pid < 0)
- return errno;
-
- /* The call was successful. Store the PID if necessary. */
- if (pid != NULL)
- *pid = new_pid;
-
- return 0;
- }
-
- /* Set signal mask. */
- if ((flags & POSIX_SPAWN_SETSIGMASK) != 0
- && sigprocmask (SIG_SETMASK, &attrp->_ss, NULL) != 0)
- _exit (SPAWN_ERROR);
-
- /* Set signal default action. */
- if ((flags & POSIX_SPAWN_SETSIGDEF) != 0)
- {
- /* We have to iterate over all signals. This could possibly be
- done better but it requires system specific solutions since
- the sigset_t data type can be very different on different
- architectures. */
- int sig;
- struct sigaction sa;
-
- memset (&sa, '\0', sizeof (sa));
- sa.sa_handler = SIG_DFL;
-
- for (sig = 1; sig <= NSIG; ++sig)
- if (sigismember (&attrp->_sd, sig) != 0
- && sigaction (sig, &sa, NULL) != 0)
- _exit (SPAWN_ERROR);
-
- }
-
-#if (_LIBC ? defined _POSIX_PRIORITY_SCHEDULING : HAVE_SCHED_SETPARAM && HAVE_SCHED_SETSCHEDULER)
- /* Set the scheduling algorithm and parameters. */
- if ((flags & (POSIX_SPAWN_SETSCHEDPARAM | POSIX_SPAWN_SETSCHEDULER))
- == POSIX_SPAWN_SETSCHEDPARAM)
- {
- if (sched_setparam (0, &attrp->_sp) == -1)
- _exit (SPAWN_ERROR);
- }
- else if ((flags & POSIX_SPAWN_SETSCHEDULER) != 0)
- {
- if (sched_setscheduler (0, attrp->_policy,
- (flags & POSIX_SPAWN_SETSCHEDPARAM) != 0
- ? &attrp->_sp : NULL) == -1)
- _exit (SPAWN_ERROR);
- }
-#endif
-
- /* Set the process group ID. */
- if ((flags & POSIX_SPAWN_SETPGROUP) != 0
- && setpgid (0, attrp->_pgrp) != 0)
- _exit (SPAWN_ERROR);
-
- /* Set the effective user and group IDs. */
- if ((flags & POSIX_SPAWN_RESETIDS) != 0
- && (local_seteuid (getuid ()) != 0
- || local_setegid (getgid ()) != 0))
- _exit (SPAWN_ERROR);
-
- /* Execute the file actions. */
- if (file_actions != NULL)
- {
- int cnt;
-
- for (cnt = 0; cnt < file_actions->_used; ++cnt)
- {
- struct __spawn_action *action = &file_actions->_actions[cnt];
-
- switch (action->tag)
- {
- case spawn_do_close:
- if (close_not_cancel (action->action.close_action.fd) != 0)
- /* Signal the error. */
- _exit (SPAWN_ERROR);
- break;
-
- case spawn_do_open:
- {
- int new_fd = open_not_cancel (action->action.open_action.path,
- action->action.open_action.oflag
- | O_LARGEFILE,
- action->action.open_action.mode);
-
- if (new_fd == -1)
- /* The 'open' call failed. */
- _exit (SPAWN_ERROR);
-
- /* Make sure the desired file descriptor is used. */
- if (new_fd != action->action.open_action.fd)
- {
- if (dup2 (new_fd, action->action.open_action.fd)
- != action->action.open_action.fd)
- /* The 'dup2' call failed. */
- _exit (SPAWN_ERROR);
-
- if (close_not_cancel (new_fd) != 0)
- /* The 'close' call failed. */
- _exit (SPAWN_ERROR);
- }
- }
- break;
-
- case spawn_do_dup2:
- if (dup2 (action->action.dup2_action.fd,
- action->action.dup2_action.newfd)
- != action->action.dup2_action.newfd)
- /* The 'dup2' call failed. */
- _exit (SPAWN_ERROR);
- break;
- }
- }
- }
-
- if (! use_path || strchr (file, '/') != NULL)
- {
- /* The FILE parameter is actually a path. */
- execve (file, argv, envp);
-
- if (errno == ENOEXEC)
- script_execute (file, argv, envp);
-
- /* Oh, oh. 'execve' returns. This is bad. */
- _exit (SPAWN_ERROR);
- }
-
- /* We have to search for FILE on the path. */
- path = getenv ("PATH");
- if (path == NULL)
- {
-#if HAVE_CONFSTR
- /* There is no 'PATH' in the environment.
- The default search path is the current directory
- followed by the path 'confstr' returns for '_CS_PATH'. */
- len = confstr (_CS_PATH, (char *) NULL, 0);
- path = (char *) alloca (1 + len);
- path[0] = ':';
- (void) confstr (_CS_PATH, path + 1, len);
-#else
- /* Pretend that the PATH contains only the current directory. */
- path = "";
-#endif
- }
-
- len = strlen (file) + 1;
- pathlen = strlen (path);
- name = alloca (pathlen + len + 1);
- /* Copy the file name at the top. */
- name = (char *) memcpy (name + pathlen + 1, file, len);
- /* And add the slash. */
- *--name = '/';
-
- p = path;
- do
- {
- char *startp;
-
- path = p;
- p = strchrnul (path, ':');
-
- if (p == path)
- /* Two adjacent colons, or a colon at the beginning or the end
- of 'PATH' means to search the current directory. */
- startp = name + 1;
- else
- startp = (char *) memcpy (name - (p - path), path, p - path);
-
- /* Try to execute this name. If it works, execv will not return. */
- execve (startp, argv, envp);
-
- if (errno == ENOEXEC)
- script_execute (startp, argv, envp);
-
- switch (errno)
- {
- case EACCES:
- case ENOENT:
- case ESTALE:
- case ENOTDIR:
- /* Those errors indicate the file is missing or not executable
- by us, in which case we want to just try the next path
- directory. */
- break;
-
- default:
- /* Some other error means we found an executable file, but
- something went wrong executing it; return the error to our
- caller. */
- _exit (SPAWN_ERROR);
- }
- }
- while (*p++ != '\0');
-
- /* Return with an error. */
- _exit (SPAWN_ERROR);
-}
-
-#endif
diff --git a/lib/spawnp.c b/lib/spawnp.c
deleted file mode 100644
index 8bc5f99a..00000000
--- a/lib/spawnp.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 2000, 2009-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-/* Specification. */
-#include <spawn.h>
-
-#include "spawn_int.h"
-
-/* Spawn a new process executing FILE with the attributes describes in *ATTRP.
- Before running the process perform the actions described in FILE-ACTIONS. */
-int
-posix_spawnp (pid_t *pid, const char *file,
- const posix_spawn_file_actions_t *file_actions,
- const posix_spawnattr_t *attrp, char *const argv[],
- char *const envp[])
-{
- return __spawni (pid, file, file_actions, attrp, argv, envp, 1);
-}
diff --git a/lib/stat-size.h b/lib/stat-size.h
index 049b8b91..42482fa6 100644
--- a/lib/stat-size.h
+++ b/lib/stat-size.h
@@ -1,5 +1,5 @@
/* macros useful in interpreting size-related values in struct stat.
- Copyright (C) 1989, 1991-2013 Free Software Foundation, Inc.
+ Copyright (C) 1989, 1991-2014 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
diff --git a/lib/stat-time.h b/lib/stat-time.h
index 2d3b5cd6..b3df6eb8 100644
--- a/lib/stat-time.h
+++ b/lib/stat-time.h
@@ -1,6 +1,6 @@
/* stat-related time functions.
- Copyright (C) 2005, 2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2007, 2009-2014 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
@@ -23,6 +23,9 @@
#include <sys/stat.h>
#include <time.h>
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
_GL_INLINE_HEADER_BEGIN
#ifndef _GL_STAT_TIME_INLINE
# define _GL_STAT_TIME_INLINE _GL_INLINE
diff --git a/lib/stat.c b/lib/stat.c
index f888130d..35f4b0b1 100644
--- a/lib/stat.c
+++ b/lib/stat.c
@@ -1,5 +1,5 @@
/* Work around platform bugs in stat.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 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
diff --git a/lib/stdalign.in.h b/lib/stdalign.in.h
index c3a67321..dcaab55b 100644
--- a/lib/stdalign.in.h
+++ b/lib/stdalign.in.h
@@ -1,6 +1,6 @@
/* A substitute for ISO C11 <stdalign.h>.
- Copyright 2011-2013 Free Software Foundation, Inc.
+ Copyright 2011-2014 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
@@ -41,13 +41,28 @@
are 4 unless the option '-malign-double' is used.
The result cannot be used as a value for an 'enum' constant, if you
- want to be portable to HP-UX 10.20 cc and AIX 3.2.5 xlc. */
+ want to be portable to HP-UX 10.20 cc and AIX 3.2.5 xlc.
+
+ Include <stddef.h> for offsetof. */
#include <stddef.h>
-#if defined __cplusplus
+
+/* FreeBSD 9.1 <sys/cdefs.h>, included by <stddef.h> and lots of other
+ standard headers, defines conflicting implementations of _Alignas
+ and _Alignof that are no better than ours; override them. */
+#undef _Alignas
+#undef _Alignof
+
+#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112
+# ifdef __cplusplus
+# if 201103 <= __cplusplus
+# define _Alignof(type) alignof (type)
+# else
template <class __t> struct __alignof_helper { char __a; __t __b; };
-# define _Alignof(type) offsetof (__alignof_helper<type>, __b)
-#else
-# define _Alignof(type) offsetof (struct { char __a; type __b; }, __b)
+# define _Alignof(type) offsetof (__alignof_helper<type>, __b)
+# endif
+# else
+# define _Alignof(type) offsetof (struct { char __a; type __b; }, __b)
+# endif
#endif
#define alignof _Alignof
#define __alignof_is_defined 1
@@ -77,12 +92,17 @@
*/
-#if __GNUC__ || __IBMC__ || __IBMCPP__ || 0x5110 <= __SUNPRO_C
-# define _Alignas(a) __attribute__ ((__aligned__ (a)))
-#elif 1300 <= _MSC_VER
-# define _Alignas(a) __declspec (align (a))
+#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112
+# if defined __cplusplus && 201103 <= __cplusplus
+# define _Alignas(a) alignas (a)
+# elif (__GNUC__ || __HP_cc || __HP_aCC || __IBMC__ || __IBMCPP__ \
+ || __ICC || 0x5110 <= __SUNPRO_C)
+# define _Alignas(a) __attribute__ ((__aligned__ (a)))
+# elif 1300 <= _MSC_VER
+# define _Alignas(a) __declspec (align (a))
+# endif
#endif
-#ifdef _Alignas
+#if defined _Alignas || (defined __STDC_VERSION && 201112 <= __STDC_VERSION__)
# define alignas _Alignas
# define __alignas_is_defined 1
#endif
diff --git a/lib/stdarg.in.h b/lib/stdarg.in.h
index 7484842d..5b37dd36 100644
--- a/lib/stdarg.in.h
+++ b/lib/stdarg.in.h
@@ -1,5 +1,5 @@
/* Substitute for and wrapper around <stdarg.h>.
- Copyright (C) 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2008-2014 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
diff --git a/lib/stdbool.in.h b/lib/stdbool.in.h
index 7c157727..651e8dff 100644
--- a/lib/stdbool.in.h
+++ b/lib/stdbool.in.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2003, 2006-2013 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2003, 2006-2014 Free Software Foundation, Inc.
Written by Bruno Haible <haible@clisp.cons.org>, 2001.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/stddef.in.h b/lib/stddef.in.h
index 40f0536a..f5c0e056 100644
--- a/lib/stddef.in.h
+++ b/lib/stddef.in.h
@@ -1,6 +1,6 @@
/* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 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
diff --git a/lib/stdint.in.h b/lib/stdint.in.h
index 2db8b2e3..247f0d89 100644
--- a/lib/stdint.in.h
+++ b/lib/stdint.in.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2002, 2004-2013 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2002, 2004-2014 Free Software Foundation, Inc.
Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
This file is part of gnulib.
@@ -38,8 +38,7 @@
other system header files; just include the system's <stdint.h>.
Ideally we should test __BIONIC__ here, but it is only defined after
<sys/cdefs.h> has been included; hence test __ANDROID__ instead. */
-#if defined __ANDROID__ \
- && defined _SYS_TYPES_H_ && !defined __need_size_t
+#if defined __ANDROID__ && defined _GL_INCLUDING_SYS_TYPES_H
# @INCLUDE_NEXT@ @NEXT_STDINT_H@
#else
diff --git a/lib/stdio--.h b/lib/stdio--.h
index fe6d83ed..83ddf5aa 100644
--- a/lib/stdio--.h
+++ b/lib/stdio--.h
@@ -1,6 +1,6 @@
/* Like stdio.h, but redefine some names to avoid glitches.
- Copyright (C) 2005-2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2009-2014 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
diff --git a/lib/stdio-impl.h b/lib/stdio-impl.h
index e00600a1..299fe475 100644
--- a/lib/stdio-impl.h
+++ b/lib/stdio-impl.h
@@ -1,5 +1,5 @@
/* Implementation details of FILE streams.
- Copyright (C) 2007-2008, 2010-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007-2008, 2010-2014 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
@@ -57,7 +57,7 @@
# define fp_ fp
# endif
-# if (defined __NetBSD__ && __NetBSD_Version__ >= 105270000) || defined __OpenBSD__ /* NetBSD >= 1.5ZA, OpenBSD */
+# if (defined __NetBSD__ && __NetBSD_Version__ >= 105270000) || defined __OpenBSD__ || defined __ANDROID__ /* NetBSD >= 1.5ZA, OpenBSD, Android */
/* See <http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup>
and <http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup> */
struct __sfileext
diff --git a/lib/stdio-safer.h b/lib/stdio-safer.h
index 7b67ae05..96c861fe 100644
--- a/lib/stdio-safer.h
+++ b/lib/stdio-safer.h
@@ -1,6 +1,6 @@
/* Invoke stdio functions, but avoid some glitches.
- Copyright (C) 2001, 2003, 2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2003, 2006, 2009-2014 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
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index d6af99ca..1e1fe84c 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -1,6 +1,6 @@
/* A GNU-like <stdio.h>.
- Copyright (C) 2004, 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2007-2014 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
@@ -124,6 +124,15 @@
#define _GL_STDIO_STRINGIZE(token) #token
#define _GL_STDIO_MACROEXPAND_AND_STRINGIZE(token) _GL_STDIO_STRINGIZE(token)
+/* When also using extern inline, suppress the use of static inline in
+ standard headers of problematic Apple configurations, as Libc at
+ least through Libc-825.26 (2013-04-09) mishandles it; see, e.g.,
+ <http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>.
+ Perhaps Apple will fix this some day. */
+#if (defined _GL_EXTERN_INLINE_IN_USE && defined __APPLE__ \
+ && defined __GNUC__ && defined __STDC__)
+# undef putc_unlocked
+#endif
#if @GNULIB_DPRINTF@
# if @REPLACE_DPRINTF@
@@ -579,13 +588,23 @@ _GL_CXXALIAS_SYS (fwrite, size_t,
<http://sources.redhat.com/bugzilla/show_bug.cgi?id=11959>,
which sometimes causes an unwanted diagnostic for fwrite calls.
This affects only function declaration attributes under certain
- versions of gcc, and is not needed for C++. */
+ versions of gcc and clang, and is not needed for C++. */
# if (0 < __USE_FORTIFY_LEVEL \
&& __GLIBC__ == 2 && 4 <= __GLIBC_MINOR__ && __GLIBC_MINOR__ <= 15 \
&& 3 < __GNUC__ + (4 <= __GNUC_MINOR__) \
&& !defined __cplusplus)
# undef fwrite
-# define fwrite(a, b, c, d) ({size_t __r = fwrite (a, b, c, d); __r; })
+# undef fwrite_unlocked
+extern size_t __REDIRECT (rpl_fwrite,
+ (const void *__restrict, size_t, size_t,
+ FILE *__restrict),
+ fwrite);
+extern size_t __REDIRECT (rpl_fwrite_unlocked,
+ (const void *__restrict, size_t, size_t,
+ FILE *__restrict),
+ fwrite_unlocked);
+# define fwrite rpl_fwrite
+# define fwrite_unlocked rpl_fwrite_unlocked
# endif
# endif
_GL_CXXALIASWARN (fwrite);
diff --git a/lib/stdlib--.h b/lib/stdlib--.h
index ac02ece9..29be0654 100644
--- a/lib/stdlib--.h
+++ b/lib/stdlib--.h
@@ -1,6 +1,6 @@
/* Like stdlib.h, but redefine some names to avoid glitches.
- Copyright (C) 2005-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005-2007, 2009-2014 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
diff --git a/lib/stdlib-safer.h b/lib/stdlib-safer.h
index 1e314937..6816a366 100644
--- a/lib/stdlib-safer.h
+++ b/lib/stdlib-safer.h
@@ -1,6 +1,6 @@
/* Invoke stdlib.h functions, but avoid some glitches.
- Copyright (C) 2005, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2009-2014 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
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index 422ad714..46e10dba 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -1,6 +1,6 @@
/* A GNU-like <stdlib.h>.
- Copyright (C) 1995, 2001-2004, 2006-2013 Free Software Foundation, Inc.
+ Copyright (C) 1995, 2001-2004, 2006-2014 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
@@ -767,6 +767,22 @@ _GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
# endif
#endif
+#if @GNULIB_SECURE_GETENV@
+/* Look up NAME in the environment, returning 0 in insecure situations. */
+# if !@HAVE_SECURE_GETENV@
+_GL_FUNCDECL_SYS (secure_getenv, char *,
+ (char const *name) _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name));
+_GL_CXXALIASWARN (secure_getenv);
+#elif defined GNULIB_POSIXCHECK
+# undef secure_getenv
+# if HAVE_RAW_DECL_SECURE_GETENV
+_GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - "
+ "use gnulib module secure_getenv for portability");
+# endif
+#endif
+
#if @GNULIB_SETENV@
/* Set NAME to VALUE in the environment.
If REPLACE is nonzero, overwrite an existing value. */
diff --git a/lib/stpcpy.c b/lib/stpcpy.c
index 8d7dfb07..880a7061 100644
--- a/lib/stpcpy.c
+++ b/lib/stpcpy.c
@@ -1,5 +1,5 @@
/* stpcpy.c -- copy a string and return pointer to end of new string
- Copyright (C) 1992, 1995, 1997-1998, 2006, 2009-2013 Free Software
+ Copyright (C) 1992, 1995, 1997-1998, 2006, 2009-2014 Free Software
Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C Library.
diff --git a/lib/stpncpy.c b/lib/stpncpy.c
index 8b14fb95..37018e8b 100644
--- a/lib/stpncpy.c
+++ b/lib/stpncpy.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1995-1997, 2002-2003, 2005-2007, 2009-2013 Free Software
+/* Copyright (C) 1993, 1995-1997, 2002-2003, 2005-2007, 2009-2014 Free Software
* Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C Library.
diff --git a/lib/str-kmp.h b/lib/str-kmp.h
index 16d83a14..b25d07f8 100644
--- a/lib/str-kmp.h
+++ b/lib/str-kmp.h
@@ -1,6 +1,6 @@
/* Substring search in a NUL terminated string of UNIT elements,
using the Knuth-Morris-Pratt algorithm.
- Copyright (C) 2005-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005-2014 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2005.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/str-two-way.h b/lib/str-two-way.h
index 707145db..49ee7469 100644
--- a/lib/str-two-way.h
+++ b/lib/str-two-way.h
@@ -1,5 +1,5 @@
/* Byte-wise substring search, using the Two-Way algorithm.
- Copyright (C) 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2008-2014 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Eric Blake <ebb9@byu.net>, 2008.
diff --git a/lib/strchrnul.c b/lib/strchrnul.c
deleted file mode 100644
index f6b07227..00000000
--- a/lib/strchrnul.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/* Searching in a string.
- Copyright (C) 2003, 2007-2013 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-/* Specification. */
-#include <string.h>
-
-/* Find the first occurrence of C in S or the final NUL byte. */
-char *
-strchrnul (const char *s, int c_in)
-{
- /* On 32-bit hardware, choosing longword to be a 32-bit unsigned
- long instead of a 64-bit uintmax_t tends to give better
- performance. On 64-bit hardware, unsigned long is generally 64
- bits already. Change this typedef to experiment with
- performance. */
- typedef unsigned long int longword;
-
- const unsigned char *char_ptr;
- const longword *longword_ptr;
- longword repeated_one;
- longword repeated_c;
- unsigned char c;
-
- c = (unsigned char) c_in;
- if (!c)
- return rawmemchr (s, 0);
-
- /* Handle the first few bytes by reading one byte at a time.
- Do this until CHAR_PTR is aligned on a longword boundary. */
- for (char_ptr = (const unsigned char *) s;
- (size_t) char_ptr % sizeof (longword) != 0;
- ++char_ptr)
- if (!*char_ptr || *char_ptr == c)
- return (char *) char_ptr;
-
- longword_ptr = (const longword *) char_ptr;
-
- /* All these elucidatory comments refer to 4-byte longwords,
- but the theory applies equally well to any size longwords. */
-
- /* Compute auxiliary longword values:
- repeated_one is a value which has a 1 in every byte.
- repeated_c has c in every byte. */
- repeated_one = 0x01010101;
- repeated_c = c | (c << 8);
- repeated_c |= repeated_c << 16;
- if (0xffffffffU < (longword) -1)
- {
- repeated_one |= repeated_one << 31 << 1;
- repeated_c |= repeated_c << 31 << 1;
- if (8 < sizeof (longword))
- {
- size_t i;
-
- for (i = 64; i < sizeof (longword) * 8; i *= 2)
- {
- repeated_one |= repeated_one << i;
- repeated_c |= repeated_c << i;
- }
- }
- }
-
- /* Instead of the traditional loop which tests each byte, we will
- test a longword at a time. The tricky part is testing if *any of
- the four* bytes in the longword in question are equal to NUL or
- c. We first use an xor with repeated_c. This reduces the task
- to testing whether *any of the four* bytes in longword1 or
- longword2 is zero.
-
- Let's consider longword1. We compute tmp =
- ((longword1 - repeated_one) & ~longword1) & (repeated_one << 7).
- That is, we perform the following operations:
- 1. Subtract repeated_one.
- 2. & ~longword1.
- 3. & a mask consisting of 0x80 in every byte.
- Consider what happens in each byte:
- - If a byte of longword1 is zero, step 1 and 2 transform it into 0xff,
- and step 3 transforms it into 0x80. A carry can also be propagated
- to more significant bytes.
- - If a byte of longword1 is nonzero, let its lowest 1 bit be at
- position k (0 <= k <= 7); so the lowest k bits are 0. After step 1,
- the byte ends in a single bit of value 0 and k bits of value 1.
- After step 2, the result is just k bits of value 1: 2^k - 1. After
- step 3, the result is 0. And no carry is produced.
- So, if longword1 has only non-zero bytes, tmp is zero.
- Whereas if longword1 has a zero byte, call j the position of the least
- significant zero byte. Then the result has a zero at positions 0, ...,
- j-1 and a 0x80 at position j. We cannot predict the result at the more
- significant bytes (positions j+1..3), but it does not matter since we
- already have a non-zero bit at position 8*j+7.
-
- The test whether any byte in longword1 or longword2 is zero is equivalent
- to testing whether tmp1 is nonzero or tmp2 is nonzero. We can combine
- this into a single test, whether (tmp1 | tmp2) is nonzero.
-
- This test can read more than one byte beyond the end of a string,
- depending on where the terminating NUL is encountered. However,
- this is considered safe since the initialization phase ensured
- that the read will be aligned, therefore, the read will not cross
- page boundaries and will not cause a fault. */
-
- while (1)
- {
- longword longword1 = *longword_ptr ^ repeated_c;
- longword longword2 = *longword_ptr;
-
- if (((((longword1 - repeated_one) & ~longword1)
- | ((longword2 - repeated_one) & ~longword2))
- & (repeated_one << 7)) != 0)
- break;
- longword_ptr++;
- }
-
- char_ptr = (const unsigned char *) longword_ptr;
-
- /* At this point, we know that one of the sizeof (longword) bytes
- starting at char_ptr is == 0 or == c. On little-endian machines,
- we could determine the first such byte without any further memory
- accesses, just by looking at the tmp result from the last loop
- iteration. But this does not work on big-endian machines.
- Choose code that works in both cases. */
-
- char_ptr = (unsigned char *) longword_ptr;
- while (*char_ptr && (*char_ptr != c))
- char_ptr++;
- return (char *) char_ptr;
-}
diff --git a/lib/strchrnul.valgrind b/lib/strchrnul.valgrind
deleted file mode 100644
index b14fa130..00000000
--- a/lib/strchrnul.valgrind
+++ /dev/null
@@ -1,12 +0,0 @@
-# Suppress a valgrind message about use of uninitialized memory in strchrnul().
-# This use is OK because it provides only a speedup.
-{
- strchrnul-value4
- Memcheck:Value4
- fun:strchrnul
-}
-{
- strchrnul-value8
- Memcheck:Value8
- fun:strchrnul
-}
diff --git a/lib/strdup.c b/lib/strdup.c
index 5826ab02..14cb1266 100644
--- a/lib/strdup.c
+++ b/lib/strdup.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1996-1998, 2002-2004, 2006-2007, 2009-2013 Free Software
+/* Copyright (C) 1991, 1996-1998, 2002-2004, 2006-2007, 2009-2014 Free Software
Foundation, Inc.
This file is part of the GNU C Library.
diff --git a/lib/streq.h b/lib/streq.h
index 12c1867c..0e62fb93 100644
--- a/lib/streq.h
+++ b/lib/streq.h
@@ -1,5 +1,5 @@
/* Optimized string comparison.
- Copyright (C) 2001-2002, 2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2001-2002, 2007, 2009-2014 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
diff --git a/lib/strerror-override.c b/lib/strerror-override.c
index d0ed2fb8..255d9333 100644
--- a/lib/strerror-override.c
+++ b/lib/strerror-override.c
@@ -1,6 +1,6 @@
/* strerror-override.c --- POSIX compatible system error routine
- Copyright (C) 2010-2013 Free Software Foundation, Inc.
+ Copyright (C) 2010-2014 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
diff --git a/lib/strerror-override.h b/lib/strerror-override.h
index 3b8f24b9..e98c1c16 100644
--- a/lib/strerror-override.h
+++ b/lib/strerror-override.h
@@ -1,6 +1,6 @@
/* strerror-override.h --- POSIX compatible system error routine
- Copyright (C) 2010-2013 Free Software Foundation, Inc.
+ Copyright (C) 2010-2014 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
@@ -48,7 +48,7 @@
|| GNULIB_defined_EOWNERDEAD \
|| GNULIB_defined_ENOTRECOVERABLE \
|| GNULIB_defined_EILSEQ
-extern const char *strerror_override (int errnum);
+extern const char *strerror_override (int errnum) _GL_ATTRIBUTE_CONST;
# else
# define strerror_override(ignored) NULL
# endif
diff --git a/lib/strerror.c b/lib/strerror.c
index 80a2f2ee..e54f0cc9 100644
--- a/lib/strerror.c
+++ b/lib/strerror.c
@@ -1,6 +1,6 @@
/* strerror.c --- POSIX compatible system error routine
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007-2014 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
diff --git a/lib/strftime.c b/lib/strftime.c
index 91d5d85c..857cca56 100644
--- a/lib/strftime.c
+++ b/lib/strftime.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2001, 2003-2007, 2009-2013 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2001, 2003-2007, 2009-2014 Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C Library.
Bugs can be reported to bug-glibc@prep.ai.mit.edu.
@@ -681,24 +681,44 @@ strftime_case_ (bool upcase, STREAM_OR_CHAR_T *s,
switch (format_char)
{
#define DO_NUMBER(d, v) \
- digits = d; \
- number_value = v; goto do_number
+ do \
+ { \
+ digits = d; \
+ number_value = v; \
+ goto do_number; \
+ } \
+ while (0)
#define DO_SIGNED_NUMBER(d, negative, v) \
- digits = d; \
- negative_number = negative; \
- u_number_value = v; goto do_signed_number
+ do \
+ { \
+ digits = d; \
+ negative_number = negative; \
+ u_number_value = v; \
+ goto do_signed_number; \
+ } \
+ while (0)
/* The mask is not what you might think.
When the ordinal i'th bit is set, insert a colon
before the i'th digit of the time zone representation. */
#define DO_TZ_OFFSET(d, negative, mask, v) \
- digits = d; \
- negative_number = negative; \
- tz_colon_mask = mask; \
- u_number_value = v; goto do_tz_offset
+ do \
+ { \
+ digits = d; \
+ negative_number = negative; \
+ tz_colon_mask = mask; \
+ u_number_value = v; \
+ goto do_tz_offset; \
+ } \
+ while (0)
#define DO_NUMBER_SPACEPAD(d, v) \
- digits = d; \
- number_value = v; goto do_number_spacepad
+ do \
+ { \
+ digits = d; \
+ number_value = v; \
+ goto do_number_spacepad; \
+ } \
+ while (0)
case L_('%'):
if (modifier != 0)
@@ -1265,9 +1285,9 @@ strftime_case_ (bool upcase, STREAM_OR_CHAR_T *s,
}
if (modifier == L_('O'))
goto bad_format;
- else
- DO_SIGNED_NUMBER (4, tp->tm_year < -TM_YEAR_BASE,
- tp->tm_year + (unsigned int) TM_YEAR_BASE);
+
+ DO_SIGNED_NUMBER (4, tp->tm_year < -TM_YEAR_BASE,
+ tp->tm_year + (unsigned int) TM_YEAR_BASE);
case L_('y'):
if (modifier == L_('E'))
diff --git a/lib/strftime.h b/lib/strftime.h
index a47e6d1e..be016ea8 100644
--- a/lib/strftime.h
+++ b/lib/strftime.h
@@ -1,6 +1,6 @@
/* declarations for strftime.c
- Copyright (C) 2002, 2004, 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2008-2014 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
diff --git a/lib/striconv.c b/lib/striconv.c
index ba90eddb..2495d81c 100644
--- a/lib/striconv.c
+++ b/lib/striconv.c
@@ -1,5 +1,5 @@
/* Charset conversion.
- Copyright (C) 2001-2007, 2010-2013 Free Software Foundation, Inc.
+ Copyright (C) 2001-2007, 2010-2014 Free Software Foundation, Inc.
Written by Bruno Haible and Simon Josefsson.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/striconv.h b/lib/striconv.h
index 88eaf9dd..5747731e 100644
--- a/lib/striconv.h
+++ b/lib/striconv.h
@@ -1,5 +1,5 @@
/* Charset conversion.
- Copyright (C) 2001-2004, 2006-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2001-2004, 2006-2007, 2009-2014 Free Software Foundation, Inc.
Written by Bruno Haible and Simon Josefsson.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/string.in.h b/lib/string.in.h
index d7a6c9c9..90621420 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -1,6 +1,6 @@
/* A GNU-like <string.h>.
- Copyright (C) 1995-1996, 2001-2013 Free Software Foundation, Inc.
+ Copyright (C) 1995-1996, 2001-2014 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
diff --git a/lib/strintcmp.c b/lib/strintcmp.c
index 23398c3e..98665017 100644
--- a/lib/strintcmp.c
+++ b/lib/strintcmp.c
@@ -1,6 +1,6 @@
/* Compare integer strings.
- Copyright (C) 2005-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005-2014 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
diff --git a/lib/stripslash.c b/lib/stripslash.c
index 0e452a95..6f802d4c 100644
--- a/lib/stripslash.c
+++ b/lib/stripslash.c
@@ -1,6 +1,6 @@
/* stripslash.c -- remove redundant trailing slashes from a file name
- Copyright (C) 1990, 2001, 2003-2006, 2009-2013 Free Software Foundation,
+ Copyright (C) 1990, 2001, 2003-2006, 2009-2014 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/strncat.c b/lib/strncat.c
index 7fb9f25f..71be4d65 100644
--- a/lib/strncat.c
+++ b/lib/strncat.c
@@ -1,5 +1,5 @@
/* Concatenate strings.
- Copyright (C) 1999, 2002, 2006, 2010-2013 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2010-2014 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This program is free software: you can redistribute it and/or modify it
diff --git a/lib/strndup.c b/lib/strndup.c
index e60268b8..cc1a4843 100644
--- a/lib/strndup.c
+++ b/lib/strndup.c
@@ -1,6 +1,6 @@
/* A replacement function, for systems that lack strndup.
- Copyright (C) 1996-1998, 2001-2003, 2005-2007, 2009-2013 Free Software
+ Copyright (C) 1996-1998, 2001-2003, 2005-2007, 2009-2014 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
diff --git a/lib/strnlen.c b/lib/strnlen.c
index 57fdfe77..ddccebc6 100644
--- a/lib/strnlen.c
+++ b/lib/strnlen.c
@@ -1,5 +1,5 @@
/* Find the length of STRING, but scan at most MAXLEN characters.
- Copyright (C) 2005-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005-2007, 2009-2014 Free Software Foundation, Inc.
Written by Simon Josefsson.
This program is free software; you can redistribute it and/or modify
diff --git a/lib/strnlen1.c b/lib/strnlen1.c
index 0c22d21e..363776a9 100644
--- a/lib/strnlen1.c
+++ b/lib/strnlen1.c
@@ -1,5 +1,5 @@
/* Find the length of STRING + 1, but scan at most MAXLEN bytes.
- Copyright (C) 2005-2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2009-2014 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
diff --git a/lib/strnlen1.h b/lib/strnlen1.h
index 7c65e316..b2f956f5 100644
--- a/lib/strnlen1.h
+++ b/lib/strnlen1.h
@@ -1,5 +1,5 @@
/* Find the length of STRING + 1, but scan at most MAXLEN bytes.
- Copyright (C) 2005, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2009-2014 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
diff --git a/lib/strnumcmp-in.h b/lib/strnumcmp-in.h
index 37580332..436f0a6c 100644
--- a/lib/strnumcmp-in.h
+++ b/lib/strnumcmp-in.h
@@ -1,6 +1,6 @@
/* Compare numeric strings. This is an internal include file.
- Copyright (C) 1988-2013 Free Software Foundation, Inc.
+ Copyright (C) 1988-2014 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
diff --git a/lib/strnumcmp.c b/lib/strnumcmp.c
index 314eef79..1a9bccfe 100644
--- a/lib/strnumcmp.c
+++ b/lib/strnumcmp.c
@@ -1,6 +1,6 @@
/* Compare numeric strings.
- Copyright (C) 2005-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005-2014 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
diff --git a/lib/strpbrk.c b/lib/strpbrk.c
index 0f77bcdc..46e58d3b 100644
--- a/lib/strpbrk.c
+++ b/lib/strpbrk.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1994, 2000, 2002-2003, 2006, 2009-2013 Free Software
+/* Copyright (C) 1991, 1994, 2000, 2002-2003, 2006, 2009-2014 Free Software
Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C Library.
diff --git a/lib/strsignal.c b/lib/strsignal.c
index 12cd881f..77ba0630 100644
--- a/lib/strsignal.c
+++ b/lib/strsignal.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1994-2002, 2005, 2008-2013 Free Software Foundation,
+/* Copyright (C) 1991, 1994-2002, 2005, 2008-2014 Free Software Foundation,
Inc.
This file is part of the GNU C Library.
diff --git a/lib/strstr.c b/lib/strstr.c
index b91acec7..d5b9d784 100644
--- a/lib/strstr.c
+++ b/lib/strstr.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1994, 1996-1998, 2000, 2004, 2007-2013 Free Software
+/* Copyright (C) 1991-1994, 1996-1998, 2000, 2004, 2007-2014 Free Software
Foundation, Inc.
This file is part of the GNU C Library.
diff --git a/lib/strtod.c b/lib/strtod.c
index 5c43b4f5..e554a84f 100644
--- a/lib/strtod.c
+++ b/lib/strtod.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1992, 1997, 1999, 2003, 2006, 2008-2013 Free Software
+/* Copyright (C) 1991-1992, 1997, 1999, 2003, 2006, 2008-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -31,9 +31,6 @@
#ifndef HAVE_LDEXP_IN_LIBC
#define HAVE_LDEXP_IN_LIBC 0
#endif
-#ifndef HAVE_RAW_DECL_STRTOD
-#define HAVE_RAW_DECL_STRTOD 0
-#endif
/* Return true if C is a space in the current locale, avoiding
problems with signed char and isspace. */
@@ -344,24 +341,11 @@ strtod (const char *nptr, char **endptr)
return negative ? -num : num;
}
-/* The "underlying" strtod implementation. This must be defined
+/* The underlying strtod implementation. This must be defined
after strtod because it #undefs strtod. */
static double
underlying_strtod (const char *nptr, char **endptr)
{
- if (HAVE_RAW_DECL_STRTOD)
- {
- /* Prefer the native strtod if available. Usually it should
- work and it should give more-accurate results than our
- approximation. */
- #undef strtod
- return strtod (nptr, endptr);
- }
- else
- {
- /* Approximate strtod well enough for this module. There's no
- need to handle anything but finite unsigned decimal
- numbers with nonnull ENDPTR. */
- return parse_number (nptr, 10, 10, 1, 'e', endptr);
- }
+#undef strtod
+ return strtod (nptr, endptr);
}
diff --git a/lib/strtoimax.c b/lib/strtoimax.c
index c9bd2ad3..2c33d585 100644
--- a/lib/strtoimax.c
+++ b/lib/strtoimax.c
@@ -1,6 +1,6 @@
/* Convert string representation of a number into an intmax_t value.
- Copyright (C) 1999, 2001-2004, 2006, 2009-2013 Free Software Foundation,
+ Copyright (C) 1999, 2001-2004, 2006, 2009-2014 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
@@ -28,48 +28,55 @@
#include "verify.h"
#ifdef UNSIGNED
-# ifndef HAVE_DECL_STRTOULL
+# if HAVE_UNSIGNED_LONG_LONG_INT
+# ifndef HAVE_DECL_STRTOULL
"this configure-time declaration test was not run"
-# endif
-# if !HAVE_DECL_STRTOULL && HAVE_UNSIGNED_LONG_LONG_INT
+# endif
+# if !HAVE_DECL_STRTOULL
unsigned long long int strtoull (char const *, char **, int);
+# endif
# endif
#else
-# ifndef HAVE_DECL_STRTOLL
+# if HAVE_LONG_LONG_INT
+# ifndef HAVE_DECL_STRTOLL
"this configure-time declaration test was not run"
-# endif
-# if !HAVE_DECL_STRTOLL && HAVE_LONG_LONG_INT
+# endif
+# if !HAVE_DECL_STRTOLL
long long int strtoll (char const *, char **, int);
+# endif
# endif
#endif
#ifdef UNSIGNED
# define Have_long_long HAVE_UNSIGNED_LONG_LONG_INT
# define Int uintmax_t
+# define Strtoimax strtoumax
+# define Strtol strtoul
+# define Strtoll strtoull
# define Unsigned unsigned
-# define strtoimax strtoumax
-# define strtol strtoul
-# define strtoll strtoull
#else
# define Have_long_long HAVE_LONG_LONG_INT
# define Int intmax_t
+# define Strtoimax strtoimax
+# define Strtol strtol
+# define Strtoll strtoll
# define Unsigned
#endif
Int
-strtoimax (char const *ptr, char **endptr, int base)
+Strtoimax (char const *ptr, char **endptr, int base)
{
#if Have_long_long
verify (sizeof (Int) == sizeof (Unsigned long int)
|| sizeof (Int) == sizeof (Unsigned long long int));
if (sizeof (Int) != sizeof (Unsigned long int))
- return strtoll (ptr, endptr, base);
+ return Strtoll (ptr, endptr, base);
#else
verify (sizeof (Int) == sizeof (Unsigned long int));
#endif
- return strtol (ptr, endptr, base);
+ return Strtol (ptr, endptr, base);
}
diff --git a/lib/strtol.c b/lib/strtol.c
index 379eda8c..2e015dc5 100644
--- a/lib/strtol.c
+++ b/lib/strtol.c
@@ -1,6 +1,6 @@
/* Convert string representation of a number into an integer value.
- Copyright (C) 1991-1992, 1994-1999, 2003, 2005-2007, 2009-2013 Free Software
+ Copyright (C) 1991-1992, 1994-1999, 2003, 2005-2007, 2009-2014 Free Software
Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C
diff --git a/lib/strtoll.c b/lib/strtoll.c
index bb424002..47dfaa06 100644
--- a/lib/strtoll.c
+++ b/lib/strtoll.c
@@ -1,5 +1,5 @@
/* Function to parse a 'long long int' from text.
- Copyright (C) 1995-1997, 1999, 2001, 2009-2013 Free Software Foundation,
+ Copyright (C) 1995-1997, 1999, 2001, 2009-2014 Free Software Foundation,
Inc.
This file is part of the GNU C Library.
diff --git a/lib/strtoul.c b/lib/strtoul.c
index a0ca376c..4c5ceaff 100644
--- a/lib/strtoul.c
+++ b/lib/strtoul.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1997, 2009-2013 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1997, 2009-2014 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/strtoull.c b/lib/strtoull.c
index 494cc2f2..30e6e027 100644
--- a/lib/strtoull.c
+++ b/lib/strtoull.c
@@ -1,5 +1,5 @@
/* Function to parse an 'unsigned long long int' from text.
- Copyright (C) 1995-1997, 1999, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 1995-1997, 1999, 2009-2014 Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C
Library. Bugs can be reported to bug-glibc@gnu.org.
diff --git a/lib/symlink.c b/lib/symlink.c
index d3c9f21b..0e3fae25 100644
--- a/lib/symlink.c
+++ b/lib/symlink.c
@@ -1,5 +1,5 @@
/* Stub for symlink().
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 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
diff --git a/lib/sys_ioctl.in.h b/lib/sys_ioctl.in.h
index 62024ab0..c13e3172 100644
--- a/lib/sys_ioctl.in.h
+++ b/lib/sys_ioctl.in.h
@@ -1,5 +1,5 @@
/* Substitute for and wrapper around <sys/ioctl.h>.
- Copyright (C) 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2008-2014 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
diff --git a/lib/sys_resource.in.h b/lib/sys_resource.in.h
index af546fb4..7a17e32d 100644
--- a/lib/sys_resource.in.h
+++ b/lib/sys_resource.in.h
@@ -1,5 +1,5 @@
/* Substitute for <sys/resource.h>.
- Copyright (C) 2012-2013 Free Software Foundation, Inc.
+ Copyright (C) 2012-2014 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
diff --git a/lib/sys_select.in.h b/lib/sys_select.in.h
index 521ccef3..a876b9ca 100644
--- a/lib/sys_select.in.h
+++ b/lib/sys_select.in.h
@@ -1,5 +1,5 @@
/* Substitute for <sys/select.h>.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007-2014 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
@@ -21,23 +21,27 @@
/* On OSF/1 and Solaris 2.6, <sys/types.h> and <sys/time.h>
both include <sys/select.h>.
+ On Cygwin, <sys/time.h> includes <sys/select.h>.
Simply delegate to the system's header in this case. */
#if (@HAVE_SYS_SELECT_H@ \
- && ((defined __osf__ && defined _SYS_TYPES_H_ && defined _OSF_SOURCE) \
+ && ((defined __osf__ && defined _SYS_TYPES_H_ \
+ && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H \
+ && defined _OSF_SOURCE) \
|| (defined __sun && defined _SYS_TYPES_H \
&& (! (defined _XOPEN_SOURCE || defined _POSIX_C_SOURCE) \
- || defined __EXTENSIONS__))) \
- && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H)
+ || defined __EXTENSIONS__))))
# define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H
# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
#elif (@HAVE_SYS_SELECT_H@ \
- && ((defined __osf__ && defined _SYS_TIME_H_ && defined _OSF_SOURCE) \
+ && (defined _CYGWIN_SYS_TIME_H \
+ || (defined __osf__ && defined _SYS_TIME_H_ \
+ && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H \
+ && defined _OSF_SOURCE) \
|| (defined __sun && defined _SYS_TIME_H \
&& (! (defined _XOPEN_SOURCE || defined _POSIX_C_SOURCE) \
- || defined __EXTENSIONS__))) \
- && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H)
+ || defined __EXTENSIONS__))))
# define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H
# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
diff --git a/lib/sys_socket.in.h b/lib/sys_socket.in.h
index b4cf0c39..3cdc0d11 100644
--- a/lib/sys_socket.in.h
+++ b/lib/sys_socket.in.h
@@ -1,6 +1,6 @@
/* Provide a sys/socket header file for systems lacking it (read: MinGW)
and for systems where it is incomplete.
- Copyright (C) 2005-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005-2014 Free Software Foundation, Inc.
Written by Simon Josefsson.
This program is free software; you can redistribute it and/or modify
@@ -63,6 +63,9 @@
#ifndef _@GUARD_PREFIX@_SYS_SOCKET_H
#define _@GUARD_PREFIX@_SYS_SOCKET_H
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
_GL_INLINE_HEADER_BEGIN
#ifndef _GL_SYS_SOCKET_INLINE
# define _GL_SYS_SOCKET_INLINE _GL_INLINE
diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h
index acc36947..b47a7ff0 100644
--- a/lib/sys_stat.in.h
+++ b/lib/sys_stat.in.h
@@ -1,5 +1,5 @@
/* Provide a more complete sys/stat header file.
- Copyright (C) 2005-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005-2014 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
diff --git a/lib/sys_time.in.h b/lib/sys_time.in.h
index 656c3f13..30057ad4 100644
--- a/lib/sys_time.in.h
+++ b/lib/sys_time.in.h
@@ -1,6 +1,6 @@
/* Provide a more complete sys/time.h.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007-2014 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
@@ -24,6 +24,15 @@
#endif
@PRAGMA_COLUMNS@
+/* On Cygwin and on many BSDish systems, <sys/time.h> includes itself
+ recursively via <sys/select.h>.
+ Simply delegate to the system's header in this case; it is a no-op.
+ Without this extra ifdef, the C++ gettimeofday declaration below
+ would be a forward declaration in gnulib's nested <sys/time.h>. */
+#if defined _CYGWIN_SYS_TIME_H || defined _SYS_TIME_H || defined _SYS_TIME_H_
+# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
+#else
+
/* The include_next requires a split double-inclusion guard. */
#if @HAVE_SYS_TIME_H@
# @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
@@ -200,4 +209,5 @@ _GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - "
#endif
#endif /* _@GUARD_PREFIX@_SYS_TIME_H */
+#endif /* _CYGWIN_SYS_TIME_H */
#endif /* _@GUARD_PREFIX@_SYS_TIME_H */
diff --git a/lib/sys_types.in.h b/lib/sys_types.in.h
index d7da3562..deb5d67d 100644
--- a/lib/sys_types.in.h
+++ b/lib/sys_types.in.h
@@ -1,6 +1,6 @@
/* Provide a more complete sys/types.h.
- Copyright (C) 2011-2013 Free Software Foundation, Inc.
+ Copyright (C) 2011-2014 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
@@ -23,7 +23,9 @@
#ifndef _@GUARD_PREFIX@_SYS_TYPES_H
/* The include_next requires a split double-inclusion guard. */
+# define _GL_INCLUDING_SYS_TYPES_H
#@INCLUDE_NEXT@ @NEXT_SYS_TYPES_H@
+# undef _GL_INCLUDING_SYS_TYPES_H
#ifndef _@GUARD_PREFIX@_SYS_TYPES_H
#define _@GUARD_PREFIX@_SYS_TYPES_H
diff --git a/lib/sys_uio.in.h b/lib/sys_uio.in.h
index fef19dc3..0b403bc1 100644
--- a/lib/sys_uio.in.h
+++ b/lib/sys_uio.in.h
@@ -1,5 +1,5 @@
/* Substitute for <sys/uio.h>.
- Copyright (C) 2011-2013 Free Software Foundation, Inc.
+ Copyright (C) 2011-2014 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
diff --git a/lib/sys_utsname.in.h b/lib/sys_utsname.in.h
index d468ba9c..f9e9d9d9 100644
--- a/lib/sys_utsname.in.h
+++ b/lib/sys_utsname.in.h
@@ -1,5 +1,5 @@
/* Substitute for <sys/utsname.h>.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 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
diff --git a/lib/sys_wait.in.h b/lib/sys_wait.in.h
index bd97d61f..6412af4d 100644
--- a/lib/sys_wait.in.h
+++ b/lib/sys_wait.in.h
@@ -1,5 +1,5 @@
/* A POSIX-like <sys/wait.h>.
- Copyright (C) 2001-2003, 2005-2013 Free Software Foundation, Inc.
+ Copyright (C) 2001-2003, 2005-2014 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
diff --git a/lib/tempname.c b/lib/tempname.c
index bdb4f21a..183dae8c 100644
--- a/lib/tempname.c
+++ b/lib/tempname.c
@@ -1,6 +1,6 @@
/* tempname.c - generate the name of a temporary file.
- Copyright (C) 1991-2003, 2005-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 1991-2003, 2005-2007, 2009-2014 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
@@ -70,10 +70,7 @@
# define __mkdir mkdir
# define __open open
# define __lxstat64(version, file, buf) lstat (file, buf)
-#endif
-
-#if ! (HAVE___SECURE_GETENV || _LIBC)
-# define __secure_getenv getenv
+# define __secure_getenv secure_getenv
#endif
#ifdef _LIBC
diff --git a/lib/tempname.h b/lib/tempname.h
index 1709e99d..696aff25 100644
--- a/lib/tempname.h
+++ b/lib/tempname.h
@@ -1,6 +1,6 @@
/* Create a temporary file or directory.
- Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2009-2014 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
diff --git a/lib/termios.in.h b/lib/termios.in.h
index 1a5d7e52..1299bb73 100644
--- a/lib/termios.in.h
+++ b/lib/termios.in.h
@@ -1,5 +1,5 @@
/* Substitute for and wrapper around <termios.h>.
- Copyright (C) 2010-2013 Free Software Foundation, Inc.
+ Copyright (C) 2010-2014 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
diff --git a/lib/time.in.h b/lib/time.in.h
index 8ced7947..81abdf46 100644
--- a/lib/time.in.h
+++ b/lib/time.in.h
@@ -1,6 +1,6 @@
/* A more-standard <time.h>.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007-2014 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
@@ -48,20 +48,13 @@
/* Some systems don't define struct timespec (e.g., AIX 4.1, Ultrix 4.3).
Or they define it with the wrong member names or define it in <sys/time.h>
- (e.g., FreeBSD circa 1997). Stock Mingw does not define it, but the
- pthreads-win32 library defines it in <pthread.h>. */
+ (e.g., FreeBSD circa 1997). Stock Mingw prior to 3.0 does not define it,
+ but the pthreads-win32 library defines it in <pthread.h>. */
# if ! @TIME_H_DEFINES_STRUCT_TIMESPEC@
# if @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
# include <sys/time.h>
# elif @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@
# include <pthread.h>
-/* The pthreads-win32 <pthread.h> also defines a couple of broken macros. */
-# undef asctime_r
-# undef ctime_r
-# undef gmtime_r
-# undef localtime_r
-# undef rand_r
-# undef strtok_r
# else
# ifdef __cplusplus
@@ -187,6 +180,39 @@ _GL_CXXALIASWARN (gmtime_r);
# endif
# endif
+/* Convert TIMER to RESULT, assuming local time and UTC respectively. See
+ <http://www.opengroup.org/susv3xsh/localtime.html> and
+ <http://www.opengroup.org/susv3xsh/gmtime.html>. */
+# if @GNULIB_GETTIMEOFDAY@
+# if @REPLACE_LOCALTIME@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef localtime
+# define localtime rpl_localtime
+# endif
+_GL_FUNCDECL_RPL (localtime, struct tm *, (time_t const *__timer)
+ _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (localtime, struct tm *, (time_t const *__timer));
+# else
+_GL_CXXALIAS_SYS (localtime, struct tm *, (time_t const *__timer));
+# endif
+_GL_CXXALIASWARN (localtime);
+# endif
+
+# if @GNULIB_GETTIMEOFDAY@
+# if @REPLACE_GMTIME@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef gmtime
+# define gmtime rpl_gmtime
+# endif
+_GL_FUNCDECL_RPL (gmtime, struct tm *, (time_t const *__timer)
+ _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (gmtime, struct tm *, (time_t const *__timer));
+# else
+_GL_CXXALIAS_SYS (gmtime, struct tm *, (time_t const *__timer));
+# endif
+_GL_CXXALIASWARN (gmtime);
+# endif
+
/* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store
the resulting broken-down time into TM. See
<http://www.opengroup.org/susv3xsh/strptime.html>. */
diff --git a/lib/time_r.c b/lib/time_r.c
index 98662998..a848d544 100644
--- a/lib/time_r.c
+++ b/lib/time_r.c
@@ -1,6 +1,6 @@
/* Reentrant time functions like localtime_r.
- Copyright (C) 2003, 2006-2007, 2010-2013 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2006-2007, 2010-2014 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
diff --git a/lib/timespec.h b/lib/timespec.h
index d665e6cc..872cbb76 100644
--- a/lib/timespec.h
+++ b/lib/timespec.h
@@ -1,6 +1,6 @@
/* timespec -- System time interface
- Copyright (C) 2000, 2002, 2004-2005, 2007, 2009-2013 Free Software
+ Copyright (C) 2000, 2002, 2004-2005, 2007, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -21,11 +21,31 @@
# include <time.h>
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
_GL_INLINE_HEADER_BEGIN
#ifndef _GL_TIMESPEC_INLINE
# define _GL_TIMESPEC_INLINE _GL_INLINE
#endif
+/* Resolution of timespec time stamps (in units per second), and log
+ base 10 of the resolution. */
+
+enum { TIMESPEC_RESOLUTION = 1000000000 };
+enum { LOG10_TIMESPEC_RESOLUTION = 9 };
+
+/* Return a timespec with seconds S and nanoseconds NS. */
+
+_GL_TIMESPEC_INLINE struct timespec
+make_timespec (time_t s, long int ns)
+{
+ struct timespec r;
+ r.tv_sec = s;
+ r.tv_nsec = ns;
+ return r;
+}
+
/* Return negative, zero, positive if A < B, A == B, A > B, respectively.
For each time stamp T, this code assumes that either:
diff --git a/lib/trim.c b/lib/trim.c
index 9581f511..742de9be 100644
--- a/lib/trim.c
+++ b/lib/trim.c
@@ -1,5 +1,5 @@
/* Removes leading and/or trailing whitespaces
- Copyright (C) 2006-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006-2014 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
diff --git a/lib/trim.h b/lib/trim.h
index ab0caa1b..e4dc938b 100644
--- a/lib/trim.h
+++ b/lib/trim.h
@@ -1,5 +1,5 @@
/* Removes leading and/or trailing whitespaces
- Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2009-2014 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
diff --git a/lib/u64.h b/lib/u64.h
index d8009ad3..ee3bfcd8 100644
--- a/lib/u64.h
+++ b/lib/u64.h
@@ -1,6 +1,6 @@
/* uint64_t-like operations that work even on hosts lacking uint64_t
- Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2009-2014 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
@@ -19,6 +19,9 @@
#include <stdint.h>
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
_GL_INLINE_HEADER_BEGIN
#ifndef _GL_U64_INLINE
# define _GL_U64_INLINE _GL_INLINE
diff --git a/lib/uname.c b/lib/uname.c
index e6b29a47..c1d85196 100644
--- a/lib/uname.c
+++ b/lib/uname.c
@@ -1,5 +1,5 @@
/* uname replacement.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 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
diff --git a/lib/unicodeio.c b/lib/unicodeio.c
index 62aee248..9df8b79f 100644
--- a/lib/unicodeio.c
+++ b/lib/unicodeio.c
@@ -1,6 +1,6 @@
/* Unicode character output to streams with locale dependent encoding.
- Copyright (C) 2000-2003, 2006, 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2000-2003, 2006, 2008-2014 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
diff --git a/lib/unicodeio.h b/lib/unicodeio.h
index eee7e284..1706cf64 100644
--- a/lib/unicodeio.h
+++ b/lib/unicodeio.h
@@ -1,6 +1,6 @@
/* Unicode character output to streams with locale dependent encoding.
- Copyright (C) 2000-2003, 2005, 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2000-2003, 2005, 2008-2014 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
diff --git a/lib/unistd--.h b/lib/unistd--.h
index ac2de1cf..9d0e54d1 100644
--- a/lib/unistd--.h
+++ b/lib/unistd--.h
@@ -1,6 +1,6 @@
/* Like unistd.h, but redefine some names to avoid glitches.
- Copyright (C) 2005, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2009-2014 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
diff --git a/lib/unistd-safer.h b/lib/unistd-safer.h
index 5c2b55ae..4b0ca6ab 100644
--- a/lib/unistd-safer.h
+++ b/lib/unistd-safer.h
@@ -1,6 +1,6 @@
/* Invoke unistd-like functions, but avoid some glitches.
- Copyright (C) 2001, 2003, 2005, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2003, 2005, 2009-2014 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
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index a870fe7b..622b2287 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -1,5 +1,5 @@
/* Substitute for and wrapper around <unistd.h>.
- Copyright (C) 2003-2013 Free Software Foundation, Inc.
+ Copyright (C) 2003-2014 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
@@ -21,9 +21,23 @@
#endif
@PRAGMA_COLUMNS@
+#ifdef _GL_INCLUDING_UNISTD_H
+/* Special invocation convention:
+ - On Mac OS X 10.3.9 we have a sequence of nested includes
+ <unistd.h> -> <signal.h> -> <pthread.h> -> <unistd.h>
+ In this situation, the functions are not yet declared, therefore we cannot
+ provide the C++ aliases. */
+
+#@INCLUDE_NEXT@ @NEXT_UNISTD_H@
+
+#else
+/* Normal invocation convention. */
+
/* The include_next requires a split double-inclusion guard. */
#if @HAVE_UNISTD_H@
+# define _GL_INCLUDING_UNISTD_H
# @INCLUDE_NEXT@ @NEXT_UNISTD_H@
+# undef _GL_INCLUDING_UNISTD_H
#endif
/* Get all possible declarations of gethostname(). */
@@ -61,8 +75,10 @@
/* mingw, MSVC, BeOS, Haiku declare environ in <stdlib.h>, not in
<unistd.h>. */
/* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */
+/* OSF Tru64 Unix cannot see gnulib rpl_strtod when system <stdlib.h> is
+ included here. */
/* But avoid namespace pollution on glibc systems. */
-#ifndef __GLIBC__
+#if !defined __GLIBC__ && !defined __osf__
# define __need_system_stdlib_h
# include <stdlib.h>
# undef __need_system_stdlib_h
@@ -110,9 +126,13 @@
/* Get getopt(), optarg, optind, opterr, optopt.
But avoid namespace pollution on glibc systems. */
#if @GNULIB_UNISTD_H_GETOPT@ && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT
+# define __need_getopt
# include <getopt.h>
#endif
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
_GL_INLINE_HEADER_BEGIN
#ifndef _GL_UNISTD_INLINE
# define _GL_UNISTD_INLINE _GL_INLINE
@@ -648,10 +668,19 @@ _GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - "
#if @GNULIB_GETDTABLESIZE@
/* Return the maximum number of file descriptors in the current process.
In POSIX, this is same as sysconf (_SC_OPEN_MAX). */
-# if !@HAVE_GETDTABLESIZE@
+# if @REPLACE_GETDTABLESIZE@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef getdtablesize
+# define getdtablesize rpl_getdtablesize
+# endif
+_GL_FUNCDECL_RPL (getdtablesize, int, (void));
+_GL_CXXALIAS_RPL (getdtablesize, int, (void));
+# else
+# if !@HAVE_GETDTABLESIZE@
_GL_FUNCDECL_SYS (getdtablesize, int, (void));
-# endif
+# endif
_GL_CXXALIAS_SYS (getdtablesize, int, (void));
+# endif
_GL_CXXALIASWARN (getdtablesize);
#elif defined GNULIB_POSIXCHECK
# undef getdtablesize
@@ -1524,4 +1553,5 @@ _GL_CXXALIASWARN (write);
_GL_INLINE_HEADER_END
#endif /* _@GUARD_PREFIX@_UNISTD_H */
+#endif /* _GL_INCLUDING_UNISTD_H */
#endif /* _@GUARD_PREFIX@_UNISTD_H */
diff --git a/lib/unistr.in.h b/lib/unistr.in.h
index 980b4bbf..222c9595 100644
--- a/lib/unistr.in.h
+++ b/lib/unistr.in.h
@@ -1,5 +1,5 @@
/* Elementary Unicode string functions.
- Copyright (C) 2001-2002, 2005-2013 Free Software Foundation, Inc.
+ Copyright (C) 2001-2002, 2005-2014 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
diff --git a/lib/unistr/u8-mbtoucr.c b/lib/unistr/u8-mbtoucr.c
index 72cab8dc..b11543a5 100644
--- a/lib/unistr/u8-mbtoucr.c
+++ b/lib/unistr/u8-mbtoucr.c
@@ -1,5 +1,5 @@
/* Look at first character in UTF-8 string, returning an error code.
- Copyright (C) 1999-2002, 2006-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 1999-2002, 2006-2007, 2009-2014 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2001.
This program is free software: you can redistribute it and/or modify it
diff --git a/lib/unistr/u8-uctomb-aux.c b/lib/unistr/u8-uctomb-aux.c
index 47c2e882..8fdd88b5 100644
--- a/lib/unistr/u8-uctomb-aux.c
+++ b/lib/unistr/u8-uctomb-aux.c
@@ -1,5 +1,5 @@
/* Conversion UCS-4 to UTF-8.
- Copyright (C) 2002, 2006-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006-2007, 2009-2014 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This program is free software: you can redistribute it and/or modify it
diff --git a/lib/unistr/u8-uctomb.c b/lib/unistr/u8-uctomb.c
index 1932a2b4..df9b227e 100644
--- a/lib/unistr/u8-uctomb.c
+++ b/lib/unistr/u8-uctomb.c
@@ -1,5 +1,5 @@
/* Store a character in UTF-8 string.
- Copyright (C) 2002, 2005-2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005-2006, 2009-2014 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This program is free software: you can redistribute it and/or modify it
diff --git a/lib/unitypes.in.h b/lib/unitypes.in.h
index 06eef05c..bc302c24 100644
--- a/lib/unitypes.in.h
+++ b/lib/unitypes.in.h
@@ -1,5 +1,5 @@
/* Elementary types and macros for the GNU UniString library.
- Copyright (C) 2002, 2005-2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005-2006, 2009-2014 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
diff --git a/lib/uniwidth.in.h b/lib/uniwidth.in.h
index 8931cc9b..b2fd218e 100644
--- a/lib/uniwidth.in.h
+++ b/lib/uniwidth.in.h
@@ -1,5 +1,5 @@
/* Display width functions.
- Copyright (C) 2001-2002, 2005, 2007, 2009-2013 Free Software Foundation,
+ Copyright (C) 2001-2002, 2005, 2007, 2009-2014 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify it
diff --git a/lib/uniwidth/cjk.h b/lib/uniwidth/cjk.h
index 11b14dfe..71ea0cb7 100644
--- a/lib/uniwidth/cjk.h
+++ b/lib/uniwidth/cjk.h
@@ -1,5 +1,5 @@
/* Test for CJK encoding.
- Copyright (C) 2001-2002, 2005-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2001-2002, 2005-2007, 2009-2014 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This program is free software: you can redistribute it and/or modify it
diff --git a/lib/uniwidth/width.c b/lib/uniwidth/width.c
index 173d0872..2c070c3e 100644
--- a/lib/uniwidth/width.c
+++ b/lib/uniwidth/width.c
@@ -1,5 +1,5 @@
/* Determine display width of Unicode character.
- Copyright (C) 2001-2002, 2006-2013 Free Software Foundation, Inc.
+ Copyright (C) 2001-2002, 2006-2014 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This program is free software: you can redistribute it and/or modify it
diff --git a/lib/unlink.c b/lib/unlink.c
index fdd5565f..a234be4a 100644
--- a/lib/unlink.c
+++ b/lib/unlink.c
@@ -1,6 +1,6 @@
/* Work around unlink bugs.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 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
diff --git a/lib/unlinkat.c b/lib/unlinkat.c
index 67263721..fff8310e 100644
--- a/lib/unlinkat.c
+++ b/lib/unlinkat.c
@@ -1,6 +1,6 @@
/* Work around unlinkat bugs on Solaris 9 and Hurd.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 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
diff --git a/lib/unlocked-io.h b/lib/unlocked-io.h
index df3e1391..4b0f3ff0 100644
--- a/lib/unlocked-io.h
+++ b/lib/unlocked-io.h
@@ -1,6 +1,6 @@
/* Prefer faster, non-thread-safe stdio functions if available.
- Copyright (C) 2001-2004, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2001-2004, 2009-2014 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
diff --git a/lib/unsetenv.c b/lib/unsetenv.c
index eea21129..53721fc4 100644
--- a/lib/unsetenv.c
+++ b/lib/unsetenv.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1995-2002, 2005-2013 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1995-2002, 2005-2014 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software: you can redistribute it and/or modify
@@ -14,12 +14,12 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#include <config.h>
-
/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
optimizes away the name == NULL test below. */
#define _GL_ARG_NONNULL(params)
+#include <config.h>
+
/* Specification. */
#include <stdlib.h>
diff --git a/lib/userspec.c b/lib/userspec.c
index d760996c..1be9266e 100644
--- a/lib/userspec.c
+++ b/lib/userspec.c
@@ -1,5 +1,5 @@
/* userspec.c -- Parse a user and group string.
- Copyright (C) 1989-1992, 1997-1998, 2000, 2002-2013 Free Software
+ Copyright (C) 1989-1992, 1997-1998, 2000, 2002-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -114,10 +114,13 @@ parse_with_separator (char const *spec, char const *separator,
char const *g;
char *gname = NULL;
uid_t unum = *uid;
- gid_t gnum = *gid;
+ gid_t gnum = gid ? *gid : -1;
error_msg = NULL;
- *username = *groupname = NULL;
+ if (username)
+ *username = NULL;
+ if (groupname)
+ *groupname = NULL;
/* Set U and G to nonzero length strings corresponding to user and
group specifiers or to NULL. If U is not NULL, it is a newly
@@ -215,20 +218,29 @@ parse_with_separator (char const *spec, char const *separator,
if (error_msg == NULL)
{
*uid = unum;
- *gid = gnum;
- *username = u;
- *groupname = gname;
- u = NULL;
+ if (gid)
+ *gid = gnum;
+ if (username)
+ {
+ *username = u;
+ u = NULL;
+ }
+ if (groupname)
+ {
+ *groupname = gname;
+ gname = NULL;
+ }
}
- else
- free (gname);
free (u);
+ free (gname);
return _(error_msg);
}
/* Extract from SPEC, which has the form "[user][:.][group]",
a USERNAME, UID U, GROUPNAME, and GID G.
+ If the GID parameter is NULL the entire SPEC is treated as a user.
+ If the USERNAME and GROUPNAME parameters are NULL they're ignored.
Either user or group, or both, must be present.
If the group is omitted but the separator is given,
use the given user's login group.
@@ -247,11 +259,11 @@ char const *
parse_user_spec (char const *spec, uid_t *uid, gid_t *gid,
char **username, char **groupname)
{
- char const *colon = strchr (spec, ':');
+ char const *colon = gid ? strchr (spec, ':') : NULL;
char const *error_msg =
parse_with_separator (spec, colon, uid, gid, username, groupname);
- if (!colon && error_msg)
+ if (gid && !colon && error_msg)
{
/* If there's no colon but there is a dot, and if looking up the
whole spec failed (i.e., the spec is not an owner name that
diff --git a/lib/utimecmp.c b/lib/utimecmp.c
index dc622ad1..49ea5f86 100644
--- a/lib/utimecmp.c
+++ b/lib/utimecmp.c
@@ -1,6 +1,6 @@
/* utimecmp.c -- compare file time stamps
- Copyright (C) 2004-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2004-2007, 2009-2014 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
diff --git a/lib/utimecmp.h b/lib/utimecmp.h
index 1bc90186..81c16e27 100644
--- a/lib/utimecmp.h
+++ b/lib/utimecmp.h
@@ -1,6 +1,6 @@
/* utimecmp.h -- compare file time stamps
- Copyright (C) 2004, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2009-2014 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
diff --git a/lib/utimens.c b/lib/utimens.c
index 87123605..dd3ec668 100644
--- a/lib/utimens.c
+++ b/lib/utimens.c
@@ -1,6 +1,6 @@
/* Set file access and modification times.
- Copyright (C) 2003-2013 Free Software Foundation, Inc.
+ Copyright (C) 2003-2014 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
@@ -90,10 +90,12 @@ validate_timespec (struct timespec timespec[2])
assert (timespec);
if ((timespec[0].tv_nsec != UTIME_NOW
&& timespec[0].tv_nsec != UTIME_OMIT
- && (timespec[0].tv_nsec < 0 || 1000000000 <= timespec[0].tv_nsec))
+ && ! (0 <= timespec[0].tv_nsec
+ && timespec[0].tv_nsec < TIMESPEC_RESOLUTION))
|| (timespec[1].tv_nsec != UTIME_NOW
&& timespec[1].tv_nsec != UTIME_OMIT
- && (timespec[1].tv_nsec < 0 || 1000000000 <= timespec[1].tv_nsec)))
+ && ! (0 <= timespec[1].tv_nsec
+ && timespec[1].tv_nsec < TIMESPEC_RESOLUTION)))
{
errno = EINVAL;
return -1;
@@ -216,15 +218,19 @@ fdutimens (int fd, char const *file, struct timespec const timespec[2])
if (0 <= utimensat_works_really)
{
int result;
-# if __linux__
+# if __linux__ || __sun
/* As recently as Linux kernel 2.6.32 (Dec 2009), several file
systems (xfs, ntfs-3g) have bugs with a single UTIME_OMIT,
but work if both times are either explicitly specified or
UTIME_NOW. Work around it with a preparatory [f]stat prior
to calling futimens/utimensat; fortunately, there is not much
timing impact due to the extra syscall even on file systems
- where UTIME_OMIT would have worked. FIXME: Simplify this in
- 2012, when file system bugs are no longer common. */
+ where UTIME_OMIT would have worked.
+
+ The same bug occurs in Solaris 11.1 (Apr 2013).
+
+ FIXME: Simplify this for Linux in 2016 and for Solaris in
+ 2024, when file system bugs are no longer common. */
if (adjustment_needed == 2)
{
if (fd < 0 ? stat (file, &st) : fstat (fd, &st))
@@ -236,7 +242,7 @@ fdutimens (int fd, char const *file, struct timespec const timespec[2])
/* Note that st is good, in case utimensat gives ENOSYS. */
adjustment_needed++;
}
-# endif /* __linux__ */
+# endif
# if HAVE_UTIMENSAT
if (fd < 0)
{
@@ -445,15 +451,19 @@ lutimens (char const *file, struct timespec const timespec[2])
if (0 <= lutimensat_works_really)
{
int result;
-# if __linux__
+# if __linux__ || __sun
/* As recently as Linux kernel 2.6.32 (Dec 2009), several file
systems (xfs, ntfs-3g) have bugs with a single UTIME_OMIT,
but work if both times are either explicitly specified or
UTIME_NOW. Work around it with a preparatory lstat prior to
calling utimensat; fortunately, there is not much timing
impact due to the extra syscall even on file systems where
- UTIME_OMIT would have worked. FIXME: Simplify this in 2012,
- when file system bugs are no longer common. */
+ UTIME_OMIT would have worked.
+
+ The same bug occurs in Solaris 11.1 (Apr 2013).
+
+ FIXME: Simplify this for Linux in 2016 and for Solaris in
+ 2024, when file system bugs are no longer common. */
if (adjustment_needed == 2)
{
if (lstat (file, &st))
@@ -465,7 +475,7 @@ lutimens (char const *file, struct timespec const timespec[2])
/* Note that st is good, in case utimensat gives ENOSYS. */
adjustment_needed++;
}
-# endif /* __linux__ */
+# endif
result = utimensat (AT_FDCWD, file, ts, AT_SYMLINK_NOFOLLOW);
# ifdef __linux__
/* Work around a kernel bug:
diff --git a/lib/utimens.h b/lib/utimens.h
index 82a72a7a..faaf3c70 100644
--- a/lib/utimens.h
+++ b/lib/utimens.h
@@ -1,6 +1,6 @@
/* Set file access and modification times.
- Copyright 2012-2013 Free Software Foundation, Inc.
+ Copyright 2012-2014 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
@@ -26,6 +26,9 @@ int lutimens (char const *, struct timespec const [2]);
# include <fcntl.h>
# include <sys/stat.h>
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
_GL_INLINE_HEADER_BEGIN
#ifndef _GL_UTIMENS_INLINE
# define _GL_UTIMENS_INLINE _GL_INLINE
diff --git a/lib/utimensat.c b/lib/utimensat.c
index 01104002..185cb14c 100644
--- a/lib/utimensat.c
+++ b/lib/utimensat.c
@@ -1,5 +1,5 @@
/* Set the access and modification time of a file relative to directory fd.
- Copyright (C) 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 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
@@ -48,7 +48,7 @@ int
rpl_utimensat (int fd, char const *file, struct timespec const times[2],
int flag)
{
-# ifdef __linux__
+# if defined __linux__ || defined __sun
struct timespec ts[2];
# endif
@@ -57,7 +57,7 @@ rpl_utimensat (int fd, char const *file, struct timespec const times[2],
if (0 <= utimensat_works_really)
{
int result;
-# ifdef __linux__
+# if defined __linux__ || defined __sun
struct stat st;
/* As recently as Linux kernel 2.6.32 (Dec 2009), several file
systems (xfs, ntfs-3g) have bugs with a single UTIME_OMIT,
@@ -65,8 +65,12 @@ rpl_utimensat (int fd, char const *file, struct timespec const times[2],
UTIME_NOW. Work around it with a preparatory [l]stat prior
to calling utimensat; fortunately, there is not much timing
impact due to the extra syscall even on file systems where
- UTIME_OMIT would have worked. FIXME: Simplify this in 2012,
- when file system bugs are no longer common. */
+ UTIME_OMIT would have worked.
+
+ The same bug occurs in Solaris 11.1 (Apr 2013).
+
+ FIXME: Simplify this for Linux in 2016 and for Solaris in
+ 2024, when file system bugs are no longer common. */
if (times && (times[0].tv_nsec == UTIME_OMIT
|| times[1].tv_nsec == UTIME_OMIT))
{
@@ -89,17 +93,17 @@ rpl_utimensat (int fd, char const *file, struct timespec const times[2],
values. */
else if (times
&& ((times[0].tv_nsec != UTIME_NOW
- && (times[0].tv_nsec < 0
- || times[0].tv_nsec >= 1000000000))
+ && ! (0 <= times[0].tv_nsec
+ && times[0].tv_nsec < TIMESPEC_RESOLUTION))
|| (times[1].tv_nsec != UTIME_NOW
- && (times[1].tv_nsec < 0
- || times[1].tv_nsec >= 1000000000))))
+ && ! (0 <= times[1].tv_nsec
+ && times[1].tv_nsec < TIMESPEC_RESOLUTION))))
{
errno = EINVAL;
return -1;
}
# endif
-# endif /* __linux__ */
+# endif
result = utimensat (fd, file, times, flag);
/* Linux kernel 2.6.25 has a bug where it returns EINVAL for
UTIME_NOW or UTIME_OMIT with non-zero tv_sec, which
diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c
index 8fdab32e..b7c8709e 100644
--- a/lib/vasnprintf.c
+++ b/lib/vasnprintf.c
@@ -1,5 +1,5 @@
/* vsprintf with automatic memory allocation.
- Copyright (C) 1999, 2002-2013 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002-2014 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
@@ -5153,7 +5153,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
size_t tmp_length =
MAX_ROOM_NEEDED (&a, dp->arg_index,
dp->conversion, type, flags,
- width, has_precision,
+ has_width ? width : 0,
+ has_precision,
precision, pad_ourselves);
if (maxlen < tmp_length)
diff --git a/lib/vasnprintf.h b/lib/vasnprintf.h
index 7658f505..daa946dc 100644
--- a/lib/vasnprintf.h
+++ b/lib/vasnprintf.h
@@ -1,5 +1,5 @@
/* vsprintf with automatic memory allocation.
- Copyright (C) 2002-2004, 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2002-2004, 2007-2014 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
diff --git a/lib/vasprintf.c b/lib/vasprintf.c
index d0d4a11b..eed90374 100644
--- a/lib/vasprintf.c
+++ b/lib/vasprintf.c
@@ -1,5 +1,5 @@
/* Formatted output to strings.
- Copyright (C) 1999, 2002, 2006-2013 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006-2014 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
diff --git a/lib/verify.h b/lib/verify.h
index cb8e90b5..a25e5146 100644
--- a/lib/verify.h
+++ b/lib/verify.h
@@ -1,6 +1,6 @@
/* Compile-time assert-like macros.
- Copyright (C) 2005-2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2009-2014 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
@@ -18,7 +18,7 @@
/* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */
#ifndef _GL_VERIFY_H
-# define _GL_VERIFY_H
+#define _GL_VERIFY_H
/* Define _GL_HAVE__STATIC_ASSERT to 1 if _Static_assert works as per C11.
@@ -31,14 +31,24 @@
Use this only with GCC. If we were willing to slow 'configure'
down we could also use it with other compilers, but since this
affects only the quality of diagnostics, why bother? */
-# if (4 < __GNUC__ || (__GNUC__ == 4 && 6 <= __GNUC_MINOR__)) && !defined __cplusplus
-# define _GL_HAVE__STATIC_ASSERT 1
-# endif
+#if (4 < __GNUC__ + (6 <= __GNUC_MINOR__) \
+ && (201112L <= __STDC_VERSION__ || !defined __STRICT_ANSI__) \
+ && !defined __cplusplus)
+# define _GL_HAVE__STATIC_ASSERT 1
+#endif
/* The condition (99 < __GNUC__) is temporary, until we know about the
first G++ release that supports static_assert. */
-# if (99 < __GNUC__) && defined __cplusplus
-# define _GL_HAVE_STATIC_ASSERT 1
-# endif
+#if (99 < __GNUC__) && defined __cplusplus
+# define _GL_HAVE_STATIC_ASSERT 1
+#endif
+
+/* FreeBSD 9.1 <sys/cdefs.h>, included by <stddef.h> and lots of other
+ system headers, defines a conflicting _Static_assert that is no
+ better than ours; override it. */
+#ifndef _GL_HAVE_STATIC_ASSERT
+# include <stddef.h>
+# undef _Static_assert
+#endif
/* Each of these macros verifies that its argument R is nonzero. To
be portable, R should be an integer constant expression. Unlike
@@ -141,50 +151,50 @@
Use a template type to work around the problem. */
/* Concatenate two preprocessor tokens. */
-# define _GL_CONCAT(x, y) _GL_CONCAT0 (x, y)
-# define _GL_CONCAT0(x, y) x##y
+#define _GL_CONCAT(x, y) _GL_CONCAT0 (x, y)
+#define _GL_CONCAT0(x, y) x##y
/* _GL_COUNTER is an integer, preferably one that changes each time we
use it. Use __COUNTER__ if it works, falling back on __LINE__
otherwise. __LINE__ isn't perfect, but it's better than a
constant. */
-# if defined __COUNTER__ && __COUNTER__ != __COUNTER__
-# define _GL_COUNTER __COUNTER__
-# else
-# define _GL_COUNTER __LINE__
-# endif
+#if defined __COUNTER__ && __COUNTER__ != __COUNTER__
+# define _GL_COUNTER __COUNTER__
+#else
+# define _GL_COUNTER __LINE__
+#endif
/* Generate a symbol with the given prefix, making it unique if
possible. */
-# define _GL_GENSYM(prefix) _GL_CONCAT (prefix, _GL_COUNTER)
+#define _GL_GENSYM(prefix) _GL_CONCAT (prefix, _GL_COUNTER)
/* Verify requirement R at compile-time, as an integer constant expression
that returns 1. If R is false, fail at compile-time, preferably
with a diagnostic that includes the string-literal DIAGNOSTIC. */
-# define _GL_VERIFY_TRUE(R, DIAGNOSTIC) \
- (!!sizeof (_GL_VERIFY_TYPE (R, DIAGNOSTIC)))
+#define _GL_VERIFY_TRUE(R, DIAGNOSTIC) \
+ (!!sizeof (_GL_VERIFY_TYPE (R, DIAGNOSTIC)))
-# ifdef __cplusplus
-# if !GNULIB_defined_struct__gl_verify_type
+#ifdef __cplusplus
+# if !GNULIB_defined_struct__gl_verify_type
template <int w>
struct _gl_verify_type {
unsigned int _gl_verify_error_if_negative: w;
};
-# define GNULIB_defined_struct__gl_verify_type 1
-# endif
-# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \
- _gl_verify_type<(R) ? 1 : -1>
-# elif defined _GL_HAVE__STATIC_ASSERT
-# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \
- struct { \
- _Static_assert (R, DIAGNOSTIC); \
- int _gl_dummy; \
- }
-# else
-# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \
- struct { unsigned int _gl_verify_error_if_negative: (R) ? 1 : -1; }
+# define GNULIB_defined_struct__gl_verify_type 1
# endif
+# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \
+ _gl_verify_type<(R) ? 1 : -1>
+#elif defined _GL_HAVE__STATIC_ASSERT
+# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \
+ struct { \
+ _Static_assert (R, DIAGNOSTIC); \
+ int _gl_dummy; \
+ }
+#else
+# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \
+ struct { unsigned int _gl_verify_error_if_negative: (R) ? 1 : -1; }
+#endif
/* Verify requirement R at compile-time, as a declaration without a
trailing ';'. If R is false, fail at compile-time, preferably
@@ -193,23 +203,23 @@ template <int w>
Unfortunately, unlike C11, this implementation must appear as an
ordinary declaration, and cannot appear inside struct { ... }. */
-# ifdef _GL_HAVE__STATIC_ASSERT
-# define _GL_VERIFY _Static_assert
-# else
-# define _GL_VERIFY(R, DIAGNOSTIC) \
- extern int (*_GL_GENSYM (_gl_verify_function) (void)) \
- [_GL_VERIFY_TRUE (R, DIAGNOSTIC)]
-# endif
+#ifdef _GL_HAVE__STATIC_ASSERT
+# define _GL_VERIFY _Static_assert
+#else
+# define _GL_VERIFY(R, DIAGNOSTIC) \
+ extern int (*_GL_GENSYM (_gl_verify_function) (void)) \
+ [_GL_VERIFY_TRUE (R, DIAGNOSTIC)]
+#endif
/* _GL_STATIC_ASSERT_H is defined if this code is copied into assert.h. */
-# ifdef _GL_STATIC_ASSERT_H
-# if !defined _GL_HAVE__STATIC_ASSERT && !defined _Static_assert
-# define _Static_assert(R, DIAGNOSTIC) _GL_VERIFY (R, DIAGNOSTIC)
-# endif
-# if !defined _GL_HAVE_STATIC_ASSERT && !defined static_assert
-# define static_assert _Static_assert /* C11 requires this #define. */
-# endif
+#ifdef _GL_STATIC_ASSERT_H
+# if !defined _GL_HAVE__STATIC_ASSERT && !defined _Static_assert
+# define _Static_assert(R, DIAGNOSTIC) _GL_VERIFY (R, DIAGNOSTIC)
# endif
+# if !defined _GL_HAVE_STATIC_ASSERT && !defined static_assert
+# define static_assert _Static_assert /* C11 requires this #define. */
+# endif
+#endif
/* @assert.h omit start@ */
@@ -227,18 +237,42 @@ template <int w>
verify_true is obsolescent; please use verify_expr instead. */
-# define verify_true(R) _GL_VERIFY_TRUE (R, "verify_true (" #R ")")
+#define verify_true(R) _GL_VERIFY_TRUE (R, "verify_true (" #R ")")
/* Verify requirement R at compile-time. Return the value of the
expression E. */
-# define verify_expr(R, E) \
- (_GL_VERIFY_TRUE (R, "verify_expr (" #R ", " #E ")") ? (E) : (E))
+#define verify_expr(R, E) \
+ (_GL_VERIFY_TRUE (R, "verify_expr (" #R ", " #E ")") ? (E) : (E))
/* Verify requirement R at compile-time, as a declaration without a
trailing ';'. */
-# define verify(R) _GL_VERIFY (R, "verify (" #R ")")
+#define verify(R) _GL_VERIFY (R, "verify (" #R ")")
+
+#ifndef __has_builtin
+# define __has_builtin(x) 0
+#endif
+
+/* Assume that R always holds. This lets the compiler optimize
+ accordingly. R should not have side-effects; it may or may not be
+ evaluated. Behavior is undefined if R is false. */
+
+#if (__has_builtin (__builtin_unreachable) \
+ || 4 < __GNUC__ + (5 <= __GNUC_MINOR__))
+# define assume(R) ((R) ? (void) 0 : __builtin_unreachable ())
+#elif 1200 <= _MSC_VER
+# define assume(R) __assume (R)
+#elif (defined lint \
+ && (__has_builtin (__builtin_trap) \
+ || 3 < __GNUC__ + (3 < __GNUC_MINOR__ + (4 <= __GNUC_PATCHLEVEL__))))
+ /* Doing it this way helps various packages when configured with
+ --enable-gcc-warnings, which compiles with -Dlint. It's nicer
+ when 'assume' silences warnings even with older GCCs. */
+# define assume(R) ((R) ? (void) 0 : __builtin_trap ())
+#else
+# define assume(R) ((void) (0 && (R)))
+#endif
/* @assert.h omit end@ */
diff --git a/lib/verror.c b/lib/verror.c
index 5f899c1b..9388f622 100644
--- a/lib/verror.c
+++ b/lib/verror.c
@@ -1,5 +1,5 @@
/* va_list error handler for noninteractive utilities
- Copyright (C) 2006-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006-2007, 2009-2014 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
diff --git a/lib/verror.h b/lib/verror.h
index 7e7284ad..c6292bc6 100644
--- a/lib/verror.h
+++ b/lib/verror.h
@@ -1,5 +1,5 @@
/* Declaration for va_list error-reporting function
- Copyright (C) 2006-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006-2007, 2009-2014 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
diff --git a/lib/version-etc-fsf.c b/lib/version-etc-fsf.c
index e1c69da9..b37dd605 100644
--- a/lib/version-etc-fsf.c
+++ b/lib/version-etc-fsf.c
@@ -1,5 +1,5 @@
/* Variable with FSF copyright information, for version-etc.
- Copyright (C) 1999-2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 1999-2006, 2009-2014 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
diff --git a/lib/version-etc.c b/lib/version-etc.c
index b7d23ab5..04f5b620 100644
--- a/lib/version-etc.c
+++ b/lib/version-etc.c
@@ -1,5 +1,5 @@
/* Print --version and bug-reporting information in a consistent format.
- Copyright (C) 1999-2013 Free Software Foundation, Inc.
+ Copyright (C) 1999-2014 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
@@ -38,7 +38,7 @@
# define PACKAGE PACKAGE_TARNAME
#endif
-enum { COPYRIGHT_YEAR = 2013 };
+enum { COPYRIGHT_YEAR = 2014 };
/* The three functions below display the --version information the
standard way.
diff --git a/lib/version-etc.h b/lib/version-etc.h
index 6c3d0843..8e1b2ccf 100644
--- a/lib/version-etc.h
+++ b/lib/version-etc.h
@@ -1,5 +1,5 @@
/* Print --version and bug-reporting information in a consistent format.
- Copyright (C) 1999, 2003, 2005, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2003, 2005, 2009-2014 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
diff --git a/lib/vfprintf.c b/lib/vfprintf.c
index 635e36eb..b49caaee 100644
--- a/lib/vfprintf.c
+++ b/lib/vfprintf.c
@@ -1,5 +1,5 @@
/* Formatted output to a stream.
- Copyright (C) 2004, 2006-2013 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006-2014 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
diff --git a/lib/vprintf.c b/lib/vprintf.c
index 0c507582..d97f5c8a 100644
--- a/lib/vprintf.c
+++ b/lib/vprintf.c
@@ -1,5 +1,5 @@
/* Formatted output to a stream.
- Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2014 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
diff --git a/lib/w32sock.h b/lib/w32sock.h
index 44f3a1a0..b921b1bc 100644
--- a/lib/w32sock.h
+++ b/lib/w32sock.h
@@ -1,6 +1,6 @@
/* w32sock.h --- internal auxiliary functions for Windows socket functions
- Copyright (C) 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2008-2014 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
diff --git a/lib/w32spawn.h b/lib/w32spawn.h
deleted file mode 100644
index 3b5c08af..00000000
--- a/lib/w32spawn.h
+++ /dev/null
@@ -1,222 +0,0 @@
-/* Auxiliary functions for the creation of subprocesses. Native Windows API.
- Copyright (C) 2001, 2003-2013 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2003.
-
- 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
-
-/* Get declarations of the native Windows API functions. */
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-
-/* Get _open_osfhandle(). */
-#include <io.h>
-
-#include <stdbool.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-
-/* Get _get_osfhandle(). */
-#include "msvc-nothrow.h"
-
-#include "cloexec.h"
-#include "xalloc.h"
-
-/* Duplicates a file handle, making the copy uninheritable.
- Returns -1 for a file handle that is equivalent to closed. */
-static int
-dup_noinherit (int fd)
-{
- fd = dup_cloexec (fd);
- if (fd < 0 && errno == EMFILE)
- error (EXIT_FAILURE, errno, _("_open_osfhandle failed"));
-
- return fd;
-}
-
-/* Returns a file descriptor equivalent to FD, except that the resulting file
- descriptor is none of STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO.
- FD must be open and non-inheritable. The result will be non-inheritable as
- well.
- If FD < 0, FD itself is returned. */
-static int
-fd_safer_noinherit (int fd)
-{
- if (STDIN_FILENO <= fd && fd <= STDERR_FILENO)
- {
- /* The recursion depth is at most 3. */
- int nfd = fd_safer_noinherit (dup_noinherit (fd));
- int saved_errno = errno;
- close (fd);
- errno = saved_errno;
- return nfd;
- }
- return fd;
-}
-
-/* Duplicates a file handle, making the copy uninheritable and ensuring the
- result is none of STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO.
- Returns -1 for a file handle that is equivalent to closed. */
-static int
-dup_safer_noinherit (int fd)
-{
- return fd_safer_noinherit (dup_noinherit (fd));
-}
-
-/* Undoes the effect of TEMPFD = dup_safer_noinherit (ORIGFD); */
-static void
-undup_safer_noinherit (int tempfd, int origfd)
-{
- if (tempfd >= 0)
- {
- if (dup2 (tempfd, origfd) < 0)
- error (EXIT_FAILURE, errno, _("cannot restore fd %d: dup2 failed"),
- origfd);
- close (tempfd);
- }
- else
- {
- /* origfd was closed or open to no handle at all. Set it to a closed
- state. This is (nearly) equivalent to the original state. */
- close (origfd);
- }
-}
-
-/* Prepares an argument vector before calling spawn().
- Note that spawn() does not by itself call the command interpreter
- (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
- ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- GetVersionEx(&v);
- v.dwPlatformId == VER_PLATFORM_WIN32_NT;
- }) ? "cmd.exe" : "command.com").
- Instead it simply concatenates the arguments, separated by ' ', and calls
- CreateProcess(). We must quote the arguments since Windows CreateProcess()
- interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
- special way:
- - Space and tab are interpreted as delimiters. They are not treated as
- delimiters if they are surrounded by double quotes: "...".
- - Unescaped double quotes are removed from the input. Their only effect is
- that within double quotes, space and tab are treated like normal
- characters.
- - Backslashes not followed by double quotes are not special.
- - But 2*n+1 backslashes followed by a double quote become
- n backslashes followed by a double quote (n >= 0):
- \" -> "
- \\\" -> \"
- \\\\\" -> \\"
- - '*', '?' characters may get expanded through wildcard expansion in the
- callee: By default, in the callee, the initialization code before main()
- takes the result of GetCommandLine(), wildcard-expands it, and passes it
- to main(). The exceptions to this rule are:
- - programs that inspect GetCommandLine() and ignore argv,
- - mingw programs that have a global variable 'int _CRT_glob = 0;',
- - Cygwin programs, when invoked from a Cygwin program.
- */
-#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037*?"
-#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
-static char **
-prepare_spawn (char **argv)
-{
- size_t argc;
- char **new_argv;
- size_t i;
-
- /* Count number of arguments. */
- for (argc = 0; argv[argc] != NULL; argc++)
- ;
-
- /* Allocate new argument vector. */
- new_argv = XNMALLOC (1 + argc + 1, char *);
-
- /* Add an element upfront that can be used when argv[0] turns out to be a
- script, not a program.
- On Unix, this would be "/bin/sh". On native Windows, "sh" is actually
- "sh.exe". We have to omit the directory part and rely on the search in
- PATH, because the mingw "mount points" are not visible inside Windows
- CreateProcess(). */
- *new_argv++ = "sh.exe";
-
- /* Put quoted arguments into the new argument vector. */
- for (i = 0; i < argc; i++)
- {
- const char *string = argv[i];
-
- if (string[0] == '\0')
- new_argv[i] = xstrdup ("\"\"");
- else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
- {
- bool quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
- size_t length;
- unsigned int backslashes;
- const char *s;
- char *quoted_string;
- char *p;
-
- length = 0;
- backslashes = 0;
- if (quote_around)
- length++;
- for (s = string; *s != '\0'; s++)
- {
- char c = *s;
- if (c == '"')
- length += backslashes + 1;
- length++;
- if (c == '\\')
- backslashes++;
- else
- backslashes = 0;
- }
- if (quote_around)
- length += backslashes + 1;
-
- quoted_string = (char *) xmalloc (length + 1);
-
- p = quoted_string;
- backslashes = 0;
- if (quote_around)
- *p++ = '"';
- for (s = string; *s != '\0'; s++)
- {
- char c = *s;
- if (c == '"')
- {
- unsigned int j;
- for (j = backslashes + 1; j > 0; j--)
- *p++ = '\\';
- }
- *p++ = c;
- if (c == '\\')
- backslashes++;
- else
- backslashes = 0;
- }
- if (quote_around)
- {
- unsigned int j;
- for (j = backslashes; j > 0; j--)
- *p++ = '\\';
- *p++ = '"';
- }
- *p = '\0';
-
- new_argv[i] = quoted_string;
- }
- else
- new_argv[i] = (char *) string;
- }
- new_argv[argc] = NULL;
-
- return new_argv;
-}
diff --git a/lib/wait-process.c b/lib/wait-process.c
deleted file mode 100644
index 17a2430f..00000000
--- a/lib/wait-process.c
+++ /dev/null
@@ -1,361 +0,0 @@
-/* Waiting for a subprocess to finish.
- Copyright (C) 2001-2003, 2005-2013 Free Software Foundation, Inc.
- Written by Bruno Haible <haible@clisp.cons.org>, 2001.
-
- 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
-
-
-#include <config.h>
-
-/* Specification. */
-#include "wait-process.h"
-
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <signal.h>
-
-#include <sys/types.h>
-#include <sys/wait.h>
-
-#include "error.h"
-#include "fatal-signal.h"
-#include "xalloc.h"
-#include "gettext.h"
-
-#define _(str) gettext (str)
-
-#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
-
-
-#if defined _MSC_VER || defined __MINGW32__
-
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-
-/* The return value of spawnvp() is really a process handle as returned
- by CreateProcess(). Therefore we can kill it using TerminateProcess. */
-#define kill(pid,sig) TerminateProcess ((HANDLE) (pid), sig)
-
-#endif
-
-
-/* Type of an entry in the slaves array.
- The 'used' bit determines whether this entry is currently in use.
- (If pid_t was an atomic type like sig_atomic_t, we could just set the
- 'child' field to 0 when unregistering a slave process, and wouldn't need
- the 'used' field.)
- The 'used' and 'child' fields are accessed from within the cleanup_slaves()
- action, therefore we mark them as 'volatile'. */
-typedef struct
-{
- volatile sig_atomic_t used;
- volatile pid_t child;
-}
-slaves_entry_t;
-
-/* The registered slave subprocesses. */
-static slaves_entry_t static_slaves[32];
-static slaves_entry_t * volatile slaves = static_slaves;
-static sig_atomic_t volatile slaves_count = 0;
-static size_t slaves_allocated = SIZEOF (static_slaves);
-
-/* The termination signal for slave subprocesses.
- 2003-10-07: Terminator becomes Governator. */
-#ifdef SIGHUP
-# define TERMINATOR SIGHUP
-#else
-# define TERMINATOR SIGTERM
-#endif
-
-/* The cleanup action. It gets called asynchronously. */
-static void
-cleanup_slaves (void)
-{
- for (;;)
- {
- /* Get the last registered slave. */
- size_t n = slaves_count;
- if (n == 0)
- break;
- n--;
- slaves_count = n;
- /* Skip unused entries in the slaves array. */
- if (slaves[n].used)
- {
- pid_t slave = slaves[n].child;
-
- /* Kill the slave. */
- kill (slave, TERMINATOR);
- }
- }
-}
-
-/* Register a subprocess as being a slave process. This means that the
- subprocess will be terminated when its creator receives a catchable fatal
- signal or exits normally. Registration ends when wait_subprocess()
- notices that the subprocess has exited. */
-void
-register_slave_subprocess (pid_t child)
-{
- static bool cleanup_slaves_registered = false;
- if (!cleanup_slaves_registered)
- {
- atexit (cleanup_slaves);
- at_fatal_signal (cleanup_slaves);
- cleanup_slaves_registered = true;
- }
-
- /* Try to store the new slave in an unused entry of the slaves array. */
- {
- slaves_entry_t *s = slaves;
- slaves_entry_t *s_end = s + slaves_count;
-
- for (; s < s_end; s++)
- if (!s->used)
- {
- /* The two uses of 'volatile' in the slaves_entry_t type above
- (and ISO C 99 section 5.1.2.3.(5)) ensure that we mark the
- entry as used only after the child pid has been written to the
- memory location s->child. */
- s->child = child;
- s->used = 1;
- return;
- }
- }
-
- if (slaves_count == slaves_allocated)
- {
- /* Extend the slaves array. Note that we cannot use xrealloc(),
- because then the cleanup_slaves() function could access an already
- deallocated array. */
- slaves_entry_t *old_slaves = slaves;
- size_t new_slaves_allocated = 2 * slaves_allocated;
- slaves_entry_t *new_slaves =
- (slaves_entry_t *)
- malloc (new_slaves_allocated * sizeof (slaves_entry_t));
- if (new_slaves == NULL)
- {
- /* xalloc_die() will call exit() which will invoke cleanup_slaves().
- Additionally we need to kill child, because it's not yet among
- the slaves list. */
- kill (child, TERMINATOR);
- xalloc_die ();
- }
- memcpy (new_slaves, old_slaves,
- slaves_allocated * sizeof (slaves_entry_t));
- slaves = new_slaves;
- slaves_allocated = new_slaves_allocated;
- /* Now we can free the old slaves array. */
- if (old_slaves != static_slaves)
- free (old_slaves);
- }
- /* The three uses of 'volatile' in the types above (and ISO C 99 section
- 5.1.2.3.(5)) ensure that we increment the slaves_count only after the
- new slave and its 'used' bit have been written to the memory locations
- that make up slaves[slaves_count]. */
- slaves[slaves_count].child = child;
- slaves[slaves_count].used = 1;
- slaves_count++;
-}
-
-/* Unregister a child from the list of slave subprocesses. */
-static void
-unregister_slave_subprocess (pid_t child)
-{
- /* The easiest way to remove an entry from a list that can be used by
- an asynchronous signal handler is just to mark it as unused. For this,
- we rely on sig_atomic_t. */
- slaves_entry_t *s = slaves;
- slaves_entry_t *s_end = s + slaves_count;
-
- for (; s < s_end; s++)
- if (s->used && s->child == child)
- s->used = 0;
-}
-
-
-/* Wait for a subprocess to finish. Return its exit code.
- If it didn't terminate correctly, exit if exit_on_error is true, otherwise
- return 127. */
-int
-wait_subprocess (pid_t child, const char *progname,
- bool ignore_sigpipe, bool null_stderr,
- bool slave_process, bool exit_on_error,
- int *termsigp)
-{
-#if HAVE_WAITID && defined WNOWAIT && 0
- /* Commented out because waitid() without WEXITED and with WNOWAIT doesn't
- work: On Solaris 7 and OSF/1 4.0, it returns -1 and sets errno = ECHILD,
- and on HP-UX 10.20 it just hangs. */
- /* Use of waitid() with WNOWAIT avoids a race condition: If slave_process is
- true, and this process sleeps a very long time between the return from
- waitpid() and the execution of unregister_slave_subprocess(), and
- meanwhile another process acquires the same PID as child, and then - still
- before unregister_slave_subprocess() - this process gets a fatal signal,
- it would kill the other totally unrelated process. */
- siginfo_t info;
-
- if (termsigp != NULL)
- *termsigp = 0;
- for (;;)
- {
- if (waitid (P_PID, child, &info, WEXITED | (slave_process ? WNOWAIT : 0))
- < 0)
- {
-# ifdef EINTR
- if (errno == EINTR)
- continue;
-# endif
- if (exit_on_error || !null_stderr)
- error (exit_on_error ? EXIT_FAILURE : 0, errno,
- _("%s subprocess"), progname);
- return 127;
- }
-
- /* info.si_code is set to one of CLD_EXITED, CLD_KILLED, CLD_DUMPED,
- CLD_TRAPPED, CLD_STOPPED, CLD_CONTINUED. Loop until the program
- terminates. */
- if (info.si_code == CLD_EXITED
- || info.si_code == CLD_KILLED || info.si_code == CLD_DUMPED)
- break;
- }
-
- /* The child process has exited or was signalled. */
-
- if (slave_process)
- {
- /* Unregister the child from the list of slave subprocesses, so that
- later, when we exit, we don't kill a totally unrelated process which
- may have acquired the same pid. */
- unregister_slave_subprocess (child);
-
- /* Now remove the zombie from the process list. */
- for (;;)
- {
- if (waitid (P_PID, child, &info, WEXITED) < 0)
- {
-# ifdef EINTR
- if (errno == EINTR)
- continue;
-# endif
- if (exit_on_error || !null_stderr)
- error (exit_on_error ? EXIT_FAILURE : 0, errno,
- _("%s subprocess"), progname);
- return 127;
- }
- break;
- }
- }
-
- switch (info.si_code)
- {
- case CLD_KILLED:
- case CLD_DUMPED:
- if (termsigp != NULL)
- *termsigp = info.si_status; /* TODO: or info.si_signo? */
-# ifdef SIGPIPE
- if (info.si_status == SIGPIPE && ignore_sigpipe)
- return 0;
-# endif
- if (exit_on_error || (!null_stderr && termsigp == NULL))
- error (exit_on_error ? EXIT_FAILURE : 0, 0,
- _("%s subprocess got fatal signal %d"),
- progname, info.si_status);
- return 127;
- case CLD_EXITED:
- if (info.si_status == 127)
- {
- if (exit_on_error || !null_stderr)
- error (exit_on_error ? EXIT_FAILURE : 0, 0,
- _("%s subprocess failed"), progname);
- return 127;
- }
- return info.si_status;
- default:
- abort ();
- }
-#else
- /* waitpid() is just as portable as wait() nowadays. */
- int status;
-
- if (termsigp != NULL)
- *termsigp = 0;
- status = 0;
- for (;;)
- {
- int result = waitpid (child, &status, 0);
-
- if (result != child)
- {
-# ifdef EINTR
- if (errno == EINTR)
- continue;
-# endif
-# if 0 /* defined ECHILD */
- if (errno == ECHILD)
- {
- /* Child process nonexistent?! Assume it terminated
- successfully. */
- status = 0;
- break;
- }
-# endif
- if (exit_on_error || !null_stderr)
- error (exit_on_error ? EXIT_FAILURE : 0, errno,
- _("%s subprocess"), progname);
- return 127;
- }
-
- /* One of WIFSIGNALED (status), WIFEXITED (status), WIFSTOPPED (status)
- must always be true, since we did not specify WCONTINUED in the
- waitpid() call. Loop until the program terminates. */
- if (!WIFSTOPPED (status))
- break;
- }
-
- /* The child process has exited or was signalled. */
-
- if (slave_process)
- /* Unregister the child from the list of slave subprocesses, so that
- later, when we exit, we don't kill a totally unrelated process which
- may have acquired the same pid. */
- unregister_slave_subprocess (child);
-
- if (WIFSIGNALED (status))
- {
- if (termsigp != NULL)
- *termsigp = WTERMSIG (status);
-# ifdef SIGPIPE
- if (WTERMSIG (status) == SIGPIPE && ignore_sigpipe)
- return 0;
-# endif
- if (exit_on_error || (!null_stderr && termsigp == NULL))
- error (exit_on_error ? EXIT_FAILURE : 0, 0,
- _("%s subprocess got fatal signal %d"),
- progname, (int) WTERMSIG (status));
- return 127;
- }
- if (!WIFEXITED (status))
- abort ();
- if (WEXITSTATUS (status) == 127)
- {
- if (exit_on_error || !null_stderr)
- error (exit_on_error ? EXIT_FAILURE : 0, 0,
- _("%s subprocess failed"), progname);
- return 127;
- }
- return WEXITSTATUS (status);
-#endif
-}
diff --git a/lib/wait-process.h b/lib/wait-process.h
deleted file mode 100644
index 6d8f0d2b..00000000
--- a/lib/wait-process.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Waiting for a subprocess to finish.
- Copyright (C) 2001-2003, 2006, 2008-2013 Free Software Foundation, Inc.
- Written by Bruno Haible <haible@clisp.cons.org>, 2001.
-
- 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
-
-#ifndef _WAIT_PROCESS_H
-#define _WAIT_PROCESS_H
-
-/* Get pid_t. */
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-
-#include <stdbool.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* Wait for a subprocess to finish. Return its exit code.
- If it didn't terminate correctly, exit if exit_on_error is true, otherwise
- return 127.
- Arguments:
- - child is the pid of the subprocess.
- - progname is the name of the program executed by the subprocess, used for
- error messages.
- - If ignore_sigpipe is true, consider a subprocess termination due to
- SIGPIPE as equivalent to a success. This is suitable for processes whose
- only purpose is to write to standard output. This flag can be safely set
- to false when the process' standard output is known to go to DEV_NULL.
- - If null_stderr is true, the usual error message to stderr will be omitted.
- This is suitable when the subprocess does not fulfill an important task.
- - slave_process should be set to true if the process has been launched as a
- slave process.
- - If exit_on_error is true, any error will cause the main process to exit
- with an error status.
- - If termsigp is not NULL: *termsig will be set to the signal that
- terminated the subprocess (if supported by the platform: not on native
- Windows platforms), otherwise 0, and the error message about the signal
- that terminated the subprocess will be omitted.
- Prerequisites: The signal handler for SIGCHLD should not be set to SIG_IGN,
- otherwise this function will not work. */
-extern int wait_subprocess (pid_t child, const char *progname,
- bool ignore_sigpipe, bool null_stderr,
- bool slave_process, bool exit_on_error,
- int *termsigp);
-
-/* Register a subprocess as being a slave process. This means that the
- subprocess will be terminated when its creator receives a catchable fatal
- signal or exits normally. Registration ends when wait_subprocess()
- notices that the subprocess has exited. */
-extern void register_slave_subprocess (pid_t child);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* _WAIT_PROCESS_H */
diff --git a/lib/waitpid.c b/lib/waitpid.c
deleted file mode 100644
index d28a70b3..00000000
--- a/lib/waitpid.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Wait for process state change.
- Copyright (C) 2001-2003, 2005-2013 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 3, 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, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-/* Specification. */
-#include <sys/wait.h>
-
-/* Implementation for native Windows systems. */
-
-#include <process.h> /* for _cwait, WAIT_CHILD */
-
-pid_t
-waitpid (pid_t pid, int *statusp, int options)
-{
- return _cwait (statusp, pid, WAIT_CHILD);
-}
diff --git a/lib/wchar.in.h b/lib/wchar.in.h
index b6e43627..473285fb 100644
--- a/lib/wchar.in.h
+++ b/lib/wchar.in.h
@@ -1,6 +1,6 @@
/* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007-2014 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
diff --git a/lib/wcrtomb.c b/lib/wcrtomb.c
index da42809b..1d340cd9 100644
--- a/lib/wcrtomb.c
+++ b/lib/wcrtomb.c
@@ -1,5 +1,5 @@
/* Convert wide character to multibyte character.
- Copyright (C) 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2008-2014 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2008.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/wcswidth-impl.h b/lib/wcswidth-impl.h
index 63476342..b71f9976 100644
--- a/lib/wcswidth-impl.h
+++ b/lib/wcswidth-impl.h
@@ -1,5 +1,5 @@
/* Determine number of screen columns needed for a size-bounded wide string.
- Copyright (C) 1999, 2011-2013 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2011-2014 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 1999.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/wcswidth.c b/lib/wcswidth.c
index 383d5e1f..656dc6c4 100644
--- a/lib/wcswidth.c
+++ b/lib/wcswidth.c
@@ -1,5 +1,5 @@
/* Determine number of screen columns needed for a size-bounded wide string.
- Copyright (C) 2011-2013 Free Software Foundation, Inc.
+ Copyright (C) 2011-2014 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2011.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/wctype.in.h b/lib/wctype.in.h
index 0cd02d5a..ab066539 100644
--- a/lib/wctype.in.h
+++ b/lib/wctype.in.h
@@ -1,6 +1,6 @@
/* A substitute for ISO C99 <wctype.h>, for platforms that lack it.
- Copyright (C) 2006-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006-2014 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
@@ -44,6 +44,13 @@
# include <wchar.h>
#endif
+/* mingw has declarations of towupper and towlower in <ctype.h> as
+ well <wctype.h>. Include <ctype.h> in advance to avoid rpl_ prefix
+ being added to the declarations. */
+#ifdef __MINGW32__
+# include <ctype.h>
+#endif
+
/* Include the original <wctype.h> if it exists.
BeOS 5 has the functions but no <wctype.h>. */
/* The include_next requires a split double-inclusion guard. */
@@ -54,6 +61,9 @@
#ifndef _@GUARD_PREFIX@_WCTYPE_H
#define _@GUARD_PREFIX@_WCTYPE_H
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
_GL_INLINE_HEADER_BEGIN
#ifndef _GL_WCTYPE_INLINE
# define _GL_WCTYPE_INLINE _GL_INLINE
diff --git a/lib/wcwidth.c b/lib/wcwidth.c
index 253fcaa6..d7837bb1 100644
--- a/lib/wcwidth.c
+++ b/lib/wcwidth.c
@@ -1,5 +1,5 @@
/* Determine the number of screen columns needed for a character.
- Copyright (C) 2006-2007, 2010-2013 Free Software Foundation, Inc.
+ Copyright (C) 2006-2007, 2010-2014 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
diff --git a/lib/write-any-file.c b/lib/write-any-file.c
index f6d2747c..1cd0b791 100644
--- a/lib/write-any-file.c
+++ b/lib/write-any-file.c
@@ -1,6 +1,6 @@
/* Determine whether we can write any file.
- Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2014 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
diff --git a/lib/write.c b/lib/write.c
index 2d204219..ff31dbb6 100644
--- a/lib/write.c
+++ b/lib/write.c
@@ -1,5 +1,5 @@
/* POSIX compatible write() function.
- Copyright (C) 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2008-2014 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2008.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/xalloc-die.c b/lib/xalloc-die.c
index daa403b9..7bdd2a31 100644
--- a/lib/xalloc-die.c
+++ b/lib/xalloc-die.c
@@ -1,6 +1,6 @@
/* Report a memory allocation failure and exit.
- Copyright (C) 1997-2000, 2002-2004, 2006, 2009-2013 Free Software
+ Copyright (C) 1997-2000, 2002-2004, 2006, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/xalloc-oversized.h b/lib/xalloc-oversized.h
index a971c78a..f3329228 100644
--- a/lib/xalloc-oversized.h
+++ b/lib/xalloc-oversized.h
@@ -1,6 +1,6 @@
/* xalloc-oversized.h -- memory allocation size checking
- Copyright (C) 1990-2000, 2003-2004, 2006-2013 Free Software Foundation, Inc.
+ Copyright (C) 1990-2000, 2003-2004, 2006-2014 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
diff --git a/lib/xalloc.h b/lib/xalloc.h
index da7c4b6b..3f6b5b80 100644
--- a/lib/xalloc.h
+++ b/lib/xalloc.h
@@ -1,6 +1,6 @@
/* xalloc.h -- malloc with out-of-memory checking
- Copyright (C) 1990-2000, 2003-2004, 2006-2013 Free Software Foundation, Inc.
+ Copyright (C) 1990-2000, 2003-2004, 2006-2014 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
@@ -22,6 +22,9 @@
#include "xalloc-oversized.h"
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
_GL_INLINE_HEADER_BEGIN
#ifndef XALLOC_INLINE
# define XALLOC_INLINE _GL_INLINE
@@ -61,7 +64,7 @@ void *xrealloc (void *p, size_t s)
_GL_ATTRIBUTE_ALLOC_SIZE ((2));
void *x2realloc (void *p, size_t *pn);
void *xmemdup (void const *p, size_t s)
- _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE ((2));
+ _GL_ATTRIBUTE_ALLOC_SIZE ((2));
char *xstrdup (char const *str)
_GL_ATTRIBUTE_MALLOC;
@@ -119,10 +122,9 @@ xnrealloc (void *p, size_t n, size_t s)
/* If P is null, allocate a block of at least *PN such objects;
otherwise, reallocate P so that it contains more than *PN objects
- each of S bytes. *PN must be nonzero unless P is null, and S must
- be nonzero. Set *PN to the new number of objects, and return the
- pointer to the new block. *PN is never set to zero, and the
- returned pointer is never null.
+ each of S bytes. S must be nonzero. Set *PN to the new number of
+ objects, and return the pointer to the new block. *PN is never set
+ to zero, and the returned pointer is never null.
Repeated reallocations are guaranteed to make progress, either by
allocating an initial block with a nonzero size, or by allocating a
@@ -193,13 +195,13 @@ x2nrealloc (void *p, size_t *pn, size_t s)
}
else
{
- /* Set N = ceil (1.5 * N) so that progress is made if N == 1.
+ /* Set N = floor (1.5 * N) + 1 so that progress is made even if N == 0.
Check for overflow, so that N * S stays in size_t range.
- The check is slightly conservative, but an exact check isn't
+ The check may be slightly conservative, but an exact check isn't
worth the trouble. */
if ((size_t) -1 / 3 * 2 / s <= n)
xalloc_die ();
- n += (n + 1) / 2;
+ n += n / 2 + 1;
}
*pn = n;
diff --git a/lib/xasprintf.c b/lib/xasprintf.c
index 1808b701..4e0b5b16 100644
--- a/lib/xasprintf.c
+++ b/lib/xasprintf.c
@@ -1,5 +1,5 @@
/* vasprintf and asprintf with out-of-memory checking.
- Copyright (C) 1999, 2002-2004, 2006, 2009-2013 Free Software Foundation,
+ Copyright (C) 1999, 2002-2004, 2006, 2009-2014 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/xfreopen.c b/lib/xfreopen.c
index c7acbd17..abc8221b 100644
--- a/lib/xfreopen.c
+++ b/lib/xfreopen.c
@@ -1,5 +1,5 @@
-/* a wrapper for frepoen
- Copyright (C) 2008-2013 Free Software Foundation, Inc.
+/* a wrapper for freopen
+ Copyright (C) 2008-2014 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
diff --git a/lib/xfts.c b/lib/xfts.c
index e982cc08..bcc82d05 100644
--- a/lib/xfts.c
+++ b/lib/xfts.c
@@ -1,6 +1,6 @@
/* xfts.c -- a wrapper for fts_open
- Copyright (C) 2003-2013 Free Software Foundation, Inc.
+ Copyright (C) 2003-2014 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
diff --git a/lib/xgetcwd.c b/lib/xgetcwd.c
index d4e7a783..e91e8e55 100644
--- a/lib/xgetcwd.c
+++ b/lib/xgetcwd.c
@@ -1,6 +1,6 @@
/* xgetcwd.c -- return current directory with unlimited length
- Copyright (C) 2001, 2003-2004, 2006-2007, 2009-2013 Free Software
+ Copyright (C) 2001, 2003-2004, 2006-2007, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/xgetcwd.h b/lib/xgetcwd.h
index fa15bc60..9630d6c7 100644
--- a/lib/xgetcwd.h
+++ b/lib/xgetcwd.h
@@ -1,5 +1,5 @@
/* prototype for xgetcwd
- Copyright (C) 1995, 2001, 2003, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 1995, 2001, 2003, 2009-2014 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
diff --git a/lib/xgetgroups.c b/lib/xgetgroups.c
index 98080db0..7f9d86a4 100644
--- a/lib/xgetgroups.c
+++ b/lib/xgetgroups.c
@@ -1,6 +1,6 @@
/* xgetgroups.c -- return a list of the groups a user or current process is in
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007-2014 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
diff --git a/lib/xgethostname.c b/lib/xgethostname.c
index 5d5a07c7..0f7b178f 100644
--- a/lib/xgethostname.c
+++ b/lib/xgethostname.c
@@ -1,6 +1,6 @@
/* xgethostname.c -- return current hostname with unlimited length
- Copyright (C) 1992, 1996, 2000-2001, 2003-2006, 2009-2013 Free Software
+ Copyright (C) 1992, 1996, 2000-2001, 2003-2006, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/xmalloc.c b/lib/xmalloc.c
index 57e34b7c..264d44af 100644
--- a/lib/xmalloc.c
+++ b/lib/xmalloc.c
@@ -1,6 +1,6 @@
/* xmalloc.c -- malloc with out of memory checking
- Copyright (C) 1990-2000, 2002-2006, 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 1990-2000, 2002-2006, 2008-2014 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
diff --git a/lib/xmemcoll.c b/lib/xmemcoll.c
index 59d9555b..39b8ce8e 100644
--- a/lib/xmemcoll.c
+++ b/lib/xmemcoll.c
@@ -1,6 +1,6 @@
/* Locale-specific memory comparison.
- Copyright (C) 2002-2004, 2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2002-2004, 2006, 2009-2014 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
diff --git a/lib/xnanosleep.c b/lib/xnanosleep.c
index d9b97a18..3b2b43ba 100644
--- a/lib/xnanosleep.c
+++ b/lib/xnanosleep.c
@@ -1,6 +1,6 @@
/* xnanosleep.c -- a more convenient interface to nanosleep
- Copyright (C) 2002-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2002-2007, 2009-2014 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
diff --git a/lib/xprintf.c b/lib/xprintf.c
index e24b4f18..52f8d5cd 100644
--- a/lib/xprintf.c
+++ b/lib/xprintf.c
@@ -1,5 +1,5 @@
/* printf wrappers that fail immediately for non-file-related errors
- Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2014 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
diff --git a/lib/xprintf.h b/lib/xprintf.h
index 62986a8c..96fbcfa1 100644
--- a/lib/xprintf.h
+++ b/lib/xprintf.h
@@ -1,5 +1,5 @@
/* printf wrappers that fail immediately for non-file-related errors
- Copyright (C) 2007-2013 Free Software Foundation, Inc.
+ Copyright (C) 2007-2014 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
diff --git a/lib/xreadlink.c b/lib/xreadlink.c
index cdf9f632..2f3b8a10 100644
--- a/lib/xreadlink.c
+++ b/lib/xreadlink.c
@@ -1,6 +1,6 @@
/* xreadlink.c -- readlink wrapper to return the link name in malloc'd storage
- Copyright (C) 2001, 2003-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2003-2007, 2009-2014 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
diff --git a/lib/xreadlink.h b/lib/xreadlink.h
index da62be61..af80ca43 100644
--- a/lib/xreadlink.h
+++ b/lib/xreadlink.h
@@ -1,6 +1,6 @@
/* Reading symbolic links without size limitation.
- Copyright (C) 2001, 2003-2004, 2007, 2009-2013 Free Software Foundation,
+ Copyright (C) 2001, 2003-2004, 2007, 2009-2014 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/xsize.h b/lib/xsize.h
index 2922f353..fd12c670 100644
--- a/lib/xsize.h
+++ b/lib/xsize.h
@@ -1,6 +1,6 @@
/* xsize.h -- Checked size_t computations.
- Copyright (C) 2003, 2008-2013 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2008-2014 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
@@ -27,6 +27,9 @@
# include <stdint.h>
#endif
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
_GL_INLINE_HEADER_BEGIN
#ifndef XSIZE_INLINE
# define XSIZE_INLINE _GL_INLINE
diff --git a/lib/xstriconv.c b/lib/xstriconv.c
index fb8aad24..be1ef2df 100644
--- a/lib/xstriconv.c
+++ b/lib/xstriconv.c
@@ -1,5 +1,5 @@
/* Charset conversion with out-of-memory checking.
- Copyright (C) 2001-2004, 2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2001-2004, 2006, 2009-2014 Free Software Foundation, Inc.
Written by Bruno Haible.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/xstriconv.h b/lib/xstriconv.h
index 2b239e74..75f8f832 100644
--- a/lib/xstriconv.h
+++ b/lib/xstriconv.h
@@ -1,5 +1,5 @@
/* Charset conversion with out-of-memory checking.
- Copyright (C) 2001-2004, 2006-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2001-2004, 2006-2007, 2009-2014 Free Software Foundation, Inc.
Written by Bruno Haible and Simon Josefsson.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/xstrndup.c b/lib/xstrndup.c
index eae92d03..d2259c82 100644
--- a/lib/xstrndup.c
+++ b/lib/xstrndup.c
@@ -1,6 +1,6 @@
/* Duplicate a bounded initial segment of a string, with out-of-memory
checking.
- Copyright (C) 2003, 2006-2007, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2006-2007, 2009-2014 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
diff --git a/lib/xstrndup.h b/lib/xstrndup.h
index 59673b04..6a409f7a 100644
--- a/lib/xstrndup.h
+++ b/lib/xstrndup.h
@@ -1,6 +1,6 @@
/* Duplicate a bounded initial segment of a string, with out-of-memory
checking.
- Copyright (C) 2003, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2009-2014 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
diff --git a/lib/xstrtod.c b/lib/xstrtod.c
index a36a6135..7caa615d 100644
--- a/lib/xstrtod.c
+++ b/lib/xstrtod.c
@@ -1,6 +1,6 @@
/* error-checking interface to strtod-like functions
- Copyright (C) 1996, 1999-2000, 2003-2006, 2009-2013 Free Software
+ Copyright (C) 1996, 1999-2000, 2003-2006, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/xstrtod.h b/lib/xstrtod.h
index 8a4543d0..1fb8d7b7 100644
--- a/lib/xstrtod.h
+++ b/lib/xstrtod.h
@@ -1,6 +1,6 @@
/* Error-checking interface to strtod-like functions.
- Copyright (C) 1996, 1998, 2003-2004, 2006, 2009-2013 Free Software
+ Copyright (C) 1996, 1998, 2003-2004, 2006, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/xstrtol-error.c b/lib/xstrtol-error.c
index 688cef72..9629dabb 100644
--- a/lib/xstrtol-error.c
+++ b/lib/xstrtol-error.c
@@ -1,6 +1,6 @@
/* A more useful interface to strtol.
- Copyright (C) 1995-1996, 1998-1999, 2001-2004, 2006-2013 Free Software
+ Copyright (C) 1995-1996, 1998-1999, 2001-2004, 2006-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/xstrtol.c b/lib/xstrtol.c
index 6f78572a..f6d535a7 100644
--- a/lib/xstrtol.c
+++ b/lib/xstrtol.c
@@ -1,6 +1,6 @@
/* A more useful interface to strtol.
- Copyright (C) 1995-1996, 1998-2001, 2003-2007, 2009-2013 Free Software
+ Copyright (C) 1995-1996, 1998-2001, 2003-2007, 2009-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -182,7 +182,7 @@ __xstrtol (const char *s, char **ptr, int strtol_base,
break;
case 'c':
- overflow = 0;
+ overflow = LONGINT_OK;
break;
case 'E': /* exa or exbi */
diff --git a/lib/xstrtol.h b/lib/xstrtol.h
index 5354c872..fe54f6af 100644
--- a/lib/xstrtol.h
+++ b/lib/xstrtol.h
@@ -1,6 +1,6 @@
/* A more useful interface to strtol.
- Copyright (C) 1995-1996, 1998-1999, 2001-2004, 2006-2013 Free Software
+ Copyright (C) 1995-1996, 1998-1999, 2001-2004, 2006-2014 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
diff --git a/lib/xtime.h b/lib/xtime.h
index c38e9dc3..574e0dbf 100644
--- a/lib/xtime.h
+++ b/lib/xtime.h
@@ -1,6 +1,6 @@
/* xtime -- extended-resolution integer time stamps
- Copyright (C) 2005-2006, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2005-2006, 2009-2014 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,9 @@
#ifndef XTIME_H_
#define XTIME_H_ 1
+#ifndef _GL_INLINE_HEADER_BEGIN
+ #error "Please include config.h first."
+#endif
_GL_INLINE_HEADER_BEGIN
#ifndef XTIME_INLINE
# define XTIME_INLINE _GL_INLINE
diff --git a/lib/xvasprintf.c b/lib/xvasprintf.c
index 702b5e6b..7a4029e7 100644
--- a/lib/xvasprintf.c
+++ b/lib/xvasprintf.c
@@ -1,5 +1,5 @@
/* vasprintf and asprintf with out-of-memory checking.
- Copyright (C) 1999, 2002-2004, 2006-2013 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002-2004, 2006-2014 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
diff --git a/lib/xvasprintf.h b/lib/xvasprintf.h
index 1208fa19..407a5e0d 100644
--- a/lib/xvasprintf.h
+++ b/lib/xvasprintf.h
@@ -1,5 +1,5 @@
/* vasprintf and asprintf with out-of-memory checking.
- Copyright (C) 2002-2004, 2006-2013 Free Software Foundation, Inc.
+ Copyright (C) 2002-2004, 2006-2014 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
diff --git a/lib/yesno.c b/lib/yesno.c
index 37976791..ddb34454 100644
--- a/lib/yesno.c
+++ b/lib/yesno.c
@@ -1,6 +1,6 @@
/* yesno.c -- read a yes/no response from stdin
- Copyright (C) 1990, 1998, 2001, 2003-2013 Free Software Foundation, Inc.
+ Copyright (C) 1990, 1998, 2001, 2003-2014 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
diff --git a/lib/yesno.h b/lib/yesno.h
index 470b9db6..3a6d8c9f 100644
--- a/lib/yesno.h
+++ b/lib/yesno.h
@@ -1,5 +1,5 @@
/* declare yesno
- Copyright (C) 2004, 2009-2013 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2009-2014 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